bmelly / Stata

Stata packages
MIT License
1 stars 0 forks source link

cdeco: why group==0 - group==1, not vice versa? #1

Open kalashnov opened 9 months ago

kalashnov commented 9 months ago

I just want to point out, that defining

$$QE(\tau) = Q{<0,0>} - Q{<1,1>}$$ Is very confusing and breaks the usual convention people use, when considering treatment effects:

$$\tau = \mathbb{E}[Y(1)] - \mathbb{E}[Y(0)]$$

https://github.com/bmelly/Stata/blob/b718c3f252b4729c0f04325dc04f4986be2b78ad/cdeco.ado#L200

This leads to code output, which can seem counterintuitive at first, eg consider the following code and output:

E.g. consider the following code and it's output:

cdeco Wages2000 Wages1998, group(black)
---------------------------------------------------------------------------------
                                                   |          P-values 
Null-hypothesis                                    | KS-statistic   CMS-statistic
---------------------------------------------------+-----------------------------
Correct specification of the parametric model 0    |      .19            .78
Correct specification of the parametric model 1    |      .33            .41
Differences between the observable distributions   |
    No effect: QE(tau)=0 for all taus              |        0              0
    Constant effect: QE(tau)=QE(0.5) for all taus  |        0              0
    Stochastic dominance: QE(tau)>0 for all taus   |      .91            .91
    Stochastic dominance: QE(tau)<0 for all taus   |        0              0
Effects of characteristics                         |
    No effect: QTE(tau)=0 for all taus             |        0              0
    Constant effect: QE(tau)=QE(0.5) for all taus  |      .01            .01
    Stochastic dominance: QE(tau)>0 for all taus   |      .94            .94
    Stochastic dominance: QE(tau)<0 for all taus   |        0              0
Effects of coefficients                            |
    No effect: QE(tau)=0 for all taus              |        0              0
    Constant effect: QE(tau)=QE(0.5) for all taus  |      .37            .33
    Stochastic dominance: QE(tau)>0 for all taus   |      .91            .91
    Stochastic dominance: QE(tau)<0 for all taus   |        0              0
---------------------------------------------------------------------------------

(Falsely) assuming that the difference in observed distribution is black=1 - black=0 give a (wrong) result that black wages FOSD white wages

Also the convention used in this package is not alligned with other packages in this repository and with the main paper:

Screenshot 2024-02-03 at 15 24 44

It is also not consistent with analogous result from qrprocess package:

qrprocess wages_pcy2000 wages_pcy1998 black, quantiles(0.01(0.01)0.99) functional
------------------------------------------------------------------------------
                                                   |          P-values 
Null-hypothesis                              Coef. |   KS-stat.     CMS-stat. 
---------------------------------------------------+--------------------------
No effect: beta(tau)=0 for all taus                |
                                    wages_pcy1998  |    0.000         0.000
                                            black  |    0.030         0.000
                                            _cons  |    0.000         0.000
                                       all slopes  |    0.000         0.000
Constant effect: beta(tau)=B for all taus          |
                                    wages_pcy1998  |    0.000         0.000
                                            black  |    0.010         0.070
                                            _cons  |    0.000         0.000
                                       all slopes  |    0.000         0.000
Positive effect: beta(tau)>=0 for all taus         |
                                    wages_pcy1998  |    1.000         1.000
                                            black  |    0.010         0.000
                                            _cons  |    1.000         1.000
                                       all slopes  |    0.040         0.000
Negative effect: beta(tau)<=0 for all taus         |
                                    wages_pcy1998  |    0.000         0.000
                                            black  |    0.960         0.980
                                            _cons  |    0.000         0.000
                                       all slopes  |    0.000         0.000
Location-scale shift                               |
                                    wages_pcy1998  |    0.070         0.230
                                            black  |    0.400         0.270
                                       all slopes  |    0.070         0.220
------------------------------------------------------------------------------

Shouldn't the convention in cdeco package be changed?

bmelly commented 9 months ago

I agree with this comment. I will try to find the time to do it in the following weeks. You already get the "correct" results simply by multiplying all the effects by -1 (or by multiplying the outcome by -1). I also need to add an option for the definition of the counterfactual outcome (X from group 0 and coefficients from group 1, or the opposite).