[R-sig-ME] New mcmcpvalue?

Hank Stevens HStevens at MUOhio.edu
Tue Jul 8 18:33:46 CEST 2008


Hi folks,
It seems that with lme4_0.999375-21, and -20, lmer objects (mer class)  
require a new mcmcpvalue function, because of the values created. This  
(I think) works properly, because it converts the rows of the output  
to columns used by the original mcmcpvalue.

mcmcpvalue <- function(X) {
    ##From Bates pers comm. September 14, 2006 2:59:23 PM EDT
    ## elementary version that creates an empirical p-value for the
    ## hypothesis that the columns of samp have mean zero versus a
    ## general multivariate distribution with elliptical contours.
# samp <- rnorm(10000, m=3)
    ## differences from the mean standardized by the observed
    ## variance-covariance factor

## NEW PART
if(class(X) == "numeric") samp <- as.matrix(X) else{
   samp <- t( X ) }
## END new part

std <- backsolve(chol(var(samp)),
                     cbind(0, t(samp)) - colMeans(samp),
                     transpose = TRUE)
    sqdist <- colSums(std * std)
    sum(sqdist[-1] > sqdist[1])/nrow(samp)
}



Dr. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.cas.muohio.edu/ecology
http://www.muohio.edu/botany/

"If the stars should appear one night in a thousand years, how would men
believe and adore." -Ralph Waldo Emerson, writer and philosopher  
(1803-1882)




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