Description Usage Arguments Value Author(s) References See Also Examples
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.
1 2 |
object |
an object of class MFAmix obtained with the function
|
data |
a data frame containing the description of the new observations
on all the variables. This data frame will be split into |
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. |
Returns the matrix of the scores of the new observations on the principal components or on the rotated principal components of MFAmix.
Marie Chavent marie.chavent@u-bordeaux.fr, Amaury Labenne.
Chavent M., Kuentz-Simonet V., Labenne A., Saracco J., Multivariate analysis of mixed data: The PCAmixdata R package, arXiv:1411.4911 [stat.CO].
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.