Q & A – Lecture 4
Nicolo` Margaritella March 22, 2020
Parameter interpretation in slide 68
Copyright By PowCoder代写 加微信 powcoder
Consider the analysis of the relationship between the number of satellite crabs (response variable) and the covariates “Width of the Carapace” and “Carapace Colour”. We set the following generalised linear model with a log-link connecting the response mean with the linear combination of the covariates:
log(μi) = β0 + β1Widthi + β2Li.Medi + β3Medi + β4dark.Medi, (1)
μi = exp{β0} exp{β1Widthi} exp{β2Li.Medi} exp{β3Medi} exp{β4dark.Medi},
where Widthi represents the centred covariate. The second line of Equa- tion (1) highlights the multiplicative effect of the covariates on the mean μi. After running JAGS, we want to interpret our results.
UPDATED: Plug-in the posterior means obtained in slide 68 like shown here:
μi =exp{0.816}exp{0.544×Widthi}exp{0.455×Li.Medi} (2) exp{0.258 × Medi} exp{0.01 × dark.Medi}
is NOT RECOMMENDED. This is because we are approximating E(exp(μi)) with exp(E(μi)) and we don’t know how good this approximation is going to be!
The best approach is to use the posterior samples of each parameters ob- tained with JAGS and compute E(exp(βj)) in just one line of R-code:
fit.crabs<− as.data.frame(combine.mcmc(results.crabs.mult.B)) mean(exp(fit.crabs$beta0))#= 2.30
mean(exp(fit.crabs$beta.dk.med))#= 1.02
Now we have the correct results and we can interpret them as follows:
• E[exp{β0}] = 2.30 is the expected number of satellite crabs for a fe-
male with a dark carapace of average width (i.e. Widthi = 0 and Li.Med=Med=dark.Med=0)
• A female crab with a carapace width one unit larger than the mean
(Width) has an expected number of satellite crabs increased of E[exp{β1}] =
1.73 times, while the other variables are held constant. Equivalently, for
a one unit increase in Widthi there is a 73% increase in the expected number of satellites while the other variables are held constant.
• A female crab with a light medium coloured carapace attracts on av- erage E[exp{β2}] = 1.60 times more satellite crabs than a female with dark coloured carapace, while the other variables are held constant. Equivalently, there is a 60% increase in the expected number of satel- lite crabs attracted by a female crab with light medium carapace than one with dark carapace while the other variables are held constant. We can interpret the other parameters in the same way.
Posterior distribution of μi
To avoid approximations and generate credible intervals, we can obtain the posterior distribution of μi conditional on any possible value of the co- variates, from the posterior distribution of the relative parameters βj with j = {0, 1, 2, 3, 4}. For example, the posterior mean and 95% credible interval
for μ|Width = 2, Li.M ed = 1 is obtained as follows:
post mu=exp(fit.crabs$beta0+ fit.crabs$beta.width∗2 + fit.crabs$beta.lt.med∗1)
mean(post mu) # 10.74
quantile(post mu,c(0.025 ,0.975)) # 2.5% 97.5%
# 7.286524 15.043891
One question was if we could obtain the same result by monitoring the pa- rameter μi within JAGS (by adding “mu” in the variable.names arguments of the coda.samples function in slide 67). Two comments about this:
• Monitoring μi in JAGS means storing i×S additional MCMC samples, where S is the number of MCMC samples saved after burn-in. These additional data increase the size of results.crabs.mult.B from 1 MB to 41 MB (not very efficient for i >> 0)
• By monitoring μi in JAGS we obtain the posterior distributions relative to only those combinations of covariates observed in our sample. In
the example above, the combination (Width = 2,Li.Med = 1) does not appear in any of the crabs observed in our dataset but we can still make inference on that!
These comments are valid also for the case of the posterior predictive distri- butions in slide 72.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com