library("FRB") ################################################### # Example 1: Robust principal components analysis ################################################### data("ForgedBankNotes") res <- FRBpcaMM(ForgedBankNotes, R=999, conf=0.95) # or using formula res <- FRBpcaMM(~.,data=ForgedBankNotes, R=999, conf=0.95) # extended output summary(res) # Choose type of bootstrap confidence intervals summary(res,confmethod="basic") # graphical output plot(res) # select type of graph explicitly plotFRBvars(res) plotFRBangles(res) plotFRBloadings(res) # Choose type of bootstrap confidence intervals plot(res,confmethod="basic") # Outlier detection and identification diagplot(res) ################################################### # Example 2: One-sample Hotelling test ################################################### data("ForgedBankNotes") samplemean <- apply(ForgedBankNotes, 2, mean) res <- FRBhotellingMM(ForgedBankNotes, mu0=samplemean) # or using formula res <- FRBhotellingMM(cbind(Length,Left,Right,Bottom,Top,Diagonal)~1, data=ForgedBankNotes,mu0=samplemean) # extended output summary(res) # graphical output plot(res) # Outlier detection and identification diagplot(res) ################################################### # Example 3: Two-sample Hotelling test ################################################### data("hemophilia") grp <-as.factor(hemophilia[,3]) x <- hemophilia[which(grp==levels(grp)[1]),1:2] y <- hemophilia[which(grp==levels(grp)[2]),1:2] res <- FRBhotellingMM(x,y) # or shorter using formula res <- FRBhotellingMM(cbind(AHFactivity,AHFantigen)~gr, data=hemophilia) # numerical output res # graphical output plot(res) # Outlier detection and identification diagplot(res) ################################################### # Example 4: Multivariate linear regression ################################################### data("schooldata") school.x <- data.matrix(schooldata[,1:5]) school.y <- data.matrix(schooldata[,6:8]) res <- FRBmultiregMM(school.x, school.y, R=999, conf = 0.95) # or shorter using formula res <- FRBmultiregMM(cbind(reading,mathematics,selfesteem)~., data=schooldata, R=999, conf = 0.95) # extended output summary(res) # graphical output plot(res, expl=2:6) # Choose type of bootstrap confidence intervals plot(res,expl=2:4,confmethod="basic") # Outlier detection and identification diagplot(res) # Outlier detection and identification directly based on point estimates res <- MMest_multireg(cbind(reading,mathematics,selfesteem)~., data=schooldata) diagplot(res)