[R] Problem with tsboot

John Theal jtheal at free.fr
Thu Nov 22 19:13:22 CET 2007


I'm trying to bootstrap some regression coefficients so that I can  
estimate confidence intervals, but boot is not producing results.  Can
anybody suggest what I'm doing wrong here?

 > SpecPress <- ts(rnorm(501))
 > Returns <- ts(rnorm(501))
 > BootData <- data.frame(cbind(SpecPress, Returns))
 > boot.specpress <- function(data, indices, maxit=20){
+ 	data <- data[indices,]
+ 	mod <- dyn$lm(SpecPress~lag(Returns,-1)+lag(SpecPress,-1))
+ 	coefficients(mod)
+ }
 >
 > system.time(SpecPress.boot <- tsboot(BootData, boot.specpress,  
R=1000, maxit=100))
    user  system elapsed
  46.007   1.544  65.439
 >
 > SpecPress.boot

MODEL BASED BOOTSTRAP FOR TIME SERIES


Call:
tsboot(tseries = BootData, statistic = boot.specpress, R = 1000,
     maxit = 100)


Bootstrap Statistics :
        original  bias    std. error
t1*  0.04287253       0           0
t2*  0.05566368       0           0
t3* -0.02394464       0           0



More information about the R-help mailing list