Model run

## sw-fg663i2vnw62u4fg6gbm 
## juvenile survival, all data, no woodymono, no correlation 
## Random Inits: TRUE 
## Inits object: randomInits 
## Total minutes: 980.72 
## 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.5033
## 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(2.0290, 1/0.7799^2)
mu_beta ~ dnorm(0.2811, 1/0.9164^2)

sigma_alpha ~ dgamma(1.2467^2/0.8880^2, 1.2467/0.8880^2)
sigma_beta ~ dgamma(1.4838^2/1.5390^2, 1.4838/1.5390^2)
sigma_spp ~ dgamma(1.7007^2/0.1394^2, 1.7007/0.1394^2)
sigma_pop ~ dgamma(1.2516^2/0.0189^2, 1.2516/0.0189^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] 1.6683 0.8636 -0.1604 1.7104 3.2797 1 5550
alpha[2] 1.0125 1.0043 -0.9680 1.0224 2.8534 1 4779
alpha[3] 1.3162 0.8850 -0.3105 1.2757 3.1036 1 4052
alpha[4] 2.1408 0.6191 0.9602 2.1179 3.4577 1 5490
alpha[5] 3.4046 1.3914 1.1898 3.2222 6.4095 1 5106
alpha[6] 2.3842 0.5297 1.3985 2.3688 3.5080 1 5783
alpha[7] 2.2689 0.5653 1.2630 2.2345 3.4803 1 5434
beta[1] 0.3319 0.2825 -0.1918 0.3189 0.9283 1 5793
beta[2] 0.7854 1.6336 -2.0179 0.4394 4.7455 1 4598
beta[3] 1.3805 1.6533 -0.7954 0.8245 5.1322 1 3845
beta[4] 0.5634 0.6818 -0.6243 0.4751 2.0904 1 5572
beta[5] -1.3341 2.6015 -8.4662 -0.2823 1.5030 1 4301
beta[6] 0.4419 0.3937 -0.2938 0.4245 1.2643 1 5596
beta[7] -0.1223 0.1947 -0.5034 -0.1219 0.2588 1 5969
mu_alpha 2.0290 0.7799 0.4634 2.0170 3.6157 1 5896
mu_beta 0.2811 0.9164 -1.7541 0.2577 2.1974 1 5878
sigma_alpha 1.2467 0.8880 0.0674 1.0850 3.3941 1 4995
sigma_beta 1.4838 1.5390 0.0660 0.8773 5.7850 1 3866
sigma_spp 1.7007 0.1394 1.4750 1.6848 2.0221 1 6093
sigma_pop 1.2516 0.0189 1.2156 1.2513 1.2895 1 6128
lambda 0.2461 0.1391 0.0210 0.2374 0.5315 1 5950

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


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

Fit

Fig. S2-2: Scatterplot of summed squared residuals between observed and predicted juvenile survival (logit transformed) and between simulated and predicted juvenile survival (logit transformed) at each MCMC iteration for each population. The Bayesian posterior predictive check p-value was 0.50.

Species response

Fig. S2-3: Juvenile survival 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. S2-4: Parameter estimates for \(\alpha_{m}\) (Eqn. 1) showing juvenile survival (logit transformed) 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. S2-5: Parameter estimates for \(\beta_{m}\) (Eqn. 1) showing effects of a 1 SD change in plant height (15.6 m) on juvenile survival (logit transformed) 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.

Survival vs. height

Fig. S2-6: Juvenile survival rates (logit transformed) 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 juvenile survival rate (logit transformed) of each species (\(z_{j}\)).

ANOVA

Fig. S2-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 juvenile survivorship (logit transformed). 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. S2-8: Predicted juvenile survival rates based on biological traits and phylogenetic relatedness for five focal plant species (Abies concolor - 4 populations in dataset, Astragalus alopecurus - 16, Cecropia obtusifolia - 4, and Frasera speciosa - 25). “Fitted” values (gray bars) are the posterior distributions for the estimated juvenile survival 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 juvenile survival 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.