harrelfe / rms

Regression Modeling Strategies
https://hbiostat.org/R/rms
Other
172 stars 48 forks source link

Missing factor names in model presentation using latex(model) #83

Open Niclase78 opened 4 years ago

Niclase78 commented 4 years ago

Using latex on a rms result (below example for ols) does not show the factor name, only the level.

library(rms) outcome <- rnorm(100) set.seed(3434) diabetes <- as.factor(sample(c('Yes','No'),100, replace = TRUE)) diabetes2 <- as.factor(sample(c('Yes','No'),100, replace = TRUE))

mod <- ols(outcome~diabetes+diabetes2) latex(mod)

Results in: [{\rm E({\rm outcome}}) = X\beta, {\rm \ \ where} \ ] \begin{eqnarray} \lefteqn{X\hat{\beta}=}\ & & -0.05028528 \ & & +0.3015909[{\rm Yes}] \ & & -0.2327972[{\rm Yes}] \ \end{eqnarray} and ([c]=1) if subject is in group (c), 0 otherwise

Above you see that diabetes and diabetes2 are missing from the model presentation, we only see 0.3015[Yes] - 0.2338[Yes].

The same behaviour can be seen in online examples like http://hbiostat.org/R/rms/examples.html Here you can se +1.345826[male], should be +1.345826[sex = male]

/ Niclas Eriksson