View source: R/ordinal_reg-rms.R
| rms_orm_wrapper | R Documentation |
lrm and ormrms::orm() did not support case weights or penalty before version 7.0-0.
The fit wrapper errs or warns informatively when either is requested from an
older version. Both rms::lrm() and rms::orm() use rms::predictrms()
internally, which does not accept tibble inputs. The predict wrapper ensures
that newdata is converted to a plain data frame before the S3 method is
dispatched.
rms_orm_wrapper(formula, data, weights = NULL, ..., call = rlang::caller_env())
predict_lrm_wrapper(object, newdata, type, ...)
formula |
The formula to pass. |
data |
The data frame to pass. |
weights |
An optional vector of case weights to pass. |
... |
Additional arguments passed to the underlying method. |
call |
The execution environment of a currently running function. |
object |
A fitted model object of class |
newdata |
A data frame or tibble of predictors. |
type |
The prediction type, passed to the underlying method. |
rms_orm_wrapper() returns an object of class orm as returned by
rms::orm(). predict_lrm_wrapper() returns the result of
stats::predict() dispatched on object.
house_data <-
MASS::housing[rep(seq(nrow(MASS::housing)), MASS::housing$Freq), -5]
# fit wrapper
( fit_orig <- rms::orm(Sat ~ Infl + Type + Cont, data = house_data) )
( fit_wrap <- rms_orm_wrapper(
Sat ~ Infl + Type + Cont, data = house_data
) )
# predict wrapper
( fit <- rms::lrm(Sat ~ Infl + Type + Cont, data = house_data) )
predict(
fit,
newdata = head(house_data, 3),
type = "fitted.ind"
)
# tibble input is converted internally
predict_lrm_wrapper(
fit,
newdata = tibble::as_tibble(head(house_data, 3)),
type = "fitted.ind"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.