4 deleted 1 character in body; edited tags

I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is

lm.full <- lmer(behaviour ~ task*sex + (1|ID/task), REML=FALSE, data=dat)


I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova:

lm.base1 <- lmer(behaviour ~ task+sex+(1|ID/task), REML=FALSE, data=dat)
anova(lm.base1, lm.full)
anova(lm.base2, lm.full2)


Q1: Is it ok to use these categorical predictors in a linear mixed model?
Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)?
Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient? Q4: To check for normality is using the following code ok? hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)  I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is lm.full <- lmer(behaviour ~ task*sex + (1|ID/task), REML=FALSE, data=dat) lm.full2 <-lme(behaviour ~ task*sex, random = ~ 1|ID/task), method="ML", data=dat)  I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova: lm.base1 <- lmer(behaviour ~ task+sex+(1|ID/task), REML=FALSE, data=dat) lm.base2 <- lme(behaviour ~ task+sex, random= ~1|ID/task), method="ML", data=dat) anova(lm.base1, lm.full) anova(lm.base2, lm.full2)  Q1: Is it ok to use these categorical predictors in a linear mixed model? Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)? Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient?
Q4: To check for normality is using the following code ok?

hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)


I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is

lm.full <- lmer(behaviour ~ task*sex + (1|ID/task), REML=FALSE, data=dat)


I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova:

lm.base1 <- lmer(behaviour ~ task+sex+(1|ID/task), REML=FALSE, data=dat)
anova(lm.base1, lm.full)
anova(lm.base2, lm.full2)


Q1: Is it ok to use these categorical predictors in a linear mixed model?
Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)?
Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient? Q4: To check for normality is using the following code ok? hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)  3 deleted 4 characters in body I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is lm.full <- lmer(behaviour ~ task*sex + (1|rat1|ID/task), REML=FALSE, data=dat) lm.full2 <-lme(behaviour ~ task*sex, random = ~ 1|rat1|ID/task), method="ML", data=dat)  I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova: lm.base1 <- lmer(behaviour ~ task+sex+(1|rat1|ID/task), REML=FALSE, data=dat) lm.base2 <- lme(behaviour ~ task+sex, random= ~1|rat~1|ID/task), method="ML", data=dat) anova(lm.base1, lm.full) anova(lm.base2, lm.full2)  Q1: Is it ok to use these categorical predictors in a linear mixed model? Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)? Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient?
Q4: To check for normality is using the following code ok?

hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)


I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is

lm.full <- lmer(behaviour ~ task*sex + (1|rat/task), REML=FALSE, data=dat)


I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova:

lm.base1 <- lmer(behaviour ~ task+sex+(1|rat/task), REML=FALSE, data=dat)
anova(lm.base1, lm.full)
anova(lm.base2, lm.full2)


Q1: Is it ok to use these categorical predictors in a linear mixed model?
Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)?
Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient? Q4: To check for normality is using the following code ok? hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)  I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task. I used both the lmer and lme4 package to investigate this, however, I am stuck with trying to check assumptions for either method. The code I run is lm.full <- lmer(behaviour ~ task*sex + (1|ID/task), REML=FALSE, data=dat) lm.full2 <-lme(behaviour ~ task*sex, random = ~ 1|ID/task), method="ML", data=dat)  I checked if the interaction was the best model by comparing it with the simpler model without the interaction and running an anova: lm.base1 <- lmer(behaviour ~ task+sex+(1|ID/task), REML=FALSE, data=dat) lm.base2 <- lme(behaviour ~ task+sex, random= ~1|ID/task), method="ML", data=dat) anova(lm.base1, lm.full) anova(lm.base2, lm.full2)  Q1: Is it ok to use these categorical predictors in a linear mixed model? Q2: Do I understand correctly it is fine the outcome variable ("behaviour") does not need to be normally distributed itself (across sex/tasks)? Q3: How can I check homogeneity of variance? For a simple linear model I use plot(LM$fitted.values,rstandard(LM)). Is using plot(reside(lm.base1)) sufficient?
Q4: To check for normality is using the following code ok?

hist((resid(lm.base1) - mean(resid(lm.base1))) / sd(resid(lm.base1)), freq = FALSE); curve(dnorm, add = TRUE)

2 edited title

1