[R] non-overlapping blocks bootstrap?
Martin Ivanov
tramni at abv.bg
Wed Feb 6 09:22:26 CET 2013
Dear Rafael,
Thank You very much for Your reply.
I need to use non-overlapping blocks and such that each block ends with an element having an index multiple of 3 in the original series.
For example if I have the numbers: 1 2 3 4 5 6 7 8 9, the samples I could take are:
123 456 789, 456 789 123, 789 123 456, 789 456 123, 456 123 789 and 123 789 456.
As You see, the blocks must contain consecutive elements from the original sample.
The reason why I need exactly that resampling is that my data are monthly and are stratified by season. So in effect my time series looks like this,
e.g. for the summer:
1 2 3 4 5 6 7 8 9 10 11 12 ... : the indices in the data
J J A J J A J J A J J A .... : the months
1989 1990 1991 1992 .... : the years
and so on. So the block size of 3 is naturally determined by the nature of my data. I assume the interannual correlations are negligible compared to the intraseasonal ones and neglect the former.
Best regards,
Martin
>-------- Оригинално писмо --------
>От: Rafael Robledo
>Относно: Re: [R] non-overlapping blocks bootstrap?
>До: Martin Ivanov
>Изпратено на: Вторник, 2013, Февруари 5 23:57:52 EET
>
>
>If you only need to take blocks of a defined size from a time series,
>you may use sample function (which default behavior is to sample
>without replace).
>
>For example:
>
>tt <- 1:24
>ss <- sample(tt, replace=F)
>
>bs <- 3
>nb <- length(tt) / bs
>
>res <- split(ss, rep(1:nb, each=bs))
>
>Hope this helps,
>
>
>On Tue, Feb 5, 2013 at 8:28 AM, Martin Ivanov wrote:
>> Dear R users,
>>
>> I need to perform a block bootstrap to a time series. The block size must be 3 and the blocks must NOT overlap.
>> I found a number of functions for bootstrap in R (tsboot, tsbootstrap in tseries, and LocSig in SpatialVx), but neither of them seems to implement non-overlapping blocks. Is there a way to perform a bootstrap with non-overlapping fixed-size blocks in R?
>>
>> Best regards,
>>
>> Martin
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>--
>Rafael Robledo J.
>
>On Tue, Feb 5, 2013 at 8:28 AM, Martin Ivanov wrote:
>> Dear R users,
>>
>> I need to perform a block bootstrap to a time series. The block size must be 3 and the blocks must NOT overlap.
>> I found a number of functions for bootstrap in R (tsboot, tsbootstrap in tseries, and LocSig in SpatialVx), but neither of them seems to implement non-overlapping blocks. Is there a way to perform a bootstrap with non-overlapping fixed-size blocks in R?
>>
>> Best regards,
>>
>> Martin
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>--
>Rafael R.
>
More information about the R-help
mailing list