Dear list members,
In the example dataset attached, the data have this hierarchical structure: 50 Treatments from 20 Experiments from 8 Publications. For each treatment, there is an observed (or reported) value and the corresponding predicted value by a model under evaluation. I can evaluate the model using the raw predictions and the predictions adjusted with the random effect of Experiment. However, I am not able to calculated the predictions adjusted with the random effect of Experiment nested into Publication.
I use the following steps:
? The dataset is imported and renamed "d" and Residuals are calculated
#Calculate the residuals
d$Residuals <- d$Observed-d$Predicted
str(d)
'data.frame': 50 obs. of 8 variables:
$ ID : num 1 2 3 4 5 6 7 8 9 10 ...
$ Publication: num 1 1 1 1 1 1 1 1 1 2 ...
$ Experiment : num 1.1 1.1 1.1 1.2 1.2 1.2 1.3 1.3 1.3 2.1 ...
$ Treatment : num 1 2 3 4 5 6 7 8 9 10 ...
$ SEM : num 4 4 4 12 12 12 11 11 11 45 ...
$ Observed : num 141 65 97 178 210 185 147 141 174 217 ...
$ Predicted : num 136 71 78 158 200 255 141 112 162 259 ...
$ Residuals : num 5 -6 19 20 10 -70 6 29 12 -42 ...
? Results from the RMSE function (see details of the function at the bottom):
#RMSE with raw predictions
RMSE(d$Observed, d$Predicted)
labels output
1 N 50.00000
2 Observed Mean 172.50000
3 Predicted Mean 186.24000
4 RMSE 42.14712
5 RMSE, % mean 24.43311 (% of observed mean)
6 Mean Bias, % MSE 10.62766
7 Slope Bias, % MSE 6.49443
8 Dispersion, % MSE 82.87792
9 Mean Bias -13.74000
10 Slope Bias -0.09949
11 P-Mean Bias 0.01957
12 P-Slope Bias 0.05834
13 RSR 0.39921 (RMSE/sd Observed)
14 CCC 0.92198
? Calculate predictions adjusted with the random effect of Experiment and weighting data with 1/SEM:
m1 <- rma.mv(Residuals ~ 1, SEM, random = list(~1|Experiment, ~ 1|Treatment),
df AIC BIC AICc logLik LRT pval QE
Full 4 478.64551 486.21279 479.55460 -235.32275 7451.72582
Reduced 3 502.23883 507.91429 502.77216 -248.11941 25.59332 <.00001 7451.72582
I would use the following model but I don't know how to proceed after that:
m2 <- rma.mv(Residuals ~ 1, SEM, random = list(~1|Publication, ~1|Experiment, ~ 1|Treatment),