The package is a panel adaptation of the gets package see see here.
This code is being developed by Felix Pretis and Moritz Schwarz. The associated working paper is published under “Panel Break Detection: Detecting Unknown Treatment, Stability, Heterogeneity, and Outliers” by Pretis and Schwarz, which is available at SSRN here.
You can install the released version of getspanel from CRAN with:
install.packages("getspanel")
And the development version from GitHub with:
# install.packages("devtools")
::install_github("moritzpschwarz/getspanel") devtools
library(getspanel)
data("EU_emissions_road")
<- c("Austria", "Belgium", "Germany", "Denmark", "Spain", "Finland",
subset_EU15 "France", "Greece", "Ireland", "Italy", "Luxembourg", "Netherlands","Portugal", "Sweden", "United Kingdom")
<- EU_emissions_road[EU_emissions_road$country %in% subset_EU15, ]
EU_emissions_road
<- isatpanel(data = EU_emissions_road,
is1 formula = transport.emissions ~ lgdp + lpop,
index = c("country","year"),
effect = "twoways",
fesis = TRUE,
print.searchinfo = FALSE # to save space we suppress the status information in the estimation
)
is1
: Tue Oct 11 22:22:54 2022
Date: y
Dependent var.: Ordinary Least Squares (OLS)
Method-Covariance: Ordinary
Varianceobservations (mean eq.): 720
No. of : 1 to 720
Sample
:
SPECIFIC mean equation
-stat p-value
coef std.error t-8544.9 2319.1 -3.6845 0.0002486 ***
lgdp 3805.8 7072.2 0.5381 0.5906719
lpop 4274.3 2043.0 2.0922 0.0368149 *
idBelgium -2664.8 3066.9 -0.8689 0.3852402
idDenmark -6504.6 2855.6 -2.2779 0.0230635 *
idFinland 76891.2 11146.3 6.8983 1.267e-11 ***
idFrance 95573.1 13389.2 7.1381 2.576e-12 ***
idGermany -6335.6 2358.2 -2.6866 0.0074053 **
idGreece -17559.0 4251.5 -4.1301 4.108e-05 ***
idIreland 51941.9 11492.0 4.5198 7.373e-06 ***
idItaly -19579.9 17644.9 -1.1097 0.2675620
idLuxembourg 9878.4 3654.9 2.7028 0.0070586 **
idNetherlands -13847.2 2926.9 -4.7309 2.752e-06 ***
idPortugal 26281.4 9483.6 2.7712 0.0057464 **
idSpain 5772.1 1467.4 3.9336 9.281e-05 ***
idSweden 71674.8 11502.5 6.2312 8.394e-10 ***
idUnitedKingdom 164694.5 78288.9 2.1037 0.0357963 *
time1971 166697.1 78291.3 2.1292 0.0336196 *
time1972 168798.7 78286.3 2.1562 0.0314421 *
time1973 168090.5 78311.0 2.1464 0.0322126 *
time1974 169229.5 78359.2 2.1597 0.0311694 *
time1975 171162.4 78370.9 2.1840 0.0293242 *
time1976 172672.3 78381.7 2.2030 0.0279527 *
time1977 173404.0 78408.0 2.2116 0.0273496 *
time1978 174686.2 78411.1 2.2278 0.0262390 *
time1979 175036.3 78425.6 2.2319 0.0259685 *
time1980 173981.1 78456.6 2.2175 0.0269363 *
time1981 174638.0 78465.5 2.2257 0.0263841 *
time1982 174009.8 78486.7 2.2171 0.0269696 *
time1983 175197.8 78482.9 2.2323 0.0259400 *
time1984 175966.5 78477.5 2.2423 0.0252866 *
time1985 178003.6 78471.4 2.2684 0.0236378 *
time1986 177602.8 78455.3 2.2637 0.0239238 *
time1987 179349.0 78449.9 2.2862 0.0225708 *
time1988 181676.6 78457.7 2.3156 0.0208954 *
time1989 184188.7 78469.4 2.3473 0.0192153 *
time1990 186004.6 78501.0 2.3695 0.0181100 *
time1991 187439.1 78528.6 2.3869 0.0172809 *
time1992 186694.7 78559.7 2.3765 0.0177724 *
time1993 187225.9 78566.4 2.3830 0.0174618 *
time1994 187945.6 78571.2 2.3920 0.0170425 *
time1995 189158.1 78579.2 2.4072 0.0163562 *
time1996 190048.3 78577.3 2.4186 0.0158577 *
time1997 191989.8 78575.8 2.4434 0.0148199 *
time1998 193511.7 78574.7 2.4628 0.0140489 *
time1999 194083.9 78574.7 2.4701 0.0137688 *
time2000 193751.0 78575.7 2.4658 0.0139324 *
time2001 194470.6 78599.6 2.4742 0.0136120 *
time2002 195708.3 78653.1 2.4882 0.0130907 *
time2003 196762.8 78672.1 2.5010 0.0126314 *
time2004 196528.2 78698.4 2.4972 0.0127668 *
time2005 197151.9 78718.2 2.5045 0.0125091 *
time2006 197502.9 78741.6 2.5082 0.0123797 *
time2007 195755.6 78785.9 2.4847 0.0132223 *
time2008 193794.3 78850.7 2.4577 0.0142456 *
time2009 193455.7 78869.7 2.4529 0.0144386 *
time2010 192842.4 78888.6 2.4445 0.0147745 *
time2011 190772.0 78922.4 2.4172 0.0159186 *
time2012 190987.4 78949.3 2.4191 0.0158361 *
time2013 191602.8 78967.6 2.4263 0.0155269 *
time2014 192490.6 78979.5 2.4372 0.0150719 *
time2015 193349.8 79000.3 2.4475 0.0146546 *
time2016 193936.6 79016.4 2.4544 0.0143778 *
time2017 193549.0 79030.9 2.4490 0.0145913 *
time2018 .1987 -5813.0 1429.7 -4.0658 5.382e-05 ***
fesisAustria.1989 -5272.4 1400.4 -3.7650 0.0001819 ***
fesisBelgium.1978 20291.0 2180.3 9.3067 < 2.2e-16 ***
fesisGermany.1987 29019.1 1860.1 15.6008 < 2.2e-16 ***
fesisGermany.2003 -12626.6 1565.9 -8.0634 3.658e-15 ***
fesisGermany.1988 -11190.2 1436.9 -7.7878 2.756e-14 ***
fesisDenmark.1993 20950.9 1822.2 11.4978 < 2.2e-16 ***
fesisSpain.2001 16109.9 1841.2 8.7498 < 2.2e-16 ***
fesisSpain.1991 -10796.4 1346.2 -8.0200 5.045e-15 ***
fesisFinland.1988 25862.9 1454.3 17.7840 < 2.2e-16 ***
fesisFrance.1987 23772.3 1429.0 16.6354 < 2.2e-16 ***
fesisUnitedKingdom.1987 -6852.9 1590.3 -4.3090 1.898e-05 ***
fesisGreece.1981 12187.4 3320.0 3.6709 0.0002618 ***
fesisItaly.1983 20029.1 3169.2 6.3199 4.906e-10 ***
fesisItaly.1987 -7330.2 1503.7 -4.8749 1.375e-06 ***
fesisLuxembourg.1990 -10435.0 1394.6 -7.4826 2.416e-13 ***
fesisSweden---
: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Signif. codes
:
Diagnostics and fit
-sq df p-value
Chi-Box AR(1) 387.15 1 < 2.2e-16 ***
Ljung-Box ARCH(1) 332.36 1 < 2.2e-16 ***
Ljung---
: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Signif. codes
4131.66485
SE of regression -squared 0.99245
R-lik.(n=720) -6976.66946 Log
plot(is1)
Let’s explore the other plots that we can use:
plot_grid(is1)
We can plot the counterfactual aspects compared
plot_counterfactual(is1)
We can plot the residuals against an OLS model:
plot_residuals(is1)
An example using coefficient step indicator saturation and impulse indicator saturation:
<- isatpanel(data = EU_emissions_road,
is2 formula = transport.emissions ~ lgdp + lpop,
index = c("country","year"),
effect = "twoways",
csis = TRUE,
iis = TRUE,
print.searchinfo = FALSE # to save space we suppress the status information in the estimation
)
is2
: Tue Oct 11 22:26:05 2022
Date: y
Dependent var.: Ordinary Least Squares (OLS)
Method-Covariance: Ordinary
Varianceobservations (mean eq.): 720
No. of : 1 to 720
Sample
:
SPECIFIC mean equation
-stat p-value
coef std.error t-13562.7 4211.3 -3.2205 0.0013437 **
lgdp 11530.0 12595.1 0.9154 0.3603039
lpop 4072.8 3200.4 1.2726 0.2036224
idBelgium -3500.7 5098.6 -0.6866 0.4925816
idDenmark -7890.2 4676.3 -1.6872 0.0920373 .
idFinland 91966.1 20019.1 4.5939 5.230e-06 ***
idFrance 130080.3 22833.4 5.6969 1.853e-08 ***
idGermany -10071.6 4527.6 -2.2245 0.0264582 *
idGreece -12507.6 7160.2 -1.7468 0.0811409 .
idIreland 74371.0 19872.7 3.7424 0.0001985 ***
idItaly -9431.8 30453.4 -0.3097 0.7568786
idLuxembourg 12538.2 6499.9 1.9290 0.0541714 .
idNetherlands -14265.2 5105.2 -2.7943 0.0053560 **
idPortugal 40175.7 17091.9 2.3506 0.0190442 *
idSpain 3831.8 2021.2 1.8957 0.0584389 .
idSweden 85369.9 20139.9 4.2389 2.574e-05 ***
idUnitedKingdom 165717.1 136771.0 1.2116 0.2260930
time1971 167722.7 136772.0 1.2263 0.2205344
time1972 170003.0 136760.4 1.2431 0.2142916
time1973 2412928.9 742685.7 3.2489 0.0012184 **
time1974 2419489.5 744568.7 3.2495 0.0012159 **
time1975 2428993.2 746965.9 3.2518 0.0012063 **
time1976 142336.5 137478.0 1.0353 0.3008967
time1977 143226.9 137533.6 1.0414 0.2980809
time1978 144588.8 137539.0 1.0513 0.2935332
time1979 146898.5 137498.2 1.0684 0.2857536
time1980 149430.1 137450.7 1.0872 0.2773732
time1981 150067.2 137467.4 1.0917 0.2753904
time1982 150128.9 137493.0 1.0919 0.2752826
time1983 148838.1 137568.4 1.0819 0.2796908
time1984 149614.7 137560.7 1.0876 0.2771650
time1985 151551.6 137555.8 1.1017 0.2709815
time1986 157289.0 137423.9 1.1446 0.2528175
time1987 160112.5 137399.5 1.1653 0.2443246
time1988 162186.8 137387.0 1.1805 0.2382312
time1989 160971.7 137500.1 1.1707 0.2421496
time1990 161227.8 137567.2 1.1720 0.2416314
time1991 162533.1 137619.9 1.1810 0.2380253
time1992 163225.4 137672.3 1.1856 0.2362122
time1993 163970.5 137678.7 1.1910 0.2341039
time1994 164736.3 137687.6 1.1965 0.2319592
time1995 167245.3 137659.0 1.2149 0.2248378
time1996 170150.5 137593.2 1.2366 0.2166770
time1997 172113.2 137592.3 1.2509 0.2114258
time1998 174212.2 137574.7 1.2663 0.2058581
time1999 176516.9 137525.3 1.2835 0.1997682
time2000 177200.6 137559.8 1.2882 0.1981466
time2001 177616.7 137611.0 1.2907 0.1972633
time2002 173799.6 137793.6 1.2613 0.2076541
time2003 174930.0 137825.9 1.2692 0.2048226
time2004 174700.2 137872.6 1.2671 0.2055707
time2005 182331.5 137695.0 1.3242 0.1859144
time2006 182116.7 137661.8 1.3229 0.1863265
time2007 182267.4 137779.5 1.3229 0.1863385
time2008 176480.4 137993.7 1.2789 0.2013900
time2009 173932.3 138094.7 1.2595 0.2082986
time2010 173181.3 138132.4 1.2537 0.2103913
time2011 171369.9 138181.9 1.2402 0.2153596
time2012 172026.0 138214.6 1.2446 0.2137187
time2013 172638.2 138247.4 1.2488 0.2122036
time2014 173699.6 138264.4 1.2563 0.2094660
time2015 174927.4 138290.4 1.2649 0.2063526
time2016 175512.6 138319.7 1.2689 0.2049362
time2017 175075.2 138347.7 1.2655 0.2061575
time2018 -40328.7 9481.1 -4.2536 2.415e-05 ***
iis97 -36997.2 9481.5 -3.9020 0.0001054 ***
iis98 -35707.6 9481.1 -3.7662 0.0001809 ***
iis99 -33422.5 9570.2 -3.4923 0.0005114 ***
iis100 -30662.7 9491.1 -3.2307 0.0012976 **
iis101 -27504.6 9582.2 -2.8704 0.0042338 **
iis102 34325.4 9434.9 3.6381 0.0002965 ***
iis229 -139568.0 45644.0 -3.0577 0.0023221 **
lpop.csis1974 141257.3 45642.4 3.0949 0.0020539 **
lpop.csis1977 ---
: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Signif. codes
:
Diagnostics and fit
-sq df p-value
Chi-Box AR(1) 585.38 1 < 2.2e-16 ***
Ljung-Box ARCH(1) 411.09 1 < 2.2e-16 ***
Ljung---
: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Signif. codes
9005.99607
SE of regression -squared 0.96374
R-lik.(n=720) -7541.20077
Logplot(is2)
plot_grid(is2)
and an example of Coefficient Fixed-Effect Step indicator saturation:
<- isatpanel(data = EU_emissions_road,
is3 formula = transport.emissions ~ lgdp + lpop,
index = c("country","year"),
effect = "twoways",
cfesis = TRUE,
print.searchinfo = FALSE # to save space we suppress the status information in the estimation
)
is3 plot(is3)
We can also use e.g. the fixest
package to estimate our
models:
<- isatpanel(data = EU_emissions_road,
is4 formula = transport.emissions ~ lgdp + lpop,
index = c("country","year"),
effect = "twoways",
engine = "fixest",
fesis = TRUE,
print.searchinfo = FALSE # to save space we suppress the status information in the estimation
)
plot(is4)