I found in the matlab examples a way to use mean and sd for bootstrapping:

rng default  % For reproducibility
y = exprnd(5,100,1);
stats = bootstrp(100,@(x)[mean(x) std(x)],y);

Is there a way to add autocorrelation to this function? If yes, how would you do it?

Practically I have the mean, the SD and the ACF of my sample. I'm trying to find a way to create samples that respect these three numbers, assuming that the autocorrelation is stable. I am open to alternative suggestions besides bootstrapping.

  • $\begingroup$ I am sorry but I cannot understand what you want to do. Can you please clarify what you mean by "the autocorrelation is stable"? Is your sample a time-series of some kind? Do you have multiple longitudinal data? Simply bootstrapping a sample would probably obliterate any autocorrelation structure it might have. Maybe you want to consider "blocked bootstrap" but I am not certain even for that. $\endgroup$ – usεr11852 Jan 19 '15 at 23:02
  • $\begingroup$ The original data is a sequence of speed and bearings (North South angles) change over time- so yes it is time series indeed. What I'm trying to do is to recreate these two sequences with different values, keeping the mean, SD and the average acf coef in tact (given some SE variation). Truth is that moving block bootstrap for the speed and circular moving block bootstrap for the angle should be exactly what I'm looking for by definition, but I cannot get my head around how to insert the acf coef in the code so far-have you seen any examples perhaps? $\endgroup$ – C.Colden Jan 20 '15 at 13:36
  • $\begingroup$ I have not seen code examples. I have seen the references you need though. :D In particular you want to check this paper by Concalves and Politis. They make a short review of available "block bootstrap" methods and then finally discuss "block-free" methods (such as the Dependent Wild Boostrap - awesome name, I would reference it just so I could write "just sample wild" and then cite them). $\endgroup$ – usεr11852 Jan 20 '15 at 16:33
  • $\begingroup$ Thanks a lot usεr11852! I'm aware of the paper, not of the cool named algorithm though - I'll go through it. A small update from my side, I've found this lecture in R quite helpful for running the moving block - stat.cmu.edu/~cshalizi/uADA/12/lectures/time-series.R - relatively easily transferable in matlab - the reasoning is the same. Still haven't found any helpful circular implementation yet. $\endgroup$ – C.Colden Jan 21 '15 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.