Last chance! 50% off unlimited learning
Sale ends in
summary.rms
forms a summary of the effects of each
factor. When summary
is used to estimate odds or hazard ratios for
continuous variables, it allows the levels of interacting factors to be
easily set, as well as allowing the user to choose the interval for the
effect. This method of estimating effects allows for nonlinearity in
the predictor. Factors requiring multiple parameters are handled, as
summary
obtains predicted values at the needed points and takes
differences. By default, inter-quartile range effects (odds ratios,
hazards ratios, etc.) are printed for continuous factors, and all
comparisons with the reference level are made for categorical factors.
print.summary.rms
prints the results, latex.summary.rms
typesets
the results, and plot.summary.rms
plots shaded confidence bars to display the results graphically.
The longest confidence bar on each page is labeled with confidence levels
(unless this bar has been ignored due to clip
). By default, the
following confidence levels are all shown: .9, .95, and .99, using
blue of different transparencies.If usebootcoef=TRUE
and the fit was run through bootcov
,
the confidence intervals are bootstrap nonparametric percentile
confidence intervals, basic bootstrap, or BCa intervals, obtained on contrasts
evaluated on all bootstrap samples.
## S3 method for class 'rms':
summary(object, \dots, est.all=TRUE, antilog,
conf.int=.95, abbrev=FALSE, vnames=c("names","labels"),
conf.type=c('individual','simultaneous'),
usebootcoef=TRUE, boot.type=c("percentile","bca","basic"), verbose=FALSE)## S3 method for class 'summary.rms':
print(x, \dots)
## S3 method for class 'summary.rms':
latex(object, title, table.env=TRUE, \dots)
## S3 method for class 'summary.rms':
plot(x, at, log=FALSE,
q=c(0.9, 0.95, 0.99), xlim, nbar, cex=1, nint=10,
cex.main=1, clip=c(-1e30,1e30), main,
col=rgb(red=.1,green=.1,blue=.8,alpha=c(.1,.4,.7)),
col.points=rgb(red=.1,green=.1,blue=.8,alpha=1), pch=17, lwd=3,
...)
rms
fit object. Either options(datadist)
should have
been set before the fit, or datadist()
and
options(datadist)
run before summary
. For latex
is
the result of summar
summary
, omit list of variables to estimate effects for all
predictors. Use a list
of variables of the form age, sex
to estimate using default
ranges. Specify age=50
for example to adjust age to 50 when testing
FALSE
to only estimate effects of variables listed. Default is TRUE
.FALSE
to suppress printing of anti-logged effects. Default
is TRUE
if the model was fitted by lrm
or cph
.
Antilogged effects will be odds ratios for logistic models and hazard ratios
for proportio.95
for 95%
confidence intervals of effects.TRUE
to use the abbreviate
function to shorten
factor levels for categorical variables in the model."labels"
to use variable labels to label effects.
Default is "names"
to use variable names.conf.type="simultaneous"
to use the multcomp
package's
glht
and confint
fit
was the result of bootcov
but you want to use the
bootstrap covariance matrix instead of the nonparametric percentile,
basic, or BCa methods for confidence intervals (which uses all the bootstrap
coefficients), speci'bca'
to compute BCa confidence
limits or to 'basic'
to use the basic bootstrap. The default
is to compute percentile intervals.TRUE
when conf.type='simultaneous'
to get output describing scope of simultaneous adjustmentssummary
title
to pass to latex
. Default is name of fit object passed to
summary
prefixed with "summary"
.latex
log=TRUE
, at
should be in anti-log units.TRUE
to plot on $X\beta$ scale but labeled with
anti-logs.plot
in units of the linear predictors (log scale
if log=TRUE
). If at
is specified and xlim
is
omitted, xlim
is derived from the range of at
.nbar
horizontal bars. Default is the
number of non-interaction factors in the model. Set nbar
to a larger
value to keep too much surrounding space from appearing around horizontal
bars. If
cex
parameter for factor labels.pretty
.cex
parameter for main title. Set to 0
to
suppress the title.c(clip[1], clip[2])
will be
ignored, and clip
also be respected when computing xlim
when xlim
is not specified. clip
should be in the units of
f
log
,
e.g., "log Odds Ratio"
.q
summary.rms
, a matrix of class summary.rms
with rows corresponding to factors in
the model and columns containing the low and high values for the effects,
the range for the effects, the effect point estimates (difference in
predicted values for high and low factor values), the standard error
of this effect estimate, and the lower and upper confidence limits.
If fit$scale.pred
has a second level, two rows appear for each factor,
the second corresponding to anti--logged effects. Non--categorical factors
are stored first, and effects for any categorical factors are stored at
the end of the returned matrix. scale.pred
and adjust
. adjust
is a character string containing levels of adjustment variables, if
there are any interactions. Otherwise it is "".
latex.summary.rms
returns an object of class c("latex","file")
.
It requires the latex
function in Hmisc.datadist
, rms
, rms.trans
,
rmsMisc
,
Misc
, pretty
, contrast.rms
n <- 1000 # define sample size
set.seed(17) # so can reproduce the results
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female','male'), n,TRUE))
label(age) <- 'Age' # label is in Hmisc
label(cholesterol) <- 'Total Cholesterol'
label(blood.pressure) <- 'Systolic Blood Pressure'
label(sex) <- 'Sex'
units(cholesterol) <- 'mg/dl' # uses units.default in Hmisc
units(blood.pressure) <- 'mmHg'
# Specify population model for log odds that Y=1
L <- .4*(sex=='male') + .045*(age-50) +
(log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)]
y <- ifelse(runif(n) < plogis(L), 1, 0)
ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')
fit <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)))
s <- summary(fit) # Estimate effects using default ranges
# Gets odds ratio for age=3rd quartile
# compared to 1st quartile
latex(s) # Use LaTeX to print nice version
latex(s, file="") # Just write LaTeX code to screen
summary(fit, sex='male', age=60) # Specify ref. cell and adjustment val
summary(fit, age=c(50,70)) # Estimate effect of increasing age from
# 50 to 70
s <- summary(fit, age=c(50,60,70))
# Increase age from 50 to 70, adjust to
# 60 when estimating effects of other factors
#Could have omitted datadist if specified 3 values for all non-categorical
#variables (1 value for categorical ones - adjustment level)
plot(s, log=TRUE, at=c(.1,.5,1,1.5,2,4,8))
options(datadist=NULL)
Run the code above in your browser using DataLab