I am new to R and trying to calculate the standard deviation with bootstrapping (sd) and the associated standard error in 30 scan windows. The function below performs the corresponding rolling window if I just want sd. But when I add the bootstrap function using the boot package, I get the error below. I understand that I am trying to save the results of the bootstrap into a vector that does not fit the size. Does anyone have any tips on how to store only the boot sd and related stderror for each window in the rows of the new matrix? The goal is then to build sd and the corresponding 95% confidence intervals for each window over time. Thanks in advance for any help.
> head(data.srs) LOGFISH 1 0.8274083 2 1.0853433 3 0.8049845 4 0.8912097 5 1.3514569 6 0.8694499 run rolling window function. ex. rollWin(data, windowlength) a.temp<-rollWin(data.srs,30) > warnings() Warning messages: 1: In out[i] <- boot(data[i:(i + windowLength - 1), ], sd.fun, ... : number of items to replace is not a multiple of replacement length
source share