Hi, I am trying to estimate a 2sls using panel data (random effect model). I tried the same estimation in STATA using the ivtreg2 command. However STATA and R are giving me two different results. I figure there is something with my R code: iv=plm(formula=wecon~fdistockgdp +trade + polrightsreversed +lnrgdpch + execleft + muslim2+c100rat +c111rat +yeardum| polrightsreversed+lnrgdpch+ execleft+muslim2+c100rat+c111rat+yeardum +lnpop+lnarea+devcountrycomlanguage+bitcum, data = women, index = c("country", "year"), random.method = c("swar"), inst.method = c("bvk"), model="random") summary(iv) Coefficients : Estimate Std. Error t-value Pr(>|t|) (Intercept) -0.2258528 0.2951301 -0.7653 0.4441954 fdistockgdp -0.0067207 0.0077315 -0.8693 0.3847993 trade 0.0068462 0.0023687 2.8903 0.0038863 ** polrightsreversed 0.0092366 0.0106174 0.8699 0.3844229 lnrgdpch 0.1246679 0.0389043 3.2045 0.0013724 ** execleft 0.1118046 0.0340817 3.2805 0.0010524 ** muslim2 -0.0044742 0.0012433 -3.5986 0.0003270 *** c100rat 0.0226208 0.0595134 0.3801 0.7039114 c111rat 0.0165951 0.0618339 0.2684 0.7884310 yeardum1982 0.1479947 0.0588824 2.5134 0.0120282 * yeardum1983 0.1783255 0.0606153 2.9419 0.0032958 ** yeardum1984 0.0344572 0.0597167 0.5770 0.5639907 yeardum1985 0.2206961 0.0610344 3.6159 0.0003060 *** yeardum1986 0.2428015 0.0649779 3.7367 0.0001912 *** yeardum1987 0.0489043 0.0615708 0.7943 0.4271186 yeardum1988 0.2243599 0.0605343 3.7063 0.0002155 *** yeardum1989 0.2215060 0.0624042 3.5495 0.0003940 *** yeardum1990 0.0688333 0.0607056 1.1339 0.2569648 yeardum1991 0.1370871 0.0638830 2.1459 0.0319892 * yeardum1992 0.1851857 0.0630868 2.9354 0.0033655 ** yeardum1993 0.0904620 0.0698526 1.2950 0.1954420 yeardum1994 0.1003735 0.0737431 1.3611 0.1736137 yeardum1995 0.1164818 0.0721240 1.6150 0.1064494 yeardum1996 0.0482520 0.0787232 0.6129 0.5399837 yeardum1997 0.1049161 0.0895001 1.1722 0.2412247 yeardum1998 0.2191887 0.1109757 1.9751 0.0483807 * yeardum1999 0.1573342 0.1397150 1.1261 0.2602422 yeardum2000 0.1532796 0.1627206 0.9420 0.3463059 --- However STATA gives me ------------------------------------------------------------ ----------------------- wecon | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+----------------------------------------- ----------------------- trade | .0093915 .0027483 3.42 0.001 .004005 .014778 fdistockgdp | -.0169171 .0092405 -1.83 0.067 -.0350281 .0011938 polrightsreversed | .0165855 .0119176 1.39 0.164 -.0067726 .0399436 lnrgdpch | .1045675 .0431179 2.43 0.015 .0200579 .189077 execleft | .1373652 .0384442 3.57 0.000 .0620159 .2127145 muslim2 | -.0043645 .0013551 -3.22 0.001 -.0070205 -.0017085 c100rat | .0480539 .0657304 0.73 0.465 -.0807752 .1768831 c111rat | .0170048 .0676272 0.25 0.801 -.1155421 .1495516 Really would appreciate any help explaining why the results are so different [[alternative HTML version deleted]]
Dear Chanita, impossible to tell without a reproducible example. You do not even include your Stata call. Assuming you meant 'ivreg2' w/o "t", there are four rows of possible arguments to it in the help page, but I don't seem to find any switch for random effects. Are you sure you are not comparing a RE model with a pooled one? Best wishes, Giovanni Giovanni Millo, PhD Research Dept., Assicurazioni Generali SpA Via Machiavelli 3, 34132 Trieste (Italy) tel. +39 040 671184 fax +39 040 671160 -------------- original message ------------------ Date: Thu, 14 Nov 2013 08:12:33 -0800 From: Chanita Holmes <chanita.holmes at gmail.com> To: r-help at r-project.org Subject: [R] 2SLS for panel data, re Message-ID: <CAEaD0=6SkDOTODbPZZ19LE2ca6YxByXWp+q-GiL1g+8eFB22DA at mail.gmail.com> Content-Type: text/plain Hi, I am trying to estimate a 2sls using panel data (random effect model). I tried the same estimation in STATA using the ivtreg2 command. However STATA and R are giving me two different results. I figure there is something with my R code: iv=plm(formula=wecon~fdistockgdp +trade + polrightsreversed +lnrgdpch + execleft + muslim2+c100rat +c111rat +yeardum| polrightsreversed+lnrgdpch+ execleft+muslim2+c100rat+c111rat+yeardum +lnpop+lnarea+devcountrycomlanguage+bitcum, data = women, index = c("country", "year"), random.method = c("swar"), inst.method = c("bvk"), model="random") summary(iv) Coefficients : Estimate Std. Error t-value Pr(>|t|) (Intercept) -0.2258528 0.2951301 -0.7653 0.4441954 fdistockgdp -0.0067207 0.0077315 -0.8693 0.3847993 trade 0.0068462 0.0023687 2.8903 0.0038863 ** polrightsreversed 0.0092366 0.0106174 0.8699 0.3844229 lnrgdpch 0.1246679 0.0389043 3.2045 0.0013724 ** execleft 0.1118046 0.0340817 3.2805 0.0010524 ** muslim2 -0.0044742 0.0012433 -3.5986 0.0003270 *** c100rat 0.0226208 0.0595134 0.3801 0.7039114 c111rat 0.0165951 0.0618339 0.2684 0.7884310 yeardum1982 0.1479947 0.0588824 2.5134 0.0120282 * yeardum1983 0.1783255 0.0606153 2.9419 0.0032958 ** yeardum1984 0.0344572 0.0597167 0.5770 0.5639907 yeardum1985 0.2206961 0.0610344 3.6159 0.0003060 *** yeardum1986 0.2428015 0.0649779 3.7367 0.0001912 *** yeardum1987 0.0489043 0.0615708 0.7943 0.4271186 yeardum1988 0.2243599 0.0605343 3.7063 0.0002155 *** yeardum1989 0.2215060 0.0624042 3.5495 0.0003940 *** yeardum1990 0.0688333 0.0607056 1.1339 0.2569648 yeardum1991 0.1370871 0.0638830 2.1459 0.0319892 * yeardum1992 0.1851857 0.0630868 2.9354 0.0033655 ** yeardum1993 0.0904620 0.0698526 1.2950 0.1954420 yeardum1994 0.1003735 0.0737431 1.3611 0.1736137 yeardum1995 0.1164818 0.0721240 1.6150 0.1064494 yeardum1996 0.0482520 0.0787232 0.6129 0.5399837 yeardum1997 0.1049161 0.0895001 1.1722 0.2412247 yeardum1998 0.2191887 0.1109757 1.9751 0.0483807 * yeardum1999 0.1573342 0.1397150 1.1261 0.2602422 yeardum2000 0.1532796 0.1627206 0.9420 0.3463059 --- However STATA gives me ------------------------------------------------------------ ----------------------- wecon | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+----------------------------------------- ----------------------- trade | .0093915 .0027483 3.42 0.001 .004005 .014778 fdistockgdp | -.0169171 .0092405 -1.83 0.067 -.0350281 .0011938 polrightsreversed | .0165855 .0119176 1.39 0.164 -.0067726 .0399436 lnrgdpch | .1045675 .0431179 2.43 0.015 .0200579 .189077 execleft | .1373652 .0384442 3.57 0.000 .0620159 .2127145 muslim2 | -.0043645 .0013551 -3.22 0.001 -.0070205 -.0017085 c100rat | .0480539 .0657304 0.73 0.465 -.0807752 .1768831 c111rat | .0170048 .0676272 0.25 0.801 -.1155421 .1495516 Really would appreciate any help explaining why the results are so different [[alternative HTML version deleted]] --------------------- end original message --------- ? Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:12}}
Hi Millo Giovanni, Thanks for your response. In regards to my STATA code it would be: xi:xtiverg wecon polrightsreversed lnrgdpch execleft mulim2 c100rat c1100rat i.year (trade fdistockgdp = lnpop lnarea devcountrycomlanguage bitcum), re. Any suggestions will help so much...... Regards On Thursday, November 14, 2013 8:12:33 AM UTC-8, Phdstudent2 wrote:> > Hi, > > I am trying to estimate a 2sls using panel data (random effect model). I > tried the same estimation in STATA using the ivtreg2 command. However > STATA > and R are giving me two different results. I figure there is something > with > my R code: > > iv=plm(formula=wecon~fdistockgdp +trade + polrightsreversed +lnrgdpch + > execleft + muslim2+c100rat +c111rat +yeardum| polrightsreversed+lnrgdpch+ > execleft+muslim2+c100rat+c111rat+yeardum > +lnpop+lnarea+devcountrycomlanguage+bitcum, > data = women, index = c("country", "year"), random.method = c("swar"), > inst.method = c("bvk"), model="random") > summary(iv) > > Coefficients : > Estimate Std. Error t-value Pr(>|t|) > (Intercept) -0.2258528 0.2951301 -0.7653 0.4441954 > fdistockgdp -0.0067207 0.0077315 -0.8693 0.3847993 > trade 0.0068462 0.0023687 2.8903 0.0038863 ** > polrightsreversed 0.0092366 0.0106174 0.8699 0.3844229 > lnrgdpch 0.1246679 0.0389043 3.2045 0.0013724 ** > execleft 0.1118046 0.0340817 3.2805 0.0010524 ** > muslim2 -0.0044742 0.0012433 -3.5986 0.0003270 *** > c100rat 0.0226208 0.0595134 0.3801 0.7039114 > c111rat 0.0165951 0.0618339 0.2684 0.7884310 > yeardum1982 0.1479947 0.0588824 2.5134 0.0120282 * > yeardum1983 0.1783255 0.0606153 2.9419 0.0032958 ** > yeardum1984 0.0344572 0.0597167 0.5770 0.5639907 > yeardum1985 0.2206961 0.0610344 3.6159 0.0003060 *** > yeardum1986 0.2428015 0.0649779 3.7367 0.0001912 *** > yeardum1987 0.0489043 0.0615708 0.7943 0.4271186 > yeardum1988 0.2243599 0.0605343 3.7063 0.0002155 *** > yeardum1989 0.2215060 0.0624042 3.5495 0.0003940 *** > yeardum1990 0.0688333 0.0607056 1.1339 0.2569648 > yeardum1991 0.1370871 0.0638830 2.1459 0.0319892 * > yeardum1992 0.1851857 0.0630868 2.9354 0.0033655 ** > yeardum1993 0.0904620 0.0698526 1.2950 0.1954420 > yeardum1994 0.1003735 0.0737431 1.3611 0.1736137 > yeardum1995 0.1164818 0.0721240 1.6150 0.1064494 > yeardum1996 0.0482520 0.0787232 0.6129 0.5399837 > yeardum1997 0.1049161 0.0895001 1.1722 0.2412247 > yeardum1998 0.2191887 0.1109757 1.9751 0.0483807 * > yeardum1999 0.1573342 0.1397150 1.1261 0.2602422 > yeardum2000 0.1532796 0.1627206 0.9420 0.3463059 > --- > However STATA gives me > ------------------------------------------------------------ > ----------------------- > wecon | Coef. Std. Err. z P>|z| [95% Conf. > Interval] > ------------------+----------------------------------------- > ----------------------- > trade | .0093915 .0027483 3.42 0.001 .004005 > .014778 > fdistockgdp | -.0169171 .0092405 -1.83 0.067 -.0350281 > .0011938 > polrightsreversed | .0165855 .0119176 1.39 0.164 -.0067726 > .0399436 > lnrgdpch | .1045675 .0431179 2.43 0.015 .0200579 > .189077 > execleft | .1373652 .0384442 3.57 0.000 .0620159 > .2127145 > muslim2 | -.0043645 .0013551 -3.22 0.001 -.0070205 > -.0017085 > c100rat | .0480539 .0657304 0.73 0.465 -.0807752 > .1768831 > c111rat | .0170048 .0676272 0.25 0.801 -.1155421 > .1495516 > > Really would appreciate any help explaining why the results are so > different > > [[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. >