Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Outreg margins error


From   John Luke Gallup <jlgallup@pdx.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Outreg margins error
Date   Thu, 6 Sep 2012 19:17:53 -0700

Wameq,

If you were using a nonlinear regression method instead of -regress-, I would think you would want to use the following -margins- command since you don't seem interested in factor variable interactions:

margins, dydx(*)

As it is, in OLS the marginal effects are identical to the coefficients.

By the way, -outreg- is now updated on SSC resolving the bug that you identified.

John

On Sep 6, 2012, at 8:20 AM, Nick Cox <njcoxstata@gmail.com> wrote:

> I don't think you are understanding what -margins- does. Look at the
> help and you will see that it starts
> 
> margins [marginlist] [if] [in] [weight] [, response_options options]
> 
>    where marginlist is a list of factor variables or interactions that appear
>    in the current estimation results.
> 
> So, you are offering
> 
> tfhhh shg lntotalexp ...
> 
> to -margins- as a marginslist. My interpretation is that -margins- is
> happy to accept -tfhhh shg-, whatever they are, as part of a
> marginslist but bails out because -lntotalexp- is certainly not
> acceptable.
> 
> Otherwise put, it's not enough that your syntax looks like what
> Carsten was using as an example. It must also make sense to -margins.
> Also, you really must read the help!
> 
> Nick
> 
> On Thu, Sep 6, 2012 at 4:08 PM, Wameq Raza <wameq.r@gmail.com> wrote:
>> Dear Nick,
>> Thanks for the response. Yes, the lntotalexp is the natural log of
>> expenditure. My syntax was:
>> 
>> margins tfhhh shg lntotalexp lnhhsize fem0to13 fem36to55 fem55
>> men0to13 men14to35 men36to55 men55 eduprim_hh edumid   ///
>> _hh eduhigh_hh scst dumemp_hh2 dumemp_hh3 dumemp_hh4 dumemp_hh5
>> dumemp_hh6 kanpur allahabad aillness1 aillness2 ail   ///
>> lness4 aillness5, post
>> 
>> lntotalexp:  factor variables may not contain noninteger values
>> r(452);
>> 
>> 
>> Hopefully this syntax is correct following the previous response from
>> Carsten. I've also tried getting the margins using the same syntax
>> one variable at a time, but to no avail. Any suggestions?
>> Wameq
>> 
>> On Thu, Sep 6, 2012 at 2:02 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>>> My suggestions are:
>>> 
>>> 1. The error means what it says: -lntotalexp- (presumably the log of
>>> total expenditure) cannot be a factor variable.
>>> 
>>> 2. The error arises from incorrect syntax, but you need to show us
>>> _exactly_ what you typed with your data.
>>> 
>>> 3. For "STATA" read "Stata" throughout.
>>> 
>>> 4. Points 2 and 3 are covered by the Statalist FAQ, so you really
>>> should read that before re-posting.
>>> 
>>> Nick
>>> 
>>> On Thu, Sep 6, 2012 at 11:01 AM, Wameq Raza <wameq.r@gmail.com> wrote:
>>>> Dear Carsten and John,
>>>> Thank you so very much for the replies. As for the syntax Carsten
>>>> suggested, STATA gives me an error when estimating continuous
>>>> variables such as the ln of expenditures. The error message it gives
>>>> me is:
>>>> 
>>>> -lntotalexp:  factor variables may not contain noninteger values-
>>>> 
>>>> Any suggestions for this?
>>>> 
>>> *
>>> *   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/
>> 
>> 
>> 
>> --
>> W A M E Q   R A Z A
>> *
>> *   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/


*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index