[R] A possible too old question on significant test of correlationmatrix

Guo Wei-Wei wwguocn at gmail.com
Mon Jul 10 10:49:03 CEST 2006


Thank you, Dimitris.

The function rcor.test() is very nice. It can pass arguments to cor()
and solve my first problem of pairwised case deletion.

Best regards,
Wei-Wei


2006/7/10, Dimitris Rizopoulos <dimitris.rizopoulos at med.kuleuven.be>:
> you can use function rcor.test() from package 'ltm', e.g.,
>
> help(rcor.test, package = "ltm")
> ###
> library(ltm)
>
> dat <- data.frame(matrix(rnorm(1000), 100, 10))
>
> rcor.test(dat)
> rcor.test(dat, method = "kendall")
> rcor.test(dat, method = "spearman")
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
> ----
> Dimitris Rizopoulos
> Ph.D. Student
> Biostatistical Centre
> School of Public Health
> Catholic University of Leuven
>
> Address: Kapucijnenvoer 35, Leuven, Belgium
> Tel: +32/(0)16/336899
> Fax: +32/(0)16/337015
> Web: http://med.kuleuven.be/biostat/
>      http://www.student.kuleuven.be/~m0390867/dimitris.htm
>
>
>
> ----- Original Message -----
> From: "Guo Wei-Wei" <wwguocn at gmail.com>
> To: <r-help at stat.math.ethz.ch>
> Sent: Monday, July 10, 2006 7:27 AM
> Subject: [R] A possible too old question on significant test of
> correlationmatrix
>
>
> > Dear all,
> >
> > I'm working on a data.frame named en.data, which has n cases and m
> > columns.
> > I generate the correlation matrix of en.data by
> >
> >> cor(en.data)
> >
> > I find that there is no p-value on each correlation in the
> > correlation
> > matrix. I searched in the R-help mail list and found some related
> > posts, but I didn't find direct way to solve the problem. Someone
> > said
> > to use cor.test() or t.test(). The problem is that cor.test() and
> > t.test() can only apply on two vectors, not on a data.frame or a
> > matrix.
> >
> > My solution is
> >
> > for (i in 1:(ncol(en.data) -1)) {
> >   cor.test(en.data[,i], en.data[, i+1])
> > }
> >
> > I think it is a stupid way. Is there a direct way to do so? After
> > all,
> > it is a basic function to generate significant level of a
> > correlation
> > in a correlation matrix.
> >
> > Thank you in advance!
> > Wei-Wei
> >
> > ______________________________________________
> > 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
> >
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>



More information about the R-help mailing list