model1 <- lme(categorical_FOD_FODs~Condition_FODs*Gender_FODs,random=~1|ID/Ch,na.action=na.omit, method = "ML", data=long1.RSPL,control = lmeControl(opt = "optim"))
The model1 is the name of the model created using the lme function. The lme function takes a number of arguments. The first two arguments are the response variable and the predictor variables. In this model the response variable is categorical_FOD_FODs and the predictor variables are Condition_FODs*Gender_FODs. The random argument represents the random effects of the model and in this case, the random effects are a random intercept for each participant and a random slope for each participant and each chunk condition. The random effects are nested within the participant and the chunk conditions are nested within each participant. The na.action argument specifies how to deal with missing values, in this case missing values will be removed from the model. The method argument specifies the fitting method to be used, in this case maximum likelihood estimation (ML). The data argument specifies the dataframe from which the variables are taken, in this case the dataframe is called long1.RSPL. The control argument specifies the options to be used in the model, in this case the optim argument specifies the optimization algorithm to be used, in this case a quasi-Newton method.