[R-sig-ME] p values with lmer (mcmcpvalue error)

Kaitlyn Gaynor kaitlyng at gmail.com
Sat Apr 16 11:58:19 CEST 2011


Hello,

I am currently using lmer to make a fairly large model with 9 fixed
factors (8 of them with 2-4 levels, and 1 of them continuous) and 2
random factors, >1000 observations.  I realize there is a lot of
debate about p-values for parameter estimates but they’ve been
requested by a journal so I’m trying to calculate them.  I have been
trying to obtain p-values using the mcmcpvalue function:

fit<-lmer(vig~Act+Height+FD+IGE+Pos.For+PR+Kin+PDDO+Rank+(1|Grp/Subj),
data=vigilance)
mcmcpvalue <- function(samp)
{ std <- backsolve(chol(var(samp)),
cbind(0, t(samp)) - colMeans(samp),
transpose = TRUE)
sqdist <- colSums(std * std)
sum(sqdist[-1] > sqdist[1])/nrow(samp) }
markov1 <- mcmcsamp(fit, 5000)
HPDinterval(markov1)

mcmcpvalue(as.matrix(markov1[,1]))
mcmcpvalue(as.matrix(markov1[,2]))
...

HPDinterval generates CIs for each treatment, but mcmcpvalue function
produces the following error messages:

Error in markov1[, 1] : object of type 'S4' is not subsettable
Error in as.matrix(markov1[, 1]) :
  error in evaluating the argument 'x' in selecting a method for
function 'as.matrix'

Any help would be greatly appreciated!

Thanks,

Kaitlyn

Kaitlyn Gaynor
Department of Ecology, Evolution, and Environmental Biology
Columbia University




More information about the R-sig-mixed-models mailing list