[R] stratified bootstrap with boot

Richard Chandler rchandler at forwild.umass.edu
Wed May 4 17:16:11 CEST 2005


Hello,

I am new to R, and am having trouble getting the output I want from a
stratified bootstrap. I didn't recieve a reply the first time I posted
this question so I have tried to make it more clear. My data frame
(denboot) is set up as follows:

        SITE cswa parea treat
1      BeanA    3  1.20     m
2     BeanBC    3  1.05     m
3      BeanD    1  0.93     m
4     BlackB    1  1.01     m
5     Brooks    3  4.00     b
6      BullL    3  1.32     b
7      BullM    1  0.20     m
8      BullU    4  2.06     b
...

#Here is my code:

cswafun <- function(denboot, i) sum(cswa[i])/(sum(parea[i])
attach(denboot)
cswa.boot <- boot(denboot, cswafun, R = 10000, strata = treat)

#Here is the output

Call:
boot(data = denboot, statistic = cswafun, R = 10000, strata = treat)


Bootstrap Statistics :
    original     bias    std. error
t1* 1.109612 0.02641786   0.2032927

#Can anyone tell me why I'm not getting two estimates of
sum(cswa)/sum(parea), one for each #strata ('b' and 'm')? Any help
would be appreciated. Thanks

Richard

-- 
Richard Chandler, M.S. candidate
Department of Natural Resources Conservation
UMass Amherst
(413)545-1237




More information about the R-help mailing list