Learn R Programming

ordinalCont (version 0.4)

predict.ocm: Predict method for Continuous Ordinal Fits

Description

Predicted values based on ocm object

Usage

"predict"(object, newdata = NULL, ndens = 100, ...)

Arguments

object
an object of class ocm, usually a result of a call to ocm
newdata
optionally, a data frame in which to look for variables with which to predict. Note that all predictor variables should be present, having the same names as the variables used to fit the model. If NULL, predictions are computed for the original dataset.
ndens
the number of points on the continuous ordinal scale (0, 1) over which the densities are computed. The default is 100.
...
further arguments passed to or from other methods

Value

A list containing the following components:
mode
a vector of length equal to the number of observations. Each element is the mode of v, the continuous ordinal random variable, conditional on the covariates in the model.
density
a matrix with number of rows equal to the number of observations. Each row contains the values of the density function of v conditional on the covariates in the model. The density function is calculated over ndens equally-spaced values of v in (0,1).
x
a vector with the ndens equally-spaced values of v in (0,1) used to compute the density of v
formula
the formula used to fit the model
newdata
a new data frame used to make predictions. It takes value NULL if no new data frame has been used.

Details

An object of class ocm and optionally a new data frame are used to compute the probability densities of v, the continuous ordinal score. The estimated parameters of the fitted model and ndens (default: 100) values of v are used to compute the probability densities on the latent scale. These values are then transformed to scores on the continuous ordinal scale using the g function and the estimated values of M, B, and T.

See Also

ocm, plot.predict.ocm

Examples

Run this code
ANZ0001.ocm <- ANZ0001[ANZ0001$cycleno==0 | ANZ0001$cycleno==5,]
ANZ0001.ocm$cycleno[ANZ0001.ocm$cycleno==5] <- 1
fit.overall <- ocm(overall ~ cycleno + age + bsa + treatment, data=ANZ0001.ocm)
pred <- predict(fit.overall)
plot(pred)

Run the code above in your browser using DataLab