Reputation: 1
I am trying to run the predict()
function on the following MCMCglmm object:
prior1 = list(R=list(V=1,nu=0.002),G=list(G1=list(V=1,nu=0.002),G2=list(V=1,nu=0.002),G3=list(V=1,nu=0.002)))
interceptmodel <- MCMCglmm(yi ~ 1,
random = ~ animal + SpeciesID + PaperNo,
pedigree = tree, mev = data1$vi,data = data1,
nitt = 13000*20, thin = 10*15,
burnin = 3000*10, pr = TRUE,
verbose = T, prior = prior1)
data1 <- structure(list(PaperNo = c(1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 9L, 9L, 9L, 9L, 10L,
10L, 10L, 10L, 11L, 11L, 12L, 12L, 12L, 12L, 13L, 13L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 15L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 17L, 17L, 18L, 18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 22L, 22L, 23L, 23L, 23L, 23L, 23L, 23L, 24L, 24L,
24L, 25L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 29L, 31L, 31L, 32L, 37L,
37L, 37L, 37L, 37L, 37L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L,
43L, 43L, 43L, 48L), SpeciesID = c("Lithobates_pipiens", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Osteopilus_septentrionalis", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_catesbeiana", "Lithobates_catesbeiana",
"Alytes_obstetricans", "Alytes_obstetricans", "Alytes_obstetricans",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_pipiens", "Lithobates_pipiens", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_pipiens",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Anaxyrus_americanus", "Anaxyrus_americanus",
"Anaxyrus_americanus", "Anaxyrus_americanus", "Anaxyrus_americanus",
"Anaxyrus_americanus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Pseudacris_regilla",
"Pseudacris_regilla", "Osteopilus_septentrionalis", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Xenopus_laevis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Lithobates_palustris", "Lithobates_palustris", "Lithobates_palustris",
"Lithobates_clamitans"), animal = c("Lithobates_pipiens", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Osteopilus_septentrionalis", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_pipiens", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_catesbeiana", "Lithobates_catesbeiana",
"Alytes_obstetricans", "Alytes_obstetricans", "Alytes_obstetricans",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_pipiens", "Lithobates_pipiens", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Lithobates_pipiens",
"Lithobates_clamitans", "Lithobates_clamitans", "Lithobates_clamitans",
"Lithobates_clamitans", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Lithobates_pipiens", "Lithobates_pipiens",
"Lithobates_pipiens", "Anaxyrus_americanus", "Anaxyrus_americanus",
"Anaxyrus_americanus", "Anaxyrus_americanus", "Anaxyrus_americanus",
"Anaxyrus_americanus", "Lithobates_sylvaticus", "Lithobates_sylvaticus",
"Lithobates_sylvaticus", "Lithobates_sylvaticus", "Pseudacris_regilla",
"Pseudacris_regilla", "Osteopilus_septentrionalis", "Xenopus_laevis",
"Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis", "Xenopus_laevis",
"Xenopus_laevis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Osteopilus_septentrionalis", "Osteopilus_septentrionalis", "Osteopilus_septentrionalis",
"Lithobates_palustris", "Lithobates_palustris", "Lithobates_palustris",
"Lithobates_clamitans"), yi = c(-0.042879107, -0.159928422, 0.561210418,
-0.464539712, -0.220554633, -0.178761764, -0.191260017, 0.800703481,
0.63077842, 1.003135887, 1.938661824, 2.824703191, 2.175667395,
2.361093425, 2.105286769, 2.356659859, 1.080347884, 2.552581515,
0.247594607, -0.029228033, 1.488374356, 1.361822861, 0.420889437,
-0.604730589, 0.31061784, -1.357075761, -1.250512146, -0.405975036,
0.363379317, 0.12657832, -1.222859477, -0.659985485, -0.576164484,
0.37732584, -0.926175293, 0.830978057, 0.273940592, 0.094403528,
-0.095458219, 0.547910696, 0.474855937, -0.563565288, -0.050783383,
-0.163464876, 0.104047683, -0.190867989, 1.151400122, -0.341646097,
0, -1.719212145, -1.758976005, 0.747760374, 0.216986373, 0.605685903,
-0.139511765, 0.844969222, 0.05380397, 0.710372355, -0.333123483,
-0.383927873, -0.557441639, 0.430913916, 0.13936041, 0.615591309,
-0.394170763, -0.551839068, -0.627121844, -0.615591309, 0.784140828,
0.80727431, 0.023733961, 0.680470128, 0.775821795, 0.522692853,
0.363943662, 0.966253646, 0.950350642, 1.150976962, 0.689004216,
0.936041594, 2.39857658, 0.806728605, 0.098375571, 0.496366459,
0.091774827, 1.31549428, -0.147417038, 1.249458055, -0.625293871,
1.240458188, 0.904244499, 0.965951295, 1.410967144, 0.919707726,
0.794214366, 0.052815434, 0.26407717, -0.211261736, 0, 1.967016171,
-0.794458122, 1.438934517, -0.1858586, 0.755251203, 0.635566498,
0.886863621, -0.76525539, 0.162074319, 1.668362057, 2.022360212,
-0.280114326, -0.644513643, 0, -0.322256822, 0.028903189, -0.119165322,
-0.078489201, -0.679863174, -0.592907912, -0.537389785, -0.053193649,
-0.18431914, -0.436349802, -0.015993937, -0.458077663, -0.313654046,
0.074769579, -0.428140704, -0.557758165, -0.500213823, -1.033233037,
0.650907464, 0.891242528, 0.794945316, 0.725508348), vi = c(0.049051514,
0.285089381, 0.297146883, 0.293015216, 0.430720362, 0.429329647,
0.429715033, 0.480093839, 0.459823451, 0.510523467, 0.440624071,
0.61647984, 0.481254028, 0.516305425, 0.468700018, 0.515433906,
0.332654983, 0.555510018, 0.286577964, 0.284059264, 0.376326095,
0.361297065, 0.389143579, 0.400928026, 0.384102049, 0.493175247,
0.475808123, 0.388372817, 0.386324617, 0.379073213, 0.471533415,
0.405295636, 0.398819678, 0.386970258, 0.2379397, 0.104697519,
0.097004005, 0.096177362, 0.096179865, 0.099818539, 0.098884564,
0.100036035, 0.096098199, 0.065168982, 0.065036525, 0.28554161,
0.339262095, 0.288887088, 0.284023669, 0.133012092, 0.134740919,
0.197434303, 0.135497328, 0.192627049, 0.135004122, 0.201304988,
0.134708253, 0.196071386, 0.136638188, 0.08023603, 0.161844365,
0.159239066, 0.155775201, 0.163265438, 0.158607478, 0.16171489,
0.163563962, 0.163265438, 0.103751922, 0.10421211, 0.267862712,
0.272158073, 0.309102813, 0.190285859, 0.186767038, 0.206796816,
0.206034822, 0.216574363, 0.195323834, 0.20536001, 0.327284904,
0.19972594, 0.050982276, 0.058058179, 0.24788737, 0.226718794,
0.266468337, 0.247446783, 0.257954997, 0.191866761, 0.139851156,
0.141774553, 0.159403992, 0.206231886, 0.136736462, 0.126270012,
0.1273858, 0.12696738, 0.284023669, 0.445238361, 0.310322156,
0.370295858, 0.285462978, 0.307790518, 0.300854701, 0.31679563,
0.308424327, 0.285118172, 0.4, 0.45443787, 0.049530423, 0.051636259,
0.049040022, 0.049689081, 0.326368513, 0.327036762, 0.019863982,
0.363034387, 0.400043071, 0.504065648, 0.355712754, 0.357442975,
0.265989104, 0.064948441, 0.066694935, 0.065766133, 0.064992897,
0.066473846, 0.067538761, 0.067031425, 0.07384273, 0.038083823,
0.039768517, 0.042548234, 0.102645492)), row.names = c(NA, -135L
), class = "data.frame")
tree <- structure(list(edge = structure(c(11L, 12L, 13L, 14L, 15L, 15L,
14L, 13L, 16L, 17L, 17L, 16L, 18L, 19L, 19L, 18L, 12L, 11L, 12L,
13L, 14L, 15L, 1L, 2L, 3L, 16L, 17L, 4L, 5L, 18L, 19L, 6L, 7L,
8L, 9L, 10L), dim = c(18L, 2L)), Nnode = 9L, tip.label = c("Pseudacris_regilla",
"Osteopilus_septentrionalis", "Anaxyrus_americanus", "Lithobates_palustris",
"Lithobates_pipiens", "Lithobates_clamitans", "Lithobates_catesbeiana",
"Lithobates_sylvaticus", "Xenopus_laevis", "Alytes_obstetricans"
)), class = "phylo", order = "cladewise")
Using the following code:
interceptmodel$Random$formula <- update(interceptmodel$Random$formula,
~.+leg(mev, -1, FALSE):units)
predict(interceptmodel, marginal=interceptmodel$Random$formula)
And I am getting the following error message:
Error in predict.MCMCglmm(interceptmodel, marginal = interceptmodel$Random$formula) : if mev was used, add my_model$meta=TRUE and rerun. If not, the model is a covu model and predictions are not yet implemented for this type of model
I then run interceptmodel$meta=TRUE
and try to re-run but I am getting the same error message.
Any thoughts on how to fix this issue?
I have tried running the code slightly differently as the following:
Prediction <- predict(interceptmodel, marginal= ~leg(mev, -1, FALSE):units)
But I get the same error.
I was provided the code by a colleague who did not have this issue. I am wondering if there is something wrong with the formula for marginal =. or potentially for how I have specified the mev vector (an optional vector of measurement error variances for each data point for random effect meta-analysis).
Upvotes: 0
Views: 47