I'm trying to estimate days spent in hospital (length of stay
, continuous variable) based on a clinical severity score
(categorical, integer: 1, 2 or 3). The numbers reflect level of severity, so 1 is mild, 3 is severe.
I'm also interested to know if age
(integer, continuous variable) confounds this as well.
In R, my code is as follows, but I'm unsure if I'm treating the categorical variable for severity score
correctly.
df$scoreFac <- factor(df$score)
lm.model <- lm(lengthOfStay ~ scoreFac, data = df)
summary(lm.model)
The result coefficient is:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.1705 0.1680 6.757 2.02e-10 ***
scoreFac2 0.4313 0.1768 2.429 0.02623 *
scoreFac3 0.5340 0.1769 2.912 0.00383 **
If I want to add age
onto this:
lm.modelB <- lm(lengthOfStay ~ scoreFac + age, data = df)
summary(lm.modelB)
Resulting in coefficient output:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.753531 0.210627 3.631 0.00035 ***
scoreFac2 0.363182 0.175734 1.938 0.05595 .
scoreFac3 0.434588 0.175463 2.485 0.01665 *
age 0.008762 0.002147 3.158 0.00173 **
Should I be representing score
differently (such as using score
not scoreFac
)? I'm not sure if I'm able to correctly interpret the esimtate when there's the dummy variables for score
.