Description Usage Arguments Value Examples
View source: R/predict.partial.prop.odds.R
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.
1 2 |
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 |
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.