Model run

## sw-kn7auqi0ye7mbb1is4tv 
## recruitment, all data, no woodymono, no correlation 
## Random Inits: TRUE 
## Inits object: randomInits 
## Total minutes: 1375.86 
## Total iterations: 325000 
## n_chain: 6 
## n_adapt: 5000 
## n_burn: 20000 
## n_draw: 50000 
## n_thin: 50 
## Total samples kept: 6000 
## Extended burnin: FALSE 
## convergence: TRUE 
## ppc: 0.5053
## db_hash: compadre 4.0.2 + unpublished trait data

JAGS code

model {

# priors
mu_alpha ~ dnorm(0, 0.001)
mu_beta ~ dnorm(0, 0.001)

sigma_alpha ~ dunif(.01,  upper_alpha)
sigma_beta ~ dunif(.01,  upper_beta)
sigma_spp ~ dunif(.01, upper_spp)
sigma_pop ~ dunif(.01, upper_pop)

tau_alpha <- pow(sigma_alpha, -2)
tau_beta <- pow(sigma_beta, -2)
tau_spp <- pow(sigma_spp, -2)
tau_pop <- pow(sigma_pop, -2)

lambda ~ dunif(0, 1)

for (k in 1:nlfs){
  alpha[k] ~ dnorm(mu_alpha, tau_alpha)
  beta[k] ~ dnorm(mu_beta, tau_beta)
}

# likelihood
# species model
z_species[1:nspp] ~ dmnorm(mu[], tau_phy[,])
    
for(j in 1:nspp) {
  mu[j] <- alpha[lifeform[j]] + beta[lifeform[j]] * height[j]
}
    
# population model 
for (i in 1:length(y)) {
  y[i] ~ dnorm(z_species[species[i]], tau_pop)
  rnew[i] ~ dnorm(z_species[species[i]], tau_pop)
  rsqActual[i] <- pow(y[i] - z_species[species[i]], 2)
  rsqNew[i] <- pow(rnew[i] - z_species[species[i]], 2)
}   
    
# phylogenetic var-cov matrix
Mlam <- lambda * Amat + (1 - lambda) * ID
tau_phy <- tau_spp * inverse(Mlam)

# derived quantities
for (j in 1:nspp) {
  z[j] <- ifelse(survival == 0, z_species[j], exp(z_species[j]) / (1 + exp(z_species[j]))) 
}
    
#  posterior predictive check
zActual <- sum(rsqActual[])   
zNew <- sum(rsqNew[]) 
test <- step(zNew - zActual)    
bpvalue <- mean(test)   

}

PVR JAGS code

model {

# priors
mu_alpha ~ dnorm(-0.4119, 1/1.9750^2)
mu_beta ~ dnorm(0.5211, 1/1.1213^2)

sigma_alpha ~ dgamma(1.6462^2/1.0487^2,  1.6462/1.0487^2)
sigma_beta ~ dgamma(1.6725^2/1.4682^2, 1.6725/1.4682^2)
sigma_pop ~ dgamma(1.7008^2/0.0232^2, 1.7008/0.0232^2)
sigma_spp ~ dgamma(4.8806^2/0.5024^2, 4.8806/0.5024^2)

tau_alpha <- pow(sigma_alpha, -2)
tau_beta <- pow(sigma_beta, -2)
tau_spp <- pow(sigma_spp, -2)
tau_pop <- pow(sigma_pop, -2)

for (k in 1:nP){
  vgamma[k] ~ dnorm(0, 0.001)
}

for (k in 1:nlfs){
  alpha[k] ~ dnorm(mu_alpha, tau_alpha)
  eps.alpha[k] <- alpha[k] - mu_alpha
  beta[k] ~ dnorm(0, tau_beta)
}

# likelihood
# species model
for(j in 1:nspp) {
  z_species[j] ~ dnorm(mu[j], tau_spp)
  mu[j] <- alpha[lifeform[j]] + mu_beta * height[j] + beta[lifeform[j]] * height[j] + phylo[j]
  eps.spp[j] <- z_species[j] - mu[j]
}

phylo <- P %*% vgamma[]

# population model 
for (i in 1:length(y)) {
  y[i] ~ dnorm(z_species[species[i]], tau_pop)
  rnew[i] ~ dnorm(z_species[species[i]], tau_pop)
  rsqActual[i] <- pow(y[i] - z_species[species[i]], 2)
  rsqNew[i] <- pow(rnew[i] - z_species[species[i]], 2)
  eps.pop[i] <- y[i] - z_species[species[i]]
}   
    
# derived quantities
sd.lf <- sd(eps.alpha[])
sd.h <- abs(mu_beta)
sd.lfh <- sd(beta[])
sd.spp <- sd(eps.spp[])  
sd.pop <- sd(eps.pop[])  

for (i in 1:nP){
  sd.P[i] <- abs(vgamma[i]) * sd(P[,i])
}

#  posterior predictive check
zActual <- sum(rsqActual[])   
zNew <- sum(rsqNew[]) 
test <- step(zNew - zActual)    
bpvalue <- mean(test)   

}

Convergence/Identifiablity

mean sd 2.5% 50% 97.5% Rhat n.eff
alpha[1] -0.0423 2.1171 -4.1368 -0.0685 4.2856 1 4354
alpha[2] 0.2841 2.1804 -3.9388 0.2442 4.6548 1 3545
alpha[3] 0.9384 2.1885 -3.2604 0.9155 5.4248 1 3772
alpha[4] -0.8537 2.0979 -4.9885 -0.8253 3.3039 1 3740
alpha[5] -0.7772 2.3187 -5.6892 -0.7498 3.8343 1 4047
alpha[6] -1.1033 1.9481 -5.0245 -1.1071 2.6519 1 3795
alpha[7] -1.3160 2.0019 -5.2871 -1.2743 2.5582 1 3384
beta[1] 0.1898 0.5861 -1.0569 0.2193 1.2601 1 5367
beta[2] 0.0128 1.9807 -5.0107 0.3499 3.5690 1 5746
beta[3] -0.5559 2.3182 -6.5967 0.0902 2.8644 1 5402
beta[4] 1.9097 1.5326 -0.2455 1.5807 5.5933 1 5666
beta[5] 0.7643 2.0185 -3.5464 0.6918 5.3139 1 5849
beta[6] 0.8056 0.7443 -0.6185 0.7610 2.3822 1 6107
beta[7] 0.6352 0.3281 -0.0173 0.6379 1.2707 1 5874
mu_alpha -0.4119 1.9750 -4.3190 -0.3880 3.4723 1 3423
mu_beta 0.5211 1.1213 -2.1112 0.5765 2.7568 1 6145
sigma_alpha 1.6462 1.0487 0.1813 1.4564 4.2733 1 6423
sigma_beta 1.6725 1.4682 0.0644 1.2772 5.4875 1 4843
sigma_spp 4.8806 0.5024 3.9384 4.8717 5.8984 1 5656
sigma_pop 1.7008 0.0232 1.6552 1.7006 1.7473 1 6000
lambda 0.6943 0.1059 0.4328 0.7123 0.8516 1 5862

Of the 392 species modeled, the latent response variables converged for 100% of them.


Fig. S4-1: Trace plots of key model parameters.

Fit

Fig. S4-2: Scatterplot of summed squared residuals between observed and predicted logged fecundity and between simulated and predicted logged fecundity at each MCMC iteration for each population. The Bayesian posterior predictive check p-value was 0.51.

Species response

Fig. S4-3: Logged fecundity probabilities (\(z_{j}\), Eqn. 1) for all modeled species, ordered by magnitude. Thick lines represent the 50% equal-tailed credible intervals, thin lines represent the 95% equal-tailed credible intervals, and circles are the posterior medians.

Height parameters

Fig. S4-4: Parameter estimates for \(\alpha_{m}\) (Eqn. 1) showing logged fecundity at average plant height (8 m). Thick lines represent the 50% equal-tailed credible intervals, thin lines represent the 95% equal-tailed credible intervals, and circles are the posterior medians.


Fig. S4-5: Parameter estimates for \(\beta_{m}\) (Eqn. 1) showing effects of a 1 SD change in plant height (15.6 m) on logged fecundity by lifeform. Thick lines represent the 50% equal-tailed credible intervals, thin lines represent the 95% equal-tailed credible intervals, and circles are the posterior medians. Gray estimates with closed circles represent 50% credible intervals that do not overlap zero, and gray estimates with open circles represent 50% credible intervals that overlap zero.

Fecundity vs. height

Fig. S4-6: Logged fecundity rates as a function of maximum plant height (in meters) by lifeform. The gray shaded areas represent the 95% equal-tailed credible intervals and the red lines are the posterior medians for the fitted relationship. Filled circles are the medians and black vertical bars are the 95% equal-tailed credible intervals for the logged fecundity rate of each species (\(z_{j}\)).

ANOVA

Fig. S4-7: Results from the Bayesian analysis of variance showing the finite-population standard deviation for each source of variation (lifeform, plant height, interaction between lifeform and plant height, the five most important phylogeny vectors, unexplained variation among species, unexplained variation among populations) for logged fecundity. For simplicity we show only the five phylogeny vectors with the largest finite standard deviation values, as all other phylogeny vectors had minimal variance components. Larger values indicate a higher proportion of variation explained by the source. Filled circles represent the median, thick bars indicate the 50% credible interval, and thin bars indicate the 95% credible interval for each estimate.

Fitted vs. Predicted




Fig. S4-8: Predicted logged fecundity rates based on biological traits and phylogenetic relatedness for five focal plant species (Abies concolor - 5 populations in dataset, Astragalus alopecurus - 16, Bothriochloa ischaemum - 6, Cecropia obtusifolia - 4, and Frasera speciosa - 25). “Fitted” values (gray bars) are the posterior distributions for the estimated logged fecundity rate when data for all species were included in the model, whereas “predicted” values (black bars) are when data for the focal species were excluded. Open circles indicate the observed logged fecundity rates from each population of the species. Filled circles indicate the median, thick bars indicate the 50% credible interval, and thin bars indicate the 95% credible interval for each estimate.