hi: my guess is that no one is answering because it's too hard to follow
your code
because it contains so many indices and variables and is without comments.

I don't know where you got that info  about the distribution of the
coefficient when doing the ADF test but if you could write the code more
clearly and give a reference to your statement, then maybe somebody could
help you. Also, I think the question is more relevant for the R-Sig-Finance
list.

Finally, Bernhard Pfaff's urca package ( assuming it's still called the
urca package )
has examples of ADF testing. Why don't you take an example from there
because
the code will be clearer for others to follow and reproduce. Good luck.

















On Mon, Sep 9, 2013 at 3:41 AM, Jose Narillos de Santos <
narillosdesantos@gmail.com> wrote:

> Can anyone help me to see why maximum t-stat quantile has no Negative
> values?
>
> ¿It is posible lm estimation is not fine?
>
>
>
> ---------- Forwarded message ----------
> From: Jose Narillos de Santos <narillosdesantos@gmail.com>
> Date: 2013/9/8
> Subject: ADF test
> To: r-help <r-help@r-project.org>
>
>
> Hi all,
>
> I try to simulate an ADF test rolling on a window.
>
> The thing is that it seems I´m doing well...applying to al AR(1) model with
> unit root.
>
> I see in some econometrical papers that the t-stat maximum and minimum
> should have negative values on the quantiles 0,01 to 0,03
>  and in my case only the minimum are negative values.
>
> ¿It is posible I´m doing wrong calculus on lm?
>
> I m getting mad
>
>
> Ob <- 100
> Re <- 50
>
>
> H2<-matrix(0,Ob,Re)
>
>  for (j in 1:Re){
>
> for (i in 2:Ob){
>
>
> H2[i, j] <-1+ 1*H2[i-1, j]+rnorm(1)
>
> }
> }
>
> H3<-matrix(0,Ob,Re)
>
>
> for (i in 2:Ob){
> for (j in 1:Re){
>
> H3[i,j]<-H2[i,j]-H2[i-1,j]
>
> }}
>
> a3<-H3[2:nrow(H3),1:ncol(H3)]
> a2<-H2[1:(nrow(H2)-1),1:ncol(H2)]
>
> write.csv(a3,"a3.csv")
> write.csv(a2,"a2.csv")
>
> a3<-read.csv("a3.csv")
> a2<-read.csv("a2.csv")
>
> delta<-round(Ob*(1/3))
>
> fg<-matrix(0,nrow(H3)-delta+1,Re)
>   for (j in 1:Re){
>
> for (i in delta:nrow(H3) ){
>
>
>
>     z2<-(i-delta+1)
>     z3<-i
>
>     fg[i-delta+1,j]<-coef(summary(lm(a3[z2:z3,j+1]~(1+a2[z2:z3,j+1])  )
> ))[2,"t value"]
>     print(j)
>
>   }
> }
>
> MaxrollingT<-apply(fg, 1, max)
> MinrollingT<-apply(fg, 1, min)
> Diffrolling<-MaxrollingT-MinrollingT
>
>
> Meanrolling<-apply(fg, 1, mean)
>
> write.csv(MaxrollingT, file = "MaxrollingT.csv")
> write.csv(MinrollingT, file = "MinrollingT.csv")
> write.csv(Diffrolling, file = "DiffrollingT.csv")
> write.csv(Meanrolling, file = "Meanrolling.csv")
>
>
> print(c(quantile(MaxrollingT,0.01),quantile(MinrollingT,0.01)))
> print(c(quantile(MaxrollingT,0.015),quantile(MinrollingT,0.015)))
> print(c(quantile(MaxrollingT,0.02),quantile(MinrollingT,0.02)))
> print(c(quantile(MaxrollingT,0.025),quantile(MinrollingT,0.025)))
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>
>

	[[alternative HTML version deleted]]

