[R] VarCorr

Joshua Wiley jwiley.psych at gmail.com
Wed Jan 19 22:17:36 CET 2011


Is this what you want?

attr(VarCorr(merobject)[[1]], "stddev")

Alternately, look at:

getMethod("VarCorr", signature = "mer")

For what is happening behind the scenes and why I chose what I did to extract the standard deviations

Cheers,

Josh

On Jan 19, 2011, at 11:32, Stephanie Cooke <cooke.stephanie at gmail.com> wrote:

> I have a loop that I would like to use to extract the "stddev" for
> each itteration so I can average the "stddev" for all the runs. It
> would be helpful to know how to extract the "stddev" for each run from
> the VarCorr. Thanks
> 
> MCruns<-1000
> sighatlvec<-rep(NA,MCruns)
> sighatbvec<-rep(NA,MCruns)
> sighatevec<-rep(NA,MCruns)
> 
> for(mc in 1:MCruns)
> {
> 
> samples<-(sqrt(sigbsq)*rnorm(6))
> labs<-(sqrt(siglsq)*rnorm(2))
> errors<-(sqrt(sigesq)*rnorm(24))
> y<-errors+samples[sampfac]+labs[labfac]
> lmer<-lmer(y~1+(1|sampfac)+(1|labfac))
> print(VC<-VarCorr(lmer))
> }
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list