Hi
I have been trying so many different things to get my Inverse Mills Ratio
going for a Two stage Heckman Model, I have tried the following so far (the
commands are listed below till teh point where I get an error), I get an
error in the last sentence (marked in bold below), if this were successful
then I could have used the IMR as a control in my OLS (which would be the
OLS for the outcome equation), what I see is that the number of rows of IMR
calculated and the number of rows in the actual data set do not match and
hence IMR could not be added to my original data set, how do I fix this and
then proceed to get correct IMR to use in my outcome equation, Can someone
please help???/
> load("C:\\adpopdata1.Rdata")
> ls()
[1] "adpopdata"> attach(adpopdata)
> names(adpopdata)
[1] "ctry" "setid" "gender"
"age" "year"
[6] "ownmge" "busang" "futsup"
"discent" "knowent"
[11] "opport" "suskill" "fearfail"
"nbgoodc" "nbstatus"
[16] "sunowjob" "suyr5job" "omnowjob"
"omyr5job" "gemwork3"
[21] "suboanw" "babybuso" "estbbuso"
"suboan_m" "babybo_m"
[26] "estbbo_m" "es_gdppc" "ief_fisc"
"yearctry" "ief_ipr"
[31] "wb_law" "wb_corr" "imf_pop"
"imf_pgro" "es_gdpch"
[36] "sq_gdppc" "ln_oy5" "gemedu"
"gemhinc" "ipr_edu"
[41] "ipr_hinc" "age_sq" "ln_oy5_a"
"ln_oy5_1" "ln_sy5"
[46] "ln_osy5" "ln_oy5_e" "X_est_full"
"o_tmitr" "o_citr"
[51] "o_tdtr" "ln_oy5_2" "invmills"
"ln_onj" "ln_diff"
[56] "omjoagro" "omjorgro" "ln_orgro"
"ln_oagro" "sunowjo1"
[61] "osnowjob" "ln_osnow" "osyr5job"
"osjorgro" "ln_osrgr"
[66] "ln_osagr" "s_nacnew" "p"
"phi" "capphi"
[71] "invmil_4" "subobaby" "fearf_m"
"disc_m" "dis_fear"
[76] "fearf_r" "fearf_rm" "dis_ff_r"
"s"
> library("sampleSelection")
> myProbit<- glm(s ~ age + gender + gemedu + gemhinc + es_gdppc +
+ imf_pop + estbbo_m, family = binomial(link =
"probit"))> summary(myProbit)
Call:
glm(formula = s ~ age + gender + gemedu + gemhinc + es_gdppc +
imf_pop + estbbo_m, family = binomial(link = "probit"))
Deviance Residuals:
Min 1Q Median 3Q Max
-0.7660 -0.3053 -0.2462 -0.1984 3.2166
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.439e+00 2.985e-02 -81.714 < 2e-16 ***
age -6.436e-03 3.743e-04 -17.193 < 2e-16 ***
genderMALE 1.785e-01 9.424e-03 18.945 < 2e-16 ***
gemedu 2.128e-02 4.698e-03 4.528 5.95e-06 ***
gemhinc 1.062e-01 6.185e-03 17.166 < 2e-16 ***
es_gdppc 9.765e-06 1.400e-06 6.977 3.02e-12 ***
imf_pop 4.131e-06 1.707e-05 0.242 0.809
estbbo_m 5.932e+00 1.088e-01 54.539 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 84763 on 257357 degrees of freedom
Residual deviance: 80515 on 257350 degrees of freedom
(85893 observations deleted due to missingness)
AIC: 80531
Number of Fisher Scoring iterations: 6
*> adpopdata$IMR<-invMillsRatio(myProbit)$IMR1
Error in `$<-.data.frame`(`*tmp*`, "IMR", value =
c(2.50039945424535, :
replacement has 257358 rows, data has 343251*
--
Dr.Saurav Pathak
PhD, Univ.of.Florida
Mechanical Engineering
Doctoral Student
Innovation and Entrepreneurship
Imperial College Business School
s.pathak08@imperial.ac.uk
0044-7795321121
[[alternative HTML version deleted]]