 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: re: Adding the marginal effects at individual values of

 From Kit Baum To "Solomon Tesfu" Subject Re: st: re: Adding the marginal effects at individual values of Date Sun, 21 Feb 2010 10:06:58 -0500

```Although it is possible to calculate the slope of the probit function for each individual (and that is what is going on in the calculation of average marginal effects) and transform it to an individual-level marginal effect, it is not possible to compute an interval estimate from a sample of size 1: that is, you will not be able to consider the precision of the values. If you calculate an AME from a number of observations, you can.

Kit

On Feb 20, 2010, at 9:49 PM, Solomon Tesfu wrote:

> Thanks a lot for your suggestion. The variable I'm dealing with is age-standardized height (age-for-height) that can take any value for each child and my sample contains about 2400 observations. Your suggestion would certainly work if I were to round off all the decimals to the nearest integers and calculate the marginal effects at integer points. But that will not tell the whole story.
>
> Solomon T.
>
>>>> Kit Baum <baum@bc.edu> 02/20/10 9:01 PM >>>
> <>
> Solomon said
>> I have a bivariate probit model where the key variable of interest
>> is continuous. The 'margeff' program in stata gives me the average
>> of the marginal effects at each value of of this variable. But I
>> want to look at how the marginal effects vary with changing values
>> of the variable. Therefore,  I would like to add the marginal
>> effects at each value of this continuous variable to the data and
>> 'margeff' doesn't help me to do that. I would appreciate if anyone
>> has a suggestion as to how to proceed with this.
>
> It is hard to imagine doing this if the variable of interest is really continuous (conceptually taking on a different value for each observation), but if there is a number of discrete values of the variable of interest (e.g, years of education in Rich Williams' example dataset), then you can save the marginal effects computed at each value and attach them to their respective observation:
>
> set more off
> clear all
> use "http://www.indiana.edu/~jslsoc/stata/spex_data/ordwarm2.dta";, clear
> logit  warmlt2 age ed prst
> // for a continuous variable that takes on discrete values,
> // evaluate the average marginal effect at each such value
> margins, dydx(ed) at(ed=(0/20))
> mat ated = r(at)
> mat ame = r(b)
> putmata ed
> mata:
> meff = st_matrix("ated")[.,2], st_matrix("ame")'
> meff = (1::rows(meff)), meff
> // create a new vector that will hold the marginal effect for
> // each observation in the original data
> edme = J(rows(ed),1,.)
> for(i=1;i<=rows(ed);i++) {
> 	edme[i,1] = meff[select(meff[.,1], meff[.,2] :== ed[i]), 3]
> }
> end
> getmata edme, double
> l ed edme in 1/50
> su ed edme
>
>
> Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
>                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
>   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html
>
>
> *
> *   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/
>

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

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