Yang Wan
2008-Nov-06 04:56 UTC
[R] How to return individual equation from {aidsEst} in package [micEcon]?
Hi, R core team I am using the function {aidsEst} in package [micEcon] to do an AIDS model now. So far, everything is good. But I want to test the auto correlation and heteroskedasticity of the individual equation from AIDS demand system. How can I return the individual equation? PS: serial correlation test is {bgtest} in package [lmtest] and heteroskedasticity is {bptest} in package [lmtest], both of which need the object of formula. Thank you for your answer. Christina [[alternative HTML version deleted]]
Arne Henningsen
2008-Nov-17 10:15 UTC
[R] How to return individual equation from {aidsEst} in package [micEcon]?
On Thursday 06 November 2008 05:56:23, Yang Wan wrote:> I am using the function {aidsEst} in package [micEcon] to do an AIDS > model now. So far, everything is good. But I want to test the auto > correlation and heteroskedasticity of the individual equation from AIDS > demand system. How can I return the individual equation?The object returned by aidsEst contains an element with name "est", which is the object returned by systemfit (see documentation of aidsEst). Unfortunately, I do not know what you need to do the test. I suggest that you take a look at the documentation of systemfit and/or the corresponding JSS paper [1]. For instance, you could obtain the residuals with R> residuals( aidsEstResult$est ) where "aidsEstResult" is the object returned by aidsEst. Please let me know if you have any further questions or if you found out how to do the test. In the latter case, I suggest that you or I add a method, a wrapper function, or a hint in the documentation of the micEcon and/or the systemfit package. Both packages are developed on R-Forge. [1] http://www.jstatsoft.org/v23/i04 Best wishes, Arne> PS: serial correlation test is {bgtest} in package [lmtest] and > heteroskedasticity is {bptest} in package [lmtest], both of which need > the object of formula. > > > > Thank you for your answer. > > > > > > Christina > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Arne Henningsen http://www.arne-henningsen.name
Arne Henningsen
2008-Nov-19 23:04 UTC
[R] How to return individual equation from {aidsEst} in package [micEcon]?
On Monday 17 November 2008 21:24, Yang Wan wrote:> (1) With previous problem, I have tried the way you suggested, but I > still cannot do the tests. The problem here is that both {bgtest} and > {bptest} in package [lmtest] need a formula in their arguments as > follows, > > bgtest(formula, order = 1, order.by = NULL, type = c("Chisq", "F"), data > = list()) > bptest(formula, varformula = NULL, studentize = TRUE, data = list()) > > what I can get from {aidsEst} is the residuals. So, the previous > question, is there other way to return individual equation or do you > know another way to do these tests?Currently, I have no idea, how "bgtest" and "bptest" can be used to test the residuals of the single equations of a simultaneous equation model estimated by systemfit. It is possible to obtain the formula of each equation using the "formula" method for systemfit objects and you can obtain the data using the "model.frame" method. However, it seems to me that "bgtest" and "bptest" *estimate* the (single equation) model using the formula and the data provided as arguments, but these estimates (and hence also the residuals) generally differ from the estimates (and hence also the residuals) returned by systemfit, because "bgtest" and "bptest" do not account for contemporaneous correlation of the residuals and cross-equation restrictions. Maybe you can contact the authors of the "lmtest" package and ask if they have an idea how "bgtest" and "bptest" can be applied to single equations estimated by systemfit. Best wishes, Arne> -----Original Message----- > From: Arne Henningsen [mailto:arne.henningsen at googlemail.com] > Sent: Monday, November 17, 2008 4:15 AM > To: r-help at r-project.org > Cc: Yang Wan > Subject: Re: [R] How to return individual equation from {aidsEst} in > package [micEcon]? > > On Thursday 06 November 2008 05:56:23, Yang Wan wrote: > > I am using the function {aidsEst} in package [micEcon] to do an AIDS > > model now. So far, everything is good. But I want to test the auto > > correlation and heteroskedasticity of the individual equation from > > AIDS > > > demand system. How can I return the individual equation? > > The object returned by aidsEst contains an element with name "est", > which is > the object returned by systemfit (see documentation of aidsEst). > Unfortunately, > I do not know what you need to do the test. I suggest that you take a > look at > the documentation of systemfit and/or the corresponding JSS paper [1]. > For > instance, you could obtain the residuals with > R> residuals( aidsEstResult$est ) > where "aidsEstResult" is the object returned by aidsEst. > Please let me know if you have any further questions or if you found out > how > to do the test. In the latter case, I suggest that you or I add a > method, a > wrapper function, or a hint in the documentation of the micEcon and/or > the > systemfit package. Both packages are developed on R-Forge. > > [1] http://www.jstatsoft.org/v23/i04 > > Best wishes, > Arne > > > PS: serial correlation test is {bgtest} in package [lmtest] and > > heteroskedasticity is {bptest} in package [lmtest], both of which need > > the object of formula. > > > > > > > > Thank you for your answer. > > > > > > > > > > > > Christina > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at 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.-- Arne Henningsen http://www.arne-henningsen.name