(A)
How can I define the reference category for non-numeric covariates (binary, ordinal, or multinomial)? According to the manual "[] When placed immediately after an explanatory variable, indicates that the variable is categorical.The string in the [] represents the reference category; if empty, no reference category is used; See note.". I have used this in the past, but it does not work anymore.
Code: Select all
data(tutorial, package = "R2MLwiN")
# works
(mymodel2 <- runMLwiN(normexam ~ 1 + standlrt + sex + schgend + (1 + standlrt | school) + (1 | student), data = tutorial))
# does not work - string
(mymodel3 <- runMLwiN(normexam ~ 1 + standlrt + sex["boy"] + schgend + (1 + standlrt | school) + (1 | student), data = tutorial))
# does not work - no string
(mymodel4 <- runMLwiN(normexam ~ 1 + standlrt + sex[boy] + schgend + (1 + standlrt | school) + (1 | student), data = tutorial))
(B)
I want to specifically use an explicit reference category with an interaction, for example:
Code: Select all
(mymodel5 <- runMLwiN(normexam ~ 1 + standlrt + sex["boy"] + schgend["mixedsch"] + sex["boy"]:schgend["mixedsch"] (1 + standlrt | school) + (1 | student), data = tutorial))