[R] robust correlation

Chuck Cleland ccleland at optonline.net
Sat Apr 21 14:37:52 CEST 2007


Soare Marcian-Alin wrote:
> Hello,
> 
> How do I calculate a robust correlation in R?
> I want to compare it to the pearson method.
> 
> library(mvoutlier)
> data(chorizon)
> cor(log10(chorizon$Al), log10(chorizon$Na), method=c("pearson"))

  How about covRob() in the robust package?

covRob(log10(chorizon[,c("Al","Na")]), corr=TRUE, estim="mcd", quan =
.75, ntrial=1000)

Call:
covRob(data = log10(chorizon[, c("Al", "Na")]), corr = TRUE,
    estim = "mcd", quan = 0.75, ntrial = 1000)

Robust Estimate of Correlation:
          Al        Na
Al 1.0000000 0.1929950
Na 0.1929950 1.0000000

Robust Estimate of Location:
      Al       Na
3.940185 2.185384

> KR,
> Alin Soare
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list