[R] VarCorr

Joe P King jp at joepking.com
Wed Jan 19 21:41:07 CET 2011


Cant you just save that column of values to an object

stddev<-VC[,2]#if it's the second column that has the values

also I wouldn't save your model name in the same name as the command, when
you have " lmer<-lmer(y~1+(1|sampfac)+(1|labfac))", may be best to have
"lmer.mod<-lmer(y~1+(1|sampfac)+(1|labfac))" or something.

Joe King
206-913-2912
jp at joepking.com
Ad astra per aspera - "Through hardships to the stars"


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Stephanie Cooke
Sent: Wednesday, January 19, 2011 11:33 AM
To: r-help at r-project.org
Subject: [R] VarCorr

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