Bookmark and Share

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


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

Re: st: biprobit postestimation (marginal effects)


From   Austin Nichols <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: biprobit postestimation (marginal effects)
Date   Thu, 19 Sep 2013 13:46:37 -0400

Fabian Guy <[email protected]>:
You have to work out for yourself what conditional probabilities you
want to calculate differences in, and what values to set covariates
to, and whether those make sense, but here is a (fake) example to see
the "impact" of lagged smsa on current fy, no economic meaning or
warranty of fitness implied:

clear all
webuse psidextract
g fy=wks>50 if wks<.
tsset id t
g lfy=L.fy
g lsmsa=L.smsa
qui probit fy lsmsa ed blk south
est sto fy1
qui margins, dydx(*) post
est sto fy2
qui probit smsa lfy ed blk south
est sto smsa1
qui margins, dydx(*) post
est sto smsa2
prog mdp, eclass
version 12.1
 if replay() eret di
 else {
tempvar touse xtmp pr1 pr0 dp
tempname beta
syntax [anything], x(varname) [*]
biprobit `anything', `options'
g byte `touse'=e(sample)
loc ys=e(depvar)
loc y1:word 1 of `ys'
loc y2:word 2 of `ys'
ren `x' `xtmp'
g byte `x'=0
tempvar p00 p01 p10 p11
predict double `p11', p11
predict double `p10', p10
predict double `p01', p01
predict double `p00', p00
g double `pr0'=`p11'/(`p11'+`p01') if `y2'==1
 replace `pr0'=`p10'/(`p10'+`p00') if `y2'==0
replace `x'=1
tempvar p00 p01 p10 p11
predict double `p11', p11
predict double `p10', p10
predict double `p01', p01
predict double `p00', p00
g double `pr1'=`p11'/(`p11'+`p01') if `y2'==1
 replace `pr1'=`p10'/(`p10'+`p00') if `y2'==0
g double `dp'=`pr1'-`pr0'
su `dp' if `touse', mean
drop `x'
ren `xtmp' `x'
mat `beta'=r(mean)
mat colname `beta'=`x'
mat rowname `beta'=`y1'
qui count if `touse'
loc N=r(N)
eret post `beta', esample(`touse') dep(`y1') obs(`N') prop(b)
eret scalar N = `N'
eret loc depvar "`y1'"
eret loc cmd "mdp"
  }
end
qui biprobit (fy lsmsa ed blk south) (smsa lfy ed blk south)
est sto biprobit
mat bp=e(b)
bs:mdp (fy lsmsa ed blk south) (smsa lfy ed blk south), x(lsmsa) from(bp)
est sto dp
est tab fy1 fy2 biprobit dp, se


On Thu, Sep 19, 2013 at 12:00 PM, Fabian Guy <[email protected]> wrote:
> Thanks for the reply and sorry for being unprecise at the points a. to c.
>
> Basically I'd like to compute the following two marginal effects:
> 1.  dP(y1==1|X,L.y1,y2,L.y2)/dL.y2 and dP(y1==1|X,L.y1,y2,L.y2)/dX_j
> (marginal effect of the binary lagged variable & marginal effect of a
> regressor j)
> 2. dP(y1==1|X,L.y1,y2,L.y2)/dy2
>
> Do you know any reference or minimal example where I can look up how
> to calculate these kind of marginal effects using the command predict?
>
> Thank you very much.
>
> 2013/9/19 Fabian Guy <[email protected]>:
>> Thanks for the reply and sorry for being unprecise at the points a. to c.
>>
>> Basically I'd like to compute the following two marginal effects:
>> 1.  dP(y1==1|X,L.y1,y2,L.y2)/dL.y2 and dP(y1==1|X,L.y1,y2,L.y2)/dX_j
>> (marginal effect of the binary lagged variable & marginal effect of a
>> regressor j)
>> 2. dP(y1==1|X,L.y1,y2,L.y2)/dy2
>>
>> Do you know any reference or minimal example where I can look up how to
>> calculate these kind of marginal effects using the command predict?
>>
>> Thank you very much.
>>
>>
>>
>> 2013/9/19 Austin Nichols <[email protected]>
>>>
>>> Fabian Guy <[email protected]>:
>>>
>>> You have to write a program to predict the relevant probabilities and
>>> calculate differences, then you can bootstrap the program to get SE
>>> for your marginal effects. You should not assume "X is at the mean of
>>> the sample" rather than simply predicting the relevant probability for
>>> each sample case, then averaging across the sample, to get the mean
>>> marginal effects rather than marginal effects at the mean; you would
>>> not want a marginal effect for a sample case that is half female and
>>> half male rather than the half the effect for males plus half the
>>> effect for females.
>>>
>>> On a more practical note, it is convenient to rename the variable for
>>> which you want to impose a counterfactual value, then generate a new
>>> variable with that name e.g. generate y2=0, predict, then drop the new
>>> variable and rename back to your original data.
>>>
>>> I can't tell how many marginal effects you really want to estimate in
>>> your a,b,c below, given the 0 (1) notations, but perhaps you can
>>> explain what the primary marginal effect of interest is.  For
>>> instance, in item a, I would guess you want to know
>>> dPr(y1==1|X,L.y1,y2,L.y2)/dL.y2 which means you average over the y2
>>> and L.y1 and L.y2 possibilities, perhaps using observed lag values but
>>> probabilities of y2 in your sample.
>>>
>>> On Thu, Sep 19, 2013 at 6:10 AM, Fabian Guy <[email protected]> wrote:
>>> > Dear Stata-Experts,
>>> > I need your advice with a simple biprobit postestimation analysis. I
>>> > think the problem that I have could be solved in a straightforward
>>> > manner, but since I am not that familiar with Stata I would like to
>>> > make sure that I do not mess things up.
>>> >
>>> > So, suppose I have a panel of i=1,...,I individuals and for each
>>> > individual I have observation over time t=1,...,T.
>>> > I estimate the following _pooled_ bivariate probit model:
>>> > (y1 = L.y2 X)
>>> > (y2 = L.y1 X)
>>> > where X = common regressors in both equations (continuous, no binary
>>> > variable included in this set). The estimation turns out that
>>> > estimating a two equation probit is important, since the correlation
>>> > parameter of the errors is significantly different from zero.
>>> >
>>> > I would like to compute the following marginal effects:
>>> > a) Given X is at the mean of the sample, y2=0 (1), and L.y1=0 (1),
>>> > what is the increase/decrease in the probability of y1=1 if L.y2
>>> > increases from 0 to 1?
>>> > b) Given X_subset is at the mean, y2=0 (1), and L.y1=0 (1), what is
>>> > the increase/decrease in the probability of y1=1 if X_j increases by
>>> > one unit?
>>> > c) Given X is at the mean, L.y2 = 0 (1) y2=1 (0), and L.y1 = 0 (1),
>>> > what is the Prob. of y1=1?
>>> >
>>> > For me it looks like that those marginal effects could be typically
>>> > requested using biprobit. Do I have to use margins or predict for
>>> > these calculations? Do I have to code this by my own or is there a
>>> > Stata command with some options (like predict/margins) that could
>>> > provide me a solution to those calculations?
>>> >
>>> > A possible variation would be to set L. variables as well to their
>>> > average, however, I think it does not make much sense for dichotomous
>>> > variables.
>>> >
>>> > I appreciate any advice very much.
>>> >
>>> > Best,
>>> > Fabian
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index