[R] Using function 'boot on a bi-polar sample'
Briggs, Meredith M
Meredith.Briggs at team.telstra.com
Tue May 10 06:44:59 CEST 2005
Hello
I'm not sure I'm using boot correctly:
I have a list of values for a variable in BUCKET[, j]
I want to use function 'boot' to estimate a confidence interval on the mean of the non-zero data. The data can be bi-polar or skewed.
Is this the correct use of boot to establish a mean and standard deviation or median and percentiles?
x<-BUCKET[, j]
mean.fun<-function(x,i) {mean(x[x>0])}
median.fun<-function(x,i) {median(x[x>0])}
print(mean.fun(x))
print(median.fun(x))
B.mean<-boot(x,mean.fun,R=999)
B.median<-boot(x,mean.fun,R=999)
print(B.mean)
print(B.median)
I need the 'boot' function to sample repeatedly from the density distribution of the raw data and calculate means, medians etc.
How do I pull out the mean, median, deviations and percentiles into variables within R?
thanks
Meredith
More information about the R-help
mailing list