Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread Johan Jackson
Hi all, Thanks for the replies (including off list). I have since resolved the discrepant results. I believe it has to do with R's scoping rules - I had an object called 'labs' and a variable in the dataset (DATA) called 'labs', and apparently (to my surprise), when I called this: lmer(Y~X +

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread David Winsemius
On Aug 18, 2010, at 1:19 PM, Johan Jackson wrote: Hi all, Thanks for the replies (including off list). I have since resolved the discrepant results. I believe it has to do with R's scoping rules - I had an object called 'labs' and a variable in the dataset (DATA) called 'labs', and

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread Johan Jackson
No, apologies (good catch David!), I merely copied the script incorrectly. It was lmer(Y~X + (1|labs),data=DATA) in my original script. So my question still stands: is it expected behavior for lmer to access the object 'labs' rather than the object 'DATA$labs' when using the data= argument? JJ

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread Peter Ehlers
On 2010-08-18 11:49, Johan Jackson wrote: No, apologies (good catch David!), I merely copied the script incorrectly. It was lmer(Y~X + (1|labs),data=DATA) in my original script. So my question still stands: is it expected behavior for lmer to access the object 'labs' rather than the object

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread David Winsemius
On Aug 18, 2010, at 6:45 PM, Peter Ehlers wrote: On 2010-08-18 11:49, Johan Jackson wrote: No, apologies (good catch David!), I merely copied the script incorrectly. It was lmer(Y~X + (1|labs),data=DATA) in my original script. So my question still stands: is it expected behavior for

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread Peter Ehlers
On 2010-08-18 18:41, Johan Jackson wrote: Hi all, I figured out why this was happening. It is because my actual code was: lmer(Y~X + (1|as.factor(labs)),data=DATA) In this case, the as.factor function looks for object 'labs' not object 'DATA$labs.' Scope is something you hear about don't

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-18 Thread Johan Jackson
Hi all, I figured out why this was happening. It is because my actual code was: lmer(Y~X + (1|as.factor(labs)),data=DATA) In this case, the as.factor function looks for object 'labs' not object 'DATA$labs.' Scope is something you hear about don't worry about until it bites you on your ass I

[R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-17 Thread Johan Jackson
Hello, Setup: I have data with ~10K observations. Observations come from 16 different laboratories (labs). I am interested in how a continuous factor, X, affects my dependent variable, Y, but there are big differences in the variance and mean across labs. I run this model, which controls for

Re: [R] what does it mean when my main effect 'disappears' when using lme4?

2010-08-17 Thread Mitchell Maltenfort
One difference is that the random effect in lmer is assumed -- implicitly constrained, as I understand it -- to be a bell curve. The fixed effect model does not have that constraint. How are the values of labs effects distributed in your lm model? On Tue, Aug 17, 2010 at 8:50 PM, Johan Jackson