[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"maartenbuis" <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Estimating marginal effects of linear and quadratic term from a logit regression |

Date |
Mon, 08 Nov 2004 09:15:57 -0000 |

Dear Pradeep, Calculating the marginal effect for a logistic regression when one of the explanatory variables is also entered with an quadratic term can be done by `hand' (well, by -nlcom- actually) but it gets a bit ugly, see the example below. Notice that the first couple of lines of the -nlcom- is the probability density function of the logistic: exp(xb)/(1+exp(xb))^2. The last lines of the -nlcom- command is the derivative of xb with respect to x of interest, in this cas mpg: _b[mpg]+2*_b[mpg2]*(mean mpg). Maarten #delim ; sysuse auto; gen mpg2=mpg^2; logit foreign price weight mpg mpg2; sum price, meanonly; local price = r(mean); sum weight, meanonly; local weight = r(mean); sum mpg, meanonly; local mpg = r(mean); nlcom( exp(_b[_cons] + _b[price]*`price' + _b[weight]*`weight' + _b [mpg]*`mpg' + _b[mpg2]*`mpg'^2)/ (1+exp(_b[_cons] + _b[price]*`price' + _b[weight]*`weight' + _b [mpg]*`mpg' + _b[mpg2]*`mpg'^2))^2* (_b[mpg]+2*_b[mpg2]*`mpg') ); --- pradeep.kurukulasuriya@y...> wrote: > I have a logit model with a linear and quadratic variable along with some > other variables (call it stuff). I am trying to estimate the marginal > effects for different sets variables in my model where each set is comprised > of a linear and quadratic term. Is there a ado file for this that does not > require the differentiation to be done manually (and then run a proceedure > like nlcom) or is that the best there is? * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Estimating marginal effects of linear and quadratic term from a logit regression***From:*"maartenbuis" <maartenbuis@yahoo.co.uk>

**Re: st: Estimating marginal effects of linear and quadratic term from a logit regression***From:*"maartenbuis" <maartenbuis@yahoo.co.uk>

**References**:**st: Estimating marginal effects of linear and quadratic term from a logit regression***From:*"Pradeep Kurukulasuriya" <pradeep.kurukulasuriya@yale.edu>

- Prev by Date:
**st: Re: program** - Next by Date:
**Re: st: Estimating marginal effects of linear and quadratic term from a logit regression** - Previous by thread:
**st: Estimating marginal effects of linear and quadratic term from a logit regression** - Next by thread:
**Re: st: Estimating marginal effects of linear and quadratic term from a logit regression** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |