Predicted Values for Binary and Ordinal Logistic Models

Computes a variety of types of predicted values for fits from lrm, either from the original dataset or for new observations. The Mean.lrm function produces an S function to compute the predicted mean of a numeric ordered response variable given the linear predictor, which is assumed to use the first intercept in its computation.

models, regression
## S3 method for class 'lrm':
predict(object, \dots, type=c("lp", "fitted", "fitted.ind", "mean", "x", 
            "data.frame", "terms", "adjto","", 
            "model.frame"),, codes=FALSE)

## S3 method for class 'lrm': Mean(object, codes=FALSE, \dots)

a object created by lrm
arguments passed to predict.rms, such as kint and newdata (which is used if you are predicting out of data). See predict.rms to see how NAs are handled.
See predict.rms for "x", "data.frame", "terms", "adjto", "" and "model.frame". type="lp" is used to get linear predictors (always using the first intercept). type="fitted" i
applies only to type="lp", to get standard errors.
if TRUE, type="mean" or Mean.lrm uses the integer codes $1,2,\ldots,k$ for the $k$-level response in computing the predicted mean response.

  • a vector (type="lp" with, or type="mean" or only one observation being predicted), a list (with elements linear.predictors and if, a matrix (type="fitted" or type="fitted.ind"), a data frame, or a design matrix. For Mean.lrm the result is an S function.


logistic regression model


Hannah M, Quigley P: Presentation of ordinal regression analysis on the original scale. Biometrics 52:771--5; 1996.

See Also

lrm, predict.rms, naresid, contrast.rms

  • predict.lrm
  • Mean.lrm
# See help for predict.rms for several binary logistic
# regression examples

# Examples of predictions from ordinal models
y <- factor(sample(1:3, 400, TRUE), 1:3, c('good','better','best'))
x1 <- runif(400)
x2 <- runif(400)
f <- lrm(y ~ rcs(x1,4)*x2, x=TRUE)     #x=TRUE needed for
# Get 0.95 confidence limits for Prob[better or best]
L <- predict(f,           #omitted kint= so use 1st intercept
plogis(with(L, linear.predictors + 1.96*cbind(,
predict(f, type="fitted.ind")[1:10,]   #gets Prob(better) and all others
d <- data.frame(x1=c(.1,.5),x2=c(.5,.15))
predict(f, d, type="fitted")        # Prob(Y>=j) for new observation
predict(f, d, type="fitted.ind")    # Prob(Y=j)
predict(f, d, type='mean', codes=TRUE) # predicts mean(y) using codes 1,2,3
m <- Mean(f, codes=TRUE)
lp <- predict(f, d)
# Can use function m as an argument to Predict or nomogram to
# get predicted means instead of log odds or probabilities
# Don't use non.slopes argument to Predict for this
dd <- datadist(x1,x2); options(datadist='dd')
plot(Predict(f, x1=., fun=m), ylab='Predicted Mean')
Documentation reproduced from package rms, version 2.0-2, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.