data(schooldata)
school.x <- data.matrix(schooldata[,1:5])
school.y <- data.matrix(schooldata[,6:8])
## compute 95% efficient MM-estimates
MMres <- MMest_multireg(school.x,school.y)
## or using the formula interface
# \donttest{
MMres <- MMest_multireg(cbind(reading,mathematics,selfesteem)~., data=schooldata)
# }
## the MM-estimate of the regression coefficient matrix:
MMres$coefficients
## or alternatively
coef(MMres)
## Do plots
# \donttest{
n <- nrow(schooldata)
oldpar <- par(mfrow=c(2,1))
## the estimates can be considered as weighted least squares estimates with the
## following implicit weights
plot(1:n, MMres$weights)
## Sres$outFlag tells which points are outliers based on whether or not their
## robust distance exceeds the .975 chi-square cut-off:
plot(1:n, MMres$outFlag)
## (see also the diagnostic plot in plotDiag())
par(oldpar)
# }
Run the code above in your browser using DataLab