[R] outlier

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Jun 18 15:38:07 CEST 2003


Please do read the help page. which explains this is a random algorithm.
In your example you can try cov.rob(ap, cor=TRUE, nsamp="exact")


On Wed, 18 Jun 2003, kan Liu wrote:

> I wrote a .R file (see below)to calculate robust
> measure of correlation using cov.rob. I got different
> correlation coefficients (0.70, 0.79, 0.63, ...) when
> I run the file different times. Can you tell me what
> this means or what is wrong in using cov.rob?
> -------------
>
> library(lqs)
> a <-
> c(5.41,4.67,5.88,2.38,4.79,5.30,1.94,3.40,5.05,3.31,5.88,4.92,5.08,4.58,4.59,4.77,5.25,3.77,2.88,5.30,5.32,2.56,4.29,5.54,4.53,3.51,4.93,2.49,2.85,5.04,2.51,2.60,3.58,2.11,1.70,5.20,5.08,4.48,3.96,4.87,4.98,2.56,1.69,4.28,1.70,2.91,5.37,2.16,3.04,1.69,1.88,5.36,1.70,3.81,1.70,5.88,3.52)
> p <-
> c(5.30,4.78,4.79,0.62,4.32,2.33,0.64,3.14,3.06,4.73,5.72,2.21,4.81,1.74,4.93,4.74,5.81,3.88,3.03,4.72,5.79,3.43,4.07,5.93,2.26,3.70,5.32,4.56,1.52,2.54,0.26,2.79,3.67,4.44,1.46,4.26,4.49,5.29,3.26,3.87,3.12,3.97,3.49,0.45,0.76,4.49,5.29,1.94,4.69,2.80,2.75,5.16,0.74,5.81,1.46,5.24,4.00)
> ap <- cbind(a,p)
> cov.rob(ap, cor=TRUE)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list