predict.blrm: Make predictions from a 'blrm()' fit

predict.blrmR Documentation

Make predictions from a blrm() fit

Description

Predict method for blrm() objects

Usage

## S3 method for class 'blrm'
predict(
  object,
  ...,
  kint = NULL,
  ycut = NULL,
  zcppo = TRUE,
  Zmatrix = TRUE,
  fun = NULL,
  funint = TRUE,
  type = c("lp", "fitted", "fitted.ind", "mean", "x", "data.frame", "terms", "cterms",
    "ccterms", "adjto", "adjto.data.frame", "model.frame"),
  se.fit = FALSE,
  codes = FALSE,
  posterior.summary = c("mean", "median", "all"),
  cint = 0.95
)

Arguments

object, ..., type, se.fit, codes

see rms::predict.lrm()

kint

This is only useful in a multiple intercept model such as the ordinal logistic model. There to use to second of three intercepts, for example, specify kint=2. The default is the middle intercept corresponding to the median y. You can specify ycut instead, and the intercept corresponding to Y >= ycut will be used for kint.

ycut

for an ordinal model specifies the Y cutoff to use in evaluating departures from proportional odds, when the constrained partial proportional odds model is used. When omitted, ycut is implied by kint. The only time it is absolutely mandatory to specify ycut is when computing an effect (e.g., odds ratio) at a level of the response variable that did not occur in the data. This would only occur when the cppo function given to blrm is a continuous function. If type='x' and neither kint nor ycut are given, the partial PO part of the design matrix is not multiplied by the cppo function. If type='x', the number of predicted observations is 1, ycut is longer than 1, and zcppo is TRUE, predictions are duplicated to the length of ycut as it is assumed that the user wants to see the effect of varying ycut, e.g., to see cutoff-specific odds ratios.

zcppo

applies only to type='x' for a constrained partial PO model. Set to FALSE to prevent multiplication of Z matrix by cppo(ycut).

Zmatrix

set to FALSE to exclude the partial PO Z matrix from the returned design matrix if type='x'

fun

a function to evaluate on the linear predictor, e.g. a function created by Mean.blrm() or Quantile.blrm()

funint

set to FALSE if fun is not a function such as the result of Mean.blrm(), Quantile.blrm(), or ExProb.blrm() that contains an intercepts argument

posterior.summary

set to 'median' or 'mode' to use posterior median/mode instead of mean. For some types set to 'all' to compute the needed quantity for all posterior draws, and return one more dimension in the array.

cint

probability for highest posterior density interval. Set to FALSE to suppress calculation of the interval.

Value

a data frame, matrix, or vector with posterior summaries for the requested quantity, plus an attribute 'draws' that has all the posterior draws for that quantity. For type='fitted' and type='fitted.ind' this attribute is a 3-dimensional array representing draws x observations generating predictions x levels of Y.

Author(s)

Frank Harrell

See Also

rms::predict.lrm()

Examples

## Not run: 
  f <- blrm(...)
  predict(f, newdata, type='...', posterior.summary='median')

## End(Not run)

rmsb documentation built on Sept. 11, 2024, 8:12 p.m.