[R] Re:Chi-square distance

Tobias Verbeke tobias.verbeke at telenet.be
Tue Jan 11 13:52:19 CET 2005


>----- Oorspronkelijk bericht -----
>Van: paolacerchiello at libero.it [mailto:paolacerchiello at libero.it]
>Verzonden: dinsdag, januari 11, 2005 12:10 PM


>> I'm Ph.D student and I need an R code to compute the chi square diistance between n profile rows in a matrix.

There is a ready-made function dudi.dist in package ade4.
This function needs an object of class "dudi", so (in your
case) you need to do a correspondence analysis on your matrix.
This will define the metrics on the row and column 
spaces the way you want. The function dudi.coa only accepts
data frames as its first argument.

install.packages(ade4)
library(ade4)
mydf <- as.data.frame(mymat)
mydf.coa <- dudi.coa(mydf, scannf = FALSE, nf = 2)
dudi.dist(mydf.coa, amongrow = TRUE)

should give you the chi square distances between
row profiles.

HTH,
Tobias

>> 
>> could you help me please?
>> Thanks
>> 
>> Paola
>> 
>
>
>
>
>____________________________________________________________
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>




More information about the R-help mailing list