Re: [R] Problem with Stationary Bootstrap

2012-11-29 Thread Rui Barradas
c(rep(NA,d),u)[1:n] } u1<-myu(u) modelu<-lm(u~u1-1) Rho<-coef(modelu) if(abs(Rho)>1) break diff<-abs(Rho-rho) if(diff<0.1) break else rho<-Rho } return(coef(Model)) } result <- boot::tsboot(A, statistic=fun, R = 1000, l=nrow(a),sim = "geom", orig.t = TRUE) resu

Re: [R] Problem with Stationary Bootstrap

2012-09-17 Thread Hock Ann Lim
Dear Rui Barrada,   Thank you so much for your kind sharing. It's really help.   Regards, Lim Hock Ann From: Rui Barradas Cc: R-Help Sent: Tuesday, September 18, 2012 12:03 AM Subject: Re: [R] Problem with Stationary Bootstrap Hello, The probl

Re: [R] Problem with Stationary Bootstrap

2012-09-17 Thread Rui Barradas
Hello, The problem is your function calling itself until there's no more stack memory left. Besides, your function doesn't make any sense. You pass an argument 'fit' then do not used it but change it's value then return itself. Corrected: set.seed(1) X <- runif(10, 0, 10) Y <- 2 + 3*X a <- data

[R] Problem with Stationary Bootstrap

2012-09-17 Thread Hock Ann Lim
Dear R experts,   I'm running the following stationary bootstrap programming to find the parameters estimate of a linear model:     X<-runif(10,0,10) Y<-2+3*X a<-data.frame(X,Y) coef<-function(fit){   fit <- lm(Y~X,data=a)    return(coef(fit)) }  result<- tsboot(a,statistic=coef(fit),R = 10,n.sim