rms_po_assume: Create figures to visually examine proportional odds...

Description Usage Arguments Methods (by class) See Also Examples

View source: R/rms_po_assume.R

Description

Based on code and strategy outlined in Frank Harrell's Regression Modeling Strategies (see citation below).

Usage

1
2
3
4
5
6
7
8
9
rms_po_assume(lrmObj = NULL, ...)

## S3 method for class 'fit.mult.impute'
rms_po_assume(lrmObj, cuts, plotVars = NULL,
  mfrowAuto = FALSE, modelData, impObj, plotType = c("ggplot", "base"))

## Default S3 method:
rms_po_assume(lrmObj, cuts, plotVars = NULL,
  mfrowAuto = FALSE, modelData, plotType = c("ggplot", "base"))

Arguments

cuts

Numeric vector; sequence of points to cut outcome. Should not include lowest outcome level.

plotVars

Character vector; which variables to plot. Defaults to all.

mfrowAuto

Logical; whether to determine par(mfrow = ...) automatically. Defaults to FALSE.

modelData

Data.frame; data set used to fit original model. Used to fit logistic models with outcome dichotomized at each cut point.

impObj

aregImpute or mice object used to fit original model in fit.mult.impute.

rmsObj

Model fit of class 'lrm'.

Methods (by class)

See Also

Harrell FE. *Regression Modeling Strategies: with applications to linear models, logistic regression, and survival analysis.* New York: Springer Science + Business Media, LLC, 2001.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Regular lrm() model, no imputation
df <- data.frame(ptclass = sample(1:4, size = 20, replace = TRUE),
                 v1 = rnorm(n = 20),
                 v2 = rnorm(mean = 5, sd = 1, n = 20))

mymod <- lrm(ptclass ~ v1 + v2, data = df)
rms_po_assume(mymod, cuts = 2:4, modelData = df)

## Model using imputation
df$v1[sample(1:nrow(df), size = 5)] <- NA

aregdf <- aregImpute(~ ptclass + v1 + v2, nk = 0, data = df)
mymodImp <- fit.mult.impute(ptclass ~ v1 + v2, fitter = lrm, xtrans = aregdf, data = df)
rms_po_assume(mymodImp, cuts = 2:4, impObj = aregdf, modelData = df)

jenniferthompson/JTHelpers documentation built on May 19, 2019, 4:04 a.m.