[R] testing significance of axis loadings from multivariate dudi.mix

Mark Difford mark_difford at yahoo.co.uk
Sun Nov 6 10:33:21 CET 2011


On Nov 05, 2011 at 11:01pm Francisco Mora Ardila wrote:

> But a problem arised with the predict function: it doesn´t seem to work
> with an object 
> from dudi.mix and I dont understand why.

Francisco,

There is no predict() method for dudi.mix() or for any of the dudi objects
in ade4. I don't see why you can't get around this by doing something like
the following, but you need to take account of any scaling/centring that you
might do to your data before calling dudi.mix().

## Does a dudi.mix on continuous data, so really equals a
dudi.pca/princomp/PCA
library(ade4)
data(deug)
deug.dudi <- dudi.mix(deug$tab, scann=F, nf=2)
tt <- as.matrix(deug.dudi$tab) %*% as.matrix(deug.dudi$c1)  ## see note
below
qqplot(deug.dudi$li[,1], tt[,1])
qqplot(deug.dudi$li[,2], tt[,2])

deug.princ <- princomp(deug$tab, cor=T)
qqplot(predict(deug.princ)[,1], tt[,1])

## scaling not accounted for:
deug.princ <- princomp(deug$tab, cor=F)
qqplot(predict(deug.princ)[,1], tt[,1])

rm(tt, deug.dudi, deug.princ)

Note that in the code given above, "as.matrix(deug.dudi$tab) %*%
as.matrix(deug.dudi$c1)" is based on how stats:::predict.princomp does it.

Regards, Mark.




-----
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
--
View this message in context: http://r.789695.n4.nabble.com/testing-significance-of-axis-loadings-from-multivariate-dudi-mix-tp3994281p3995350.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list