[R] about systemfit
Martin Ivanov
tramni at abv.bg
Thu Apr 5 17:28:12 CEST 2007
Hello. I am still a newbie in R. Excuse me if I am asking something obvious. My efforts to get an answer through browsing the mailing archives failed. I want to perform an augmented Dickey-Fuller test and to obtain AIC and BIC and to be able to impose some linear restrictions on the ADF regression so as to decide the correct order of autoregression. However I could find no obvious way to impose linear restrictions or to obtain AIC from the the result of ADF.test from uroot. That is why I turned to systemfit. I ran the ADF regression with systemfit and obtained the same coefficient estimates as through ADF.test (as it had to be). Unfortunately I could not find how to extract AIC from the result of systemfit, so I evaluated the ADF regression by lm. So far so good. However the results of ftest.systemfit and linear.hypothesis from the "car" package are very different, while the results from waldtest.systemfit and linear.hypothesis coincide. I have no explanation for this issue a
nd I could not see the code of linear.hypothesis. When I type "linear.hypothesis" I get:
function (model, ...)
UseMethod("linear.hypothesis")
<environment: namespace:car>
but when I type "ftest.systemfit", I do see the actual code. Why?
Anyway, here are the results in more detail:
eqns<-list(eq = y ~ trend+ x1 + x[,1] + x[,2] + x[,3] + x[,4] + x[,5] + x[,6] + x[,7] + x[,8] + x[,9] + x[,10] + x[,11] + x[,12] + x[,13]
Rrestr10<-matrix(0,10,16);Rrestr10[1,16]=Rrestr10[2,15]=Rrestr10[3,14]=Rrestr10[4,13]=Rrestr10[5,12]=Rrestr10[6,11]=Rrestr10[7,10]=Rrestr10[8,9]=Rrestr10[9,8]=Rrestr10[10,7]=1
adfResc<-systemfit(method="OLS",eqns=eqns,R.restr=Rrestr10)
adfResu<-systemfit(method="OLS",eqns=eqns)
adfResulm<-lm(formula=eqns$eq)
ftest.systemfit( object=adfResu, R.restr=Rrestr10) :
F-test for linear parameter restrictions in equation systems
F-statistic: 9.083
degrees of freedom of the numerator: 10
degrees of freedom of the denominator: 127
p-value: 3.449e-11
linear.hypothesis(model=adfResulm,hypothesis.matrix=Rrestr10,test="F"):
Res.Df RSS Df Sum of Sq F Pr(>F)
1 127 7.3782
2 137 7.6848 -10 -0.3066 0.5277 0.868
As I said, the results of
the chisquare test with linear.hypothesis and the waldtest.systemfit coincide.
I have one more problem. This is the output of lrtest.systemfit:
lrtest.systemfit(resultc=adfResc,resultu=adfResu)
Likelihood-Ratio-test for parameter restrictions in equation systems
LR-statistic:
degrees of freedom:
p-value:
Why do I get empty values?
In summary, I need to understand why the two ftests give different results; why lrtest.systemfit gives empty output; is there some way to extract AIC and BIC from object of class systemfit or from the result of ADF.test.
Excuse me if I am asking something too obvious, but I am really at a loss.
Any suggestions on any of the above questions will be welcomed.
Regards,
Martin
More information about the R-help
mailing list