[R] about systemfit
jfox at mcmaster.ca
Thu Apr 5 18:45:14 CEST 2007
I'll address only part of your question, which is how to get the code for
linear.hypothesis() in the car package: linear.hypothesis() is an S3 generic
function with several methods:
 linear.hypothesis.default* linear.hypothesis.glm*
 linear.hypothesis.lm* linear.hypothesis.mlm*
Non-visible functions are asterisked
So the function has methods for glm, lm, and mlm objects, along with a
default method, which, as explained in ?linear.hypothesis, should work with
models for which coef() and vcov() methods exist.
To see linear.hypothesis.default(), which isn't exported from the car
namespace, you can, e.g., type
I'm not sure why you get different results for the F-test but similar
results for the Wald test. Which F-test seems to square with the Wald test
(you don't show the Wald tests)?
I hope this helps,
Department of Sociology
Canada L8S 4M4
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Ivanov
> Sent: Thursday, April 05, 2007 11:28 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] about systemfit
> 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, ...)
> <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]
> 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
> 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:
> Likelihood-Ratio-test for parameter restrictions in equation systems
> degrees of freedom:
> 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.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help