Displaying 1 result from an estimated 1 matches for "cf_diff".
2011 Jan 17
2
How to still processing despite bug errors?
...;AER")
> usc <- as.data.frame(USConsump1993)
> usc$investment <- usc$income - usc$expenditure
>
> ## 2SLS via ivreg(), Hausman by hand
> fm_ols <- lm(expenditure ~ income, data = usc)
> fm_iv <- ivreg(expenditure ~ income | investment, data = usc)
> cf_diff <- coef(fm_iv) - coef(fm_ols)
> vc_diff <- vcov(fm_iv) - vcov(fm_ols)
> x2_diff <- as.vector(t(cf_diff) %*% solve(vc_diff) %*% cf_diff)
> pchisq(x2_diff, df = 2, lower.tail = FALSE)
>
> ## 2SLS via systemfit(), Hausman via hausman.systemfit()
> library("sys...