r - Can plot interaction means for nlme fit, but not for lme4 -


using dummy dataset:

dummy.data <- data.frame(vaccinated = factor(rep(c("yes", "no"), each = 64)),   infected = factor(rep(c("yes", "no"), each = 32)),   animal = factor(rep(1:16, each = 8)),   tissue = factor(c("blood", "liver", "kidney", "brain")),   value = runif(128)   ) 

this works:

library("nlme") nlme.model <- as.formula(value ~ vaccinated * infected * tissue) nlme.fit <- lme(fixed = nlme.model, random = ~1|animal, data = dummy.data) library("phia") int.nlme <- interactionmeans(nlme.fit) plot(int.nlme) 

but doesn't:

library("lme4")   lmer.model <- as.formula(value ~ vaccinated * infected * tissue + (1 | animal)) lmer.fit <- lmer(formula = lmer.model, data = dummy.data) library("phia") int.lmer <- interactionmeans(lmer.fit) plot(int.lmer) 

with latter, get

error in t.default(m) : argument not matrix 

from plot command.

when @ int.nlme , int.lmer str, different, can't figure out problem is. input appreciated.

the error appears generated phia:::poolse , can replicated thus:

> phia:::poolse(int.nlme, "adjusted mean","vaccinated") vaccinated         no        yes  0.04483019 0.04483019  > phia:::poolse(int.lmer, "adjusted mean","vaccinated") error in t.default(m) : argument not matrix 

still digging...

and conclude bug in phia package, has neglected this:

when writing r package uses matrix package, why have specify matrix::t() instead of t()?

as workaround, , increase awesomeness, turn "covmat" attribute of int.lmer matrix classes standard r matrix classes:

> int.lmer <- interactionmeans(lmer.fit) > plot(int.lmer) error in t.default(m) : argument not matrix > attr(int.lmer, "covmat") = lapply(attr(int.lmer,"covmat"),as.matrix) > plot(int.lmer) 

the plot works.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -