查看原文
其他

synth与synth_runner命令之后合成控制法最新推荐:allsynth操作与应用

数量经济学 数量经济学 2022-12-31

synth与synth_runner命令之后合成控制法最新推荐:allsynth: Synthetic Control Bias-Correction Utilities for Stata

1、简介:

为Abadie、Diamond和Hainmueller(2010)创建的synth包添加功能。允许:估计校正偏差的差距/“治疗效果”;从安慰剂运行中计算RMSPE-p值;大大扩展了图形;和额外的功能

数据必须使用tsset panelvar timevar或xtset panelvar timevar声明为一个(平衡的)面板。在depvar和predictorvars中指定的变量必须是数值型的,不能缩写。

必须安装synth和distinct命令。allsynth中的一些选项还需要安装elasticregress命令。在实现allsynth之前,应该先理解synth命令。

Synth在比较案例研究中实施了因果推理的综合控制方法。Synth通过比较一个受干预影响的单元的总体结果depvar的演变和一个综合对照组的相同总体结果的演变,来估计一个感兴趣的干预的效果。

Synth通过搜索控制单元的加权组合来构建这个综合控制组,选择这些控制单元来近似结果预测器中受干预影响的单元。合成对照组结果的演变是对在没有干预的情况下,受影响单位所观察到的反事实的估计。Synth还可以用于执行各种安慰剂和置换测试,这些检验可以产生信息推断,而不管可用比较单元的数量和可用时间段的数量。详见Abadie and Gardeazabal(2003)和Abadie, Diamond, and Hainmueller(2010, 2014)。

语法格式为:

 synth depvar predictorvars , trunit(#) trperiod(#) [ counit(numlist) xperiod(numlist) mspeperiod() resultsperiod() nested allopt unitnames(varname) figure keep(file) customV(numlist) optsettings ]

选项含义为:depvar :结果变量。

predictorvars:。默认情况下,所有预测变量在整个预干预时期内取平均值,从tsset timevar中指定的面板时间变量中最早可用的时间段到trperiod中指定的干预之前的时间段。丢失的值在平均值中被忽略。

用户有两个选项来灵活地指定预测器的平均时间周期:

(1) xperiod(numlist)允许指定一个共同的周期,所有的预测器应该被平均

(2)对于每个特定的预测器,用户可以指定变量将被平均的周期。为此,synth使用专门的语法。时间周期是在变量名后面的括号中指定的,例如varname(period),变量名和它的周期之间没有空格。Period可以包含一个Period,一个Period的数字列表,或者由“&”连接的几个Period。周期指的是tsset timevar中指定的面板时间变量。例如,假设时间周期以年为单位,有四个预测因子X1、X2、X3、X4,则:

synth Y X1(1980) X2(1982&1986&1988) X3(1980(1)1990) X4

表明:

X1(1980): 1980年变量X1的值作为预测器输入。

X2(1982&1986&1988):变量X2在1982年、1986年和1988年的平均值作为预报器输入。

X3(1980(1)1990):变量X3在1980、1981、…年的平均值。,1990作为预报器输入。

X4:由于没有提供变量特定的周期,所以变量X4的值在整个预处理周期(默认)或在xperiod(numlist)和中指定的周期内取平均值然后作为预测者进入。

Trunit(#)受干预影响的单元的单元号,在tsset panelvar中指定的面板id变量中给出;参考tsset。注意,只能指定单个单元号。如果感兴趣的干预影响多个单元,用户可以选择先组合这些单元,然后将它们作为受干预影响的单个单元。

trperiod(#)干预发生的时间段。时段指tsset timevar中指定的面板时间变量;参考tsset。只能指定一个数字。

案例应用1

除了直接使用synth包,allsynth的代码借鉴了Jens Hainmueller的synth代码和synth_runner运行的代码(Galiani和Quistorff, 2018)。

1、与synth帮助文件中产生相同的结果:

#delimit ;
allsynth
cigsale beer(1984(1)1988) lnincome retprice age15to24
cigsale(1988) cigsale(1980) cigsale(1975),
trunit(3) trperiod(1989)
#delimit cr


2、Also lets you know that you haven’t properly specified bias-correction:


3、如果我们指定的预测变量太少,我们会得到一个警告消息:


#delimit ;
allsynth
cigsale beer retprice cigsale(1980),
trunit(3) trperiod(1989)
#delimit cr

4、allsynth:可以计算、显示和保存经典的和偏误校正的“间隙”

Add keep(smokingresults) replace figure bcorrect(replace figure):

#delimit ;
allsynth
cigsale beer(1984(1)1988) lnincome retprice age15to24
cigsale(1988) cigsale(1980) cigsale(1975),
trunit(3) trperiod(1989)
keep(smokingresults) replace figure
bcor(replace figure)
#delimit cr

The bias-corrected outcome values are only useful to calculate the bias-corrected gaps!

Also add gapfig(classic bcorrect lineback). Drop fig and bcor(figure):

#delimit ;
allsynth
cigsale beer(1984(1)1988) lnincome retprice age15to24
cigsale(1988) cigsale(1980) cigsale(1975),
trunit(3) trperiod(1989)
keep(smokingresults) replace
bcorrect(replace) gapfig(classic bcorrect lineback)
#delimit cr

5、allsynth: Can run placebo tests, calculate p-values, and graph- permutation distributions

#delimit ;
allsynth
cigsale beer(1984(1)1988) lnincome retprice age15to24
cigsale(1988) cigsale(1980) cigsale(1975),
trunit(3) trperiod(1989)
bcor(replace figure) gapfig(bcorrect placebos lineback)
pval plac keep(smokingresults) rep
#delimit cr


案例应用2

allsynth一共提供了如下案例,下面展现操作结果为:

1例1


 
          *========================================
          *           高级计量经济学
          *========================================
    
      
          *        计量经济学服务中心
      

*-------------------------------------------------------------------------------     
*        参考资料:
*        《初级计量经济学及Stata应用:Stata从入门到进阶》             
*        《高级计量经济学及Stata应用:Stata回归分析与应用》
*        《量化社会科学方法》
*        《社会科学因果推断》
*        《面板数据计量分析方法》
*        《时间序列计量分析方法》
*        《高级计量经济学及Eviews应用》
*        《R、Python、Mtalab初高级教程》
*        《空间计量入门:空间计量在Geoda、GeodaSpace中的应用》 
*        《零基础|轻松搞定空间计量:空间计量及GeoDa、Stata应用》
*        《空间计量第二部:空间计量及Matlab应用课程》
*        《空间计量第三部:空间计量及Stata应用课程》
*        《空间计量第四部:《空间计量及ArcGis应用课程》
*        《空间计量第五部:空间计量经济学》
*        《空间计量第六部:《空间计量及Python应用》
*        《空间计量第七部:《空间计量及R应用》
*        《空间计量第八部:《高级空间计量经济学》
*-------------------------------------------------------------------------------




*-------------------------------------------------------------------------------
*allsynth命令操作

*1、导入数据

use "E:\计量经济学服务中心\smoking.dta"


*2、面板设定

tsset state year

 
*3、Example 1 - Construct synthetic control group:
    synth cigsale beer(1984(1)1988) lnincome retprice age15to24 cigsale(1988) cigsale(1980) cigsale(1975), trunit(3) trperiod(1989)



案例2

*4、Example 2 - Construct synthetic control group:
    synth cigsale beer lnincome(1980&1985) retprice cigsale(1988) cigsale(1980) cigsale(1975), trunit(3) trperiod(1989) fig



结果为:


. *4、Example 2 - Construct synthetic control group:
.     synth cigsale beer lnincome(1980&1985) retprice cigsale(1988) cigsale(1980) cigsale(1975), trunit(3) trperiod(1989) fig
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
control units: for 38 of out 38 units missing obs for predictor beer in period 1970 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1971 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1972 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1973 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1974 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1975 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1976 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1977 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1978 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1979 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1980 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1981 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1982 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1983 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1970 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1971 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1972 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1973 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1974 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1975 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1976 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1977 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1978 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1979 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1980 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1981 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1982 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1983 -ignored for averaging
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: California
               Control Units: Alabama, Arkansas, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: beer lnincome(1980&1985) retprice cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |    1.9529 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
       Alabama |           0
      Arkansas |           0
      Colorado |        .292
   Connecticut |        .102
      Delaware |           0
       Georgia |           0
         Idaho |           0
      Illinois |           0
       Indiana |           0
          Iowa |           0
        Kansas |           0
      Kentucky |           0
     Louisiana |           0
         Maine |           0
     Minnesota |           0
   Mississippi |           0
      Missouri |           0
       Montana |           0
      Nebraska |           0
        Nevada |        .241
 New Hampshire |           0
    New Mexico |           0
North Carolina |           0
  North Dakota |           0
          Ohio |           0
      Oklahoma |           0
  Pennsylvania |           0
  Rhode Island |           0
South Carolina |           0
  South Dakota |           0
     Tennessee |           0
         Texas |           0
          Utah |        .365
       Vermont |           0
      Virginia |           0
 West Virginia |           0
     Wisconsin |           0
       Wyoming |           0
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                          beer |     24.28   23.22086 
           lnincome(1980&1985) |  10.06877    9.89557 
                      retprice |  66.63684   65.37821 
                 cigsale(1988) |      90.1    92.5857 
                 cigsale(1980) |     120.2   120.4157 
                 cigsale(1975) |     127.1   126.6126 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------


end of do-file


案例3

*5、Example 3 - Construct synthetic control group:

synth cigsale retprice cigsale(1970) cigsale(1979) , trunit(33) counit(1(1)20) trperiod(1980) fig resultsperiod(1970(1)1990)



. *5、Example 3 - Construct synthetic control group:
.     synth cigsale retprice cigsale(1970) cigsale(1979) , trunit(33) counit(1(1)20) trperiod(1980) fig resultsperiod(1970(1)1990)
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: Texas
               Control Units: Alabama, Arkansas, California, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa,
                              Kansas, Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1970) cigsale(1979)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  .9465555 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

-------------------------
      Co_No | Unit_Weight
------------+------------
    Alabama |           0
   Arkansas |        .698
 California |           0
   Colorado |           0
Connecticut |         .28
   Delaware |           0
    Georgia |           0
      Idaho |           0
   Illinois |           0
    Indiana |           0
       Iowa |           0
     Kansas |           0
   Kentucky |        .022
  Louisiana |           0
      Maine |           0
  Minnesota |           0
Mississippi |           0
   Missouri |           0
    Montana |           0
   Nebraska |           0
-------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |     50.17   49.14478 
                 cigsale(1970) |     106.4    107.037 
                 cigsale(1979) |     126.4   125.8968 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------


end of do-file






案例4

.     *6、Example 4 - Construct synthetic control group:
.     synth cigsale retprice cigsale(1970) cigsale(1979) , trunit(33) counit(1(1)20) trperiod(1980) resultsperiod(1970(1)1990) keep(re
> sout1)
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: Texas
               Control Units: Alabama, Arkansas, California, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa,
                              Kansas, Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1970) cigsale(1979)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  .9465555 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

-------------------------
      Co_No | Unit_Weight
------------+------------
    Alabama |           0
   Arkansas |        .698
 California |           0
   Colorado |           0
Connecticut |         .28
   Delaware |           0
    Georgia |           0
      Idaho |           0
   Illinois |           0
    Indiana |           0
       Iowa |           0
     Kansas |           0
   Kentucky |        .022
  Louisiana |           0
      Maine |           0
  Minnesota |           0
Mississippi |           0
   Missouri |           0
    Montana |           0
   Nebraska |           0
-------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |     50.17   49.14478 
                 cigsale(1970) |     106.4    107.037 
                 cigsale(1979) |     126.4   125.8968 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------


end of do-file





案例5


*7、Example 5 - Construct synthetic control group:
.     synth cigsale beer lnincome retprice age15to24 cigsale(1988) cigsale(1980) cigsale(1975) , trunit(3) trperiod(1989) xperiod(1980
> (1)1988) nested
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
control units: for 38 of out 38 units missing obs for predictor beer in period 1980 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1981 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1982 -ignored for averaging
control units: for 38 of out 38 units missing obs for predictor beer in period 1983 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1980 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1981 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1982 -ignored for averaging
treated unit: for 1 of out 1 units missing obs for predictor beer in period 1983 -ignored for averaging
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: California
               Control Units: Alabama, Arkansas, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: beer lnincome retprice age15to24 cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
Nested optimization requested
Starting nested optimization module
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  1.756235 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
       Alabama |           0
      Arkansas |           0
      Colorado |         .16
   Connecticut |        .068
      Delaware |           0
       Georgia |           0
         Idaho |           0
      Illinois |           0
       Indiana |           0
          Iowa |           0
        Kansas |           0
      Kentucky |           0
     Louisiana |           0
         Maine |           0
     Minnesota |           0
   Mississippi |           0
      Missouri |           0
       Montana |          .2
      Nebraska |           0
        Nevada |        .236
 New Hampshire |           0
    New Mexico |        .001
North Carolina |           0
  North Dakota |           0
          Ohio |           0
      Oklahoma |           0
  Pennsylvania |           0
  Rhode Island |           0
South Carolina |           0
  South Dakota |           0
     Tennessee |           0
         Texas |           0
          Utah |        .335
       Vermont |           0
      Virginia |           0
 West Virginia |           0
     Wisconsin |           0
       Wyoming |           0
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                          beer |     24.28   24.22528 
                      lnincome |  10.07656   9.858689 
                      retprice |  89.42222   89.42717 
                     age15to24 |  .1735324   .1735425 
                 cigsale(1988) |      90.1    91.6735 
                 cigsale(1980) |     120.2   120.4819 
                 cigsale(1975) |     127.1   127.1169 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------


end of do-file




.     . tempname resmat

.         forvalues i = 1/4 {
  2.         synth cigsale retprice cigsale(1988) cigsale(1980) cigsale(1975) , trunit(`i') trperiod(1989) xperiod(1980(1)1988)
  3.         matrix `resmat'
 = nullmat(`resmat') \ e(RMSPE)
  4.         local names `"`names'
 `"`i'"'"'
  5.         }
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: Alabama
               Control Units: Arkansas, California, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  3.263624 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
      Arkansas |         .38
    California |        .003
      Colorado |        .002
   Connecticut |         .08
      Delaware |        .002
       Georgia |           0
         Idaho |        .002
      Illinois |        .003
       Indiana |        .001
          Iowa |        .004
        Kansas |        .003
      Kentucky |           0
     Louisiana |        .002
         Maine |        .003
     Minnesota |        .006
   Mississippi |        .005
      Missouri |        .002
       Montana |        .002
      Nebraska |        .004
        Nevada |        .001
 New Hampshire |           0
    New Mexico |        .004
North Carolina |        .001
  North Dakota |        .003
          Ohio |        .002
      Oklahoma |        .002
  Pennsylvania |        .006
  Rhode Island |        .002
South Carolina |           0
  South Dakota |        .004
     Tennessee |        .329
         Texas |        .003
          Utah |        .117
       Vermont |        .001
      Virginia |        .001
 West Virginia |        .006
     Wisconsin |        .009
       Wyoming |        .001
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |  89.34445   88.99184 
                 cigsale(1988) |     112.1   111.6308 
                 cigsale(1980) |     123.2   122.6581 
                 cigsale(1975) |     111.7   111.1823 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: Arkansas
               Control Units: Alabama, California, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  2.709974 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
       Alabama |           0
    California |           0
      Colorado |           0
   Connecticut |        .076
      Delaware |           0
       Georgia |           0
         Idaho |           0
      Illinois |           0
       Indiana |           0
          Iowa |           0
        Kansas |           0
      Kentucky |           0
     Louisiana |           0
         Maine |           0
     Minnesota |           0
   Mississippi |           0
      Missouri |           0
       Montana |           0
      Nebraska |           0
        Nevada |           0
 New Hampshire |           0
    New Mexico |           0
North Carolina |           0
  North Dakota |           0
          Ohio |           0
      Oklahoma |           0
  Pennsylvania |           0
  Rhode Island |           0
South Carolina |           0
  South Dakota |           0
     Tennessee |        .797
         Texas |        .122
          Utah |           0
       Vermont |        .005
      Virginia |           0
 West Virginia |           0
     Wisconsin |           0
       Wyoming |           0
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |  89.87778    87.4734 
                 cigsale(1988) |     121.5   120.2454 
                 cigsale(1980) |     131.8   129.5282 
                 cigsale(1975) |     114.8   116.8725 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: California
               Control Units: Alabama, Arkansas, Colorado, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  2.506648 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
       Alabama |        .001
      Arkansas |        .001
      Colorado |        .001
   Connecticut |        .001
      Delaware |        .001
       Georgia |        .001
         Idaho |        .003
      Illinois |        .001
       Indiana |           0
          Iowa |        .001
        Kansas |        .001
      Kentucky |           0
     Louisiana |        .001
         Maine |        .001
     Minnesota |        .002
   Mississippi |        .001
      Missouri |        .001
       Montana |           0
      Nebraska |        .002
        Nevada |        .184
 New Hampshire |        .103
    New Mexico |        .002
North Carolina |           0
  North Dakota |        .136
          Ohio |        .001
      Oklahoma |        .002
  Pennsylvania |        .001
  Rhode Island |        .001
South Carolina |        .001
  South Dakota |        .002
     Tennessee |        .001
         Texas |        .002
          Utah |        .541
       Vermont |        .001
      Virginia |           0
 West Virginia |        .001
     Wisconsin |        .001
       Wyoming |        .001
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |  89.42222   89.51467 
                 cigsale(1988) |      90.1    90.2082 
                 cigsale(1980) |     120.2   120.2658 
                 cigsale(1975) |     127.1   127.1016 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Synthetic Control Method for Comparative Case Studies
--------------------------------------------------------------------------------------------------------------------------------------

First Step: Data Setup
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Data Setup successful
--------------------------------------------------------------------------------------------------------------------------------------
                Treated Unit: Colorado
               Control Units: Alabama, Arkansas, California, Connecticut, Delaware, Georgia, Idaho, Illinois, Indiana, Iowa, Kansas,
                              Kentucky, Louisiana, Maine, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire,
                              New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Pennsylvania, Rhode Island, South Carolina,
                              South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, West Virginia, Wisconsin, Wyoming
--------------------------------------------------------------------------------------------------------------------------------------
          Dependent Variable: cigsale
  MSPE minimized for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Results obtained for periods: 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
                              1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
--------------------------------------------------------------------------------------------------------------------------------------
                  Predictors: retprice cigsale(1988) cigsale(1980) cigsale(1975)
--------------------------------------------------------------------------------------------------------------------------------------
Unless period is specified
predictors are averaged over: 1980 1981 1982 1983 1984 1985 1986 1987 1988
--------------------------------------------------------------------------------------------------------------------------------------

Second Step: Run Optimization
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Optimization done
--------------------------------------------------------------------------------------------------------------------------------------

Third Step: Obtain Results
--------------------------------------------------------------------------------------------------------------------------------------
Loss: Root Mean Squared Prediction Error

---------------------
   RMSPE |  9.246514 
---------------------
--------------------------------------------------------------------------------------------------------------------------------------
Unit Weights:

----------------------------
         Co_No | Unit_Weight
---------------+------------
       Alabama |           0
      Arkansas |           0
    California |           0
   Connecticut |           0
      Delaware |           0
       Georgia |           0
         Idaho |           0
      Illinois |           0
       Indiana |           0
          Iowa |           0
        Kansas |           0
      Kentucky |           0
     Louisiana |           0
         Maine |           0
     Minnesota |           0
   Mississippi |           0
      Missouri |           0
       Montana |           0
      Nebraska |           0
        Nevada |           0
 New Hampshire |           0
    New Mexico |           0
North Carolina |           0
  North Dakota |        .114
          Ohio |           0
      Oklahoma |           0
  Pennsylvania |           0
  Rhode Island |           0
South Carolina |        .051
  South Dakota |           0
     Tennessee |           0
         Texas |           0
          Utah |        .271
       Vermont |           0
      Virginia |           0
 West Virginia |           0
     Wisconsin |           0
       Wyoming |        .564
----------------------------
--------------------------------------------------------------------------------------------------------------------------------------
Predictor Balance:

------------------------------------------------------
                               |   Treated  Synthetic 
-------------------------------+----------------------
                      retprice |  82.62222    83.9622 
                 cigsale(1988) |      94.6     95.644 
                 cigsale(1980) |       131   130.5943 
                 cigsale(1975) |       131   131.2727 
------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------

.         mat colnames `resmat' = "RMSPE"

.         mat rownames `resmat'
 = `names'

.         matlist `resmat'
 , row("Treated Unit")

Treated Unit |     RMSPE 
-------------+-----------
           1 |  3.263624 
           2 |  2.709974 
           3 |  2.506648 
           4 |  9.246514 


end of do-file



您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存