i have run into a bit of brick wall and need some help. Below is my code for running a regression model:
model1 <- lm(Housing ~ Gender + Offence + Mental illness, data = df1)#without media
model2 <- lm(Housing ~ Gender + Offence + Mental illness + Forgive + Victim + Age, na.action = na.omit, data = df1)#with media
#broom::tidy(model1a)
summary(model1)
summary(model2)
report(model1) report(model2)
#AIC model comparison
AIC(model1)
AIC(model2)
anova(model1, model2)#for model comparison
Below is the error code i get after running the anova line of code.
Error in anova.lmlist(object, ...) : models were not all fitted to the same size of dataset
Warning: Model matrix is rank deficient. Parameters Age69 were not estimable. (this warning comes up after the report (model2) so i am wondering if it is that what is causing the issue.
Does anyone have any ideas on how to fix this? I am still a novice with R studio so any help would be greatly appreciated.Thank you in advance!