Group by country and technology class
Create statistical info: median, q25, mean, q75, max sd
Example of how the dataset looks like:
| ISO | tech | median | q25 | mean | q75 | max | sd |
|---|---|---|---|---|---|---|---|
| AFG | Climate change mitigation | 0.0 | 0 | 0.0376452 | 0.0000 | 1.000 | 0.1811038 |
| AFG | Climate change mitigation technologies related to energy generation, transmission or distribution | 0.0 | 0 | 0.0376452 | 0.0000 | 1.000 | 0.1811038 |
| AFG | Solar energy | 0.0 | 0 | 0.0053871 | 0.0000 | 0.167 | 0.0299941 |
| AFG | Wind energy | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| AFG | Batteries | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| AGO | Climate change mitigation | 0.0 | 0 | 0.0161290 | 0.0000 | 0.500 | 0.0898027 |
| AGO | Climate change mitigation technologies related to energy generation, transmission or distribution | 0.0 | 0 | 0.0161290 | 0.0000 | 0.500 | 0.0898027 |
| AGO | Solar energy | 0.0 | 0 | 0.0161290 | 0.0000 | 0.500 | 0.0898027 |
| AGO | Wind energy | 0.0 | 0 | 0.0161290 | 0.0000 | 0.500 | 0.0898027 |
| AGO | Batteries | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| ALB | Climate change mitigation | 0.0 | 0 | 0.6913871 | 0.5000 | 4.983 | 1.3771277 |
| ALB | Climate change mitigation technologies related to energy generation, transmission or distribution | 0.0 | 0 | 0.0725806 | 0.0000 | 1.000 | 0.2202250 |
| ALB | Solar energy | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| ALB | Wind energy | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| ALB | Batteries | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| AND | Climate change mitigation | 0.0 | 0 | 0.1892258 | 0.2665 | 1.000 | 0.3408215 |
| AND | Climate change mitigation technologies related to energy generation, transmission or distribution | 0.0 | 0 | 0.1505161 | 0.0000 | 1.000 | 0.3342888 |
| AND | Solar energy | 0.0 | 0 | 0.0268710 | 0.0000 | 0.500 | 0.1062239 |
| AND | Wind energy | 0.0 | 0 | 0.0214839 | 0.0000 | 0.333 | 0.0831604 |
| AND | Batteries | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| ANT | Climate change mitigation | 0.5 | 0 | 0.7515806 | 1.0835 | 4.817 | 1.0175182 |
| ANT | Climate change mitigation technologies related to energy generation, transmission or distribution | 0.0 | 0 | 0.1741613 | 0.0000 | 1.450 | 0.3949840 |
| ANT | Solar energy | 0.0 | 0 | 0.0000000 | 0.0000 | 0.000 | 0.0000000 |
| ANT | Wind energy | 0.0 | 0 | 0.0322581 | 0.0000 | 0.500 | 0.1248655 |
| ANT | Batteries | 0.0 | 0 | 0.0214839 | 0.0000 | 0.333 | 0.0831604 |
Whole distribution of country means faceted by technology:
Divide distribution in quantiles and plot country 25th quantile faceted by technology:
Selection criteria: for each q25 of country&tech, if it is less than 30th quantile of entire distribution of patent counts, drop
Total sample: 21 countries
Time series:
Reasons:
Check change in distribution:
Alternative: Select 25 top patenting countries by
mean - Check distribution of country means:
Select 50 top patenting countries (by mean) and check again
distribution of country means:
Augmented Dickey-Fuller Test
adf_data_ccmt <- df3 %>% filter(tech == "Climate change mitigation")
adf_data_energy <- df3 %>% filter(tech == "Climate change mitigation technologies related to energy generation, transmission or distribution")
adf_data_batteries <- df3 %>% filter(tech == "Batteries")
adf_data_solar <- df3 %>% filter(tech == "Solar energy")
adf_data_wind <- df3 %>% filter(tech == "Wind energy")
summary(ur.df(y=adf_data_ccmt$count, type = "none",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression none
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6395.3 -1.8 3.1 18.0 2097.5
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## z.lag.1 -0.038071 0.006758 -5.634 2.09e-08 ***
## z.diff.lag 0.072801 0.025365 2.870 0.00416 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 347.1 on 1546 degrees of freedom
## Multiple R-squared: 0.02295, Adjusted R-squared: 0.02169
## F-statistic: 18.16 on 2 and 1546 DF, p-value: 1.606e-08
##
##
## Value of test-statistic is: -5.6338
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(y=adf_data_ccmt$count, type = "drift",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6386.7 -19.4 -14.6 0.9 2107.0
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.858667 9.308627 1.919 0.05523 .
## z.lag.1 -0.042474 0.007131 -5.956 3.19e-09 ***
## z.diff.lag 0.075001 0.025369 2.956 0.00316 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 346.8 on 1545 degrees of freedom
## Multiple R-squared: 0.02527, Adjusted R-squared: 0.02401
## F-statistic: 20.03 on 2 and 1545 DF, p-value: 2.586e-09
##
##
## Value of test-statistic is: -5.9561 17.7375
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1 6.43 4.59 3.78
summary(ur.df(y=adf_data_ccmt$count, type = "trend",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6385.1 -19.8 -14.7 1.1 2107.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 15.603847 17.816131 0.876 0.38126
## z.lag.1 -0.042517 0.007139 -5.955 3.21e-09 ***
## tt 0.002931 0.019746 0.148 0.88201
## z.diff.lag 0.075032 0.025378 2.957 0.00316 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 346.9 on 1544 degrees of freedom
## Multiple R-squared: 0.02529, Adjusted R-squared: 0.02339
## F-statistic: 13.35 on 3 and 1544 DF, p-value: 1.324e-08
##
##
## Value of test-statistic is: -5.9553 11.8249 17.7373
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2 6.09 4.68 4.03
## phi3 8.27 6.25 5.34
summary(ur.df(y=adf_data_energy$count, type = "none",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression none
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2983.03 -1.61 1.16 8.58 1399.99
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## z.lag.1 -0.041225 0.006863 -6.006 2.36e-09 ***
## z.diff.lag 0.116706 0.025259 4.620 4.15e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 163.5 on 1546 degrees of freedom
## Multiple R-squared: 0.03183, Adjusted R-squared: 0.03057
## F-statistic: 25.41 on 2 and 1546 DF, p-value: 1.386e-11
##
##
## Value of test-statistic is: -6.0064
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(y=adf_data_energy$count, type = "drift",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2977.51 -9.83 -7.11 0.45 1404.82
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.296721 4.356042 1.905 0.057 .
## z.lag.1 -0.045358 0.007193 -6.306 3.73e-10 ***
## z.diff.lag 0.118772 0.025261 4.702 2.81e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 163.4 on 1545 degrees of freedom
## Multiple R-squared: 0.03409, Adjusted R-squared: 0.03284
## F-statistic: 27.27 on 2 and 1545 DF, p-value: 2.301e-12
##
##
## Value of test-statistic is: -6.306 19.883
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1 6.43 4.59 3.78
summary(ur.df(y=adf_data_energy$count, type = "trend",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2977.46 -9.89 -7.05 0.62 1404.87
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.506411 8.392136 0.894 0.371
## z.lag.1 -0.045383 0.007199 -6.304 3.77e-10 ***
## tt 0.001025 0.009301 0.110 0.912
## z.diff.lag 0.118790 0.025270 4.701 2.82e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 163.5 on 1544 degrees of freedom
## Multiple R-squared: 0.0341, Adjusted R-squared: 0.03223
## F-statistic: 18.17 on 3 and 1544 DF, p-value: 1.372e-11
##
##
## Value of test-statistic is: -6.3044 13.2509 19.8764
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2 6.09 4.68 4.03
## phi3 8.27 6.25 5.34
summary(ur.df(y=adf_data_solar$count, type = "none",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression none
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -571.73 -1.36 0.05 3.54 361.37
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## z.lag.1 -0.048820 0.006196 -7.879 6.18e-15 ***
## z.diff.lag 0.392100 0.023396 16.759 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 39.09 on 1546 degrees of freedom
## Multiple R-squared: 0.1686, Adjusted R-squared: 0.1675
## F-statistic: 156.7 on 2 and 1546 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -7.879
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(y=adf_data_solar$count, type = "drift",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -571.4 -3.8 -2.4 1.1 361.6
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.45757 1.03575 2.373 0.0178 *
## z.lag.1 -0.05323 0.00646 -8.240 3.64e-16 ***
## z.diff.lag 0.39430 0.02338 16.865 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 39.03 on 1545 degrees of freedom
## Multiple R-squared: 0.1716, Adjusted R-squared: 0.1705
## F-statistic: 160 on 2 and 1545 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -8.2398 33.9472
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1 6.43 4.59 3.78
summary(ur.df(y=adf_data_solar$count, type = "trend",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -571.13 -3.94 -2.20 0.98 361.63
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.0793316 2.0017663 1.039 0.299
## z.lag.1 -0.0532785 0.0064658 -8.240 3.63e-16 ***
## tt 0.0004906 0.0022218 0.221 0.825
## z.diff.lag 0.3943406 0.0233876 16.861 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 39.04 on 1544 degrees of freedom
## Multiple R-squared: 0.1716, Adjusted R-squared: 0.17
## F-statistic: 106.6 on 3 and 1544 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -8.24 22.6338 33.9507
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2 6.09 4.68 4.03
## phi3 8.27 6.25 5.34
summary(ur.df(y=adf_data_wind$count, type = "none",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression none
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -242.579 -0.939 0.000 1.500 123.628
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## z.lag.1 -0.061232 0.008339 -7.343 3.37e-13 ***
## z.diff.lag 0.122124 0.025243 4.838 1.44e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.28 on 1546 degrees of freedom
## Multiple R-squared: 0.04179, Adjusted R-squared: 0.04055
## F-statistic: 33.71 on 2 and 1546 DF, p-value: 4.663e-15
##
##
## Value of test-statistic is: -7.3428
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(y=adf_data_wind$count, type = "drift",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -241.932 -1.849 -0.950 0.564 124.249
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.949526 0.382464 2.483 0.0131 *
## z.lag.1 -0.068209 0.008787 -7.763 1.50e-14 ***
## z.diff.lag 0.125610 0.025240 4.977 7.19e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.26 on 1545 degrees of freedom
## Multiple R-squared: 0.0456, Adjusted R-squared: 0.04436
## F-statistic: 36.91 on 2 and 1545 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -7.7628 30.1304
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1 6.43 4.59 3.78
summary(ur.df(y=adf_data_wind$count, type = "trend",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -242.033 -1.758 -0.767 0.612 124.129
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.2820829 0.7430760 1.725 0.0847 .
## z.lag.1 -0.0684714 0.0088031 -7.778 1.34e-14 ***
## tt -0.0004241 0.0008124 -0.522 0.6017
## z.diff.lag 0.1257140 0.0252463 4.980 7.09e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.26 on 1544 degrees of freedom
## Multiple R-squared: 0.04577, Adjusted R-squared: 0.04391
## F-statistic: 24.68 on 3 and 1544 DF, p-value: 1.335e-15
##
##
## Value of test-statistic is: -7.7781 20.1683 30.2524
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2 6.09 4.68 4.03
## phi3 8.27 6.25 5.34
summary(ur.df(y=adf_data_batteries$count, type = "none",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression none
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1936.52 -0.66 0.07 2.32 785.57
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## z.lag.1 -0.063867 0.008757 -7.293 4.83e-13 ***
## z.diff.lag 0.071764 0.025367 2.829 0.00473 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 92.93 on 1546 degrees of freedom
## Multiple R-squared: 0.03479, Adjusted R-squared: 0.03354
## F-statistic: 27.86 on 2 and 1546 DF, p-value: 1.294e-12
##
##
## Value of test-statistic is: -7.2928
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau1 -2.58 -1.95 -1.62
summary(ur.df(y=adf_data_batteries$count, type = "drift",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1932.50 -5.00 -4.29 -2.00 786.07
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.363047 2.430412 1.795 0.07282 .
## z.lag.1 -0.067727 0.009012 -7.516 9.54e-14 ***
## z.diff.lag 0.073694 0.025372 2.905 0.00373 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 92.86 on 1545 degrees of freedom
## Multiple R-squared: 0.0368, Adjusted R-squared: 0.03555
## F-statistic: 29.51 on 2 and 1545 DF, p-value: 2.635e-13
##
##
## Value of test-statistic is: -7.5156 28.2424
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.43 -2.86 -2.57
## phi1 6.43 4.59 3.78
summary(ur.df(y=adf_data_batteries$count, type = "trend",lags=1))
##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1932.47 -5.03 -4.15 -2.02 786.09
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.896884 4.753839 0.820 0.41249
## z.lag.1 -0.067751 0.009017 -7.514 9.67e-14 ***
## tt 0.000603 0.005285 0.114 0.90916
## z.diff.lag 0.073710 0.025380 2.904 0.00373 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 92.89 on 1544 degrees of freedom
## Multiple R-squared: 0.03681, Adjusted R-squared: 0.03494
## F-statistic: 19.67 on 3 and 1544 DF, p-value: 1.632e-12
##
##
## Value of test-statistic is: -7.5139 18.8206 28.2308
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.96 -3.41 -3.12
## phi2 6.09 4.68 4.03
## phi3 8.27 6.25 5.34