No problem. I think it’s almost impossible to interpret a predicted probability of \geq 1 exacerbation that is masked by death, so the ordinal model would estimate the probability of \geq ex. or death.
Hi Dr. Harrell, following up after the RMS 2025 course. How concerned should we be about phantom degrees of freedom when changing the model after fitting to remove ordinal, PO assumptions, etc.? One of the examples from this chapter compared a PO model to a multinomial model, which dramatically increased the df from 12 to 30. If hypothetically the multinomial model was a significantly better fit to the data (or if we moved in the opposite direction from using a multinomial to PO model), shouldn’t this also drastically impact SEs?
When you move from a simpler model to a more complex model where complexity is captured by it having more parameters, the standard errors will be automatically enlarged and you don’t have to worry. The process is self-penalizing.
For a model with a residual variance such as the linear model, moving to a more complex model will properly penalize everything but you can also get lucky and have the residual variance decrease enough (R^2 increase) so that confidence intervals actually get smaller for the more complex model.
Does anyone know the reason for this error? Maybe something to do with model convergence? How can I increase the number of iterations in a lrm() model?
set.seed(1234)
boot ← bootstraps(data, times = 500)fit ← function(split) {
d ← analysis(split)
d$week_4 ← factor(d$week_4, ordered = T)
dd ← datadist(d)
options(datadist = ‘dd’)
lrm(week_4 ~ rcs(week_1, 3)*AIS, data = d)
}boot_models ← map(boot$splits, fit)
Error inmap():
In index: 51.
Caused by error inif (objfnew > objf + 1e-06) ...:
! valor ausente onde TRUE/FALSE necessário
Runrlang::last_trace()to see where the error occurred.
Don’t put datadist and options inside a look. Use bootcov to get efficient lrm refitting using lrm.fit. Type ?lrm.fit to see how to use options trace, maxit, …. Do unit testing to debug, not looping. On that point, you can use this contruct to find out which iteration causes a failure, and next time if you are at that iteration execute browser():
it <- 0
… loop …
it <<- it + 1. # <<- to update it outside look, in..Globalenv
cat(‘it=‘, it, ‘\n’)
Not even bootcov() is working:
m ← lrm(week_4 ~ rcs(week_1, 3)*AIS, data = data, x = T, y = T)
b ← bootcov(m, B = 500, group = data$week_4, maxit = 1e6)
Warning:
In bootcov(m, B = 500, group = data$week_4, maxit = 1e+06) :
fit failure in 2 resamples. Might try increasing maxit
Don’t specify maxit > 200, and use trace=1 to see if the non-convergence can be explained. But you already have 498 useful bootstrap repetitions so you don’t need to worry much.