predict.partial.prop.odds: A function to predict probabilities for each level of an...

Description Usage Arguments Value Examples

View source: R/predict.partial.prop.odds.R

Description

This function takes a testing dataset and the output object from a partial proportional odds model fit on a training dataset, and predicts probabilities of each level of the outcome for each individual in the test data.

Usage

1
2
## S3 method for class 'partial.prop.odds'
predict(object, newdata, ...)

Arguments

object

The output object from partial.prop.odds.mod run on a training dataset.

newdata

A test dataset to be used for predictions. The outcome for test data must have the exact same levels as the training dataset

...

Other parameters

Value

A data frame of predicted probabilities for each level of the ordinal outcome for each subject, where the subjects are rows and the levels of the outcome are columns. The final column is the most likely category.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(red_test)
data(red_train)
starts <- coef(lm(quality ~ alcohol+ pH + volatile.acidity, data = red_train))
training.result <- partial.prop.odds.mod(y ="quality", in.data = red_train,
prop.odds.formula = ~ alcohol + pH,
beta.prop.odds.start = starts[2:3],
non.prop.odds.formula = ~ volatile.acidity,
beta.non.prop.odds.start = matrix(rep(starts[4], 5), nrow = 1),
method = "BFGS",
seed = c(14, 15), itnmax = 1000)
predictions <- predict(training.result, red_test)

group-wine/sommelieR documentation built on May 21, 2019, 1:43 p.m.