ordParallel {rms} | R Documentation |
Check Parallelism Assumption of Ordinal Semiparametric Models
Description
orm
models are refitted as a series of binary models for a sequence of cutoffs
on the dependent variable. Regression coefficients from this sequence are plotted
against cutoffs using ggplot2
with one panel per regression coefficient.
When censoring is present, whether or not Y is
greater than or equal to the current cutoff is not always possible, and such
observations are ignored.
Usage
ordParallel(
fit,
which,
terms = onlydata,
m,
maxcuts = 75,
lp = FALSE,
onlydata = FALSE,
scale = c("iqr", "none"),
conf.int = 0.95,
alpha = 0.15
)
Arguments
fit |
a fit object from |
which |
specifies which columns of the design matrix are assessed. By default, all columns are analyzed. |
terms |
set to |
m |
the lowest cutoff is chosen as the first Y value having at meast |
maxcuts |
the maximum number of cutoffs analyzed |
lp |
plot the effect of the linear predictor across cutpoints instead of analyzing individual predictors |
onlydata |
set to |
scale |
applies to |
conf.int |
confidence level for computing Wald confidence intervals for regression coefficients. Set to 0 to suppress confidence bands. |
alpha |
saturation for confidence bands |
Details
Whenver a cut gives rise to extremely high standard error for a regression coefficient,
the confidence limits are set to NA
. Unreasonable standard errors are determined from
the confidence interval width exceeding 7 times the standard error at the middle Y cut.
Value
ggplot2
object or a data frame
Author(s)
Frank Harrell
Examples
## Not run:
f <- orm(..., x=TRUE, y=TRUE)
ordParallel(f, which=1:5) # first 5 betas
getHdata(nhgh)
set.seed(1)
nhgh$ran <- runif(nrow(nhgh))
f <- orm(gh ~ rcs(age, 4) + ran, data=nhgh, x=TRUE, y=TRUE)
ordParallel(f) # one panel per parameter (multiple parameters per predictor)
dd <- datadist(nhgh); options(datadist='dd')
ordParallel(f, terms=TRUE)
d <- ordParallel(f, maxcuts=30, onlydata=TRUE)
dd2 <- datadist(d); options(datadist='dd2') # needed for plotting
g <- orm(Yge_cut ~ (age + ran) * rcs(Ycut, 4), data=d, x=TRUE, y=TRUE)
h <- robcov(g, d$obs)
anova(h)
qu <- quantile(d$age, c(1, 3)/4)
qu
cuts <- sort(unique(d$Ycut))
cuts
z <- contrast(h, list(age=qu[2], Ycut=cuts),
list(age=qu[1], Ycut=cuts))
z <- as.data.frame(z[.q(Ycut, Contrast, Lower, Upper)])
ggplot(z, aes(x=Ycut, y=Contrast)) + geom_line() +
geom_ribbon(aes(ymin=Lower, ymax=Upper), alpha=0.2)
## End(Not run)