I have a question regarding the use of linear models in R that contain both categorical and continuous variables as independent variables. My response variable is continuous. Can I build such a model with the "lm" function?
Olusola Makinde There's no sense in using a mixed effects model unless the variables are structured in a clustered, multilevel design. Nothing in the question suggests this is the case.
You can fit a linear model with the lm() for independent datasets that contains both categorical and numerical variables. However, you need to convert the categorical variables to factor and specify the reference level so you can get coefficients for each other levels referenced to the "reference" category.
Yes it is possible with the lm() however you should try to make the categorical variable(s) to become factor(s) and choose a reference level within the levels of the categorical variable(s). This approach helps for within level parameter estimates with reference to the chosen "reference level". I can show you how to do it when we meet in school.