I want to run the following model:
Weight ~ Height*Sex, where
* sign means interaction. I got the following result:
modell <- lm(df$weight ~ df$height*df$SEX) summary(model) # ... # Coefficients: # Estimate Std. Error t value Pr(>|t|) # (Intercept) 29.5514 43.1282 0.685 0.495 # df$height 0.2996 0.2408 1.244 0.217 # df$SEXfemale 7.0516 61.6167 0.114 0.909 # df$height:df$SEXfemale -0.1176 0.3594 -0.327 0.744 # # Residual standard error: 11.79 on 96 degrees of freedom # Multiple R-squared: 0.3452, Adjusted R-squared: 0.3248 # F-statistic: 16.87 on 3 and 96 DF, p-value: 7.015e-09
As you can see, I got only
df_height:df_SEXfemale. But coefficients with
df_SEXmale are absent (I suppose because they are interpreted as number
df$SEX is a factor variable with 2 levels (male and female).
So my questions are:
- How can I correct this situation?
- How can I plot regression lines for both groups separately (female and male) without using the