predict.mvgls.dfa: Predictions from Discriminant analysis conducted with a mvgls...

View source: R/mvgls.dfa.r

predict.mvgls.dfaR Documentation

Predictions from Discriminant analysis conducted with a mvgls model fit

Description

Returns the prediction(s) of DFA of class 'mvgls.dfa'.

Usage


## S3 method for class 'mvgls.dfa'
predict(object, newdata, prior, ...)

Arguments

object

an object of class 'mvgls' obtained from a mvgls or mvols fit.

newdata

a matrix with new observation(s) for the response variables. Note: the predictions are performed on fitted values if "newdata" is not provided.

prior

the group priors. If not provided, assumes equal prior.

...

further arguments for this generic function. If tree is provided (with tip name(s) matching rownames in newdata and in the training sample (model fit)), then the best unbiased linear prediction (BLUP) for the model is returned. Otherwise the GLS coefficients are used to predict "newdata", in this condition classification might be less optimal than performing a regular DFA (see lda from MASS or mvgls.dfa on a mvols fit).

Value

class

The class assigned to each new observations

posterior

The posterior probabilities used to classify each new observations

prior

The prior used to classify each new observations to each categories

Author(s)

J. Clavel

References

Duhamel A. et al. in prep.

See Also

mvgls.dfa predict.mvgls fitted.mvgls vcov.mvgls residuals.mvgls coef.mvgls mvgls mvols

Examples


library(mvMORPH)
n=64
p=4

tree <- pbtree(n=n)
sigma <- crossprod(matrix(runif(p*p),p,p))
resid <- mvSIM(tree, model="BM1", param=list(sigma=sigma))
Y <- rep(c(0,1.5), each=n/2) + resid
grp <- as.factor(rep(c("gp1","gp2"),each=n/2))
names(grp) = rownames(Y)
data <- list(Y=Y, grp=grp)
mod <- mvgls(Y~grp, data=data, tree=tree, model="BM")

# fda
da1 <- mvgls.dfa(mod)



mvMORPH documentation built on March 31, 2023, 6:25 p.m.