1

I did imputation using mice from the mice package.

Then I used the function 'summary' to see the result of linear regression.

I can see the factor(age)40-59 and factor(age)60-99.

But I can't find the factor(age)20-39 from the result.

Can I know the reason?

I think the factor(age)20-39 is not linear model. Am I right?

library(mice)

data("nhanes2")

attach(nhanes2)

nhanes2.lm <- lm(chl~factor(age)+bmi, data=nhanes2)

summary(nhanes2.lm)
NelsonGon
  • 13,015
  • 7
  • 27
  • 57
Aram K
  • 13
  • 2
  • See also: https://stackoverflow.com/questions/30177943/lm-function-in-r-does-not-give-coefficients-for-all-factor-levels-in-categorical – NelsonGon Mar 30 '19 at 14:51

1 Answers1

0

The age group 20-39 is the reference group in your model. So the summary gives you the effect of being in the other age groups. You can relevel your model if another group should be reference group.

nhanes2$factorage<-factor(nhanes2$age)
levels(nhanes2$factorage)
nhanes2$factorage<-relevel(nhanes2$factorage, ref="60-99")
nhanes2.lm <- lm(chl~factorage+bmi, data=nhanes2)

summary(nhanes2.lm)
User LG
  • 307
  • 2
  • 12
  • Thanks for solution. so you mean (Age)20-39 is in the 'intercept'? or (Age)20-39 is a ref? – Aram K Mar 30 '19 at 15:09
  • Think of it as the effect of changing from your reference group to one of the other. There is a good simple explanation here: https://www.theanalysisfactor.com/interpreting-regression-coefficients/ – User LG Mar 30 '19 at 15:21
  • Think of it as the effect of switching from your reference group to one of the other. There is a good simple explanation here: https://www.theanalysisfactor.com/interpreting-regression-coefficients/ – User LG Mar 30 '19 at 15:30