Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: RE: -mfx- question & beta distribution

From   May Boggess <>
Subject   Re: st: RE: RE: -mfx- question & beta distribution
Date   26 May 2004 18:30:39 -0500

On Wednesday, Stephen Jenkins responded to Jack Buckley's question about
using -mfx- following a user-written command.

As Stephen said, the question is what function do you want the marginal
effect of? A marginal effect, for a particular independent variable, is
the derivative of a function with respect to that variable, usually
evaluated that the means of the independent variables. 

For many models, it is obvious what function you want the 
derivative of (for example, probability of success after -logit-).
If this function is the default predict option after the estimator
of interest, then you can type -mfx- and it will use that default
predict option and you can get the marginal effect of the function you
want, maybe without even thinking about it.  

Implicit in what I have said above then, is that -mfx- does use 
-predict-. So, if you want to use -mfx- after a user-written command,
-predict- will have to work after your command. I don't think this is a
bad as it sounds. You need to write an ado file that predicts the
function of interest, and then in the stored results of your estimator,
you store the name of that predict ado file in e(predict). If Jack is
interested in trying this out, he can email me privately - I'd be glad
to help him out. 

Stephen suggested using -nlcom- instead, if you know the analytic
form of the marginal effect you seek. This is a great suggestion, if
you know the formula that is. For many common models, like -probit- for
example, taking the derivative of, say, the probability of success, is
not very difficult, So it is pretty easy to use -nlcom- to calculate the
marginal effect and, more importantly, its standard error by the delta

So, the main reason someone would want to use -mfx-, is if it is
difficult to differentiate the function of interest (either that, or
they just really want to avoid calculus - who can blame them). What
-mfx- does to avoid calculus is approximate the derivative numerically
and uses the delta method to get the standard error. 


> Further to Nick's response: Nick's and my -betafit- fits a 2-parameter
> Beta distribution where the parameters can depend on covariates.  My
> quick glance suggests that Jack Buckley's -mlbeta- fits a 2-parameter
> Beta distribution as well, though I am not sure about the relationships
> between our parameterisation and his. [We referred to our parameters as
> shape parameters; Jack splits his covariates into two groups, one for
> mean (?) and one set in a variance() option.]
> Regarding the original Qn about marginal effects, it would easier to
> know what statistic that Jack wanted to calculate the marginal effect
> of.  For most of these parametric distributions, summary statistics like
> the mean or the variance (and pdf and cdf) are functions of the
> parameters (and thence of covariates and coeff. estimates). These
> formulae can be looked up in a book (or worked out).  Given them,
> -nlcom- and -predictnl- are very useful commands for deriving the
> summary statistics at different covariate values, and one could also use
> them to derive marginal effects.  I don't think -mfx- is the place to
> start.  (If only because we don't have a regression model here in the
> way that I think that -mfx- assumes one has, in order to do its stuff
> correctly.)
> Stephen
> -------------------------------------------------------------
> Professor Stephen P. Jenkins <>
> Institute for Social and Economic Research
> University of Essex, Colchester CO4 3SQ, U.K.
> Tel: +44 1206 873374.  Fax: +44 1206 873151.
> > -----Original Message-----
> > From: 
> > [] On Behalf Of Nick Cox
> > Sent: 26 May 2004 14:59
> > To:
> > Subject: st: RE: -mfx- question
> > 
> > 
> > Stephen Jenkins and I wrote a program called -betafit- 
> > on SSC which I believe to be compatible with -mfx-. 
> > Depending precisely what is wanted, that appears to be 
> > an alternative. 
> > 
> > Nick 
> > 
> > 
> > Jack Buckley
> > 
> > > I wrote an ado file a while back called -mlbeta- that
> > > estimates ML models for beta-distributed dependent variables 
> > > (net from A user just asked me 
> > > if the command supports -mfx-, which it does not (in that 
> > > -mfx- does not return proper marginal effects). Can anyone 
> > > give me a hint or two about what I would need to do? Kit Baum 
> > > here at BC suggested that I might need to set-up the command 
> > > so that -predict- would work properly first?
> > 

*   For searches and help try:

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