Reputation: 675
I have a dataframe in R in which I'd like to calculate if there is a significantly higher proportion of A
's in the column value
between condition X and Y.
toy dataset below:
subject condition value proportion
1 X A .33
1 X B .33
1 Y A .5
1 X C .33
1 Y B .5
2 X A 1
2 Y A .5
2 Y B .5
3 X B 1
3 Y A .5
3 Y B .5
...
But I'm having trouble putting a lmer
model together for this, since I'm comparing proportions. Does anyone have advice? Below is the code that I'm working with that is incorrect:
m1 <- lmer(value ~ condition + (1 + condition | subject), data = data)
summary(m1)
Upvotes: 0
Views: 186
Reputation: 226732
This sounds like a logistic regression. Try:
glmer(as.numeric(value=="A") ~ condition + (1 + condition | subject),
data = data, family=binomial)
Upvotes: 1