Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Rich Steinberg <rsteinbe@iupui.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: problem with factor variable and margins. |

Date |
Wed, 17 Mar 2010 13:26:11 -0400 |

Martin Weiss wrote:

<> So "1.nainc" is not in there. Is there any message after the -margins, post- command to indicate that it got dropped? HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rich Steinberg Sent: Mittwoch, 17. März 2010 01:52 To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: problem with factor variable and margins. Martin -- thanks for quick reply.Here's what I get when I follow your directions. Note that it makes nomention of the "n" indicators.e(b)[1,24]0b. 1.linc2005 ainc2005 welinc2005 trinc2005pdv_tot~2005 home2005 owlth2005 zlinc zlincy1 .00361868 .00423484 -.02269471 -.00096762.00184778 .0001901 .00027922 0 -316.889010b. 1. 0b. 1.0b. 1. 0b. 1. 0b.zainc zainc zwelinc zwelincztrinc ztrinc zinh zinh zhomey1 0 -390.58658 0 22.6710880 68.796578 0 -93.26363 01. 0b.1.zhome zowlth zowlth nainc_aincnhome_home nowlth_owlthy1 -411.67932 0 -870.19597 .00711539.00115194 .00159752. Martin Weiss wrote:<>What does************* mat l e(b) ************* after the -margins,post- line give you? HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rich Steinberg Sent: Dienstag, 16. März 2010 23:50 To: statalist@hsphsun2.harvard.edu Subject: st: problem with factor variable and margins.Running a tobit, then getting average marginal effects (dy/dx) using themargins command. I ask it to compute the margins for some continuousvariables and 2 kinds of factor variables. Results are only reportedfor one of the two kinds of factor variables even though raw tobitcoefficients are computed for both kinds and no error messages appear.I "post" the margins results to do some testing, and all is well fortesting continuous variables and one kind of factor variable (using"test"), but I get an error message for any tests involving the otherkind of factor variable indicating it is "not found". Is it me orstata, I say hesitantly, realizing that every time in the past that Ithought I found a bug it turned out to be a stupid error on my part.Specifically, we have all sorts of income and wealth covariates and someindicators created from them: variables beginning with 'z' areindicators that =1 if the corresponding income source =0, 0 otherwise.I have no problem with the z variables. Variables beginning with n areindicators that = 1 if the corresponding income source takes a negativevalue, 0 otherwise. Here are the relevant command lines, with a fewcomments inserted:tobit Atotgiv $income i.zlinc i.zainc i.zwelinc i.ztrinc i.zinh i.zhomei.zowlth i.nainc nainc_ainc i.nhome nhome_home i.nowlth nowlth_owlth$control, ll(24.99) vce(cluster fid1968)*runs fine, produces coefficients for the three 'n' factor variables:i.nainc, i.nhome, and i.nowlthmargins, predict(ystar(0,.)) dydx( linc2005 ainc2005 welinc2005trinc2005 pdv_totinh2005 home2005 owlth2005 zlinc zainc nainc nainc_ainczwelinc ztrinc zinh zhome nhome nhome_home zowlth nowlth nowlth_owlth)post*produces the following translation and table, where the 'n' factorvariables disappearAverage marginal effects Number of obs= 4790Model VCE : Robust Expression : E(Atotgiv*|Atotgiv>0), predict(ystar(0,.))dy/dx w.r.t. : linc2005 ainc2005 welinc2005 trinc2005 pdv_totinh2005home2005 owlth2005 1.zlinc1.zainc 1.zwelinc 1.ztrinc 1.zinh 1.zhome 1.zowlthnainc_ainc nhome_home nowlth_owlthDelta-methoddy/dx Std. Err. z P>z [95% Conf. Interval]linc2005 .0036341 .0018126 2.00 0.045 .0000814 .0071867ainc2005 .0042529 .0054043 0.79 0.431 -.0063394 .0148451welinc2005 -.0227912 .0274355 -0.83 0.406 -.0765638.0309814trinc2005 -.0009717 .0044668 -0.22 0.828 -.0097265.007783pdv_tot~2005 .0018556 .0016007 1.16 0.246 -.0012817.004993home2005 .0001909 .0004784 0.40 0.690 -.0007468 .0011286 owlth2005 .0002804 .0001727 1.62 0.104 -.0000581.00061891.zlinc -318.2919 220.6601 -1.44 0.149 -750.7777 114.194 1.zainc -392.2745 79.73669 -4.92 0.000 -548.5555 -235.9935 1.zwelinc 22.76784 236.5038 0.10 0.923 -440.7712486.30691.ztrinc 69.08922 71.11036 0.97 0.331 -70.28453 208.463 1.zinh -93.65764 124.6813 -0.75 0.453 -338.0284 150.7131 1.zhome -413.516 85.3139 -4.85 0.000 -580.7282 -246.3038 1.zowlth -874.5375 135.0824 -6.47 0.000 -1139.294-609.7809nainc_ainc .0071456 .0273387 0.26 0.794 -.0464373.0607286nhome_home .0011568 .0057747 0.20 0.841 -.0101613.012475nowlth_owlth .0016043 .0015222 1.05 0.292 -.0013791.0045878Note: dy/dx for factor levels is the discrete change from the baselevel.*And then I do many tests, including the following that work and don'twork:test (ainc)(1.zainc) ( 1) ainc2005 = 0 ( 2) 1.zainc = 0 chi2( 2) = 28.57 Prob > chi2 = 0.0000 test (1.nainc) (nainc_ainc) 1.nainc not found r(111);* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

-- Rich Steinberg Department of Economics, 516 Cavanaugh Hall IUPUI Indianapolis, IN 46202-5140 317-278-7221 "Unanswered email since 1955" * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: RE: problem with factor variable and margins.***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: problem with factor variable and margins.***From:*Rich Steinberg <rsteinbe@iupui.edu>

**st: RE: problem with factor variable and margins.***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: RE: problem with factor variable and margins.***From:*Rich Steinberg <rsteinbe@iupui.edu>

**RE: st: RE: problem with factor variable and margins.***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: Tostring (string from a numerical variable)** - Next by Date:
**re: Re: st: RE: problem with factor variable and margins.** - Previous by thread:
**Re: st: RE: problem with factor variable and margins.** - Next by thread:
**RE: st: RE: problem with factor variable and margins.** - Index(es):