Hi, I can think of no reason a Hausman test could not be used for OLS---it is a comparison of vectors of coefficients from different models usually assumed to produce similar estimates under certain conditions. Dissimilarity is taken as indicative of a lack of some or all the conditions required for the two models to yield similar parameters. I suggest you look at the plm and systemfit packages. They have many functions for OLS, 2SLS, tests of endogeneity, etc. The plm (and maybe systemfit?) package also has a vignette which is a good thing to read. It has a lot of useful information on the code and examples of comparing different types of models, that you may find instructive.
Hope this helps, Josh On Sun, Oct 28, 2012 at 1:33 PM, fxen3k <f.seha...@gmail.com> wrote: > Hi there, > > I am really new to statistics in R and statistics itself as well. > My situation: I ran a lot of OLS regressions with different independent > variables. (using the lm() function). > After having done that, I know there is endogeneity due to omitted > variables. (or perhaps due to any other reasons). > And here comes the Hausman test. I know this test is used to identify > endogeneity. > But what I am not sure about is: "Can I use the Hausman test in a simple > OLS > regression or is it only possible in a 2SLS regression model?" "And if it > is > possible to use it, how can I do it?" > > Info about the data: > > data = lots of data :) > > x1 <- data$x1 > x2 <- data$x2 > x3 <- data$x3 > x4 <- data$x4 > y1 <- data$y1 > > reg1 <- summary(lm(y1 ~ x1 + x2 + x3 + x4)) > > Thanks in advance for any support! > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Hausman-test-in-R-tp4647716.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ [[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.