mpda | R Documentation |
A multi-level classification method that fits one pda
-model to
every pair of factor levels.
mpda( y, X, reg = 0.5, prior = NULL, selected = NULL, max.dim = NULL, n.seg = 10, verbose = TRUE )
y |
Vector of responses, must be a factor with 3 or more levels. |
X |
Numeric matrix of predictor values. |
reg |
The regularization parameter used by |
prior |
Vector of prior probabilities, one value for each factor level in |
selected |
Matrix of logicals, indicating selected predictor variables, see below. |
max.dim |
Integer, the maximum number of dimensions to consider in PLS. |
n.seg |
Integer, the number of cross-validation segments in |
verbose |
Logical, turns on/off output during computations. |
A multi-level problem means the response y
is a factor with at least 3 levels, i.e.
there are at least 3 distinct class labels (texts, integers, etc) in y
. If you have a 2-level problem,
use pda
.
For each pair of factor levels, a pda
model is fitted, using the subset of elements in y
containing these two levels, and the corresponding rows of X
as predictors. If there are L factor levels,
there are N=L*(L-1)/2 such model-pairs.
If the argument reg
is positive (between 0 and 1) it means the pdaDim
function is used
to estimate the dimensionality of each model. See pdaDim
for details on this. If reg
is
negative, all models will be fitted with max.dim
dimensions.
The argument prior
, if specified, indicates the prior probability of each factor level. There must be one value for
each factor level, and in the exact same order as the factor levels. By default, all factor levels have equal prior.
The matrix selected
is used to indicate variable selection. For each pair of factor levels, a pda
model is fitted, and only a selection of the predictor variables (columns) in X
may be used. In row k of
selected
is a logical vector, one TRUE/FALSE
value for each column in X
. The TRUE
elements
indicate which columns of X
to use (X[,which(selected[k,])]
). PLEASE NOTE: The rows of selected
must be ordered according to the factor level pairs:
Row 1: Factor level 1 versus 2
Row 2: Factor level 1 versus 3
...<all unique pairs of ordered levels>...
Row N: Factor level (L-1) versus L
An mpda
object, which is a list of the pairwise pda
objects. In addition,
the mpda
object has two attributes: A copy of the full predictor matrix X
(attr(mpda.obj,"X")
)and the factor levels of y
(attr(mpda.obj,"Levels")
).
Lars Snipen.
predict.mpda
, pdaDim
.
data(poems) y <- poems[,1] X <- as.matrix(poems[,-1]) mp.trn <- mpda(y, X, prior = c(1,1,1), max.dim = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.