Draws a partial nomogram that can be used to manually obtain predicted values. This is a modified version of nomogram.
nomogram.mk6(
fit,
...,
adj.to,
lp = TRUE,
lp.at,
lplabel = "Linear Predictor",
fun,
fun.at,
fun.lp.at,
funlabel = "Predicted Value",
fun.side,
interact = NULL,
intercept = 1,
conf.int = FALSE,
col.conf = c(1, 12),
conf.space = c(0.08, 0.2),
conf.lp = c("representative", "all", "none"),
est.all = TRUE,
abbrev = FALSE,
minlength = 4,
maxscale = 100,
nint = 10,
label.every = 1,
force.label = FALSE,
xfrac = 0.35,
cex.axis = 0.85,
cex.var = 1,
col.grid = NULL,
vnames = c("labels", "names"),
varname.label = TRUE,
varname.label.sep = "=",
ia.space = 0.7,
tck = NA,
tcl = -0.25,
lmgp = 0.4,
omit = NULL,
naxes,
points.label = "Points",
total.points.label = "Total Points",
total.sep.page = FALSE,
total.fun,
verbose = FALSE,
cap.labels = FALSE,
total.min,
total.max,
survtime,
mikeomit = NULL
)A nomogram
A regression model that was created with library(rms)
in effect, and (usually) with options(datadist = "object.name") in
effect.
Settings of variables to use in constructing axes.
If datadist was in effect, the default is to use
pretty(total range, nint) for continuous variables, and the class
levels for discrete ones.
For legend.nomabbrev, ... specifies optional parameters to
pass to legend. Common ones are bty = "n" to suppress
drawing the box. You may want to specify a non-proportionally spaced font
(e.g., courier) number if abbreviations are more than one letter long.
This will make the abbreviation definitions line up (e.g., specify
font = 2, the default for courier). Ignored for print.
If you didn't define datadist for all predictors,
you will have to define adjustment settings for the undefined ones, e.g.
adj.to= list(age = 50, sex = "female").
Set to FALSE to suppress creation of an axis for scoring
\(X\beta\).
If lp=TRUE, lp.at may specify a vector of
settings of \(X\beta\).
Default is to use pretty(range of linear predictors, nint).
label for linear predictor axis.
Default is "Linear Predictor".
on another axis. If more than one transformation is plotted,
put them in a list, e.g. list(function(x) x/2, function(x) 2*x).
Any function values equal to NA will be ignored.
function values to label on axis. Default fun
evaluated at lp.at. If more than one fun was specified,
using a vector for fun.at will cause all functions to be evaluated
at the same argument values. To use different values, specify a list of
vectors for fun.at, with elements corresponding to the different
functions (lists of vectors also applies to fun.lp.at and
fun.side).
If you want to
evaluate one of the functions at a different set of linear predictor
values than may have been used in constructing the linear predictor axis,
specify a vector or list of vectors
of linear predictor values at which to evaluate the function. This is
especially useful for discrete functions. The presence of this attribute
also does away with the need for nomogram to compute numerical
approximations of the inverse of the function. It also allows the
user-supplied function to return factor objects, which is useful
when e.g. a single tick mark position actually represents a range.
If the fun.lp.at parameter is present, the fun.at
vector for that function is ignored.
label for fun axis. If more than one function was
given but funlabel is of length one, it will be duplicated as needed.
If fun is a list of functions for which you specified names (see the
final example below), these names will be used as labels.
a vector or list of vectors of side parameters for
the axis function for labeling function values.
Values may be 1 to position a tick mark label below the axis (the default),
or 3 for above the axis. If for example an axis has 5 tick mark labels
and the second and third will run into each other, specify
fun.side=c(1,1,3,1,1) (assuming only one function is specified as
fun).
When a continuous variable interacts with a discrete one,
axes are constructed so that the continuous variable moves within the axis,
and separate axes represent levels of interacting factors. For
interactions between two continuous variables, all but the axis variable
must have discrete levels defined in interact.
For discrete interacting factors, you may specify levels to use in
constructing the multiple axes. For continuous interacting factors,
you must do this. Examples: interact = list(age = seq(10,70,by=10),
treat = c("A","B","D")).
for models such as the ordinal logistic model with multiple intercepts, specifies which one to use in evaluating the linear predictor.
confidence levels to display for each scoring.
Default is FALSE to display no confidence limits.
Setting conf.int to TRUE is the same as
setting it to c(0.7, 0.9),
with the line segment between the 0.7 and 0.9 levels shaded using
gray scale.
colors corresponding to conf.int.
Use fractions for gray scale(for UNIX S-PLUS).
a 2-element vector with the vertical range within which to draw confidence bars, in units of 1=spacing between main bars. Four heights are used within this range (8 for the linear predictor if more than 16 unique values were evaluated), cycling them among separate confidence intervals to reduce overlapping
default is "representative" to group all linear
predictors evaluated into deciles, and to show, for the linear predictor
confidence intervals, only the mean linear predictor within the deciles
along with the median standard error within the deciles. Set
conf.lp = "none" to suppress confidence limits for the linear
predictors, and to "all" to show all confidence limits.
To plot axes for only the subset of variables named in
..., set est.all = FALSE. Note: This option only works
when zero has a special meaning for the variables that are omitted from the
graph
Set to TRUE to use the abbreviate
function to abbreviate levels of categorical factors, both for labeling
tick marks and for axis titles. If you only want to abbreviate certain
predictor variables, set abbrev to a vector of character strings
containing their names.
abbreviate function. If you set
minlength = 1, the letters of the alphabet are used to label tick
marks for categorical predictors, and all letters are drawn no matter how
close together they are. For labeling axes (interaction settings),
minlength = 1 causes minlength = 4 to be used
default maximum point score is 100
number of intervals to label for axes representing continuous
variables.
See pretty.
Specify label.every = i to label on every
ith tick mark
set to TRUE to force every tick mark intended to
be labeled to have a label plotted (whether the labels run into each other
or not)
fraction of horizontal plot to set aside for axis titles
character size for tick mark labels
character size for axis titles (variable names)
If left unspecified, no vertical reference lines are drawn.
Specify a vector of length one (to use the same color for both minor and
major reference lines) or two (corresponding to the color for the major and
minor divisions, respectively) containing colors, to cause vertical
reference lines to the top points scale to be drawn. For R, a good choice
is col.grid = gray(c(0.8, 0.95)).
By default, variable labels are used to label axes. Set
vnames = "names" to instead use variable names.
In constructing axis titles for interactions, the
default is to add (interacting.varname = level) on the right.
Specify varname.label = FALSE to instead use "(level)".
If varname.label = TRUE, you can change the
separator to something other than
= by specifying this parameter.
When multiple axes are draw for levels of interacting factors, the default is to group combinations related to a main effect. This is done by spacing the axes for the second to last of these within a group only 0.7 (by default) of the way down as compared with normal space of 1 unit.
see tck under par
length of tick marks in nomogram
spacing between numeric axis labels and axis
(see par for mgp)
vector of character strings containing names of variables for which to suppress drawing axes. Default is to show all variables.
maximum number of axes to allow on one plot. If the nomogram requires more than one “page”, the “Points” axis will be repeated at the top of each page when necessary.
a character string giving the axis label for the points scale
a character string giving the axis label for the total points scale
set to TRUE to force the total points and
later axes to be placed on a separate page
a user-provided function that will be executed before the
total points axis is drawn. Default is not toe xecute a function.
This is useful e.g. when total.sep.page = TRUE and you wish to use
locator to find the coordinates for positioning an abbreviation
legend before it's too late and a new page is started (i.e.,
total.fun = function() print(locator(1))).
set to TRUE to get printed output detailing how tick
marks are chosen and labeled for function axes. This is useful in seeing
how certain linear predictor values cannot be solved for using inverse
linear interpolation on the (requested linear predictor values, function
values at these lp values). When this happens you will see NAs in
the verbose output, and the corresponding tick marks will not appear in
the nomogram.
logical: should the factor labels have their first letter capitalized?
the minimum point for the total point axis
the maxmum point for the total point axis
specified survival time for the predicted survival probability
a modified version of omit
Banks J: Nomograms. Encylopedia of Statistical Sciences, Vol 6. Editors: S Kotz and NL Johnson. New York: Wiley; 1985.
Lubsen J, Pool J, van der Does, E: A practical device for the application of a diagnostic or prognostic function. Meth. Inform. Med. 17:127--129; 1978.
Wikipedia: Nomogram, https://en.wikipedia.org/wiki/Nomogram.
data(prostate.dat)
dd <- datadist(prostate.dat)
options(datadist = "dd")
prostate.f <- cph(Surv(TIME_EVENT,EVENT_DOD == 1) ~ TX + rcs(PSA,3) +
BX_GLSN_CAT + CLIN_STG + rcs(AGE,3) +
RACE_AA, data = prostate.dat,
x = TRUE, y= TRUE, surv=TRUE,time.inc = 144)
## make a cph nomogram
nomogram.mk6(prostate.f, survtime=120, lp=FALSE,
funlabel = "Predicted 10-year cumulative incidence")
Run the code above in your browser using DataLab