Classify matrix variate observations in conjunction with
object of class
array or list of new observations to be classified.
If newdata is missing, an attempt will be made to retrieve the
data used to fit the
The prior probabilities of the classes, by default the
proportions in the training set or what was set in the call to
arguments based from or to other methods
This function is a method for the generic function
matrixqda". It can be invoked by calling
x of the appropriate class.
Returns a list containing the following components:
The MAP classification (a factor)
posterior probabilities for the classes
1 2 3 4 5 6 7 8 9 10
set.seed(20180221) # construct two populations of 3x4 random matrices with different means A <- rmatrixnorm(30, mean = matrix(0, nrow = 3, ncol = 4)) B <- rmatrixnorm(30, mean = matrix(1, nrow = 3, ncol = 4)) C <- array(c(A, B), dim = c(3, 4, 60)) # combine together groups <- c(rep(1, 30), rep(2, 30)) # define groups prior <- c(.5, .5) # set prior D <- matrixqda(C, groups, prior) # fit model predict(D)$posterior[1:10, ] # predict, show results of first 10 ## S3 method for class "matrixqda"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.