Plot Mahalanobis distance for a fitted smn.lmm or smsn.lmm
Plot Mahalanobis distance for a fitted smn.lmm or smsn.lmm
Plot method for objects of class "mahalDist". For the total Mahalanobis distance, it gives a quantile for outlier detection, based on the Mahalanobis distance theoretical distribution.
## S3 method for class 'mahalDist'plot(x, fitobject, type, level =0.99, nlabels =3,...)
Arguments
x: An object inheriting from class mahalDist, representing the Mahalanobis distance from a fitted scale mixture of (skew) normal linear mixed model.
fitobject: Optional. An object inheriting from class SMN or SMSN, representing the fitted scale mixture of (skew) normal linear mixed model that was used for calculating the Mahalanobis distance.
type: Optional. Either "total" (default), for the standard Mahalanobis distance, "error", for the error term of the decomposition, or "b" for the random effect term of the decomposition. For details see mahalDist.
level: An optional numeric value in (0,1) indicating the level of the quantile. It only has utility if type="total". Default is 0.99.
nlabels: Number of observations that should be labeled. Default is 3.
...: Additional arguments.
Returns
A ggplot object, plotting the index versus the Mahalanobis distance, if all subject have the same number of observations; or plotting the number of observations per subject versus the Mahalanobis, otherwise.
Author(s)
Fernanda L. Schumacher, Larissa A. Matos and Victor H. Lachos
See Also
ggplot , mahalDist , smn.lmm , smsn.lmm
Examples
fm1 = smn.lmm(distance ~ age+Sex, data=nlme::Orthodont, groupVar="Subject")plot(mahalDist(fm1), nlabels=2)#the estimated quantile is stored at the attribute "info" of the plot objectplotMD = plot(mahalDist(fm1))attr(plotMD,"info")