[R] boot with strata doubt
Ernesto Jardim
ernesto at ipimar.pt
Thu Sep 4 13:44:01 CEST 2003
Hi,
I'm using the boot package to bootstrap a linear model. The boot command
is:
> blm01 <- boot(mat, boot.fishpower, 1000, strata=boot.strata)
I'm having several problems with the linear model so I decided to check
the stratification. The first thing I did was checking the number of
observations by strata, in particular strata with only 1 observation:
> vec1 <- unlist(lapply(split(boot.strata, boot.strata), length))
> table(vec1)
vec1
1 2 3 4 5 6 7 8 10 11 12 13 15 21 23 43 56 60
19 3 11 5 4 2 1 1 3 2 1 2 1 2 1 1 1 2
So I have 19 strata with 1 observation. I decided to take a look at the
boot.array matrix to check how many observations where used in all
resamples, I was expecting at least 19.
> mat2 <- boot.array(blm01)
> vec2 <- apply(mat2,2,FUN=function(x){length(x[x=="1"])})
> vec2[vec2=="1000"]
numeric(0)
This tells me that no observation was used in all resamples.
I am getting something wrong ?
Regards
EJ
More information about the R-help
mailing list