Generation

generate functionTue, 18 Apr 2023

dependent variable: 'direction' has three levels: morning, noon, night. There is no reference level for 'direction' > table(indvar_FODs_new$direction) morning noon night 1683 1432 206 fixed factor/independent variable: 'Cond' has four levels: Ay, Bi, Ci, Di. There is no reference level for 'Cond' > table(indvar_FODs$Cond) Ay Bi Ci Di 880 880 880 880 random factor: 'colours' has two levels: blue and pink. > table(indvar_FODs_new$colours) blue pink 2720 800 data is categorical data Using 'lme4' package please test if 'Cond' and 'colours', and the interaction effect between 'Cond' and 'colours' has an effect on the 'direction'.

# R script library(nlme) library(lme4) # analysis on the effect of Cond on direction lmer(direction ~ Cond + (1 | colours), data = indvar_FODs_new) # analysis on the interaction effect of Cond and colours on direction lmer(direction ~ Cond * colours + (1 | colours), data = indvar_FODs_new)

Questions about programming?Chat with your personal AI assistant