Hi Ista,
Thanks so much :-) I hadn't clicked that mcmc sampling was used to
determine the estimates! Now it all makes sense!
Do you know if one would one usually test out several values of nsim to find a
number which is high enough that different runs get very similar results? And
do you know if there are any R functions which allow one to do this easily? For
example which show a trace as the simulations are made? (apologies if the
answers to these questions are obvious, I'm very new to using lmer in R!)
Thanks again for your help, much appreciated :-)
Cheers,
Zaneta
-----Original Message-----
From: Ista Zahn [mailto:istazahn at gmail.com]
Sent: Wednesday, 4 November 2009 1:56 a.m.
To: Park-Ng, Zaneta
Subject: Re: [R] lmer and estimable
It's right there in the function documentation. See
?estimable
especially the part about sim.mer and n.sim.
-Ista
On Tue, Nov 3, 2009 at 6:15 AM, Park-Ng, Zaneta
<Zaneta.Park-Ng at agresearch.co.nz> wrote:> Hi everyone,
>
> I'm using lmer and estimable (from packages lme4 and gmodels
respectively) and have the disconcerting happening that when I run exactly the
same code, I get different results! ?In checking this out by running the code
50x, it seems to be that answers may be randomly deviating around those which I
get from another stats package (GenStat, using the linear mixed models
functionality in this). ?As such, my guess is that perhaps there is a random
seed involved somewhere in the estimable function, and that the answer is simply
converging to a slightly different place each time, based on a slightly
different starting place. ?But this is only a guess - if anyone could either
confirm or otherwise explain this unexpected-to-me happening, that'd be
fantastic!!
>
> The code that I'm running is:
>
> design.1 = rbind(c(0,0,0,1,0,0,0,0,0,0,0,0))
>
> lme1 <- lmer(var_x~AGE*GENDER*DAM_DIET + (1|CHIP) + (1|LITTER),x_temp)
>
> ?est <- estimable(lme1,design.1)
> ?print(est)
> ?est <- estimable(lme1,design.1) ?# Repeat of code
> ?print(est)
> ?est <- estimable(lme1,design.1) ?# Another repeat of code
> ?print(est)
>
> And this is the output - you can see in this that the results vary each
time the code is run...
>
>> ? ?print(est)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?Estimate Std. Error p value
> (0 0 0 1 0 0 0 0 0 0 0 0) 0.02241752 ?0.2185279 ? 0.902
>> ? ?est <- estimable(lme1,design.1)
>> ? ?print(est)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? Estimate Std. Error p value
> (0 0 0 1 0 0 0 0 0 0 0 0) 0.001824573 ?0.2106973 ? 0.974
>> ? ?est <- estimable(lme1,design.1)
>> ? ?print(est)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?Estimate Std. Error p value
> (0 0 0 1 0 0 0 0 0 0 0 0) 0.01276941 ?0.2154196 ? 0.938
>
> My SessionInfo is as follows:
>
> R version 2.9.2 (2009-08-24)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_New Zealand.1252;LC_CTYPE=English_New
Zealand.1252;LC_MONETARY=English_New
Zealand.1252;LC_NUMERIC=C;LC_TIME=English_New Zealand.1252
>
> attached base packages:
> [1] splines ? stats ? ? graphics ?grDevices utils ? ? datasets ?tcltk ? ?
methods ? base
>
> other attached packages:
> [1] lme4_0.999375-32 ? Matrix_0.999375-31 lattice_0.17-25 ? ?multcomp_1.1-2
? ? survival_2.35-7 ? ?mvtnorm_0.9-7 ? ? ?gmodels_2.15.0 ? ? svIDE_0.9-5
>
> loaded via a namespace (and not attached):
> [1] gdata_2.4.2 ?grid_2.9.2 ? gtools_2.6.1 MASS_7.2-48 ?svMisc_0.9-5
>
> Many thanks for any help or advice that anyone can provide :)
>
> Cheers,
> Zaneta
>
> ____________________________
> Zaneta Park
> Biometrician
> T +64 6 351 8008
> E zaneta.park-ng at agresearch.co.nz
> AgResearch Limited
> Grasslands Research Centre
> Tennent Drive, Private Bag 11008, Palmerston North, New Zealand
> T ?+64 6 356 8019 ? F ?+64 6 351 8032 ?www.agresearch.co.nz
> Farming Food and Health. First
> Te Ahuwhenua Te Kai me te Whai Ora. Tuatahi
>
>
> ======================================================================>
Attention: The information contained in this message and...{{dropped:15}}
>
> ______________________________________________
> 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.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
======================================================================Attention:
The information contained in this message and...{{dropped:12}}