predict.MFAmix: Prediction of new scores in MFAmix

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function performs the scores of new observations on the principal components of MFAmix. In other words, this function is projecting the new observations onto the principal components of MFAmix obtained previoulsy on a separated dataset. Note that the new observations must be described with the same variables than those used in MFAmix. The groups of variables must also be identical.

Usage

1
2
## S3 method for class 'MFAmix'
predict(object, data, rename.level = FALSE, ...)

Arguments

object

an object of class MFAmix obtained with the function MFAmix.

data

a data frame containing the description of the new observations on all the variables. This data frame will be split into G groups according to the vector groups.

rename.level

boolean, if TRUE all the levels of the qualitative variables are renamed as follows: "variable_name=level_name". This prevents to have identical names for the levels.

...

urther arguments passed to or from other methods. They are ignored in this function.

Value

Returns the matrix of the scores of the new observations on the principal components or on the rotated principal components of MFAmix.

Author(s)

Marie Chavent marie.chavent@u-bordeaux.fr, Amaury Labenne.

References

Chavent M., Kuentz-Simonet V., Labenne A., Saracco J., Multivariate analysis of mixed data: The PCAmixdata R package, arXiv:1411.4911 [stat.CO].

See Also

MFAmix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(gironde)
class.var<-c(rep(1,9),rep(2,5),rep(3,9),rep(4,4))
names<-c("employment","housing","services","environment")
dat<-cbind(gironde$employment,gironde$housing,
           gironde$services,gironde$environment)
n <- nrow(dat)
set.seed(10)
sub <- sample(1:n,520)

res<-MFAmix(data=dat[sub,],groups=class.var,
            name.groups=names, rename.level=TRUE, 
            ndim=3,graph=FALSE)

#Predict scores of new data
pred<-predict(res,data=dat[-sub,])
plot(res,choice="ind",cex=0.6,lim.cos2.plot=0.7)  
points(pred[1:5,c(1,2)],col=2,pch=16,cex=0.6)
text(pred[1:5,c(1,2)], labels = rownames(dat[-sub,])[1:5],
     col=2,pos=3,cex=0.6)

Example output



PCAmixdata documentation built on May 2, 2019, 12:38 p.m.