Dear All,
I am wondering if you can help me understanding the underlaying
calculations/formula for the confidence intervals (both) using the
predic.rma function.
I will try to explain the situation using an example below.
pred se ci.lb ci.ub cr.lb cr.ub
351.1013 5.3417 340.6318 361.5708 308.7079 393.4947
My question is how I can use estimates from the rm () model results above
(the formula) to get the ci.lb ci.ub cr.lb cr.ub manually?
To get pred value, we used the following formula which makes sense:
Intercept_estimate + Age_coeff_estimate X Age (65) +Sex_coeff_estimate X 0
[if women] or 100 [if men] + Sleep_Night_coeff_estimate X 0 [first night]
or 1 [second night].
Which formula we should use to get in the same way: ci.lb ci.ub cr.lb
cr.ub?
Thank you in advance and sorry if it sounds somewhat confusing,
Tetyana
Dear Tetyana
Have you looked at the Riley et al paper referenced in the
documentation? I think it has the formula although I have not time to
check that now.
Michael
On 18/09/2019 04:40, Tetyana Kendzerska wrote:
Dear All,
I am wondering if you can help me understanding the underlaying
calculations/formula for the confidence intervals (both) using the
predic.rma function.
I will try to explain the situation using an example below.
pred se ci.lb ci.ub cr.lb cr.ub
351.1013 5.3417 340.6318 361.5708 308.7079 393.4947
My question is how I can use estimates from the rm () model results above
(the formula) to get the ci.lb ci.ub cr.lb cr.ub manually?
To get pred value, we used the following formula which makes sense:
Intercept_estimate + Age_coeff_estimate X Age (65) +Sex_coeff_estimate X 0
[if women] or 100 [if men] + Sleep_Night_coeff_estimate X 0 [first night]
or 1 [second night].
Which formula we should use to get in the same way: ci.lb ci.ub cr.lb
cr.ub?
Thank you in advance and sorry if it sounds somewhat confusing,
Tetyana
Hi Tetyana,
Let V_b be the estimated variance-covariance matrix of the fixed effects, which is computed with:
V_b = (X'WX)^(-1),
where X is the model matrix (with a column of 1s for the intercept and columns for the other moderators in the model) and W = M^(-1) is the inverse of the model-implied estimated variance-covariance matrix of the outcomes (M). For this model, M is just equal to a diagonal matrix with TST_E^2 + hat(tau)^2 along the diagonal, where hat(tau)^2 is the estimated value of tau^2. And hence W is diagonal with 1/ (TST_E^2 + hat(tau)^2) along the diagonal.
You can extract X with model.matrix(test_TST), M with vcov(test_TST, type="obs"), and W with weights(test_TST, type="matrix"). See help(vcov.rma) and help(weights.rma.uni).
Now let x be a row vector with the desired values for the moderators (again, with a 1 in the first column). Then the predicted value is given by xb, where b is the column vector with the estimated model coefficients (which you can get with test_TRT$b or cbind(coef(test_LRT))). And then:
Var[xb] = x V_b x'
and SE[xb] = sqrt(Var[xb]), so that is how you will get the SE that is given by predict() and then the lower and upper 95% CI bounds are given by
xb +- 1.96 * SE[xb]
(or rather qnorm(.975) instead of 1.96 to be precise). The bounds of the credibility/prediction interval are given by
xb +- 1.96 * sqrt(Var[xb] + hat(tau)^2).
P.S.: newmods=cbind(c(65),c(100),c(1)) is unnecessarily complex. This will do: newmods=c(65,100,1).
Best,
Wolfgang
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of Tetyana Kendzerska
Sent: Wednesday, 18 September, 2019 5:41
To: r-sig-meta-analysis at r-project.org
Subject: [R-meta] FW: Welcome to the "R-sig-meta-analysis" mailing list (Digest mode) _ question
Dear All,
I am wondering if you can help me understanding the underlaying
calculations/formula for the confidence intervals (both) using the
predic.rma function.
I will try to explain the situation using an example below.
pred se ci.lb ci.ub cr.lb cr.ub
351.1013 5.3417 340.6318 361.5708 308.7079 393.4947
My question is how I can use estimates from the rm () model results above
(the formula) to get the ci.lb ci.ub cr.lb cr.ub manually?
To get pred value, we used the following formula which makes sense:
Intercept_estimate + Age_coeff_estimate X Age (65) +Sex_coeff_estimate X 0
[if women] or 100 [if men] + Sleep_Night_coeff_estimate X 0 [first night]
or 1 [second night].
Which formula we should use to get in the same way: ci.lb ci.ub cr.lb
cr.ub?
Thank you in advance and sorry if it sounds somewhat confusing,
Tetyana