Learn R Programming

ordinalCont (version 1.3.0)

predict.ocm: Predict method for Continuous Ordinal Fits

Description

Predicted values based on ocm object

Usage

# S3 method for ocm
predict(object, newdata = NULL, ndens = 10, ...)

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 evenly spaced values of v over which the probability density is evaluated (default: 10)

...

further arguments passed to or from other methods

Value

A list containing the following components:

mean

a vector of length equal to the number of observations. Each element is the mean 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 log 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 values of v are used to compute the probability densities and their means. If a new data frame is used to make predictions, the individual (random) effects are set to zero, while they are maintained to the estimated values if newdata is NULL.

See Also

ocm, plot.predict.ocm

Examples

Run this code
# NOT RUN {
fit.overall <- ocm(overall ~ cycleno + age + bsa + treatment, data=ANZ0001.sub, scale=c(0,100))
pred <- predict(fit.overall)
plot(pred)
# }

Run the code above in your browser using DataLab