-------------
      name:  <unnamed>
       log:  K:\Eigene Dateien\abgeschlossen\telecom_regulation_competition\2016 BB Inflation\Submission IREE\data_analysis\prepare_data.smcl
  log type:  smcl
 opened on:  13 Apr 2018, 11:07:48

.
. drop if year == 2015
(34 observations deleted)

. compress
  (0 bytes saved)

. order iso_3 countryname year

. sort iso year

.
. * set up panel
. encode countryname , gen(co1)

. order co1 countryname year

. drop if co1 == .
(0 observations deleted)

. xtset co1 year
       panel variable:  co1 (strongly balanced)
        time variable:   year, 1995 to 2014
                delta:  1 unit

.
. ****************
. * TIME DUMMIES
. ****************
.
. * period dummies
. gen time =.
(680 missing values generated)

. replace time = 4 if year == 2010 | year == 2011 | year == 2012 | year == 2013 | year == 2014
(170 real changes made)

. replace time = 3 if year == 2005 | year == 2006 | year == 2007 | year == 2008 | year == 2009
(170 real changes made)

. replace time = 2 if year == 2000 | year == 2001 | year == 2002 | year == 2003 | year == 2004
(170 real changes made)

. replace time = 1 if year == 1995 | year == 1996 | year == 1997 | year == 1998 | year == 1999
(170 real changes made)

. tab time, gen(periodd)

       time |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        170       25.00       25.00
          2 |        170       25.00       50.00
          3 |        170       25.00       75.00
          4 |        170       25.00      100.00
------------+-----------------------------------
      Total |        680      100.00

. * crisis dummy
. gen crisis = .
(680 missing values generated)

. replace crisis = 1 if year > 2008
(204 real changes made)

. replace crisis = 0 if year < 2009
(476 real changes made)

.
. sort countryname year

.
. * DATA ISSUES WITH COUNTRIES
. * UK dummy
. gen ukdummy = .
(680 missing values generated)

. replace ukdummy = 1 if iso_3 == "GBR" & year == 2007
(1 real change made)

. replace ukdummy = 0 if iso_3 == "GBR" & year != 2007
(19 real changes made)

. replace ukdummy = 0 if iso_3 != "GBR"
(660 real changes made)

. * country cleaning (too short time series; no data on output gaps)
. drop if countryname == "Chile"
(20 observations deleted)

. drop if iso_3 == "SVN"
(20 observations deleted)

. drop if iso_3 == "KOR"
(20 observations deleted)

. drop if iso_3 == "TUR"
(20 observations deleted)

.
. ********************
. * DEFINE VARIABLES
. ********************
. * Delta CPI
. gen cpi = fp_cpi_totl_zg

. sort iso_3 year

. by iso_3: gen cpidiff = cpi - cpi[_n-1]
(30 missing values generated)

.
. * Penetration fixed
. gen population = sp_pop_totl

. gen fixed = ( _I4213TFBB / population) *100
(149 missing values generated)

. by iso_3: gen fixeddiff = fixed - fixed[_n-1]
(181 missing values generated)

.
. * GDP GAP (OECD)
. by iso_3, sort: gen gapoecddelta = gdp_gap_po_OECD  - gdp_gap_po_OECD[_n-1]
(72 missing values generated)

. by iso_3: gen gdpgapdiff = gdp_gap_po_OECD  - gdp_gap_po_OECD[_n-1]
(72 missing values generated)

.
. * Raw materials index (HWWI, base year 2005)
. by iso_3, sort: gen hwwidiff = hwwi_dollar_2005 - hwwi_dollar_2005[_n-1]
(90 missing values generated)

.
. * Foreign Exchange Basket
. gen fx = px_rex_reer_2005
(20 missing values generated)

. by iso_3: gen fxdiff = fx - fx[_n-1]
(49 missing values generated)

.
.
. * trade shares (goods and services)
. gen tradeshare_goods =  tg
(7 missing values generated)

. by iso_3: gen tradegoodsdiff = tradeshare_goods - tradeshare_goods[_n-1]
(37 missing values generated)

.
. * for robustness checks
. gen gdpgr = ny_gdp_mktp_kd_zg
(2 missing values generated)

. gen gdppc = ny_gdp_mktp_kd
(1 missing value generated)

. gen agri_share = nv_agr_totl_zs
(46 missing values generated)

.
. ********************
. * SAMPLE DESCRIPTION
. ********************
. * Correlations
. pwcorr cpi fixed gdp_gap_po_OECD  tradeshare_goods hwwi_dollar fx if cpidiff != . & fixeddiff != . & gdpgapdiff != . & hwwidiff != . & fxdiff != . , sig

             |      cpi    fixed gdp_ga~D trades~s hww~2005       fx
-------------+------------------------------------------------------
         cpi |   1.0000
             |
             |
       fixed |  -0.1669   1.0000
             |   0.0011
             |
gdp_gap_po~D |   0.2629  -0.2363   1.0000
             |   0.0000   0.0000
             |
tradeshare~s |   0.1686   0.0828   0.0426   1.0000
             |   0.0010   0.1096   0.4110
             |
hwwi_do~2005 |   0.0438   0.7813  -0.2356   0.1360   1.0000
             |   0.3965   0.0000   0.0000   0.0084
             |
          fx |  -0.2332   0.0951   0.0421   0.1897   0.2381   1.0000
             |   0.0000   0.0650   0.4145   0.0002   0.0000
             |

. pwcorr cpidiff fixeddiff gdpgapdiff tradegoodsdiff hwwidiff fxdiff if cpidiff != . & fixeddiff != . & gdpgapdiff != . & hwwidiff != . & fxdiff != . , sig

             |  cpidiff fixedd~f gdpgap~f tradeg~f hwwidiff   fxdiff
-------------+------------------------------------------------------
     cpidiff |   1.0000
             |
             |
   fixeddiff |   0.0132   1.0000
             |   0.7983
             |
  gdpgapdiff |   0.3759   0.2085   1.0000
             |   0.0000   0.0000
             |
tradegoods~f |   0.4432   0.0575   0.4818   1.0000
             |   0.0000   0.2669   0.0000
             |
    hwwidiff |   0.5776   0.1073   0.5934   0.6223   1.0000
             |   0.0000   0.0373   0.0000   0.0000
             |
      fxdiff |  -0.0469   0.0730   0.1529  -0.1420   0.1739   1.0000
             |   0.3635   0.1570   0.0029   0.0059   0.0007
             |

.
. * Descriptives
. tabstat cpidiff fixeddiff gdpgapdiff tradegoodsdiff   hwwidiff fxdiff if  cpidiff != . & fixeddiff != . & gdpgapdiff != . & hwwidiff != . & fxdiff != . & ukdummy != . , statistics ( n mean p50 min max) columns(statistics)

variable   |         N      mean       p50       min       max
-------------+--------------------------------------------------
cpidiff   |       377 -.1201843 -.0268924 -8.533443  7.614522
fixeddiff   |       377  2.263357  1.848694 -12.41255  19.03263
gdpgapdiff   |       377 -.3103167  .0855973 -9.817417  5.344656
tradegoods~f   |       375  .7436928  .8954353 -31.58026  21.60353
hwwidiff   |       377  10.26851  15.01836 -61.82095  43.52286
fxdiff   |       377  .6263159  .8433838 -21.03251  16.77142
-------------+--------------------------------------------------

.
. * Coverage
. tab countryname if cpidiff != . & fixeddiff != . & gdpgapdiff != . & hwwidiff != . & fxdiff != .

        Country |      Freq.     Percent        Cum.
----------------+-----------------------------------
      Australia |         10        2.65        2.65
        Austria |         14        3.71        6.37
        Belgium |         15        3.98       10.34
         Canada |         15        3.98       14.32
 Czech Republic |         13        3.45       17.77
        Denmark |         13        3.45       21.22
        Finland |         13        3.45       24.67
         France |         15        3.98       28.65
        Germany |         13        3.45       32.10
         Greece |         10        2.65       34.75
        Hungary |         13        3.45       38.20
        Iceland |         14        3.71       41.91
        Ireland |         11        2.92       44.83
         Israel |         12        3.18       48.01
          Italy |         13        3.45       51.46
          Japan |         15        3.98       55.44
     Luxembourg |         12        3.18       58.62
         Mexico |         13        3.45       62.07
    Netherlands |         13        3.45       65.52
    New Zealand |         13        3.45       68.97
         Norway |         13        3.45       72.41
         Poland |         12        3.18       75.60
       Portugal |         14        3.71       79.31
Slovak Republic |         11        2.92       82.23
          Spain |         13        3.45       85.68
         Sweden |         13        3.45       89.12
    Switzerland |         13        3.45       92.57
 United Kingdom |         13        3.45       96.02
  United States |         15        3.98      100.00
----------------+-----------------------------------
          Total |        377      100.00

.
. ********************
. * graphs (Annex)
. set scheme s2mono

.
. #delimit ;
delimiter now ;
. xtline cpi cpidiff  , subtitle(,nobox)
>         graphregion(lcolor(white) fcolor(white) ifcolor(white) icolor(white) )
>         plotregion( ifcolor(white) fcolor(white) lcolor(white) icolor(white) )
>         legend (region(lpattern(blank)) bcolor(white) label(1 "CPI (annual change in %)") label(2 "CPI (annual change in %), 1st diff.")  cols(2))
>         bcolor(white)
> ;

. #delimit ;
delimiter now ;
. xtline fixed fixeddiff, subtitle(,nobox)
>         graphregion(lcolor(white) fcolor(white) icolor(white) )
>         plotregion( fcolor(white) lcolor(white) icolor(white) )
>         legend (region(lpattern(blank)) bcolor(white) label(1 "Fixed b.b. penetration") label(2 "Fixed b.b. penetration, 1st diff.")  cols(2))
> ;

. #delimit ;
delimiter now ;
. xtline cpidiff fixeddiff, subtitle(,nobox)
>         graphregion(lcolor(white) fcolor(white) icolor(white) )
>         plotregion( fcolor(white) lcolor(white) icolor(white) )
>         legend (region(lpattern(blank)) bcolor(white)
>         label(1 "CPI (annual change in %), 1st diff.") label(2 "Fixed b.b. penetration, 1st diff.")  cols(2))
> ;

. #delimit cr
delimiter now cr
.
.
. ********* Original estimate: M.H. Yi, C. Choi / Journal of Policy Modeling 27 (2005) 885–889
. * log ratio
. gen logfixed = log(fixed)
(149 missing values generated)

.
. * Growth of Quasi Money
. by iso_3: gen m2gr_itu = (fm_lbl_mqmy_cn - fm_lbl_mqmy_cn[_n-1] ) / fm_lbl_mqmy_cn[_n-1]
(466 missing values generated)

.
. by iso_3: gen m2gr = (m2 - m2[_n-1] ) / m2[_n-1]
(477 missing values generated)

.
. * unemployment rate
. gen unemp = sl_uem_totl_zs

.
. * CLOSE LOG
. log close
      name:  <unnamed>
       log:  K:\Eigene Dateien\abgeschlossen\telecom_regulation_competition\2016 BB Inflation\Submission IREE\data_analysis\prepare_data.smcl
  log type:  smcl
 closed on:  13 Apr 2018, 11:08:11
-------------