Dear Kateryna The hausman() method for objects of class "systemfit" tests multiple-equation models estimated by 3SLS against multiple-equation models estimated by 2SLS (see documentation, e.g. [1]). It seems to me that this is not the type of Hausman test that you want to conduct.
[1] http://www.inside-r.org/packages/cran/systemfit/docs/hausman.systemfit Best regards, Arne On 6 January 2016 at 20:02, David Winsemius <dwinsem...@comcast.net> wrote: > >> On Jan 6, 2016, at 9:44 AM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: >> >> To post appropriately, use less apologizing and more reading of the Posting >> Guide that is mentioned in the footer of all messages on this list >> (including this one). Note that HTML does not work well on the list, so be >> sure to turn it off in your email program (at least when sending emails >> here). >> >> I have never used this function, but the error message is pretty clear. If >> you read the help for the systemfit function it states "list of formulas", >> not "list of model objects". The objects returned from lrm are not formulas. >> Perhaps look at some examples of using that function, such as the ones in >> the help (type ?systemfit after you have loaded the systemfit package into >> R). > > To go a bit further in explaining what might have better prepared responders > to offer a specific and tested reply, please note as you read through the > Posting Guide that a data example is strongly suggested. Also suggested is > that you post all `library` calls for any packages beyond the base set. The > `lrm` function, for instance` is most likely from the 'rms'-package. That > raises a further concern about which I have limited experience to offer. The > rms-regression functions may or may not have methods defined that allow use > of functions from other packages. I see that when 'systemfit' is loaded, the > `lrtest`-function from rms is listed as being masked, and I further see that > lrtest {lmtest} assumes there will be an `update`-method, but I do not see an > `update.lrm` function when I execute: > > methods(update) > > On the other hand there may be grounds for guarded optimism. After preparing > the example on the help page for `lrm` and creating the lrm example 'fit' we > see that lrm objects may be constructed so that the can inherit the glm class > and therefore use the update.glm method. > >> class(fit) > [1] "lrm" "rms" "glm" > > So to proceed, you might make a list of those models and then run `lapply` > with the `formula` function to extract the needed formula-objects: > > formula(fit) > #y ~ blood.pressure + sex * (age + rcs(cholesterol, 4)) > > -- > David. > > >> -- >> Sent from my phone. Please excuse my brevity. >> >> On January 6, 2016 5:02:52 AM PST, Kateryna Riabchenko >> <riabchenko.kater...@gmail.com> wrote: >>> Hello, I am not advanced in R (that is why my questions can sound >>> stupid). >>> I apologize for that in advance. But that is how my brain works - I >>> need to >>> ask questions to understand. I was searching the answer everywhere - >>> without result. So I am asking You. >>> >>> *Given:* >>> >>> I have 8 regression Models: >>> Model1 <- lrm(ACINTENSITY ~ GDPGROWTH, data = ACU) >>> Model2<- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION, data = ACU) >>> Model3 <- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION, data = >>> ACU) >>> Model4<- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION + >>> CENTRALBANK, >>> data = ACU) >>> Model5 <- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION + >>> CENTRALBANK >>> + CPI, data = ACU) >>> Model6 <- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION + >>> CENTRALBANK >>> + CPI + INTERATE, data = ACU) >>> Model7<- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION + >>> CENTRALBANK >>> + CPI + INTERATE + UNEMPL, data = ACU) >>> Model8 <- lrm(ACINTENSITY ~ GDPGROWTH + POPULATION + FEDUNION + >>> CENTRALBANK >>> + CPI + INTERATE + UNEMPL + INTERNET, data = ACU) >>> As you can see, each time a new explanatory variable is added. >>> I want to perform the Hausman Test >>> for that I installed systemfit package >>> My idea was to compare Model1 with Model2, Model2 with model3, ... and >>> so on >>> >>> *I started with this*: >>> inst <- ~ POPULATION - *this is Question1:* I don't know what I need >>> to >>> mention in *"inst"*. I put additional variable in Model2 which does not >>> exist in Model1, but I ma not sure that is correct! Or maybe I need to >>> put >>> all variables, which were used in 2 models. if You can explain - thank >>> you! >>> system <- list(Model1, Model2) >>> >>> # perform the estimations >>> fit2sls <- systemfit(system, "2SLS", inst = inst, data = ACU) >>> >>> but R responded: >>> >>> Error in systemfit(system, "2SLS", inst = inst, data = ACU) : >>> the list of argument 'formula' must contain only objects of class >>> 'formula' >>> >>> >>> >>> Please, help me to understand What I do wrong! >>> Best, >>> Kateryna >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> 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]] >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. > > David Winsemius > Alameda, CA, USA > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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 ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.