[R] how to test robustness of correlation
Berton Gunter
gunter.berton at gene.com
Thu Jan 26 18:32:59 CET 2006
Gabor:
Contrary to popular belief, rank-based procedures are **not** resistant.
Example:
> x<-c(1:10,100);y<-c(1:10+rnorm(10,sd=.25),-100)
> cor(x,y)
[1] -0.9816899 ## awful
> cor(x,y,method='spearman')
[1] 0.5 ## better
> require(MASS)
Loading required package: MASS
[1] TRUE
> cov.rob(cbind(x,y),cor=TRUE)
## ... bunch of output omitted
$cor
x y
x 1.0000000 0.9977734 ## best
y 0.9977734 1.0000000
## Look at the plot to see.
-- Bert
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor
> Grothendieck
> Sent: Thursday, January 26, 2006 9:05 AM
> To: yang.x.qiu at gsk.com
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] how to test robustness of correlation
>
> The cor function can do spearman correlation using
> method = "spearman" .
>
> On 1/25/06, yang.x.qiu at gsk.com <yang.x.qiu at gsk.com> wrote:
> > Hi, there:
> >
> > As you all know, correlation is not a very robust
> procedure. Sometimes
> > correlation could be driven by a few outliers. There are a
> few ways to
> > improve the robustness of correlation (pearson
> correlation), either by
> > outlier removal procedure, or resampling technique.
> >
> > I am wondering if there is any R package or R code that
> have incorporated
> > outlier removal or resampling procedure in calculating correlation
> > coefficient.
> >
> > Your help is greatly appreciated.
> >
> > Thanks.
> > Yang
> >
> > Yang Qiu
> > Integrated Data Analysis
> > Cheminformatics at RTP
> > GlaxoSmithKline
> > [[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
> >
>
> ______________________________________________
> 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