[R] bootstrapped correlation confint lower than -1 ?
Liviu Andronic
landronimirc at gmail.com
Sun Aug 16 12:22:29 CEST 2009
Dear R users,
Does the results below make any sense? Can the the interval of the
correlation coefficient be between *-1.0185* and -0.8265 at 95%
confidence level?
Liviu
> library(boot)
> data(mtcars)
> with(mtcars, cor.test(mpg, wt, met="spearman"))
Spearman's rank correlation rho
data: mpg and wt
S = 10292, p-value = 1.488e-11
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
-0.88642
Warning message:
In cor.test.default(mpg, wt, met = "spearman") :
Cannot compute exact p-values with ties
> corr.fun <- function(data, indices) {
+ data.samp <- data[indices,] # allows boot to select sample
+ tmp.corr <- with(data.samp, cor.test(mpg, wt, met="spearman"))
+ return(tmp.corr$estimate)
+ }
> corr.boot <- boot(mtcars, corr.fun, R=1000)
There were 50 or more warnings (use warnings() to see the first 50)
> corr.boot
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = mtcars, statistic = corr.fun, R = 1000)
Bootstrap Statistics :
original bias std. error
t1* -0.88642 0.012992 0.050042
> boot.ci(corr.boot, type="basic")
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates
CALL :
boot.ci(boot.out = corr.boot, type = "basic")
Intervals :
Level Basic
95% (-1.0185, -0.8265 )
Calculations and Intervals on Original Scale
--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
More information about the R-help
mailing list