predict.mpda | R Documentation |
Classify new data based on a trained mpda
model.
## S3 method for class 'mpda' predict(object, newdata = NULL, ...)
object |
A fitted |
newdata |
Matrix of predictor values. |
... |
Additional arguments to |
Based on the trained mpda
model, new data objects (rows of newdata
) are
classified, i.e. assigned to a level of the response factor. Remember that mpda
does not scale
the predictor matrix, make certain your
newdata
are treated identically to the predictor matrix used to train the mpda
model. If no newdata
are available, the training data in the mpda
object are used.
Notice: Only the largest dimension of each pairwise pda
model is used for prediction. When training
the mpda
you would normally use the regularization argument reg
and pdaDim
to
estimate the dimension for each pariwise model, see mpda
. Thus, different pairwise pda
are trained to their optimal dimensionality.
A list with two elements, Classifications
and Post.means
.
The vector Classifications
are the suggested factor level for each sample in newdata
.
The matrix Post.means
contains the posterior mean values for each factor level. For L factor levels,
each level is competing' against the other in (L-1) 'matches'. Each match results in posterior probabilities for the
two competing levels. The Post.mean
scores of level k is simply the average of these (L-1) posterior probabilities.
If a sample has a Post.means
value close to 1 for level k, it means this level is the clear winner in all
pairwise 'matches'.
Lars Snipen.
mpda
.
data(poems) y <- poems[,1] X <- as.matrix(poems[,-1]) mp.trn <- mpda(y, X, reg = 0.5, prior = c(1,1,1), max.dim = 3) lst <- predict(mp.trn) print(table(y, lst$Classifications))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.