data(ais, package="sn") ##Australian Institute of Sport data set
attach(ais)
##It is considered a bivariate regression model
##with Hg and SSF as response variables and
##Hc, Fe, Bfat and LBM as covariates
y<-cbind(Hg,SSF)
n<-nrow(y); m<-ncol(y)
X.aux=model.matrix(~Hc+Fe+Bfat+LBM)
p<-ncol(X.aux)
X<-array(0,dim=c(2*p,m,n))
for(i in 1:n) {
X[1:p,1,i]=X.aux[i,,drop=FALSE]
X[p+1:p,2,i]=X.aux[i,,drop=FALSE]
}
##See the covariate matrix X
##X
# \donttest{
fit.MN=estimate.MN(y, X) #Fit the MN distribution
res.MN=distMahal(fit.MN) #Compute the Mahalanobis distances
plot(res.MN) #Plot the Mahalanobis distances
#
fit.MSN=estimate.MSN(y, X) #Fit the MSN distribution
res.MSN=distMahal(fit.MSN) #Compute the Mahalanobis distances
plot(res.MSN) #Plot the Mahalanobis distances
# }
Run the code above in your browser using DataLab