[R] robust method to obtain a correlation coeff?
John Kane
jrkrideau at yahoo.ca
Mon Aug 24 19:01:56 CEST 2009
I may be misunderstanding the question but would
cor(d1, use='complete.obs') or some other variant of "use" help?
--- On Mon, 8/24/09, Christian Meesters <meesters at imbie.uni-bonn.de> wrote:
> From: Christian Meesters <meesters at imbie.uni-bonn.de>
> Subject: [R] robust method to obtain a correlation coeff?
> To: "r-help at r-project.org Help" <r-help at r-project.org>
> Received: Monday, August 24, 2009, 10:47 AM
> Hi,
>
> Being a R-newbie I am wondering how to calculate a
> correlation
> coefficient (preferably with an associated p-value) for
> data like:
>
> > d[,1]
> [1] 25.5 25.3 25.1 NA 23.3 21.5 23.8 23.2
> 24.2 22.7 27.6 24.2 ...
> > d[,2]
> [1] 0.0 11.1 0.0 NA 0.0
> 10.1 10.6 9.5 0.0 57.9 0.0 0.0
> ...
>
> Apparently corr(d) from the boot-library fails with NAs in
> the data,
> also cor.test cannot cope with a different number of NAs.
> Is there a
> solution to this problem (calculating a correlation
> coefficient and
> ignoring different number of NAs), e.g. Pearson's corr
> coeff?
>
> If so, please point me to the relevant piece of
> documentation.
>
> TIA
> Christian
>
> ______________________________________________
> R-help at r-project.org
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>
__________________________________________________________________
Be smarter than spam. See how smart SpamGuard is
ons in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca
More information about the R-help
mailing list