PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, October 7, 2022

[FIXED] What will be best "formula" for this mixed effects model

 October 07, 2022     lme4, mixed-models, r, regression, statistics     No comments   

Issue

I have following study which I want to analyze with Mixed effects model:

"Subjects" are divided in two "Group" (Treatment A and B).

"Weight" is recorded before and 3 months ("Time") after treatment (repeated measures).

Need to correct for subjects "age" and "gender" also.

Main question is: Whether two groups differ in their effect on weight?

For Mixed effects, I was considering following syntax with lmer function of lme4 package:

lmer(weight ~ Group*Time + age, (1|subject) + (1|gender), data=mydata)

Is this syntax correct or do I need to use more complex terms such as ones given below:

(time|subject)
(time + 1|subject)
(1|subject) + (1|Group:subject) + (1|Time:subject)

I have tried to see different sources on the internet but literature seems to be very confusing.


Solution

gender should not be a random effect (intercept). It doesn't meet any of the usual requirements for it to be treated as random.

(time|subject)

and

(time + 1|subject)

are the same. It means you are allowing the fixed effect of time to vary at different levels of subject

(1|subject) + (1|Group:subject) + (1|Time:subject)

makes very little sense. This says that Time is nested in subject because (1|Time:subject) is the samee as (1|subject:Time) and (1|subject) + (1|subject:Time) is the definition of how to specify nested random effects. The addition of (1|Group:subject) seems bizarre and I would be surprised if such a model is identified. Your research question is "Whether two groups differ" so this means you want to know the fixed effect of Group, so (1|Group:subject) does not make sense.

The model:

lmer(weight ~ Group*Time + age + gender, (1|subject), data=mydata)

makes sense.

Finally, this question should be on Cross Validated.



Answered By - Robert Long
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing