TABLES

Table 1

# Load Table 1 data
table1 <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\table1.dta")

# Column 1: Tabulate true_nat
table(table1$true_nat)
## 
##              -        austria        benelux        britain         canada 
##              2              3              4             88              1 
## czechoslovakia         france        germany germany/france          india 
##              1              9            225              1              1 
##     swi/france    switzerland            usa 
##              1             49            240
# Column 2: Count patents by country
cat("USA patents:", sum(table1$usa == 1, na.rm = TRUE), "\n")
## USA patents: 289
cat("Germany patents:", sum(table1$germany == 1, na.rm = TRUE), "\n")
## Germany patents: 197
cat("Other countries patents:", sum(table1$usa == 0 & table1$germany == 0, na.rm = TRUE))
## Other countries patents: 139

Table 6

# Load main dataset
chem_patents <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\chem_patents_maindataset.dta")

# Data preparation steps
chem_patents <- chem_patents %>%
  arrange(uspto_class, grntyr) %>%
  group_by(uspto_class) %>%
  mutate(ccc = cumsum(count)) %>%
  ungroup()

# Replace count variables with NA where ccc == 0
count_vars <- c("count_usa", "count")
for(var in count_vars) {
  chem_patents[[var]] <- ifelse(chem_patents$ccc == 0, NA, chem_patents[[var]])
}

# Create time dummies
for(x in 1876:1939) {
  chem_patents[[paste0("td_", x)]] <- as.numeric(chem_patents$grntyr == x)
}

# Filter data
chem_patents <- chem_patents %>%
  group_by(uspto_class) %>%
  mutate(
    aaa = ifelse(ccc == 0 & grntyr == 1919, 1, NA),
    bbb = max(aaa, na.rm = TRUE)
  ) %>%
  ungroup() %>%
  filter(bbb != 1, ccc != 0) %>%
  select(-aaa, -bbb, -ccc)

# Convert to panel data
pdata <- pdata.frame(chem_patents, index = c("class_id", "grntyr"))

# Model specifications for Table 6
models_table6 <- list()

# Model 1
models_table6[[1]] <- plm(count_usa ~ treat + count_for_2 + . - class_id - grntyr - uspto_class_class_class_class_class_class - count - count_usa - treat - count_for_2, 
                         data = pdata[, c("count_usa", "treat", "count_for_2", grep("td_", names(pdata), value = TRUE))],
                         model = "within", effect = "individual")

# Model 2
models_table6[[2]] <- plm(count_usa ~ treat + count_for + . - class_id - grntyr - uspto_class_class_class_class_class_class - count - count_usa - treat - count_for, 
                         data = pdata[, c("count_usa", "treat", "count_for", grep("td_", names(pdata), value = TRUE))],
                         model = "within", effect = "individual")

# Model 3
models_table6[[3]] <- plm(count_usa ~ treat + . - class_id - grntyr - uspto_class_class_class_class_class_class - count - count_usa - treat, 
                         data = pdata[, c("count_usa", "treat", grep("td_", names(pdata), value = TRUE))],
                         model = "within", effect = "individual")

# Display results
stargazer(models_table6, type = "text", title = "Table 6 Results")
## 
## Table 6 Results
## ==============================================================
##                                     Dependent variable:       
##                               --------------------------------
##                                          count_usa            
##                                  (1)        (2)        (3)    
## --------------------------------------------------------------
## td_1876                       -0.384***  -0.384***  -0.384*** 
##                                (0.069)    (0.069)    (0.069)  
##                                                               
## td_1877                       -0.504***  -0.504***  -0.504*** 
##                                (0.066)    (0.066)    (0.066)  
##                                                               
## td_1878                       -0.639***  -0.639***  -0.639*** 
##                                (0.065)    (0.065)    (0.065)  
##                                                               
## td_1879                       -0.604***  -0.604***  -0.604*** 
##                                (0.063)    (0.063)    (0.063)  
##                                                               
## td_1880                       -0.583***  -0.583***  -0.583*** 
##                                (0.063)    (0.063)    (0.063)  
##                                                               
## td_1881                       -0.613***  -0.613***  -0.613*** 
##                                (0.062)    (0.062)    (0.062)  
##                                                               
## td_1882                       -0.455***  -0.455***  -0.455*** 
##                                (0.062)    (0.062)    (0.062)  
##                                                               
## td_1883                       -0.392***  -0.392***  -0.392*** 
##                                (0.061)    (0.061)    (0.061)  
##                                                               
## td_1884                       -0.474***  -0.474***  -0.474*** 
##                                (0.061)    (0.061)    (0.061)  
##                                                               
## td_1885                       -0.329***  -0.329***  -0.329*** 
##                                (0.060)    (0.060)    (0.060)  
##                                                               
## td_1886                       -0.440***  -0.440***  -0.440*** 
##                                (0.060)    (0.060)    (0.060)  
##                                                               
## td_1887                       -0.483***  -0.483***  -0.483*** 
##                                (0.060)    (0.060)    (0.060)  
##                                                               
## td_1888                       -0.468***  -0.468***  -0.468*** 
##                                (0.060)    (0.060)    (0.060)  
##                                                               
## td_1889                       -0.391***  -0.391***  -0.391*** 
##                                (0.060)    (0.060)    (0.060)  
##                                                               
## td_1890                       -0.331***  -0.331***  -0.331*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1891                       -0.380***  -0.380***  -0.380*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1892                       -0.452***  -0.452***  -0.452*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1893                       -0.359***  -0.359***  -0.359*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1894                       -0.455***  -0.455***  -0.455*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1895                       -0.391***  -0.391***  -0.391*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1896                       -0.382***  -0.382***  -0.382*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1897                       -0.346***  -0.346***  -0.346*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1898                       -0.417***  -0.417***  -0.417*** 
##                                (0.059)    (0.059)    (0.059)  
##                                                               
## td_1899                       -0.239***  -0.239***  -0.239*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1900                       -0.291***  -0.291***  -0.291*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1901                       -0.277***  -0.277***  -0.277*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1902                       -0.278***  -0.278***  -0.278*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1903                       -0.219***  -0.219***  -0.219*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1904                       -0.254***  -0.254***  -0.254*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1905                       -0.248***  -0.248***  -0.248*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1906                       -0.203***  -0.203***  -0.203*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1907                         -0.088     -0.088     -0.088  
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1908                       -0.173***  -0.173***  -0.173*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1909                        -0.119**   -0.119**   -0.119** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1910                       -0.172***  -0.172***  -0.172*** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1911                        -0.119**   -0.119**   -0.119** 
##                                (0.058)    (0.058)    (0.058)  
##                                                               
## td_1912                         -0.079     -0.079     -0.079  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1913                       -0.149***  -0.149***  -0.149*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1914                         -0.005     -0.005     -0.005  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1915                         0.076      0.076      0.076   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1916                        0.144**    0.144**    0.144**  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1917                        0.119**    0.119**    0.119**  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1918                         0.066      0.066      0.066   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1919                         0.033      0.033      0.033   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1920                         0.017      0.017      0.017   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1921                         0.089      0.089      0.089   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1922                         0.099*     0.099*     0.099*  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1923                         0.037      0.037      0.037   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1924                        0.112**    0.112**    0.112**  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1925                        0.129**    0.129**    0.129**  
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1926                        0.170***   0.170***   0.170*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1927                         0.076      0.076      0.076   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1928                         0.086      0.086      0.086   
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1929                        0.188***   0.188***   0.188*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1930                        0.188***   0.188***   0.188*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1931                        0.493***   0.493***   0.493*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1932                        0.574***   0.574***   0.574*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1933                        0.526***   0.526***   0.526*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1934                        0.544***   0.544***   0.544*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1935                        0.470***   0.470***   0.470*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1936                        0.552***   0.552***   0.552*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1937                        0.473***   0.473***   0.473*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1938                        0.528***   0.528***   0.528*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## td_1939                        0.672***   0.672***   0.672*** 
##                                (0.057)    (0.057)    (0.057)  
##                                                               
## --------------------------------------------------------------
## Observations                   223,048    223,048    223,048  
## R2                              0.061      0.061      0.061   
## Adjusted R2                     0.041      0.041      0.041   
## F Statistic (df = 64; 218400) 222.734*** 222.734*** 222.734***
## ==============================================================
## Note:                              *p<0.1; **p<0.05; ***p<0.01

Table 7

# Load primary classes dataset
primary_classes <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\chem_patents_primaryclassesdataset.dta")

# Create time dummies
for(x in 1876:1939) {
  primary_classes[[paste0("td_", x)]] <- as.numeric(primary_classes$grntyr == x)
}

pdata_primary <- pdata.frame(primary_classes, index = c("class_id", "grntyr"))

# Models for Table 7
models_table7 <- list()

models_table7[[1]] <- plm(count_usa ~ treat + count_for + . - class_id - grntyr - count_usa - treat - count_for,
                         data = pdata_primary[, c("count_usa", "treat", "count_for", grep("td_", names(pdata_primary), value = TRUE))],
                         model = "within", effect = "individual")

models_table7[[2]] <- plm(count_usa ~ count_cl + count_for + . - class_id - grntyr - count_usa - count_cl - count_for,
                         data = pdata_primary[, c("count_usa", "count_cl", "count_for", grep("td_", names(pdata_primary), value = TRUE))],
                         model = "within", effect = "individual")

models_table7[[3]] <- plm(count_usa ~ year_conf + count_for + . - class_id - grntyr - count_usa - year_conf - count_for,
                         data = pdata_primary[, c("count_usa", "year_conf", "count_for", grep("td_", names(pdata_primary), value = TRUE))],
                         model = "within", effect = "individual")

stargazer(models_table7, type = "text", title = "Table 7 Results")
## 
## Table 7 Results
## ==============================================================
##                                     Dependent variable:       
##                               --------------------------------
##                                          count_usa            
##                                  (1)        (2)        (3)    
## --------------------------------------------------------------
## td_1876                         0.002      0.002      0.002   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1877                         -0.004     -0.004     -0.004  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1878                         -0.010     -0.010     -0.010  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1879                         -0.007     -0.007     -0.007  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1880                        -0.0002    -0.0002    -0.0002  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1881                         -0.006     -0.006     -0.006  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1882                         0.021*     0.021*     0.021*  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1883                        0.036***   0.036***   0.036*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1884                         0.018      0.018      0.018   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1885                        0.047***   0.047***   0.047*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1886                        0.026**    0.026**    0.026**  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1887                         0.010      0.010      0.010   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1888                         0.011      0.011      0.011   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1889                        0.027**    0.027**    0.027**  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1890                        0.044***   0.044***   0.044*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1891                        0.032***   0.032***   0.032*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1892                         0.018      0.018      0.018   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1893                        0.028**    0.028**    0.028**  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1894                         0.010      0.010      0.010   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1895                         0.016      0.016      0.016   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1896                        0.031***   0.031***   0.031*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1897                        0.030**    0.030**    0.030**  
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1898                         0.017      0.017      0.017   
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1899                        0.063***   0.063***   0.063*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1900                        0.042***   0.042***   0.042*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1901                        0.049***   0.049***   0.049*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1902                        0.058***   0.058***   0.058*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1903                        0.067***   0.067***   0.067*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1904                        0.062***   0.062***   0.062*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1905                        0.057***   0.057***   0.057*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1906                        0.083***   0.083***   0.083*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1907                        0.100***   0.100***   0.100*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1908                        0.082***   0.082***   0.082*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1909                        0.096***   0.096***   0.096*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1910                        0.088***   0.088***   0.088*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1911                        0.088***   0.088***   0.088*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1912                        0.109***   0.109***   0.109*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1913                        0.091***   0.091***   0.091*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1914                        0.131***   0.131***   0.131*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1915                        0.168***   0.168***   0.168*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1916                        0.196***   0.196***   0.196*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1917                        0.192***   0.192***   0.192*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1918                        0.178***   0.178***   0.178*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1919                        0.155***   0.155***   0.155*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1920                        0.161***   0.161***   0.161*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1921                        0.178***   0.178***   0.178*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1922                        0.196***   0.196***   0.196*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1923                        0.183***   0.183***   0.183*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1924                        0.207***   0.207***   0.207*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1925                        0.203***   0.203***   0.203*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1926                        0.219***   0.219***   0.219*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1927                        0.179***   0.179***   0.179*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1928                        0.164***   0.164***   0.164*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1929                        0.204***   0.204***   0.204*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1930                        0.213***   0.213***   0.213*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1931                        0.301***   0.301***   0.301*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1932                        0.318***   0.318***   0.318*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1933                        0.288***   0.288***   0.288*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1934                        0.281***   0.281***   0.281*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1935                        0.270***   0.270***   0.270*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1936                        0.273***   0.273***   0.273*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1937                        0.252***   0.252***   0.252*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1938                        0.272***   0.272***   0.272*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## td_1939                        0.312***   0.312***   0.312*** 
##                                (0.012)    (0.012)    (0.012)  
##                                                               
## --------------------------------------------------------------
## Observations                   367,640    367,640    367,640  
## R2                              0.025      0.025      0.025   
## Adjusted R2                     0.010      0.010      0.010   
## F Statistic (df = 64; 361920) 145.452*** 145.452*** 145.452***
## ==============================================================
## Note:                              *p<0.1; **p<0.05; ***p<0.01

Table 8

# Load indigo dataset
indigo_data <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\chem_patents_indigodataset.dta")

# Create time dummies
for(x in 1876:1939) {
  indigo_data[[paste0("td_", x)]] <- as.numeric(indigo_data$grntyr == x)
}

pdata_indigo <- pdata.frame(indigo_data, index = c("class_id", "grntyr"))

# Models for Table 8
models_table8 <- list()

models_table8[[1]] <- plm(count_usa ~ treat + count_for + . - class_id - grntyr - count_usa - treat - count_for,
                         data = pdata_indigo[, c("count_usa", "treat", "count_for", grep("td_", names(pdata_indigo), value = TRUE))],
                         model = "within", effect = "individual")

models_table8[[2]] <- plm(count_usa ~ count_cl + count_for + . - class_id - grntyr - count_usa - count_cl - count_for,
                         data = pdata_indigo[, c("count_usa", "count_cl", "count_for", grep("td_", names(pdata_indigo), value = TRUE))],
                         model = "within", effect = "individual")

models_table8[[3]] <- plm(count_usa ~ year_conf + count_for + . - class_id - grntyr - count_usa - year_conf - count_for,
                         data = pdata_indigo[, c("count_usa", "year_conf", "count_for", grep("td_", names(pdata_indigo), value = TRUE))],
                         model = "within", effect = "individual")

stargazer(models_table8, type = "text", title = "Table 8 Results")
## 
## Table 8 Results
## ==========================================================
##                                   Dependent variable:     
##                              -----------------------------
##                                        count_usa          
##                                 (1)       (2)       (3)   
## ----------------------------------------------------------
## td_1876                        0.001     0.001     0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1877                        0.001     0.001     0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1878                       -0.001    -0.001    -0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1879                        0.000     0.000     0.000  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1880                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1881                        0.003     0.003     0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1882                        0.003     0.003     0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1883                       -0.001    -0.001    -0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1884                        0.000     0.000     0.000  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1885                        0.003     0.003     0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1886                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1887                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1888                        0.006     0.006     0.006  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1889                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1890                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1891                       -0.001    -0.001    -0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1892                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1893                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1894                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1895                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1896                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1897                        0.006     0.006     0.006  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1898                       -0.001    -0.001    -0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1899                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1900                        0.001     0.001     0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1901                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1902                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1903                        0.000     0.000     0.000  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1904                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1905                        0.004     0.004     0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1906                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1907                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1908                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1909                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1910                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1911                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1912                        0.003     0.003     0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1913                       -0.003    -0.003    -0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1914                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1915                        0.003     0.003     0.003  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1916                        0.004     0.004     0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1917                        0.010     0.010     0.010  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1918                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1919                       -0.004    -0.004    -0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1920                       0.013*    0.013*    0.013*  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1921                       0.016**   0.016**   0.016** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1922                        0.010     0.010     0.010  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1923                       0.014**   0.014**   0.014** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1924                        0.004     0.004     0.004  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1925                        0.000     0.000     0.000  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1926                      0.021***  0.021***  0.021*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1927                      0.031***  0.031***  0.031*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1928                      0.020***  0.020***  0.020*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1929                       -0.001    -0.001    -0.001  
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1930                       0.014**   0.014**   0.014** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1931                      0.053***  0.053***  0.053*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1932                      0.038***  0.038***  0.038*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1933                      0.020***  0.020***  0.020*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1934                      0.068***  0.068***  0.068*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1935                      0.044***  0.044***  0.044*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1936                      0.135***  0.135***  0.135*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1937                      0.089***  0.089***  0.089*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1938                      0.040***  0.040***  0.040*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## td_1939                      0.094***  0.094***  0.094*** 
##                               (0.007)   (0.007)   (0.007) 
##                                                           
## ----------------------------------------------------------
## Observations                  45,760    45,760    45,760  
## R2                             0.036     0.036     0.036  
## Adjusted R2                    0.020     0.020     0.020  
## F Statistic (df = 64; 44992) 26.564*** 26.564*** 26.564***
## ==========================================================
## Note:                          *p<0.1; **p<0.05; ***p<0.01

Table 9

# Load DuPont data
dupont_data <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\dupont_data.dta")

# Create time dummies (assuming similar time period)
for(x in 1876:1939) {
  dupont_data[[paste0("td_", x)]] <- as.numeric(dupont_data$grntyr == x)
}

pdata_dupont <- pdata.frame(dupont_data, index = c("class_id", "grntyr"))

# Models for Table 9
models_table9 <- list()

models_table9[[1]] <- plm(patents ~ treat_NO_dupont + treat_dupont + count_for + . - class_id - grntyr - patents - treat_NO_dupont - treat_dupont - count_for,
                         data = pdata_dupont[, c("patents", "treat_NO_dupont", "treat_dupont", "count_for", grep("td_", names(pdata_dupont), value = TRUE))],
                         model = "within", effect = "individual")

# Additional models would follow similar pattern...

stargazer(models_table9, type = "text", title = "Table 9 Results")
## 
## Table 9 Results
## =========================================
##                  Dependent variable:     
##              ----------------------------
##                        patents           
## -----------------------------------------
## td_1889               -0.257***          
##                        (0.005)           
##                                          
## td_1891               -0.257***          
##                        (0.005)           
##                                          
## td_1896               -0.256***          
##                        (0.005)           
##                                          
## td_1898               -0.257***          
##                        (0.005)           
##                                          
## td_1906               -0.256***          
##                        (0.005)           
##                                          
## td_1907               -0.252***          
##                        (0.005)           
##                                          
## td_1908               -0.253***          
##                        (0.005)           
##                                          
## td_1909               -0.248***          
##                        (0.005)           
##                                          
## td_1910               -0.253***          
##                        (0.005)           
##                                          
## td_1911               -0.253***          
##                        (0.005)           
##                                          
## td_1912               -0.254***          
##                        (0.005)           
##                                          
## td_1913               -0.254***          
##                        (0.005)           
##                                          
## td_1914               -0.255***          
##                        (0.005)           
##                                          
## td_1915               -0.254***          
##                        (0.005)           
##                                          
## td_1916               -0.254***          
##                        (0.005)           
##                                          
## td_1917               -0.253***          
##                        (0.005)           
##                                          
## td_1918               -0.254***          
##                        (0.005)           
##                                          
## td_1919               -0.250***          
##                        (0.005)           
##                                          
## td_1920               -0.249***          
##                        (0.005)           
##                                          
## td_1921               -0.255***          
##                        (0.005)           
##                                          
## td_1922               -0.253***          
##                        (0.005)           
##                                          
## td_1923               -0.252***          
##                        (0.005)           
##                                          
## td_1924               -0.253***          
##                        (0.005)           
##                                          
## td_1925               -0.249***          
##                        (0.005)           
##                                          
## td_1926               -0.250***          
##                        (0.005)           
##                                          
## td_1927               -0.243***          
##                        (0.005)           
##                                          
## td_1928               -0.242***          
##                        (0.005)           
##                                          
## td_1929               -0.234***          
##                        (0.005)           
##                                          
## td_1930               -0.224***          
##                        (0.005)           
##                                          
## td_1931               -0.207***          
##                        (0.005)           
##                                          
## td_1932               -0.157***          
##                        (0.005)           
##                                          
## td_1933               -0.107***          
##                        (0.005)           
##                                          
## td_1934               -0.093***          
##                        (0.005)           
##                                          
## td_1935               -0.074***          
##                        (0.005)           
##                                          
## td_1936                0.028***          
##                        (0.005)           
##                                          
## td_1937               -0.027***          
##                        (0.005)           
##                                          
## td_1938               -0.029***          
##                        (0.005)           
##                                          
## td_1939                0.030***          
##                        (0.005)           
##                                          
## -----------------------------------------
## Observations           222,924           
## R2                      0.097            
## Adjusted R2             0.073            
## F Statistic  613.315*** (df = 38; 217170)
## =========================================
## Note:         *p<0.1; **p<0.05; ***p<0.01

FIGURES

Figure 1

## Figure 1
fig1 <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\fig1.dta")

# 直接使用count_germany作为count_ger
fig1$count_ger <- fig1$count_germany

# 提取时间虚拟变量
td_vars <- grep("^td_", names(fig1), value = TRUE)

cat("Running regression models...\n")
## Running regression models...
cat("Time period covered:", length(td_vars), "years from 1875 to 1939\n")
## Time period covered: 65 years from 1875 to 1939
cat("Sample sizes:\n")
## Sample sizes:
cat("  licensed_class == 0:", sum(fig1$licensed_class == 0), "observations\n")
##   licensed_class == 0: 65 observations
cat("  licensed_class == 1:", sum(fig1$licensed_class == 1), "observations\n")
##   licensed_class == 1: 65 observations
# 对licensed_class == 0的样本回归 (无常数项)
model_non_licensed <- lm(
  reformulate(td_vars, "count_ger", intercept = FALSE),
  data = fig1[fig1$licensed_class == 0, ]
)

# 对licensed_class == 1的样本回归 (无常数项)
model_licensed <- lm(
  reformulate(td_vars, "count_ger", intercept = FALSE),
  data = fig1[fig1$licensed_class == 1, ]
)

# 输出结果
cat("\n=== Regression results for non-licensed classes (licensed_class == 0) ===\n")
## 
## === Regression results for non-licensed classes (licensed_class == 0) ===
print(summary(model_non_licensed))
## 
## Call:
## lm(formula = reformulate(td_vars, "count_ger", intercept = FALSE), 
##     data = fig1[fig1$licensed_class == 0, ])
## 
## Residuals:
## ALL 65 residuals are 0: no residual degrees of freedom!
## 
## Coefficients:
##         Estimate Std. Error t value Pr(>|t|)
## td_1875        3        NaN     NaN      NaN
## td_1876        3        NaN     NaN      NaN
## td_1877       11        NaN     NaN      NaN
## td_1878        8        NaN     NaN      NaN
## td_1879       11        NaN     NaN      NaN
## td_1880       18        NaN     NaN      NaN
## td_1881       28        NaN     NaN      NaN
## td_1882       32        NaN     NaN      NaN
## td_1883       42        NaN     NaN      NaN
## td_1884       29        NaN     NaN      NaN
## td_1885       47        NaN     NaN      NaN
## td_1886       40        NaN     NaN      NaN
## td_1887       48        NaN     NaN      NaN
## td_1888       66        NaN     NaN      NaN
## td_1889       74        NaN     NaN      NaN
## td_1890       76        NaN     NaN      NaN
## td_1891       81        NaN     NaN      NaN
## td_1892       80        NaN     NaN      NaN
## td_1893      105        NaN     NaN      NaN
## td_1894      108        NaN     NaN      NaN
## td_1895       79        NaN     NaN      NaN
## td_1896      105        NaN     NaN      NaN
## td_1897      117        NaN     NaN      NaN
## td_1898      143        NaN     NaN      NaN
## td_1899      160        NaN     NaN      NaN
## td_1900      229        NaN     NaN      NaN
## td_1901      178        NaN     NaN      NaN
## td_1902      156        NaN     NaN      NaN
## td_1903      170        NaN     NaN      NaN
## td_1904      150        NaN     NaN      NaN
## td_1905      144        NaN     NaN      NaN
## td_1906      124        NaN     NaN      NaN
## td_1907      149        NaN     NaN      NaN
## td_1908      147        NaN     NaN      NaN
## td_1909      138        NaN     NaN      NaN
## td_1910      167        NaN     NaN      NaN
## td_1911      191        NaN     NaN      NaN
## td_1912      174        NaN     NaN      NaN
## td_1913      173        NaN     NaN      NaN
## td_1914      161        NaN     NaN      NaN
## td_1915      128        NaN     NaN      NaN
## td_1916       89        NaN     NaN      NaN
## td_1917       71        NaN     NaN      NaN
## td_1918       40        NaN     NaN      NaN
## td_1919       30        NaN     NaN      NaN
## td_1920       25        NaN     NaN      NaN
## td_1921       57        NaN     NaN      NaN
## td_1922      118        NaN     NaN      NaN
## td_1923       98        NaN     NaN      NaN
## td_1924      120        NaN     NaN      NaN
## td_1925      177        NaN     NaN      NaN
## td_1926      160        NaN     NaN      NaN
## td_1927      156        NaN     NaN      NaN
## td_1928      208        NaN     NaN      NaN
## td_1929      309        NaN     NaN      NaN
## td_1930      323        NaN     NaN      NaN
## td_1931      445        NaN     NaN      NaN
## td_1932      591        NaN     NaN      NaN
## td_1933      592        NaN     NaN      NaN
## td_1934      480        NaN     NaN      NaN
## td_1935      415        NaN     NaN      NaN
## td_1936      401        NaN     NaN      NaN
## td_1937      446        NaN     NaN      NaN
## td_1938      478        NaN     NaN      NaN
## td_1939      535        NaN     NaN      NaN
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 65 and 0 DF,  p-value: NA
cat("\n=== Regression results for licensed classes (licensed_class == 1) ===\n")
## 
## === Regression results for licensed classes (licensed_class == 1) ===
print(summary(model_licensed))
## 
## Call:
## lm(formula = reformulate(td_vars, "count_ger", intercept = FALSE), 
##     data = fig1[fig1$licensed_class == 1, ])
## 
## Residuals:
## ALL 65 residuals are 0: no residual degrees of freedom!
## 
## Coefficients:
##         Estimate Std. Error t value Pr(>|t|)
## td_1875        1        NaN     NaN      NaN
## td_1876        0        NaN     NaN      NaN
## td_1877        2        NaN     NaN      NaN
## td_1878        3        NaN     NaN      NaN
## td_1879        0        NaN     NaN      NaN
## td_1880        8        NaN     NaN      NaN
## td_1881       18        NaN     NaN      NaN
## td_1882       30        NaN     NaN      NaN
## td_1883        8        NaN     NaN      NaN
## td_1884        5        NaN     NaN      NaN
## td_1885       10        NaN     NaN      NaN
## td_1886        5        NaN     NaN      NaN
## td_1887       10        NaN     NaN      NaN
## td_1888       15        NaN     NaN      NaN
## td_1889       21        NaN     NaN      NaN
## td_1890       20        NaN     NaN      NaN
## td_1891       26        NaN     NaN      NaN
## td_1892       19        NaN     NaN      NaN
## td_1893       27        NaN     NaN      NaN
## td_1894       27        NaN     NaN      NaN
## td_1895       31        NaN     NaN      NaN
## td_1896       35        NaN     NaN      NaN
## td_1897       26        NaN     NaN      NaN
## td_1898       41        NaN     NaN      NaN
## td_1899       54        NaN     NaN      NaN
## td_1900       90        NaN     NaN      NaN
## td_1901       66        NaN     NaN      NaN
## td_1902       57        NaN     NaN      NaN
## td_1903       72        NaN     NaN      NaN
## td_1904       60        NaN     NaN      NaN
## td_1905       60        NaN     NaN      NaN
## td_1906       44        NaN     NaN      NaN
## td_1907       65        NaN     NaN      NaN
## td_1908       77        NaN     NaN      NaN
## td_1909       77        NaN     NaN      NaN
## td_1910       86        NaN     NaN      NaN
## td_1911      103        NaN     NaN      NaN
## td_1912      105        NaN     NaN      NaN
## td_1913       84        NaN     NaN      NaN
## td_1914       72        NaN     NaN      NaN
## td_1915       66        NaN     NaN      NaN
## td_1916       70        NaN     NaN      NaN
## td_1917       35        NaN     NaN      NaN
## td_1918       25        NaN     NaN      NaN
## td_1919        2        NaN     NaN      NaN
## td_1920        8        NaN     NaN      NaN
## td_1921       18        NaN     NaN      NaN
## td_1922       43        NaN     NaN      NaN
## td_1923       33        NaN     NaN      NaN
## td_1924       28        NaN     NaN      NaN
## td_1925       58        NaN     NaN      NaN
## td_1926       38        NaN     NaN      NaN
## td_1927       36        NaN     NaN      NaN
## td_1928       56        NaN     NaN      NaN
## td_1929       97        NaN     NaN      NaN
## td_1930      103        NaN     NaN      NaN
## td_1931      128        NaN     NaN      NaN
## td_1932      201        NaN     NaN      NaN
## td_1933      187        NaN     NaN      NaN
## td_1934      109        NaN     NaN      NaN
## td_1935      117        NaN     NaN      NaN
## td_1936      123        NaN     NaN      NaN
## td_1937      118        NaN     NaN      NaN
## td_1938      137        NaN     NaN      NaN
## td_1939      139        NaN     NaN      NaN
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 65 and 0 DF,  p-value: NA
# 可选:提取系数用于绘图或其他分析
coef_non_licensed <- coef(model_non_licensed)
coef_licensed <- coef(model_licensed)

cat("\nNumber of coefficients for non-licensed classes:", length(coef_non_licensed), "\n")
## 
## Number of coefficients for non-licensed classes: 65
cat("Number of coefficients for licensed classes:", length(coef_licensed), "\n")
## Number of coefficients for licensed classes: 65

Figures 2 & 3

# Load main dataset for figures
chem_figures <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\chem_patents_maindataset.dta")

# Figure 2: Count CL in 1930
fig2_data <- chem_figures %>% filter(grntyr == 1930) %>% select(count_cl)
print("Figure 2 - Count CL in 1930:")
## [1] "Figure 2 - Count CL in 1930:"
print(summary(fig2_data))
##     count_cl       
##  Min.   : 0.00000  
##  1st Qu.: 0.00000  
##  Median : 0.00000  
##  Mean   : 0.08416  
##  3rd Qu.: 0.00000  
##  Max.   :15.00000
# Figure 3: Year conf in 1930  
fig3_data <- chem_figures %>% filter(grntyr == 1930) %>% select(year_conf)
print("Figure 3 - Year conf in 1930:")
## [1] "Figure 3 - Year conf in 1930:"
print(summary(fig3_data))
##    year_conf      
##  Min.   :  0.000  
##  1st Qu.:  0.000  
##  Median :  0.000  
##  Mean   :  1.076  
##  3rd Qu.:  0.000  
##  Max.   :161.000

Figure 4

# Create time dummies and interaction terms
for(x in 1875:1918) {
  chem_figures[[paste0("td_", x)]] <- as.numeric(chem_figures$grntyr == x)
  chem_figures[[paste0("treat_", x)]] <- ifelse(chem_figures$grntyr == x, chem_figures$treat, 0)
}

# Remove specific variables as in Stata code
chem_figures <- chem_figures %>% select(-td_1900, -treat_1900)

pdata_fig4 <- pdata.frame(chem_figures, index = c("class_id", "grntyr"))

# Run regression
fig4_model <- plm(count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class - count - count_usa,
                 data = pdata_fig4[, c("count_usa", "count_for", 
                                      grep("treat_", names(pdata_fig4), value = TRUE),
                                      grep("td_", names(pdata_fig4), value = TRUE))],
                 model = "within", effect = "individual")
summary(fig4_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class - 
##     count - count_usa, data = pdata_fig4[, c("count_usa", "count_for", 
##     grep("treat_", names(pdata_fig4), value = TRUE), grep("td_", 
##         names(pdata_fig4), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 7248, T = 65, N = 471120
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -10.336713  -0.264930  -0.036121   0.141257  56.615204 
## 
## Coefficients:
##             Estimate Std. Error  t-value  Pr(>|t|)    
## count_for  0.3168408  0.0029212 108.4611 < 2.2e-16 ***
## td_1875   -0.4308885  0.0107895 -39.9358 < 2.2e-16 ***
## td_1876   -0.4265404  0.0107893 -39.5337 < 2.2e-16 ***
## td_1877   -0.4289897  0.0107890 -39.7618 < 2.2e-16 ***
## td_1878   -0.4444259  0.0107892 -41.1916 < 2.2e-16 ***
## td_1879   -0.4359046  0.0107887 -40.4037 < 2.2e-16 ***
## td_1880   -0.4271620  0.0107887 -39.5935 < 2.2e-16 ***
## td_1881   -0.4337887  0.0107871 -40.2136 < 2.2e-16 ***
## td_1882   -0.3974373  0.0107862 -36.8468 < 2.2e-16 ***
## td_1883   -0.3765343  0.0107868 -34.9071 < 2.2e-16 ***
## td_1884   -0.3968117  0.0107864 -36.7883 < 2.2e-16 ***
## td_1885   -0.3532913  0.0107866 -32.7527 < 2.2e-16 ***
## td_1886   -0.3818181  0.0107871 -35.3958 < 2.2e-16 ***
## td_1887   -0.3957858  0.0107866 -36.6923 < 2.2e-16 ***
## td_1888   -0.3948037  0.0107850 -36.6066 < 2.2e-16 ***
## td_1889   -0.3715498  0.0107845 -34.4523 < 2.2e-16 ***
## td_1890   -0.3524282  0.0107839 -32.6810 < 2.2e-16 ***
## td_1891   -0.3695596  0.0107837 -34.2701 < 2.2e-16 ***
## td_1892   -0.3939513  0.0107845 -36.5294 < 2.2e-16 ***
## td_1893   -0.3665626  0.0107827 -33.9954 < 2.2e-16 ***
## td_1894   -0.4041571  0.0107826 -37.4825 < 2.2e-16 ***
## td_1895   -0.3787694  0.0107835 -35.1250 < 2.2e-16 ***
## td_1896   -0.3773788  0.0107831 -34.9973 < 2.2e-16 ***
## td_1897   -0.3668495  0.0107816 -34.0255 < 2.2e-16 ***
## td_1898   -0.4035454  0.0107800 -37.4346 < 2.2e-16 ***
## td_1899   -0.3369571  0.0107779 -31.2638 < 2.2e-16 ***
## td_1901   -0.3499862  0.0107787 -32.4701 < 2.2e-16 ***
## td_1902   -0.3498113  0.0107788 -32.4537 < 2.2e-16 ***
## td_1903   -0.3206698  0.0107788 -29.7499 < 2.2e-16 ***
## td_1904   -0.3313110  0.0107803 -30.7329 < 2.2e-16 ***
## td_1905   -0.3282087  0.0107805 -30.4447 < 2.2e-16 ***
## td_1906   -0.3045231  0.0107810 -28.2463 < 2.2e-16 ***
## td_1907   -0.2504626  0.0107796 -23.2348 < 2.2e-16 ***
## td_1908   -0.2950662  0.0107794 -27.3733 < 2.2e-16 ***
## td_1909   -0.2655954  0.0107796 -24.6387 < 2.2e-16 ***
## td_1910   -0.2961085  0.0107791 -27.4707 < 2.2e-16 ***
## td_1911   -0.2677443  0.0107791 -24.8392 < 2.2e-16 ***
## td_1912   -0.2455545  0.0107790 -22.7808 < 2.2e-16 ***
## td_1913   -0.2817091  0.0107802 -26.1321 < 2.2e-16 ***
## td_1914   -0.1987952  0.0107797 -18.4415 < 2.2e-16 ***
## td_1915   -0.1478176  0.0107799 -13.7124 < 2.2e-16 ***
## td_1916   -0.1039339  0.0107801  -9.6413 < 2.2e-16 ***
## td_1917   -0.1134728  0.0107809 -10.5253 < 2.2e-16 ***
## td_1918   -0.1416648  0.0107821 -13.1389 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    400810
## Residual Sum of Squares: 373350
## R-Squared:      0.068524
## Adj. R-Squared: 0.053882
## F-statistic: 775.494 on 44 and 463828 DF, p-value: < 2.22e-16

Figure 5

fig5 <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\fig5.dta")

# Create bins and summarize
bins <- seq(0, 1, by = 0.1)

for(i in 1:(length(bins)-1)) {
  cat(paste0("Share ", bins[i], "-", bins[i+1], " (non-licensed): "))
  print(summary(fig5$share[fig5$licensed_class == 0 & fig5$share >= bins[i] & fig5$share < bins[i+1]]))
  
  cat(paste0("Share ", bins[i], "-", bins[i+1], " (licensed): "))
  print(summary(fig5$share[fig5$licensed_class == 1 & fig5$share >= bins[i] & fig5$share < bins[i+1]]))
}
## Share 0-0.1 (non-licensed):      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0000000 0.0000000 0.0000000 0.0003737 0.0000000 0.0909091 
## Share 0-0.1 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.00000 0.00000 0.00000 0.00486 0.00000 0.09091 
## Share 0.1-0.2 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1000  0.1250  0.1559  0.1482  0.1667  0.1905 
## Share 0.1-0.2 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1000  0.1111  0.1250  0.1333  0.1667  0.1818 
## Share 0.2-0.3 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.2000  0.2000  0.2500  0.2414  0.2500  0.2941 
## Share 0.2-0.3 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.2000  0.2375  0.2500  0.2408  0.2500  0.2857 
## Share 0.3-0.4 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.3000  0.3333  0.3333  0.3364  0.3333  0.3846 
## Share 0.3-0.4 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.3077  0.3333  0.3333  0.3426  0.3458  0.3846 
## Share 0.4-0.5 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.4000  0.4000  0.4189  0.4230  0.4286  0.4857 
## Share 0.4-0.5 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.4000  0.4214  0.4286  0.4373  0.4644  0.4783 
## Share 0.5-0.6 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5000  0.5000  0.5000  0.5124  0.5000  0.5952 
## Share 0.5-0.6 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5000  0.5000  0.5000  0.5194  0.5455  0.5833 
## Share 0.6-0.7 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6000  0.6250  0.6667  0.6532  0.6667  0.7000 
## Share 0.6-0.7 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6000  0.6667  0.6667  0.6620  0.6667  0.7000 
## Share 0.7-0.8 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.7027  0.7241  0.7500  0.7453  0.7600  0.7949 
## Share 0.7-0.8 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.7500  0.7639  0.7778  0.7712  0.7817  0.7857 
## Share 0.8-0.9 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.8000  0.8235  0.8571  0.8506  0.8772  0.9000 
## Share 0.8-0.9 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.8000  0.8032  0.8406  0.8431  0.8778  0.8994 
## Share 0.9-1 (non-licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.9022  0.9167  0.9333  0.9346  0.9488  0.9859 
## Share 0.9-1 (licensed):    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.9118  0.9118  0.9118  0.9118  0.9118  0.9118

Figures 7-9

# Create time-varying treatment variables
for(var in c("treat", "count_cl", "year_conf")) {
  for(x in 1919:1939) {
    chem_figures[[paste0(var, "_", x)]] <- ifelse(chem_figures$grntyr == x, chem_figures[[var]], 0)
  }
}

pdata_figures <- pdata.frame(chem_figures, index = c("class_id", "grntyr"))

# Figure 7
fig7_model <- plm(count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - count - count_usa,
                 data = pdata_figures[, c("count_usa", "count_for",
                                         grep("treat_", names(pdata_figures), value = TRUE),
                                         grep("td_", names(pdata_figures), value = TRUE))],
                 model = "within", effect = "individual")

# Figure 8  
fig8_model <- plm(count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - count - count_usa,
                 data = pdata_figures[, c("count_usa", "count_for",
                                         grep("count_cl_", names(pdata_figures), value = TRUE),
                                         grep("td_", names(pdata_figures), value = TRUE))],
                 model = "within", effect = "individual")

# Figure 9
fig9_model <- plm(count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - count - count_usa,
                 data = pdata_figures[, c("count_usa", "count_for",
                                         grep("year_conf_", names(pdata_figures), value = TRUE),
                                         grep("td_", names(pdata_figures), value = TRUE))],
                 model = "within", effect = "individual")

summary(fig7_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - 
##     count - count_usa, data = pdata_figures[, c("count_usa", 
##     "count_for", grep("treat_", names(pdata_figures), value = TRUE), 
##     grep("td_", names(pdata_figures), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 7248, T = 65, N = 471120
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -10.349687  -0.262319  -0.035918   0.140264  56.660106 
## 
## Coefficients:
##              Estimate Std. Error  t-value  Pr(>|t|)    
## count_for   0.3051794  0.0029510 103.4173 < 2.2e-16 ***
## treat_1919 -0.1390698  0.0495215  -2.8083  0.004981 ** 
## treat_1920 -0.1218695  0.0495211  -2.4610  0.013857 *  
## treat_1921 -0.0807625  0.0495195  -1.6309  0.102907    
## treat_1922 -0.1440333  0.0495176  -2.9087  0.003629 ** 
## treat_1923 -0.0886856  0.0495187  -1.7910  0.073302 .  
## treat_1924 -0.1258678  0.0495179  -2.5419  0.011027 *  
## treat_1925 -0.1588739  0.0495186  -3.2084  0.001335 ** 
## treat_1926 -0.0244829  0.0495176  -0.4944  0.621004    
## treat_1927  0.0113855  0.0495176   0.2299  0.818147    
## treat_1928 -0.0096186  0.0495209  -0.1942  0.845994    
## treat_1929 -0.0885813  0.0495306  -1.7884  0.073710 .  
## treat_1930 -0.0808124  0.0495302  -1.6316  0.102769    
## treat_1931  0.1206270  0.0495648   2.4337  0.014945 *  
## treat_1932  0.3647623  0.0496911   7.3406  2.13e-13 ***
## treat_1933  0.4315286  0.0496237   8.6960 < 2.2e-16 ***
## treat_1934  0.4253747  0.0495455   8.5855 < 2.2e-16 ***
## treat_1935  0.4596614  0.0495637   9.2742 < 2.2e-16 ***
## treat_1936  0.6973511  0.0495664  14.0690 < 2.2e-16 ***
## treat_1937  0.5400754  0.0495554  10.8984 < 2.2e-16 ***
## treat_1938  0.6312583  0.0495832  12.7313 < 2.2e-16 ***
## treat_1939  0.9173378  0.0495652  18.5077 < 2.2e-16 ***
## td_1875    -0.4256610  0.0107909 -39.4464 < 2.2e-16 ***
## td_1876    -0.4212952  0.0107906 -39.0426 < 2.2e-16 ***
## td_1877    -0.4237204  0.0107904 -39.2684 < 2.2e-16 ***
## td_1878    -0.4391774  0.0107906 -40.7000 < 2.2e-16 ***
## td_1879    -0.4306143  0.0107901 -39.9082 < 2.2e-16 ***
## td_1880    -0.4218685  0.0107901 -39.0978 < 2.2e-16 ***
## td_1881    -0.4283681  0.0107886 -39.7055 < 2.2e-16 ***
## td_1882    -0.3919379  0.0107878 -36.3316 < 2.2e-16 ***
## td_1883    -0.3710831  0.0107883 -34.3968 < 2.2e-16 ***
## td_1884    -0.3913251  0.0107879 -36.2743 < 2.2e-16 ***
## td_1885    -0.3478273  0.0107882 -32.2415 < 2.2e-16 ***
## td_1886    -0.3763959  0.0107886 -34.8882 < 2.2e-16 ***
## td_1887    -0.3903217  0.0107882 -36.1805 < 2.2e-16 ***
## td_1888    -0.3891981  0.0107867 -36.0812 < 2.2e-16 ***
## td_1889    -0.3658911  0.0107862 -33.9221 < 2.2e-16 ***
## td_1890    -0.3467115  0.0107857 -32.1456 < 2.2e-16 ***
## td_1891    -0.3638268  0.0107855 -33.7329 < 2.2e-16 ***
## td_1892    -0.3882959  0.0107862 -35.9992 < 2.2e-16 ***
## td_1893    -0.3607269  0.0107846 -33.4482 < 2.2e-16 ***
## td_1894    -0.3983037  0.0107845 -36.9331 < 2.2e-16 ***
## td_1895    -0.3730125  0.0107853 -34.5852 < 2.2e-16 ***
## td_1896    -0.3715817  0.0107850 -34.4537 < 2.2e-16 ***
## td_1897    -0.3608916  0.0107836 -33.4666 < 2.2e-16 ***
## td_1898    -0.3973895  0.0107822 -36.8560 < 2.2e-16 ***
## td_1899    -0.3304794  0.0107804 -30.6555 < 2.2e-16 ***
## td_1901    -0.3436485  0.0107811 -31.8750 < 2.2e-16 ***
## td_1902    -0.3434801  0.0107812 -31.8593 < 2.2e-16 ***
## td_1903    -0.3143498  0.0107812 -29.1571 < 2.2e-16 ***
## td_1904    -0.3251986  0.0107825 -30.1598 < 2.2e-16 ***
## td_1905    -0.3221140  0.0107826 -29.8734 < 2.2e-16 ***
## td_1906    -0.2984927  0.0107831 -27.6815 < 2.2e-16 ***
## td_1907    -0.2442536  0.0107819 -22.6541 < 2.2e-16 ***
## td_1908    -0.2888203  0.0107817 -26.7881 < 2.2e-16 ***
## td_1909    -0.2593881  0.0107819 -24.0577 < 2.2e-16 ***
## td_1910    -0.2898191  0.0107814 -26.8814 < 2.2e-16 ***
## td_1911    -0.2614629  0.0107814 -24.2512 < 2.2e-16 ***
## td_1912    -0.2392570  0.0107814 -22.1917 < 2.2e-16 ***
## td_1913    -0.2755790  0.0107824 -25.5582 < 2.2e-16 ***
## td_1914    -0.1926039  0.0107820 -17.8635 < 2.2e-16 ***
## td_1915    -0.1416441  0.0107821 -13.1370 < 2.2e-16 ***
## td_1916    -0.0977860  0.0107823  -9.0691 < 2.2e-16 ***
## td_1917    -0.1074360  0.0107830  -9.9634 < 2.2e-16 ***
## td_1918    -0.1357583  0.0107840 -12.5888 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    400810
## Residual Sum of Squares: 372470
## R-Squared:      0.070722
## Adj. R-Squared: 0.056072
## F-statistic: 543.043 on 65 and 463807 DF, p-value: < 2.22e-16
summary(fig8_model) 
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - 
##     count - count_usa, data = pdata_figures[, c("count_usa", 
##     "count_for", grep("count_cl_", names(pdata_figures), value = TRUE), 
##     grep("td_", names(pdata_figures), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 7248, T = 65, N = 471120
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -10.356747  -0.258682  -0.038511   0.136906  56.658536 
## 
## Coefficients:
##                 Estimate Std. Error  t-value  Pr(>|t|)    
## count_for      0.3040731  0.0029529 102.9751 < 2.2e-16 ***
## count_cl_itt   0.0713974  0.0025820  27.6524 < 2.2e-16 ***
## count_cl_2    -0.0052174  0.0013165  -3.9631 7.400e-05 ***
## count_cl_1919 -0.1232106  0.0229124  -5.3775 7.558e-08 ***
## count_cl_1920 -0.1296104  0.0229123  -5.6568 1.543e-08 ***
## count_cl_1921 -0.0831446  0.0229121  -3.6289 0.0002847 ***
## count_cl_1922 -0.1248014  0.0229127  -5.4468 5.130e-08 ***
## count_cl_1923 -0.1207520  0.0229122  -5.2702 1.363e-07 ***
## count_cl_1924 -0.1408728  0.0229122  -6.1484 7.835e-10 ***
## count_cl_1925 -0.1569204  0.0229136  -6.8483 7.480e-12 ***
## count_cl_1926 -0.0954199  0.0229125  -4.1645 3.120e-05 ***
## count_cl_1927 -0.0873293  0.0229125  -3.8114 0.0001382 ***
## count_cl_1928 -0.0917152  0.0229154  -4.0023 6.273e-05 ***
## count_cl_1929 -0.1280222  0.0229197  -5.5857 2.329e-08 ***
## count_cl_1930 -0.1274135  0.0229194  -5.5592 2.712e-08 ***
## count_cl_1931 -0.0764718  0.0229408  -3.3334 0.0008578 ***
## count_cl_1932  0.0089664  0.0229964   0.3899 0.6966082    
## count_cl_1933  0.0255836  0.0229687   1.1138 0.2653468    
## count_cl_1934  0.0443935  0.0229289   1.9361 0.0528519 .  
## count_cl_1935  0.1275841  0.0229332   5.5633 2.649e-08 ***
## count_cl_1936  0.2050899  0.0229332   8.9429 < 2.2e-16 ***
## count_cl_1937  0.1243849  0.0229289   5.4248 5.804e-08 ***
## count_cl_1938  0.1395484  0.0229352   6.0845 1.170e-09 ***
## count_cl_1939  0.2084023  0.0229360   9.0863 < 2.2e-16 ***
## td_1875       -0.4079394  0.0107990 -37.7756 < 2.2e-16 ***
## td_1876       -0.4035720  0.0107988 -37.3719 < 2.2e-16 ***
## td_1877       -0.4059949  0.0107985 -37.5972 < 2.2e-16 ***
## td_1878       -0.4214539  0.0107988 -39.0279 < 2.2e-16 ***
## td_1879       -0.4128869  0.0107983 -38.2363 < 2.2e-16 ***
## td_1880       -0.4041407  0.0107983 -37.4265 < 2.2e-16 ***
## td_1881       -0.4106283  0.0107969 -38.0321 < 2.2e-16 ***
## td_1882       -0.3741906  0.0107961 -34.6598 < 2.2e-16 ***
## td_1883       -0.3533404  0.0107966 -32.7271 < 2.2e-16 ***
## td_1884       -0.3735790  0.0107962 -34.6028 < 2.2e-16 ***
## td_1885       -0.3300833  0.0107964 -30.5733 < 2.2e-16 ***
## td_1886       -0.3586559  0.0107969 -33.2185 < 2.2e-16 ***
## td_1887       -0.3725778  0.0107964 -34.5093 < 2.2e-16 ***
## td_1888       -0.3714407  0.0107951 -34.4084 < 2.2e-16 ***
## td_1889       -0.3481287  0.0107946 -32.2503 < 2.2e-16 ***
## td_1890       -0.3289436  0.0107941 -30.4745 < 2.2e-16 ***
## td_1891       -0.3460574  0.0107939 -32.0604 < 2.2e-16 ***
## td_1892       -0.3705337  0.0107946 -34.3258 < 2.2e-16 ***
## td_1893       -0.3429477  0.0107931 -31.7748 < 2.2e-16 ***
## td_1894       -0.3805228  0.0107929 -35.2566 < 2.2e-16 ***
## td_1895       -0.3552408  0.0107937 -32.9118 < 2.2e-16 ***
## td_1896       -0.3538062  0.0107934 -32.7799 < 2.2e-16 ***
## td_1897       -0.3431008  0.0107922 -31.7917 < 2.2e-16 ***
## td_1898       -0.3795799  0.0107909 -35.1761 < 2.2e-16 ***
## td_1899       -0.3126393  0.0107892 -28.9770 < 2.2e-16 ***
## td_1901       -0.3258217  0.0107899 -30.1970 < 2.2e-16 ***
## td_1902       -0.3256539  0.0107899 -30.1814 < 2.2e-16 ***
## td_1903       -0.2965247  0.0107899 -27.4816 < 2.2e-16 ***
## td_1904       -0.3073931  0.0107911 -28.4858 < 2.2e-16 ***
## td_1905       -0.3043102  0.0107912 -28.1998 < 2.2e-16 ***
## td_1906       -0.2806950  0.0107917 -26.0104 < 2.2e-16 ***
## td_1907       -0.2264390  0.0107905 -20.9850 < 2.2e-16 ***
## td_1908       -0.2710021  0.0107903 -25.1153 < 2.2e-16 ***
## td_1909       -0.2415736  0.0107905 -22.3875 < 2.2e-16 ***
## td_1910       -0.2719969  0.0107901 -25.2080 < 2.2e-16 ***
## td_1911       -0.2436414  0.0107901 -22.5800 < 2.2e-16 ***
## td_1912       -0.2214340  0.0107901 -20.5220 < 2.2e-16 ***
## td_1913       -0.2577718  0.0107910 -23.8876 < 2.2e-16 ***
## td_1914       -0.1747910  0.0107906 -16.1984 < 2.2e-16 ***
## td_1915       -0.1238328  0.0107907 -11.4758 < 2.2e-16 ***
## td_1916       -0.0799772  0.0107909  -7.4115 1.250e-13 ***
## td_1917       -0.0896377  0.0107916  -8.3062 < 2.2e-16 ***
## td_1918       -0.1179724  0.0107925 -10.9309 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    400810
## Residual Sum of Squares: 372020
## R-Squared:      0.071846
## Adj. R-Squared: 0.057209
## F-statistic: 535.848 on 67 and 463805 DF, p-value: < 2.22e-16
summary(fig9_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_usa ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - 
##     count - count_usa, data = pdata_figures[, c("count_usa", 
##     "count_for", grep("year_conf_", names(pdata_figures), value = TRUE), 
##     grep("td_", names(pdata_figures), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 7248, T = 65, N = 471120
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -10.358232  -0.258342  -0.038197   0.136791  56.663836 
## 
## Coefficients:
##                   Estimate  Std. Error  t-value  Pr(>|t|)    
## count_for       3.0271e-01  2.9512e-03 102.5719 < 2.2e-16 ***
## year_conf_2    -5.0658e-05  1.0787e-05  -4.6965 2.648e-06 ***
## year_conf_itt   9.0640e-03  3.1781e-04  28.5200 < 2.2e-16 ***
## year_conf_1919 -1.1926e-02  1.8574e-03  -6.4208 1.357e-10 ***
## year_conf_1920 -1.1626e-02  1.8574e-03  -6.2596 3.862e-10 ***
## year_conf_1921 -8.2219e-03  1.8573e-03  -4.4267 9.569e-06 ***
## year_conf_1922 -1.1105e-02  1.8574e-03  -5.9791 2.246e-09 ***
## year_conf_1923 -1.0471e-02  1.8573e-03  -5.6374 1.727e-08 ***
## year_conf_1924 -1.2470e-02  1.8573e-03  -6.7140 1.896e-11 ***
## year_conf_1925 -1.3693e-02  1.8574e-03  -7.3722 1.681e-13 ***
## year_conf_1926 -9.4043e-03  1.8573e-03  -5.0633 4.121e-07 ***
## year_conf_1927 -7.9967e-03  1.8573e-03  -4.3055 1.667e-05 ***
## year_conf_1928 -7.6438e-03  1.8575e-03  -4.1151 3.870e-05 ***
## year_conf_1929 -1.0318e-02  1.8577e-03  -5.5543 2.789e-08 ***
## year_conf_1930 -1.1032e-02  1.8577e-03  -5.9382 2.883e-09 ***
## year_conf_1931 -6.2165e-03  1.8592e-03  -3.3436  0.000827 ***
## year_conf_1932  4.5048e-04  1.8629e-03   0.2418  0.808920    
## year_conf_1933  3.2627e-03  1.8613e-03   1.7529  0.079617 .  
## year_conf_1934  4.5267e-03  1.8583e-03   2.4359  0.014857 *  
## year_conf_1935  8.3580e-03  1.8587e-03   4.4968 6.900e-06 ***
## year_conf_1936  1.5788e-02  1.8587e-03   8.4941 < 2.2e-16 ***
## year_conf_1937  9.3639e-03  1.8585e-03   5.0384 4.696e-07 ***
## year_conf_1938  1.1363e-02  1.8590e-03   6.1123 9.827e-10 ***
## year_conf_1939  1.7624e-02  1.8590e-03   9.4800 < 2.2e-16 ***
## td_1875        -4.0743e-01  1.0797e-02 -37.7348 < 2.2e-16 ***
## td_1876        -4.0307e-01  1.0797e-02 -37.3308 < 2.2e-16 ***
## td_1877        -4.0549e-01  1.0797e-02 -37.5559 < 2.2e-16 ***
## td_1878        -4.2095e-01  1.0797e-02 -38.9871 < 2.2e-16 ***
## td_1879        -4.1237e-01  1.0797e-02 -38.1948 < 2.2e-16 ***
## td_1880        -4.0363e-01  1.0797e-02 -37.3848 < 2.2e-16 ***
## td_1881        -4.1010e-01  1.0795e-02 -37.9891 < 2.2e-16 ***
## td_1882        -3.7365e-01  1.0794e-02 -34.6155 < 2.2e-16 ***
## td_1883        -3.5281e-01  1.0795e-02 -32.6830 < 2.2e-16 ***
## td_1884        -3.7304e-01  1.0795e-02 -34.5585 < 2.2e-16 ***
## td_1885        -3.2955e-01  1.0795e-02 -30.5287 < 2.2e-16 ***
## td_1886        -3.5813e-01  1.0795e-02 -33.1748 < 2.2e-16 ***
## td_1887        -3.7205e-01  1.0795e-02 -34.4653 < 2.2e-16 ***
## td_1888        -3.7089e-01  1.0793e-02 -34.3628 < 2.2e-16 ***
## td_1889        -3.4757e-01  1.0793e-02 -32.2038 < 2.2e-16 ***
## td_1890        -3.2838e-01  1.0792e-02 -30.4270 < 2.2e-16 ***
## td_1891        -3.4549e-01  1.0792e-02 -32.0130 < 2.2e-16 ***
## td_1892        -3.6998e-01  1.0793e-02 -34.2796 < 2.2e-16 ***
## td_1893        -3.4237e-01  1.0791e-02 -31.7262 < 2.2e-16 ***
## td_1894        -3.7994e-01  1.0791e-02 -35.2084 < 2.2e-16 ***
## td_1895        -3.5467e-01  1.0792e-02 -32.8643 < 2.2e-16 ***
## td_1896        -3.5323e-01  1.0792e-02 -32.7319 < 2.2e-16 ***
## td_1897        -3.4251e-01  1.0791e-02 -31.7418 < 2.2e-16 ***
## td_1898        -3.7897e-01  1.0789e-02 -35.1245 < 2.2e-16 ***
## td_1899        -3.1199e-01  1.0788e-02 -28.9209 < 2.2e-16 ***
## td_1901        -3.2519e-01  1.0788e-02 -30.1427 < 2.2e-16 ***
## td_1902        -3.2502e-01  1.0788e-02 -30.1271 < 2.2e-16 ***
## td_1903        -2.9589e-01  1.0788e-02 -27.4270 < 2.2e-16 ***
## td_1904        -3.0678e-01  1.0790e-02 -28.4336 < 2.2e-16 ***
## td_1905        -3.0370e-01  1.0790e-02 -28.1478 < 2.2e-16 ***
## td_1906        -2.8010e-01  1.0790e-02 -25.9588 < 2.2e-16 ***
## td_1907        -2.2582e-01  1.0789e-02 -20.9306 < 2.2e-16 ***
## td_1908        -2.7038e-01  1.0789e-02 -25.0612 < 2.2e-16 ***
## td_1909        -2.4095e-01  1.0789e-02 -22.3334 < 2.2e-16 ***
## td_1910        -2.7137e-01  1.0788e-02 -25.1534 < 2.2e-16 ***
## td_1911        -2.4301e-01  1.0789e-02 -22.5251 < 2.2e-16 ***
## td_1912        -2.2080e-01  1.0788e-02 -20.4667 < 2.2e-16 ***
## td_1913        -2.5716e-01  1.0789e-02 -23.8346 < 2.2e-16 ***
## td_1914        -1.7417e-01  1.0789e-02 -16.1436 < 2.2e-16 ***
## td_1915        -1.2322e-01  1.0789e-02 -11.4205 < 2.2e-16 ***
## td_1916        -7.9365e-02  1.0789e-02  -7.3559 1.900e-13 ***
## td_1917        -8.9038e-02  1.0790e-02  -8.2519 < 2.2e-16 ***
## td_1918        -1.1739e-01  1.0791e-02 -10.8784 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    400810
## Residual Sum of Squares: 371910
## R-Squared:      0.07211
## Adj. R-Squared: 0.057478
## F-statistic: 537.975 on 67 and 463805 DF, p-value: < 2.22e-16

Figure 10

## Figure 10
fig10 <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\fig10.dta")

# 首先创建时间变量 - 从td_*变量推断年份
cat("Creating year variable from time dummies...\n")
## Creating year variable from time dummies...
td_vars <- grep("^td_1[0-9]{3}$", names(fig10), value = TRUE)
years <- as.numeric(gsub("td_", "", td_vars))

# 为每个观测值分配年份
fig10$year <- NA
for(i in seq_along(td_vars)) {
  fig10$year[fig10[[td_vars[i]]] == 1] <- years[i]
}

# 检查年份分配情况
cat("Year distribution:\n")
## Year distribution:
year_table <- table(fig10$year, useNA = "always")
print(year_table)
## 
##  1876  1877  1878  1879  1880  1881  1882  1883  1884  1885  1886  1887  1888 
## 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 
##  1889  1890  1891  1892  1893  1894  1895  1896  1897  1898  1899  1900  1901 
## 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 
##  1902  1903  1904  1905  1906  1907  1908  1909  1910  1911  1912  1913  1914 
## 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 
##  1915  1916  1917  1918  1919  1920  1921  1922  1923  1924  1925  1926  1927 
## 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 
##  1928  1929  1930  1931  1932  1933  1934  1935  1936  1937  1938  1939  <NA> 
## 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496 14496
# 移除年份为NA的观测值
fig10_clean <- fig10[!is.na(fig10$year), ]
cat("\nRemoved", sum(is.na(fig10$year)), "observations with missing year\n")
## 
## Removed 14496 observations with missing year
cat("Remaining observations:", nrow(fig10_clean), "\n")
## Remaining observations: 927744
# 检查class_id的分布
cat("\nClass_id distribution:\n")
## 
## Class_id distribution:
class_table <- table(fig10_clean$class_id)
cat("Number of unique class_id:", length(unique(fig10_clean$class_id)), "\n")
## Number of unique class_id: 7248
cat("Observations per class_id:", mean(table(fig10_clean$class_id)), "\n")
## Observations per class_id: 128
# 运行面板回归
cat("\nRunning panel regression...\n")
## 
## Running panel regression...
# 方法1:使用明确的变量列表(更稳定)
fig10_model <- plm(
  y ~ usa_treat_td1919 + usa_treat_td1920 + usa_treat_td1921 + usa_treat_td1922 + usa_treat_td1923 +
      usa_treat_td1924 + usa_treat_td1925 + usa_treat_td1926 + usa_treat_td1927 + usa_treat_td1928 +
      usa_treat_td1929 + usa_treat_td1930 + usa_treat_td1931 + usa_treat_td1932 + usa_treat_td1933 +
      usa_treat_td1934 + usa_treat_td1935 + usa_treat_td1936 + usa_treat_td1937 + usa_treat_td1938 +
      usa_treat_td1939 +
      usa_td1919 + usa_td1920 + usa_td1921 + usa_td1922 + usa_td1923 + usa_td1924 + usa_td1925 +
      usa_td1926 + usa_td1927 + usa_td1928 + usa_td1929 + usa_td1930 + usa_td1931 + usa_td1932 +
      usa_td1933 + usa_td1934 + usa_td1935 + usa_td1936 + usa_td1937 + usa_td1938 + usa_td1939 +
      treat_td1919 + treat_td1920 + treat_td1921 + treat_td1922 + treat_td1923 + treat_td1924 +
      treat_td1925 + treat_td1926 + treat_td1927 + treat_td1928 + treat_td1929 + treat_td1930 +
      treat_td1931 + treat_td1932 + treat_td1933 + treat_td1934 + treat_td1935 + treat_td1936 +
      treat_td1937 + treat_td1938 + treat_td1939 +
      usa + treat,
  data = fig10_clean,
  index = c("class_id", "year"),
  model = "within", 
  effect = "individual"
)

# 输出结果
cat("\n=== Figure 10 Regression Results ===\n")
## 
## === Figure 10 Regression Results ===
print(summary(fig10_model))
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = y ~ usa_treat_td1919 + usa_treat_td1920 + usa_treat_td1921 + 
##     usa_treat_td1922 + usa_treat_td1923 + usa_treat_td1924 + 
##     usa_treat_td1925 + usa_treat_td1926 + usa_treat_td1927 + 
##     usa_treat_td1928 + usa_treat_td1929 + usa_treat_td1930 + 
##     usa_treat_td1931 + usa_treat_td1932 + usa_treat_td1933 + 
##     usa_treat_td1934 + usa_treat_td1935 + usa_treat_td1936 + 
##     usa_treat_td1937 + usa_treat_td1938 + usa_treat_td1939 + 
##     usa_td1919 + usa_td1920 + usa_td1921 + usa_td1922 + usa_td1923 + 
##     usa_td1924 + usa_td1925 + usa_td1926 + usa_td1927 + usa_td1928 + 
##     usa_td1929 + usa_td1930 + usa_td1931 + usa_td1932 + usa_td1933 + 
##     usa_td1934 + usa_td1935 + usa_td1936 + usa_td1937 + usa_td1938 + 
##     usa_td1939 + treat_td1919 + treat_td1920 + treat_td1921 + 
##     treat_td1922 + treat_td1923 + treat_td1924 + treat_td1925 + 
##     treat_td1926 + treat_td1927 + treat_td1928 + treat_td1929 + 
##     treat_td1930 + treat_td1931 + treat_td1932 + treat_td1933 + 
##     treat_td1934 + treat_td1935 + treat_td1936 + treat_td1937 + 
##     treat_td1938 + treat_td1939 + usa + treat, data = fig10_clean, 
##     effect = "individual", model = "within", index = c("class_id", 
##         "year"))
## 
## Balanced Panel: n = 7248, T = 64, N = 927744
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -7.121666 -0.212323 -0.032636  0.128334 62.514239 
## 
## Coefficients:
##                    Estimate Std. Error  t-value  Pr(>|t|)    
## usa_treat_td1919 -0.2357866  0.0579182  -4.0710 4.681e-05 ***
## usa_treat_td1920 -0.1804997  0.0579182  -3.1165 0.0018304 ** 
## usa_treat_td1921 -0.1550781  0.0579182  -2.6775 0.0074168 ** 
## usa_treat_td1922 -0.2180327  0.0579182  -3.7645 0.0001669 ***
## usa_treat_td1923 -0.1424706  0.0579182  -2.4599 0.0138994 *  
## usa_treat_td1924 -0.2554625  0.0579182  -4.4107 1.030e-05 ***
## usa_treat_td1925 -0.2514942  0.0579182  -4.3422 1.411e-05 ***
## usa_treat_td1926 -0.1580336  0.0579182  -2.7286 0.0063612 ** 
## usa_treat_td1927 -0.0639942  0.0579182  -1.1049 0.2692006    
## usa_treat_td1928 -0.0856336  0.0579182  -1.4785 0.1392675    
## usa_treat_td1929 -0.1507171  0.0579182  -2.6022 0.0092619 ** 
## usa_treat_td1930 -0.1989355  0.0579182  -3.4348 0.0005931 ***
## usa_treat_td1931 -0.2341951  0.0579182  -4.0435 5.265e-05 ***
## usa_treat_td1932 -0.1141141  0.0579182  -1.9703 0.0488087 *  
## usa_treat_td1933  0.0299005  0.0579182   0.5163 0.6056780    
## usa_treat_td1934 -0.0586619  0.0579182  -1.0128 0.3111371    
## usa_treat_td1935 -0.1034287  0.0579182  -1.7858 0.0741366 .  
## usa_treat_td1936  0.0651600  0.0579182   1.1250 0.2605746    
## usa_treat_td1937 -0.0133576  0.0579182  -0.2306 0.8176028    
## usa_treat_td1938  0.1386554  0.0579182   2.3940 0.0166666 *  
## usa_treat_td1939  0.2524120  0.0579182   4.3581 1.312e-05 ***
## usa_td1919        0.1782398  0.0090209  19.7585 < 2.2e-16 ***
## usa_td1920        0.1705720  0.0090209  18.9085 < 2.2e-16 ***
## usa_td1921        0.2165789  0.0090209  24.0085 < 2.2e-16 ***
## usa_td1922        0.2319146  0.0090209  25.7085 < 2.2e-16 ***
## usa_td1923        0.1890905  0.0090209  20.9613 < 2.2e-16 ***
## usa_td1924        0.2395824  0.0090209  26.5585 < 2.2e-16 ***
## usa_td1925        0.2534713  0.0090209  28.0982 < 2.2e-16 ***
## usa_td1926        0.2850106  0.0090209  31.5944 < 2.2e-16 ***
## usa_td1927        0.2118046  0.0090209  23.4793 < 2.2e-16 ***
## usa_td1928        0.2304678  0.0090209  25.5481 < 2.2e-16 ***
## usa_td1929        0.3015037  0.0090209  33.4227 < 2.2e-16 ***
## usa_td1930        0.3169840  0.0090209  35.1388 < 2.2e-16 ***
## usa_td1931        0.5099817  0.0090209  56.5332 < 2.2e-16 ***
## usa_td1932        0.5565673  0.0090209  61.6974 < 2.2e-16 ***
## usa_td1933        0.5554099  0.0090209  61.5691 < 2.2e-16 ***
## usa_td1934        0.5755199  0.0090209  63.7983 < 2.2e-16 ***
## usa_td1935        0.5399296  0.0090209  59.8530 < 2.2e-16 ***
## usa_td1936        0.6124122  0.0090209  67.8880 < 2.2e-16 ***
## usa_td1937        0.5778347  0.0090209  64.0549 < 2.2e-16 ***
## usa_td1938        0.6222502  0.0090209  68.9786 < 2.2e-16 ***
## usa_td1939        0.7495650  0.0090209  83.0918 < 2.2e-16 ***
## treat_td1919      0.1418686  0.0407019   3.4856 0.0004911 ***
## treat_td1920      0.1150829  0.0407019   2.8275 0.0046920 ** 
## treat_td1921      0.1002020  0.0407019   2.4619 0.0138224 *  
## treat_td1922      0.1299639  0.0407019   3.1931 0.0014077 ** 
## treat_td1923      0.1180591  0.0407019   2.9006 0.0037248 ** 
## treat_td1924      0.1597258  0.0407019   3.9243 8.699e-05 ***
## treat_td1925      0.1597258  0.0407019   3.9243 8.699e-05 ***
## treat_td1926      0.1418686  0.0407019   3.4856 0.0004911 ***
## treat_td1927      0.1478210  0.0407019   3.6318 0.0002815 ***
## treat_td1928      0.1924639  0.0407019   4.7286 2.261e-06 ***
## treat_td1929      0.1656781  0.0407019   4.0705 4.691e-05 ***
## treat_td1930      0.2043686  0.0407019   5.0211 5.138e-07 ***
## treat_td1931      0.3561543  0.0407019   8.7503 < 2.2e-16 ***
## treat_td1932      0.6388924  0.0407019  15.6969 < 2.2e-16 ***
## treat_td1933      0.4692496  0.0407019  11.5289 < 2.2e-16 ***
## treat_td1934      0.3680591  0.0407019   9.0428 < 2.2e-16 ***
## treat_td1935      0.5317496  0.0407019  13.0645 < 2.2e-16 ***
## treat_td1936      0.5347258  0.0407019  13.1376 < 2.2e-16 ***
## treat_td1937      0.4632972  0.0407019  11.3827 < 2.2e-16 ***
## treat_td1938      0.4216305  0.0407019  10.3590 < 2.2e-16 ***
## treat_td1939      0.4275829  0.0407019  10.5052 < 2.2e-16 ***
## usa               0.1765944  0.0017242 102.4199 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    550390
## Residual Sum of Squares: 506230
## R-Squared:      0.080238
## Adj. R-Squared: 0.072933
## F-statistic: 1254.64 on 64 and 920432 DF, p-value: < 2.22e-16
# 模型信息
cat("\nModel information:\n")
## 
## Model information:
cat("Number of observations:", nobs(fig10_model), "\n")
## Number of observations: 927744
if(nobs(fig10_model) > 0) {
  cat("Number of groups (class_id):", length(unique(index(fig10_model)[[1]])), "\n")
  cat("Time periods:", length(unique(index(fig10_model)[[2]])), "\n")
}
## Number of groups (class_id): 7248 
## Time periods: 64

Figure 11

# Count France regression
fig11_model <- plm(count_france ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - count - count_france,
                  data = pdata_figures[, c("count_france",
                                          grep("treat_", names(pdata_figures), value = TRUE),
                                          grep("td_", names(pdata_figures), value = TRUE))],
                  model = "within", effect = "individual")
summary(fig11_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_france ~ . - class_id - grntyr - uspto_class_class_class_class_class_class_class - 
##     count - count_france, data = pdata_figures[, c("count_france", 
##     grep("treat_", names(pdata_figures), value = TRUE), grep("td_", 
##         names(pdata_figures), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 7248, T = 65, N = 471120
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.4217491 -0.0144159 -0.0018934  0.0019345 16.6279431 
## 
## Coefficients:
##               Estimate  Std. Error t-value  Pr(>|t|)    
## treat_1919 -0.01280783  0.00707564 -1.8101 0.0702763 .  
## treat_1920 -0.01280783  0.00707564 -1.8101 0.0702763 .  
## treat_1921 -0.00983164  0.00707564 -1.3895 0.1646799    
## treat_1922  0.04969217  0.00707564  7.0230 2.175e-12 ***
## treat_1923 -0.01578402  0.00707564 -2.2308 0.0256979 *  
## treat_1924 -0.00387926  0.00707564 -0.5483 0.5835167    
## treat_1925 -0.00983164  0.00707564 -1.3895 0.1646799    
## treat_1926 -0.00387926  0.00707564 -0.5483 0.5835167    
## treat_1927 -0.02471259  0.00707564 -3.4926 0.0004783 ***
## treat_1928 -0.00387926  0.00707564 -0.5483 0.5835167    
## treat_1929 -0.00387926  0.00707564 -0.5483 0.5835167    
## treat_1930 -0.02471259  0.00707564 -3.4926 0.0004783 ***
## treat_1931 -0.00090307  0.00707564 -0.1276 0.8984412    
## treat_1932 -0.01578402  0.00707564 -2.2308 0.0256979 *  
## treat_1933  0.00207312  0.00707564  0.2930 0.7695270    
## treat_1934 -0.01578402  0.00707564 -2.2308 0.0256979 *  
## treat_1935  0.01993026  0.00707564  2.8167 0.0048516 ** 
## treat_1936  0.01695407  0.00707564  2.3961 0.0165702 *  
## treat_1937  0.01993026  0.00707564  2.8167 0.0048516 ** 
## treat_1938  0.01100169  0.00707564  1.5549 0.1199782    
## treat_1939 -0.02173640  0.00707564 -3.0720 0.0021264 ** 
## td_1875    -0.01086426  0.00154017 -7.0539 1.742e-12 ***
## td_1876    -0.01045036  0.00154017 -6.7852 1.161e-11 ***
## td_1877    -0.01141614  0.00154017 -7.4123 1.244e-13 ***
## td_1878    -0.01045036  0.00154017 -6.7852 1.161e-11 ***
## td_1879    -0.00810488  0.00154017 -5.2623 1.423e-07 ***
## td_1880    -0.01196802  0.00154017 -7.7706 7.829e-15 ***
## td_1881    -0.00769097  0.00154017 -4.9936 5.929e-07 ***
## td_1882    -0.00672519  0.00154017 -4.3665 1.263e-05 ***
## td_1883    -0.00658722  0.00154017 -4.2769 1.895e-05 ***
## td_1884    -0.00658722  0.00154017 -4.2769 1.895e-05 ***
## td_1885    -0.01100223  0.00154017 -7.1435 9.111e-13 ***
## td_1886    -0.00962254  0.00154017 -6.2477 4.169e-10 ***
## td_1887    -0.00796691  0.00154017 -5.1727 2.308e-07 ***
## td_1888    -0.00175830  0.00154017 -1.1416 0.2536092    
## td_1889    -0.00148237  0.00154017 -0.9625 0.3358153    
## td_1890     0.00072514  0.00154017  0.4708 0.6377712    
## td_1891     0.00017326  0.00154017  0.1125 0.9104299    
## td_1892     0.00127702  0.00154017  0.8291 0.4070262    
## td_1893     0.00927922  0.00154017  6.0248 1.694e-09 ***
## td_1894     0.00941719  0.00154017  6.1144 9.701e-10 ***
## td_1895     0.00541609  0.00154017  3.5165 0.0004372 ***
## td_1896     0.00403640  0.00154017  2.6207 0.0087741 ** 
## td_1897     0.00955516  0.00154017  6.2040 5.511e-10 ***
## td_1898     0.01797128  0.00154017 11.6684 < 2.2e-16 ***
## td_1899     0.01134876  0.00154017  7.3685 1.728e-13 ***
## td_1901    -0.00079252  0.00154017 -0.5146 0.6068566    
## td_1902     0.00307061  0.00154017  1.9937 0.0461873 *  
## td_1903    -0.00658722  0.00154017 -4.2769 1.895e-05 ***
## td_1904    -0.00465565  0.00154017 -3.0228 0.0025045 ** 
## td_1905    -0.00493159  0.00154017 -3.2020 0.0013650 ** 
## td_1906    -0.00382784  0.00154017 -2.4853 0.0129434 *  
## td_1907    -0.00493159  0.00154017 -3.2020 0.0013650 ** 
## td_1908    -0.00493159  0.00154017 -3.2020 0.0013650 ** 
## td_1909    -0.00286206  0.00154017 -1.8583 0.0631312 .  
## td_1910    -0.00368987  0.00154017 -2.3958 0.0165867 *  
## td_1911    -0.00106846  0.00154017 -0.6937 0.4878541    
## td_1912    -0.00203424  0.00154017 -1.3208 0.1865724    
## td_1913    -0.00782894  0.00154017 -5.0832 3.713e-07 ***
## td_1914    -0.00644925  0.00154017 -4.1874 2.823e-05 ***
## td_1915    -0.00286206  0.00154017 -1.8583 0.0631312 .  
## td_1916    -0.00175830  0.00154017 -1.1416 0.2536092    
## td_1917    -0.00631128  0.00154017 -4.0978 4.172e-05 ***
## td_1918    -0.00713910  0.00154017 -4.6353 3.566e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    7622.2
## Residual Sum of Squares: 7605
## R-Squared:      0.0022575
## Adj. R-Squared: -0.01347
## F-statistic: 16.397 on 64 and 463808 DF, p-value: < 2.22e-16

Figure 13

# Load indigo dataset for Figure 13
indigo_fig13 <- read_dta("C:\\Users\\wang\\Desktop\\Moser and Voena (2012) replication package\\compulsory_licensing_replication\\chem_patents_indigodataset.dta")

# Create time dummies and treatment interactions
for(x in 1876:1939) {
  indigo_fig13[[paste0("td_", x)]] <- as.numeric(indigo_fig13$grntyr == x)
}

for(x in 1919:1939) {
  indigo_fig13[[paste0("treat_", x)]] <- ifelse(indigo_fig13$grntyr == x, indigo_fig13$treat, 0)
}

pdata_indigo_fig13 <- pdata.frame(indigo_fig13, index = c("class_id", "grntyr"))

fig13_model <- plm(count_usa ~ . - class_id - grntyr - count_usa,
                  data = pdata_indigo_fig13[, c("count_usa", "count_for",
                                               grep("treat_", names(pdata_indigo_fig13), value = TRUE),
                                               grep("td_", names(pdata_indigo_fig13), value = TRUE))],
                  model = "within", effect = "individual")
summary(fig13_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = count_usa ~ . - class_id - grntyr - count_usa, 
##     data = pdata_indigo_fig13[, c("count_usa", "count_for", grep("treat_", 
##         names(pdata_indigo_fig13), value = TRUE), grep("td_", 
##         names(pdata_indigo_fig13), value = TRUE))], effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 704, T = 65, N = 45760
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.7378213 -0.0185688 -0.0036886  0.0099155  4.7424259 
## 
## Coefficients:
##               Estimate  Std. Error t-value  Pr(>|t|)    
## count_for   0.03227848  0.00311596 10.3591 < 2.2e-16 ***
## treat_1919  0.00073284  0.01326601  0.0552 0.9559461    
## treat_1920  0.01841459  0.01326676  1.3880 0.1651366    
## treat_1921  0.02303356  0.01326538  1.7364 0.0825059 .  
## treat_1922  0.01054275  0.01326522  0.7948 0.4267537    
## treat_1923  0.00629578  0.01326572  0.4746 0.6350816    
## treat_1924  0.00828410  0.01326529  0.6245 0.5323064    
## treat_1925  0.01452804  0.01326605  1.0951 0.2734655    
## treat_1926  0.02579743  0.01326551  1.9447 0.0518173 .  
## treat_1927  0.01891697  0.01326890  1.4257 0.1539728    
## treat_1928  0.07554848  0.01326599  5.6949 1.242e-08 ***
## treat_1929  0.01271752  0.01326659  0.9586 0.3377590    
## treat_1930  0.00532536  0.01326522  0.4015 0.6880889    
## treat_1931  0.07159759  0.01326525  5.3974 6.796e-08 ***
## treat_1932  0.08890056  0.01326528  6.7017 2.084e-11 ***
## treat_1933  0.04078277  0.01327324  3.0726 0.0021236 ** 
## treat_1934  0.11254285  0.01326779  8.4824 < 2.2e-16 ***
## treat_1935  0.11189463  0.01326553  8.4350 < 2.2e-16 ***
## treat_1936  0.13249482  0.01326519  9.9882 < 2.2e-16 ***
## treat_1937  0.02701859  0.01326521  2.0368 0.0416759 *  
## treat_1938  0.08498168  0.01326771  6.4051 1.517e-10 ***
## treat_1939  0.02315979  0.01326608  1.7458 0.0808543 .  
## td_1876     0.00151216  0.00717637  0.2107 0.8331123    
## td_1877     0.00146630  0.00717637  0.2043 0.8381013    
## td_1878    -0.00137460  0.00717637 -0.1915 0.8480988    
## td_1879     0.00009170  0.00717637  0.0128 0.9898049    
## td_1880    -0.00467402  0.00717648 -0.6513 0.5148586    
## td_1881     0.00229071  0.00717657  0.3192 0.7495819    
## td_1882     0.00247411  0.00717646  0.3448 0.7302814    
## td_1883    -0.00146630  0.00717637 -0.2043 0.8381013    
## td_1884    -0.00036680  0.00717646 -0.0511 0.9592367    
## td_1885     0.00261166  0.00717640  0.3639 0.7159172    
## td_1886    -0.00302431  0.00717639 -0.4214 0.6734469    
## td_1887    -0.00329941  0.00717651 -0.4598 0.6456967    
## td_1888     0.00545257  0.00717640  0.7598 0.4473835    
## td_1889    -0.00458231  0.00717644 -0.6385 0.5231370    
## td_1890    -0.00476572  0.00717654 -0.6641 0.5066495    
## td_1891    -0.00151216  0.00717637 -0.2107 0.8331123    
## td_1892    -0.00471987  0.00717651 -0.6577 0.5107453    
## td_1893    -0.00536177  0.00717716 -0.7471 0.4550312    
## td_1894    -0.00325356  0.00717648 -0.4534 0.6502886    
## td_1895    -0.00549932  0.00717736 -0.7662 0.4435597    
## td_1896    -0.00430721  0.00717637 -0.6002 0.5483801    
## td_1897     0.00559012  0.00717637  0.7790 0.4360067    
## td_1898    -0.00210821  0.00717668 -0.2938 0.7689442    
## td_1899    -0.00357451  0.00717672 -0.4981 0.6184369    
## td_1900    -0.00013845  0.00717795 -0.0193 0.9846113    
## td_1901    -0.00490416  0.00717913 -0.6831 0.4945385    
## td_1902    -0.00618707  0.00717878 -0.8619 0.3887716    
## td_1903    -0.00197155  0.00717889 -0.2746 0.7836001    
## td_1904    -0.00577442  0.00717786 -0.8045 0.4211260    
## td_1905     0.00316096  0.00717716  0.4404 0.6596353    
## td_1906    -0.00380376  0.00717697 -0.5300 0.5961178    
## td_1907    -0.00545347  0.00717729 -0.7598 0.4473648    
## td_1908    -0.00522422  0.00717697 -0.7279 0.4666702    
## td_1909    -0.00527007  0.00717703 -0.7343 0.4627721    
## td_1910    -0.00458231  0.00717644 -0.6385 0.5231370    
## td_1911    -0.00513252  0.00717686 -0.7151 0.4745216    
## td_1912     0.00201561  0.00717681  0.2808 0.7788268    
## td_1913    -0.00421641  0.00717760 -0.5874 0.5569108    
## td_1914    -0.00527007  0.00717703 -0.7343 0.4627721    
## td_1915     0.00256581  0.00717642  0.3575 0.7206943    
## td_1916     0.00361946  0.00717664  0.5043 0.6140253    
## td_1917     0.00998903  0.00717637  1.3919 0.1639494    
## td_1918    -0.00421551  0.00717637 -0.5874 0.5569275    
## td_1919    -0.00439565  0.00757689 -0.5801 0.5618240    
## td_1920     0.00918058  0.00757708  1.2116 0.2256623    
## td_1921     0.01131266  0.00757688  1.4931 0.1354308    
## td_1922     0.00704849  0.00757747  0.9302 0.3522775    
## td_1923     0.01254657  0.00757717  1.6558 0.0977617 .  
## td_1924     0.00205565  0.00757722  0.2713 0.7861671    
## td_1925    -0.00293720  0.00757704 -0.3876 0.6982807    
## td_1926     0.01580028  0.00757740  2.0852 0.0370582 *  
## td_1927     0.02617893  0.00757747  3.4548 0.0005511 ***
## td_1928     0.00530936  0.00757747  0.7007 0.4835082    
## td_1929    -0.00563065  0.00757825 -0.7430 0.4574850    
## td_1930     0.01226588  0.00757747  1.6187 0.1055123    
## td_1931     0.03801602  0.00757796  5.0167 5.278e-07 ***
## td_1932     0.01821085  0.00758553  2.4007 0.0163663 *  
## td_1933     0.00856197  0.00758228  1.1292 0.2588160    
## td_1934     0.04508371  0.00758228  5.9459 2.769e-09 ***
## td_1935     0.02247612  0.00757778  2.9661 0.0030180 ** 
## td_1936     0.10915196  0.00757825 14.4033 < 2.2e-16 ***
## td_1937     0.08334568  0.00757778 10.9987 < 2.2e-16 ***
## td_1938     0.02112884  0.00758094  2.7871 0.0053204 ** 
## td_1939     0.08895603  0.00757728 11.7398 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    854.74
## Residual Sum of Squares: 815.22
## R-Squared:      0.046234
## Adj. R-Squared: 0.0295
## F-statistic: 25.3479 on 86 and 44970 DF, p-value: < 2.22e-16