Commit
·
c385d98
1
Parent(s):
7b9c273
add 107
Browse files- 107/paper.pdf +3 -0
- 107/replication_package/AER_UPLOADED/MAIN.do +107 -0
- 107/replication_package/AER_UPLOADED/data/Use_SUT_Framework_2007_2012_DET.csv +3 -0
- 107/replication_package/AER_UPLOADED/data/apat63_99.txt +3 -0
- 107/replication_package/AER_UPLOADED/data/bea_codes.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/bea_county_crosswalk.txt +3 -0
- 107/replication_package/AER_UPLOADED/data/create_COMETS_Patent_ExtractForEnrico.do +83 -0
- 107/replication_package/AER_UPLOADED/data/documenation/CodebookCOMETS20.xlsx +3 -0
- 107/replication_package/AER_UPLOADED/data/documenation/apat63_99_documentation.txt +3 -0
- 107/replication_package/AER_UPLOADED/data/documenation/bea_county_crosswalk_codebook.cvs +0 -0
- 107/replication_package/AER_UPLOADED/data/kodak_stock.csv +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_assignees.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_citations.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_cite_counts.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_inventors.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_us_classes.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/patent_zd_cats.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/read.do +23 -0
- 107/replication_package/AER_UPLOADED/data/read1.do +48 -0
- 107/replication_package/AER_UPLOADED/data/read_apat.do +6 -0
- 107/replication_package/AER_UPLOADED/data/tva1.dta +3 -0
- 107/replication_package/AER_UPLOADED/data/uspc_Class_to_naics07_6.txt +3 -0
- 107/replication_package/AER_UPLOADED/data2/citations_made.do +91 -0
- 107/replication_package/AER_UPLOADED/data2/citations_received.do +81 -0
- 107/replication_package/AER_UPLOADED/data2/data_4.do +358 -0
- 107/replication_package/AER_UPLOADED/data2/density14_W.do +177 -0
- 107/replication_package/AER_UPLOADED/data2/density_14_3_reshaped.do +9 -0
- 107/replication_package/AER_UPLOADED/data2/density_team.do +103 -0
- 107/replication_package/AER_UPLOADED/data_3.do +380 -0
- 107/replication_package/AER_UPLOADED/iv_new.do +122 -0
- 107/replication_package/AER_UPLOADED/kodak_stock.do +14 -0
- 107/replication_package/AER_UPLOADED/reg.do +483 -0
- 107/replication_package/AER_UPLOADED/reg11.do +242 -0
- 107/replication_package/AER_UPLOADED/reg13.do +211 -0
- 107/replication_package/AER_UPLOADED/reg2.do +333 -0
- 107/replication_package/AER_UPLOADED/reg20.do +605 -0
- 107/replication_package/AER_UPLOADED/reg22.do +330 -0
- 107/replication_package/AER_UPLOADED/reg23.do +304 -0
- 107/replication_package/AER_UPLOADED/reg27.do +136 -0
- 107/replication_package/AER_UPLOADED/reg29.do +215 -0
- 107/replication_package/AER_UPLOADED/reg3.do +271 -0
- 107/replication_package/AER_UPLOADED/reg30.do +161 -0
- 107/replication_package/AER_UPLOADED/reg31.do +167 -0
- 107/replication_package/AER_UPLOADED/reg34.do +194 -0
- 107/replication_package/AER_UPLOADED/reg36.do +277 -0
- 107/replication_package/AER_UPLOADED/reg4.do +480 -0
- 107/replication_package/AER_UPLOADED/reg5.do +88 -0
- 107/replication_package/README.pdf +3 -0
- 107/should_reproduce.txt +3 -0
107/paper.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2041794b3f9a716c71d0e965d69dad971ec9bd464e10f2586f1f600f06be99ff
|
3 |
+
size 1302997
|
107/replication_package/AER_UPLOADED/MAIN.do
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
global main ~/projects/patents_and_density/AER
|
2 |
+
|
3 |
+
|
4 |
+
* Read COMETS data
|
5 |
+
include $main/data/create_COMETS_Patent_ExtractForEnrico.do
|
6 |
+
clear all
|
7 |
+
|
8 |
+
* Read APAT data
|
9 |
+
include $main/data/read_apat
|
10 |
+
clear all
|
11 |
+
|
12 |
+
* Read Input-Output Tables
|
13 |
+
include $main/data/read1
|
14 |
+
clear all
|
15 |
+
|
16 |
+
* Take Comets data and apat data and creates new variables
|
17 |
+
include $main/data_3.do
|
18 |
+
clear all
|
19 |
+
|
20 |
+
* Figure 2 -- Top panel
|
21 |
+
include $main/kodak_stock.do
|
22 |
+
clear all
|
23 |
+
|
24 |
+
|
25 |
+
* Table 2 (col 1 to 4) Table 4 (col 1 to 4); Fig 2 (bottom panel) and Fig 3
|
26 |
+
include $main/reg3.do
|
27 |
+
clear all
|
28 |
+
include $main/reg27.do
|
29 |
+
clear all
|
30 |
+
|
31 |
+
|
32 |
+
* Table 2 (col 5) Table 4 (col 5)
|
33 |
+
include $main/data/read
|
34 |
+
clear
|
35 |
+
include $main/reg22.do
|
36 |
+
clear all
|
37 |
+
|
38 |
+
|
39 |
+
* Table 3, Table 6 (rows 1-8), 8 (top panel); Fig 5, Fig A1
|
40 |
+
include $main/reg.do
|
41 |
+
clear all
|
42 |
+
|
43 |
+
* Fig 6
|
44 |
+
include $main/reg23.do
|
45 |
+
clear all
|
46 |
+
|
47 |
+
|
48 |
+
* Table 1, 10, 11, 12 (column1); Appendix Table A1; Fig 1 and 4
|
49 |
+
include $main/reg2.do
|
50 |
+
clear all
|
51 |
+
|
52 |
+
|
53 |
+
* Table 12 (column2)
|
54 |
+
include $main/reg29.do
|
55 |
+
clear all
|
56 |
+
|
57 |
+
* Creates iv data for regressions
|
58 |
+
include $main/iv_new.do
|
59 |
+
clear all
|
60 |
+
|
61 |
+
|
62 |
+
* Table 5
|
63 |
+
* Note: F-stat are in Main.log (llok for XXX FTEST)
|
64 |
+
include $main/reg11.do
|
65 |
+
clear all
|
66 |
+
include $main/reg13.do
|
67 |
+
clear all
|
68 |
+
|
69 |
+
|
70 |
+
* Tab 6 (col 9,10); tab 7; tab8 (panel b); appendix tab A3, A5, A8
|
71 |
+
include $main/data2/citations_received.do
|
72 |
+
clear all
|
73 |
+
include $main/data2/citations_made.do
|
74 |
+
clear all
|
75 |
+
include $main/data2/density_team.do
|
76 |
+
clear all
|
77 |
+
include $main/data2/density14_W.do
|
78 |
+
clear all
|
79 |
+
include $main/data2/density_14_3_reshaped.do
|
80 |
+
clear all
|
81 |
+
include $main/reg20.do
|
82 |
+
clear all
|
83 |
+
|
84 |
+
|
85 |
+
* Appendix Table A2
|
86 |
+
include $main/reg5.do
|
87 |
+
clear all
|
88 |
+
|
89 |
+
* Appendix Table A4
|
90 |
+
include $main/reg36.do
|
91 |
+
clear all
|
92 |
+
|
93 |
+
* Appendix Table A6
|
94 |
+
include $main/reg31.do
|
95 |
+
clear all
|
96 |
+
include $main/reg30.do
|
97 |
+
clear all
|
98 |
+
|
99 |
+
|
100 |
+
* Appendix Table A7
|
101 |
+
include $main/data2/data_4.do
|
102 |
+
clear all
|
103 |
+
include $main/reg4.do
|
104 |
+
clear all
|
105 |
+
include $main/reg34.do
|
106 |
+
clear all
|
107 |
+
|
107/replication_package/AER_UPLOADED/data/Use_SUT_Framework_2007_2012_DET.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:102eec0c0330af065d8e482d8f3ea726c79c820e5838675233e750b89aec0b96
|
3 |
+
size 303309
|
107/replication_package/AER_UPLOADED/data/apat63_99.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:021a4a445368162093dd79b46088c78daf3e6f87837d106b58c542651dd9bb63
|
3 |
+
size 236903179
|
107/replication_package/AER_UPLOADED/data/bea_codes.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5b41064edb79e3f41ad2395e2c5f5b5be756fe033495682b128f2c8baa73c6ea
|
3 |
+
size 12217
|
107/replication_package/AER_UPLOADED/data/bea_county_crosswalk.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d9f425f23efae534d1ffcf0e7d5436b6b56eddbab10bfb152e31dfc11d68535
|
3 |
+
size 192318
|
107/replication_package/AER_UPLOADED/data/create_COMETS_Patent_ExtractForEnrico.do
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*************************************************************************
|
2 |
+
* Dan Wilson
|
3 |
+
* Program creates COMETS Patent dataset for use in Dan Wilson's Biotech Tax Rate project
|
4 |
+
*************************************************************************
|
5 |
+
*global DATE = "091715" // Specify date to use in filenames of created data sets
|
6 |
+
version 13.1
|
7 |
+
capture log close
|
8 |
+
*log using "/data11/home/public/dan/biotech-taxrate/data/log_files/create_COMETS_Patent.$S_DATE.log", replace
|
9 |
+
clear
|
10 |
+
set more off
|
11 |
+
pause on
|
12 |
+
|
13 |
+
|
14 |
+
//Prepare patent citation counts data
|
15 |
+
use $main/data/patent_cite_counts, clear
|
16 |
+
collapse (sum) citations, by(patent_id)
|
17 |
+
sum citations, detail
|
18 |
+
save $main/data/cite_counts, replace
|
19 |
+
|
20 |
+
|
21 |
+
//Prepare patent class data
|
22 |
+
use $main/data/patent_us_classes, clear
|
23 |
+
keep if pos==1 //keep only first listed tech class for each patent
|
24 |
+
gen class = substr(us_class, 1, strpos(us_class,"/") - 1)
|
25 |
+
destring class, replace force
|
26 |
+
drop pos us_class
|
27 |
+
save $main/data/us_classes, replace
|
28 |
+
|
29 |
+
|
30 |
+
//Prepare organization-specific data
|
31 |
+
use $main/data/patent_assignees if org_id~="", clear
|
32 |
+
egen org_namemode = mode(org_name), minmode by(org_id)
|
33 |
+
egen org_norm_namemode = mode(org_norm_name), minmode by(org_id)
|
34 |
+
egen org_typemode = mode(org_type), minmode by(org_id)
|
35 |
+
egen org_state = mode(state), minmode by(org_id)
|
36 |
+
egen org_country = mode(country), minmode by(org_id)
|
37 |
+
drop org_name org_norm_name org_type
|
38 |
+
rename org_namemode org_name
|
39 |
+
rename org_norm_namemode org_norm_name
|
40 |
+
rename org_typemode org_type
|
41 |
+
egen tag=tag(org_id)
|
42 |
+
keep if tag
|
43 |
+
keep org_id org_name org_type org_norm_name org_state org_country
|
44 |
+
save $main/data/org_id_info, replace
|
45 |
+
*/
|
46 |
+
|
47 |
+
///Create COMETS_patent dataset
|
48 |
+
use $main/data/patent_inventors, clear
|
49 |
+
keep patent_id last_name first_name middle_name bea_code city state postal_code country app_date
|
50 |
+
replace country="US" if country=="USA"
|
51 |
+
keep if country=="US"|country==""
|
52 |
+
drop country
|
53 |
+
gen year=substr(app_date,1,4)
|
54 |
+
destring year, replace
|
55 |
+
drop if year==.
|
56 |
+
order year
|
57 |
+
|
58 |
+
// Merge with data sets containing assignees, zd categories, USPTO classes, and citation counts
|
59 |
+
*rename state state_inventor
|
60 |
+
merge m:m patent_id using $main/data/patent_assignees, keepusing(org_id) keep(1 3) nogen
|
61 |
+
*rename state org_state
|
62 |
+
*rename country org_country
|
63 |
+
*rename state_inventor state
|
64 |
+
merge m:m patent_id using $main/data/patent_zd_cats, keepusing(zd) keep(1 3) nogenerate
|
65 |
+
merge m:1 patent_id using $main/data/cite_counts, keepusing(citations) keep(1 3) nogenerate
|
66 |
+
replace citations = 0 if citations==. //citations==. means that patent had no citations
|
67 |
+
merge m:1 patent_id using $main/data/us_classes, keepusing(class) keep(1 3) nogenerate
|
68 |
+
|
69 |
+
// Create single variable for inventor name
|
70 |
+
egen inventor=concat(first_name middle_name last_name), punct(" ")
|
71 |
+
replace inventor=subinstr(inventor,";","",.)
|
72 |
+
replace inventor=subinstr(inventor,"/","",.)
|
73 |
+
*replace inventor=subinstr(inventor,".","",.)
|
74 |
+
replace inventor=subinstr(inventor,".","",.) if strpos(inventor,".")==1
|
75 |
+
*replace inventor=subinstr(inventor,"'","",.)
|
76 |
+
replace inventor=itrim(inventor)
|
77 |
+
replace inventor=ltrim(inventor)
|
78 |
+
replace inventor=rtrim(inventor)
|
79 |
+
drop last_name first_name middle_name
|
80 |
+
|
81 |
+
merge m:1 org_id using $main/data/org_id_info, keepusing(org_name org_type org_norm_name org_state org_country) keep(1 3) nogen
|
82 |
+
save $main/data/COMETS_Patent_ExtractForEnrico, replace
|
83 |
+
|
107/replication_package/AER_UPLOADED/data/documenation/CodebookCOMETS20.xlsx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ead056f4e093a1c6320f45a28474f3c46de30b2a66aae664efc541f54c165ccc
|
3 |
+
size 48771
|
107/replication_package/AER_UPLOADED/data/documenation/apat63_99_documentation.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06acc94e285428837ebda59cf2a60cf2ffab39536e4137521ba6f6530e2a4e7e
|
3 |
+
size 3420
|
107/replication_package/AER_UPLOADED/data/documenation/bea_county_crosswalk_codebook.cvs
ADDED
The diff for this file is too large to render.
See raw diff
|
|
107/replication_package/AER_UPLOADED/data/kodak_stock.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:42e29d13d4ebd3e91c8403216172c82d230840fd5706801b9507c6dfc15720f6
|
3 |
+
size 597
|
107/replication_package/AER_UPLOADED/data/patent_assignees.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80a8abdd1dbf65ec6536639b86d9ec06c9b664f1989767b9b65df781b6a2c010
|
3 |
+
size 2292960713
|
107/replication_package/AER_UPLOADED/data/patent_citations.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ec22b40ddf79cee48450876ee1b6d977580b395abcf454098c29e90477b02df9
|
3 |
+
size 482882892
|
107/replication_package/AER_UPLOADED/data/patent_cite_counts.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:61fe03684a1fb42067bf50449aa4d09e6d698c87afb8e366088adfaea4c6bc55
|
3 |
+
size 162059609
|
107/replication_package/AER_UPLOADED/data/patent_inventors.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a21a824f4bcc65062c56f14da52c92915e44fa67a8eef6722b1b20297beebead
|
3 |
+
size 5027517574
|
107/replication_package/AER_UPLOADED/data/patent_us_classes.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8aeeb4c35e13b3e3401b2f323a183c2bb1994ff478f2b42fcaddfa41b94fac21
|
3 |
+
size 434142421
|
107/replication_package/AER_UPLOADED/data/patent_zd_cats.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e4d7dda8dbbb2cf6a0b54151ca73471d74b65360711e2b98bb9fa6ebff00113
|
3 |
+
size 45697023
|
107/replication_package/AER_UPLOADED/data/read.do
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
u $main/data/tva1
|
2 |
+
|
3 |
+
keep fips pop90 vhouse90 medfaminc90 trade90 agr90 const9 manuf90 emp90 white90
|
4 |
+
keep if pop ~=.
|
5 |
+
sort fips
|
6 |
+
save tmp, replace
|
7 |
+
|
8 |
+
|
9 |
+
clear
|
10 |
+
insheet using $main/data/bea_county_crosswalk.txt
|
11 |
+
rename ea bea_code
|
12 |
+
keep fips bea
|
13 |
+
sort fips
|
14 |
+
merge m:1 fips using tmp
|
15 |
+
keep if _merge ==3
|
16 |
+
drop _merge
|
17 |
+
|
18 |
+
g nonwhite90 = 1 - white90
|
19 |
+
collapse vhouse90 medfaminc90 trade90 agr90 const9 manuf90 nonwhite90 (sum) pop emp, by(bea)
|
20 |
+
summ
|
21 |
+
save $main/data/read, replace
|
22 |
+
!rm $main/tmp.dta
|
23 |
+
|
107/replication_package/AER_UPLOADED/data/read1.do
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
* Read Input-Output data
|
3 |
+
* Keep NAICS 333316 Photographic and photocopying equipment manufacturing
|
4 |
+
insheet using $main/data/Use_SUT_Framework_2007_2012_DET.csv
|
5 |
+
keep v1 v2 v92
|
6 |
+
rename v1 naics
|
7 |
+
rename v2 industry
|
8 |
+
destring v92, replace
|
9 |
+
keep if v92 ~=. & v92 >0
|
10 |
+
|
11 |
+
egen sum = sum(v92)
|
12 |
+
g share = v92/sum
|
13 |
+
rename v92 value
|
14 |
+
drop sum
|
15 |
+
|
16 |
+
sort naics
|
17 |
+
save $main/data/Use_SUT_Framework_2007_2012_DET, replace
|
18 |
+
summ
|
19 |
+
clear
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
* Cross-walk from patents class to industry NAICS
|
24 |
+
* It's not one to one. It has assocated probabilities
|
25 |
+
insheet using $main/data/uspc_Class_to_naics07_6.txt
|
26 |
+
rename naics naics
|
27 |
+
rename uspc class
|
28 |
+
|
29 |
+
|
30 |
+
* merge the two datasets
|
31 |
+
tostring naics, replace
|
32 |
+
sort naics
|
33 |
+
merge m:1 naics using $main/data/Use_SUT_Framework_2007_2012_DET
|
34 |
+
tab _merge
|
35 |
+
drop if _merge ==2
|
36 |
+
drop _merge
|
37 |
+
|
38 |
+
* each class has multiple naics and attached probabilities. Here I use probabilities
|
39 |
+
* to compute the expected value of inputs used by the photography industry
|
40 |
+
replace value = 0 if value ==.
|
41 |
+
collapse value [weight =probability], by(class)
|
42 |
+
|
43 |
+
* Save
|
44 |
+
sort class
|
45 |
+
save $main/data/read1, replace
|
46 |
+
summ
|
47 |
+
|
48 |
+
|
107/replication_package/AER_UPLOADED/data/read_apat.do
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
insheet using $main/data/apat63_99.txt
|
2 |
+
rename patent patent_id
|
3 |
+
sort patent_id
|
4 |
+
save $main/data/apat63_99, replace
|
5 |
+
summ
|
6 |
+
|
107/replication_package/AER_UPLOADED/data/tva1.dta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:144a6366591e8fa3edca57b00f177531a0ce0852de01b2c883869ce5bee565c3
|
3 |
+
size 68433611
|
107/replication_package/AER_UPLOADED/data/uspc_Class_to_naics07_6.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b1cd979fcee2cb79bc6946bb05581159f5ed8d10e84a108d622a79edc2c46ffa
|
3 |
+
size 72146
|
107/replication_package/AER_UPLOADED/data2/citations_made.do
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
*****************************************************
|
3 |
+
* First I assign a bea and zd to each cited patent
|
4 |
+
*****************************************************
|
5 |
+
u $main/data2/data_patent_level_3
|
6 |
+
keep patent_id zd2 bea
|
7 |
+
rename patent_id cite_to_patent
|
8 |
+
rename bea bea_cited_to
|
9 |
+
rename zd2 zd_cited_to
|
10 |
+
sort cite_to_patent
|
11 |
+
save $main/data2/tmp, replace
|
12 |
+
|
13 |
+
|
14 |
+
u $main/data/patent_citations.dta
|
15 |
+
keep cite_to_patent cite_from_patent
|
16 |
+
sort cite_to_patent
|
17 |
+
merge m:m cite_to_patent using $main/data2/tmp
|
18 |
+
drop if _merge ==2
|
19 |
+
drop _merge
|
20 |
+
save $main/data2/tmp2, replace
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
*****************************************************
|
25 |
+
* Now I assign a bea to each citing patent
|
26 |
+
*****************************************************
|
27 |
+
u $main/data2/data_patent_level_3
|
28 |
+
keep patent_id zd2 bea
|
29 |
+
rename patent_id cite_from_patent
|
30 |
+
rename bea bea_cited_from
|
31 |
+
rename zd2 zd_cited_from
|
32 |
+
sort cite_from_patent
|
33 |
+
save $main/data2/tmp3, replace
|
34 |
+
|
35 |
+
|
36 |
+
u $main/data2/tmp2
|
37 |
+
sort cite_from_patent
|
38 |
+
merge m:m cite_from_patent using $main/data2/tmp3
|
39 |
+
drop if _merge ==2
|
40 |
+
drop _merge
|
41 |
+
|
42 |
+
g same_bea = (bea_cited_from == bea_cited_to)
|
43 |
+
g same_zd = (zd_cited_from == zd_cited_to)
|
44 |
+
g same_bea_zd = (zd_cited_from == zd_cited_to & bea_cited_from == bea_cited_to)
|
45 |
+
g same_bea_diff_zd = (zd_cited_from ~= zd_cited_to & bea_cited_from == bea_cited_to)
|
46 |
+
summ
|
47 |
+
|
48 |
+
collapse same_bea same_zd same_bea_zd same_bea_diff_zd (count) citations_made = cite_to_patent, by(cite_from_patent)
|
49 |
+
|
50 |
+
rename cite_from_patent patent_id
|
51 |
+
sort patent_id
|
52 |
+
summ
|
53 |
+
save $main/data2/tmp4, replace
|
54 |
+
clear
|
55 |
+
|
56 |
+
|
57 |
+
*****************************************************
|
58 |
+
*****************************************************
|
59 |
+
******************************************************
|
60 |
+
******************************************************
|
61 |
+
u $main/data2/data_patent_level_3
|
62 |
+
sort patent_id
|
63 |
+
merge m:1 patent_id using $main/data2/tmp4
|
64 |
+
tab _merge
|
65 |
+
drop _merge
|
66 |
+
|
67 |
+
|
68 |
+
* In cases where there are multiple cities, zd or classes within 1 year, pick mode
|
69 |
+
* I use maxmode to deal with ties. Later I will try minmode to see if it makes a difference
|
70 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year)
|
71 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year)
|
72 |
+
|
73 |
+
|
74 |
+
* Collapse by inventor_id year. Note that main_org main_org_type are constant within a
|
75 |
+
* inventor_id year pair. I include them in by() so that they are in the
|
76 |
+
* collapsed data
|
77 |
+
summ
|
78 |
+
sort inventor_id year
|
79 |
+
collapse main_bea main_zd same_bea same_zd same_bea_zd same_bea_diff_zd (sum) citations_made , by(inventor_id year)
|
80 |
+
|
81 |
+
|
82 |
+
rename main_bea bea_code
|
83 |
+
rename main_zd zd2
|
84 |
+
|
85 |
+
drop if inventor ==.
|
86 |
+
|
87 |
+
save $main/data2/citations_made, replace
|
88 |
+
summ
|
89 |
+
|
90 |
+
|
91 |
+
|
107/replication_package/AER_UPLOADED/data2/citations_received.do
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
*****************************************************
|
3 |
+
* First I assign a bea to cited patents
|
4 |
+
*****************************************************
|
5 |
+
u $main/data2/data_patent_level_3
|
6 |
+
keep patent_id bea
|
7 |
+
rename patent_id cite_to_patent
|
8 |
+
rename bea bea_cited_to
|
9 |
+
sort cite_to_patent
|
10 |
+
save $main/data2/tmp, replace
|
11 |
+
|
12 |
+
|
13 |
+
u $main/data/patent_citations.dta
|
14 |
+
keep cite_to_patent cite_from_patent
|
15 |
+
sort cite_to_patent
|
16 |
+
merge m:m cite_to_patent using $main/data2/tmp
|
17 |
+
drop if _merge ==2
|
18 |
+
drop _merge
|
19 |
+
save $main/data2/tmp2, replace
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
*****************************************************
|
24 |
+
* Now I assign a bea to citing patents
|
25 |
+
*****************************************************
|
26 |
+
u $main/data2/data_patent_level_3
|
27 |
+
keep patent_id bea
|
28 |
+
rename patent_id cite_from_patent
|
29 |
+
rename bea bea_cited_from
|
30 |
+
sort cite_from_patent
|
31 |
+
save $main/data2/tmp3, replace
|
32 |
+
|
33 |
+
|
34 |
+
u $main/data2/tmp2
|
35 |
+
sort cite_from_patent
|
36 |
+
merge m:m cite_from_patent using $main/data2/tmp3
|
37 |
+
drop if _merge ==2
|
38 |
+
drop _merge
|
39 |
+
|
40 |
+
g same_bea = (bea_cited_from == bea_cited_to)
|
41 |
+
summ
|
42 |
+
|
43 |
+
collapse same_bea , by(cite_to_patent)
|
44 |
+
|
45 |
+
rename cite_to_patent patent_id
|
46 |
+
sort patent_id
|
47 |
+
summ
|
48 |
+
save $main/data2/tmp4, replace
|
49 |
+
clear
|
50 |
+
|
51 |
+
|
52 |
+
*****************************************************
|
53 |
+
*****************************************************
|
54 |
+
******************************************************
|
55 |
+
******************************************************
|
56 |
+
u $main/data2/data_patent_level_3
|
57 |
+
sort patent_id
|
58 |
+
merge m:1 patent_id using $main/data2/tmp4
|
59 |
+
tab _merge
|
60 |
+
drop _merge
|
61 |
+
|
62 |
+
|
63 |
+
* In cases where there are multiple cities, pick mode
|
64 |
+
* I use maxmode to deal with ties. Later I will try minmode to see if it makes a difference
|
65 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year)
|
66 |
+
|
67 |
+
|
68 |
+
* Collapse by inventor_id year.
|
69 |
+
summ
|
70 |
+
sort inventor_id year
|
71 |
+
collapse main_bea same_bea , by(inventor_id year)
|
72 |
+
|
73 |
+
rename main_bea bea_code
|
74 |
+
drop if inventor ==.
|
75 |
+
|
76 |
+
save $main/data2/citations_received, replace
|
77 |
+
summ
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
107/replication_package/AER_UPLOADED/data2/data_4.do
ADDED
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*****************************************************
|
2 |
+
*****************************************************
|
3 |
+
*****************************************************
|
4 |
+
*****************************************************
|
5 |
+
* 1 MONTH, 2 MONTHS, 3 MONTHS, 6 MONTHS, 2 YEARS, 3 YEARS
|
6 |
+
******************************************************
|
7 |
+
******************************************************
|
8 |
+
*****************************************************
|
9 |
+
*****************************************************
|
10 |
+
|
11 |
+
|
12 |
+
*****************************************************
|
13 |
+
*****************************************************
|
14 |
+
* 1 MONTH
|
15 |
+
******************************************************
|
16 |
+
******************************************************
|
17 |
+
u $main/data2/data_patent_level_3
|
18 |
+
|
19 |
+
* When a patent is joint, I split it among inventors
|
20 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
21 |
+
summ tmp7, detail
|
22 |
+
tab tmp7 if tmp7 <=20
|
23 |
+
g number = 1/tmp7
|
24 |
+
replace citations = citations / tmp7
|
25 |
+
drop tmp
|
26 |
+
|
27 |
+
* MONTH
|
28 |
+
g month = substr(app_date,6,2)
|
29 |
+
tab month
|
30 |
+
|
31 |
+
* MODE
|
32 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year month)
|
33 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year month)
|
34 |
+
egen main_class = mode(class), maxmode by(inventor_id year month)
|
35 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year month)
|
36 |
+
|
37 |
+
* COLLAPSE
|
38 |
+
summ
|
39 |
+
sort inventor_id year month
|
40 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year month main_org )
|
41 |
+
|
42 |
+
rename main_bea bea_code
|
43 |
+
rename main_zd zd2
|
44 |
+
rename main_class class
|
45 |
+
rename main_org org_new
|
46 |
+
|
47 |
+
|
48 |
+
* MERGE
|
49 |
+
sort bea zd year
|
50 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
51 |
+
tab _merge
|
52 |
+
drop _merge
|
53 |
+
|
54 |
+
* SAVE
|
55 |
+
g Den_bea_zd = density14
|
56 |
+
drop density*
|
57 |
+
drop if inventor ==.
|
58 |
+
|
59 |
+
save $main/data2/data_4a, replace
|
60 |
+
summ
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
*****************************************************
|
66 |
+
*****************************************************
|
67 |
+
* 2 MONTHS
|
68 |
+
******************************************************
|
69 |
+
******************************************************
|
70 |
+
u $main/data2/data_patent_level_3
|
71 |
+
|
72 |
+
* When a patent is joint, I split it among inventors
|
73 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
74 |
+
summ tmp7, detail
|
75 |
+
tab tmp7 if tmp7 <=20
|
76 |
+
g number = 1/tmp7
|
77 |
+
replace citations = citations / tmp7
|
78 |
+
drop tmp
|
79 |
+
|
80 |
+
* MONTH
|
81 |
+
g month = substr(app_date,6,2)
|
82 |
+
g tmp = 1 if month=="01" | month=="02"
|
83 |
+
replace tmp = 2 if month=="03" | month=="04"
|
84 |
+
replace tmp = 3 if month=="05" | month=="06"
|
85 |
+
replace tmp = 4 if month=="07" | month=="08"
|
86 |
+
replace tmp = 5 if month=="09" | month=="10"
|
87 |
+
replace tmp = 6 if month=="11" | month=="12"
|
88 |
+
drop month
|
89 |
+
g month = tmp
|
90 |
+
tab month
|
91 |
+
|
92 |
+
* MODE
|
93 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year month)
|
94 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year month)
|
95 |
+
egen main_class = mode(class), maxmode by(inventor_id year month)
|
96 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year month)
|
97 |
+
|
98 |
+
* COLLAPSE
|
99 |
+
summ
|
100 |
+
sort inventor_id year month
|
101 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year month main_org)
|
102 |
+
|
103 |
+
rename main_bea bea_code
|
104 |
+
rename main_zd zd2
|
105 |
+
rename main_class class
|
106 |
+
rename main_org org_new
|
107 |
+
|
108 |
+
|
109 |
+
* MERGE
|
110 |
+
sort bea zd year
|
111 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
112 |
+
tab _merge
|
113 |
+
drop _merge
|
114 |
+
|
115 |
+
* SAVE
|
116 |
+
g Den_bea_zd = density14
|
117 |
+
drop density*
|
118 |
+
drop if inventor ==.
|
119 |
+
|
120 |
+
save $main/data2/data_4e, replace
|
121 |
+
summ
|
122 |
+
|
123 |
+
|
124 |
+
*****************************************************
|
125 |
+
*****************************************************
|
126 |
+
* 3 MONTHS
|
127 |
+
******************************************************
|
128 |
+
******************************************************
|
129 |
+
u $main/data2/data_patent_level_3
|
130 |
+
|
131 |
+
* When a patent is joint, I split it among inventors
|
132 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
133 |
+
summ tmp7, detail
|
134 |
+
tab tmp7 if tmp7 <=20
|
135 |
+
g number = 1/tmp7
|
136 |
+
replace citations = citations / tmp7
|
137 |
+
drop tmp
|
138 |
+
|
139 |
+
* MONTH
|
140 |
+
g month = substr(app_date,6,2)
|
141 |
+
g tmp = 1 if month=="01" | month=="02" | month=="03"
|
142 |
+
replace tmp = 2 if month=="04" | month=="05" | month=="06"
|
143 |
+
replace tmp = 3 if month=="07" | month=="08" | month=="09"
|
144 |
+
replace tmp = 4 if month=="10" | month=="11" | month=="12"
|
145 |
+
drop month
|
146 |
+
g month = tmp
|
147 |
+
drop tmp
|
148 |
+
tab month
|
149 |
+
|
150 |
+
* MODE
|
151 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year month)
|
152 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year month)
|
153 |
+
egen main_class = mode(class), maxmode by(inventor_id year month)
|
154 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year month)
|
155 |
+
|
156 |
+
* COLLAPSE
|
157 |
+
summ
|
158 |
+
sort inventor_id year month
|
159 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year month main_org)
|
160 |
+
|
161 |
+
rename main_bea bea_code
|
162 |
+
rename main_zd zd2
|
163 |
+
rename main_class class
|
164 |
+
rename main_org org_new
|
165 |
+
|
166 |
+
|
167 |
+
* MERGE
|
168 |
+
sort bea zd year
|
169 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
170 |
+
tab _merge
|
171 |
+
drop _merge
|
172 |
+
|
173 |
+
* SAVE
|
174 |
+
g Den_bea_zd = density14
|
175 |
+
drop density*
|
176 |
+
drop if inventor ==.
|
177 |
+
|
178 |
+
save $main/data2/data_4f, replace
|
179 |
+
summ
|
180 |
+
|
181 |
+
|
182 |
+
|
183 |
+
*****************************************************
|
184 |
+
*****************************************************
|
185 |
+
* 6 MONTH
|
186 |
+
******************************************************
|
187 |
+
******************************************************
|
188 |
+
u $main/data2/data_patent_level_3
|
189 |
+
|
190 |
+
* When a patent is joint, I split it among inventors
|
191 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
192 |
+
summ tmp7, detail
|
193 |
+
tab tmp7 if tmp7 <=20
|
194 |
+
g number = 1/tmp7
|
195 |
+
replace citations = citations / tmp7
|
196 |
+
drop tmp
|
197 |
+
|
198 |
+
|
199 |
+
* MONTH
|
200 |
+
g month1 = substr(app_date,6,2)
|
201 |
+
g tmp = 1 if month=="01" | month=="02"
|
202 |
+
replace tmp = 1 if month=="03" | month=="04"
|
203 |
+
replace tmp = 1 if month=="05" | month=="06"
|
204 |
+
replace tmp = 2 if month=="07" | month=="08"
|
205 |
+
replace tmp = 2 if month=="09" | month=="10"
|
206 |
+
replace tmp = 2 if month=="11" | month=="12"
|
207 |
+
g month = tmp
|
208 |
+
drop tmp month1
|
209 |
+
tab month
|
210 |
+
|
211 |
+
|
212 |
+
* MODE
|
213 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year month)
|
214 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year month)
|
215 |
+
egen main_class = mode(class), maxmode by(inventor_id year month)
|
216 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year month)
|
217 |
+
|
218 |
+
* COLLAPSE
|
219 |
+
summ
|
220 |
+
sort inventor_id year month
|
221 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year month main_org)
|
222 |
+
|
223 |
+
rename main_bea bea_code
|
224 |
+
rename main_zd zd2
|
225 |
+
rename main_class class
|
226 |
+
rename main_org org_new
|
227 |
+
|
228 |
+
|
229 |
+
* MERGE
|
230 |
+
sort bea zd year
|
231 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
232 |
+
tab _merge
|
233 |
+
drop _merge
|
234 |
+
|
235 |
+
* SAVE
|
236 |
+
g Den_bea_zd = density14
|
237 |
+
drop density*
|
238 |
+
drop if inventor ==.
|
239 |
+
|
240 |
+
save $main/data2/data_4b, replace
|
241 |
+
summ
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
*****************************************************
|
248 |
+
*****************************************************
|
249 |
+
* 2 YEARS
|
250 |
+
******************************************************
|
251 |
+
******************************************************
|
252 |
+
u $main/data2/data_patent_level_3
|
253 |
+
|
254 |
+
* When a patent is joint, I split it among inventors
|
255 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
256 |
+
summ tmp7, detail
|
257 |
+
tab tmp7 if tmp7 <=20
|
258 |
+
g number = 1/tmp7
|
259 |
+
replace citations = citations / tmp7
|
260 |
+
drop tmp
|
261 |
+
|
262 |
+
|
263 |
+
g tmp = int(year/2) * 2
|
264 |
+
drop year
|
265 |
+
rename tmp year
|
266 |
+
tab year
|
267 |
+
|
268 |
+
|
269 |
+
* MODE
|
270 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year )
|
271 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year )
|
272 |
+
egen main_class = mode(class), maxmode by(inventor_id year )
|
273 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year )
|
274 |
+
|
275 |
+
* COLLAPSE
|
276 |
+
summ
|
277 |
+
sort inventor_id year
|
278 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year main_org)
|
279 |
+
|
280 |
+
rename main_bea bea_code
|
281 |
+
rename main_zd zd2
|
282 |
+
rename main_class class
|
283 |
+
rename main_org org_new
|
284 |
+
|
285 |
+
|
286 |
+
* MERGE
|
287 |
+
sort bea zd year
|
288 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
289 |
+
tab _merge
|
290 |
+
drop _merge
|
291 |
+
|
292 |
+
* SAVE
|
293 |
+
g Den_bea_zd = density14
|
294 |
+
drop density*
|
295 |
+
drop if inventor ==.
|
296 |
+
|
297 |
+
save $main/data2/data_4c, replace
|
298 |
+
summ
|
299 |
+
|
300 |
+
|
301 |
+
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
*****************************************************
|
306 |
+
*****************************************************
|
307 |
+
* 3 YEARS
|
308 |
+
******************************************************
|
309 |
+
******************************************************
|
310 |
+
u $main/data2/data_patent_level_3
|
311 |
+
|
312 |
+
* When a patent is joint, I split it among inventors
|
313 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
314 |
+
summ tmp7, detail
|
315 |
+
tab tmp7 if tmp7 <=20
|
316 |
+
g number = 1/tmp7
|
317 |
+
replace citations = citations / tmp7
|
318 |
+
drop tmp
|
319 |
+
|
320 |
+
|
321 |
+
g tmp = int(year/3) * 3
|
322 |
+
drop year
|
323 |
+
rename tmp year
|
324 |
+
tab year
|
325 |
+
|
326 |
+
|
327 |
+
* MODE
|
328 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year )
|
329 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year )
|
330 |
+
egen main_class = mode(class), maxmode by(inventor_id year )
|
331 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year )
|
332 |
+
|
333 |
+
* COLLAPSE
|
334 |
+
summ
|
335 |
+
sort inventor_id year
|
336 |
+
collapse main_bea main_zd main_class general original (sum) number citat, by(inventor_id year main_org)
|
337 |
+
|
338 |
+
rename main_bea bea_code
|
339 |
+
rename main_zd zd2
|
340 |
+
rename main_class class
|
341 |
+
rename main_org org_new
|
342 |
+
|
343 |
+
|
344 |
+
* MERGE
|
345 |
+
sort bea zd year
|
346 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
347 |
+
tab _merge
|
348 |
+
drop _merge
|
349 |
+
|
350 |
+
* SAVE
|
351 |
+
g Den_bea_zd = density14
|
352 |
+
drop density*
|
353 |
+
drop if inventor ==.
|
354 |
+
|
355 |
+
save $main/data2/data_4d, replace
|
356 |
+
summ
|
357 |
+
|
358 |
+
|
107/replication_package/AER_UPLOADED/data2/density14_W.do
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
* Measures of cluster size that put some weight on qualty of
|
4 |
+
* inventors (as opposed just their raw number)
|
5 |
+
*******************************************************************
|
6 |
+
********************************************************************
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
***********************************************
|
11 |
+
***********************************************
|
12 |
+
* CLEAN THE DATA
|
13 |
+
***********************************************
|
14 |
+
***********************************************
|
15 |
+
u $main/data/COMETS_Patent_ExtractForEnrico
|
16 |
+
|
17 |
+
keep if year >1970 & year <=2007
|
18 |
+
egen inventor_id = group(inventor)
|
19 |
+
drop if inventor_id ==.
|
20 |
+
drop if class ==.
|
21 |
+
|
22 |
+
drop if bea =="NOCOUNTRY"
|
23 |
+
drop if bea =="OTHER_USA"
|
24 |
+
drop if bea =="UNITED STATES"
|
25 |
+
destring bea, replace
|
26 |
+
drop if bea ==.
|
27 |
+
drop if bea ==0
|
28 |
+
|
29 |
+
* ZD is the broad technology class
|
30 |
+
* Here I create a ZD2 which is the numeric version
|
31 |
+
egen zd2 = group(zd)
|
32 |
+
tab zd zd2
|
33 |
+
drop if zd2 ==.
|
34 |
+
|
35 |
+
|
36 |
+
* Cases of patents with multiple inventors
|
37 |
+
*egen N = count(year), by(inventor_id patent_id)
|
38 |
+
*summ N
|
39 |
+
*drop N
|
40 |
+
|
41 |
+
* MERGE WITH NBER PATENT DATA
|
42 |
+
sort patent
|
43 |
+
merge m:m patent using $main/data/apat63_99
|
44 |
+
tab _merge
|
45 |
+
summ
|
46 |
+
drop _merge
|
47 |
+
drop if inventor_id ==.
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
****************************************************************
|
52 |
+
*****************************************************************
|
53 |
+
* DATA CHECK:
|
54 |
+
* MULTIPLE CITIES AND TECHNOLOGY PER YEAR
|
55 |
+
****************************************************************
|
56 |
+
*****************************************************************
|
57 |
+
* I drop if number of different cities or zd in a given year too large
|
58 |
+
g N = 1
|
59 |
+
sort inventor year bea
|
60 |
+
by inventor year: replace N = N[_n-1] + 1 if bea ~= bea[_n-1] & _n >1
|
61 |
+
egen NN = max(N), by(inventor)
|
62 |
+
drop if NN > 3 & NN ~=.
|
63 |
+
drop N NN
|
64 |
+
|
65 |
+
g N = 1
|
66 |
+
sort inventor year zd2
|
67 |
+
by inventor year: replace N = N[_n-1] + 1 if zd2 ~= zd2[_n-1] & _n >1
|
68 |
+
egen NN = max(N), by(inventor year)
|
69 |
+
drop if NN > 3 & NN ~=.
|
70 |
+
drop N NN
|
71 |
+
|
72 |
+
|
73 |
+
***********************************************
|
74 |
+
***************************************************
|
75 |
+
* MEASURES OF CLUSTERS DENSITY
|
76 |
+
* WEIGHTED
|
77 |
+
***************************************************
|
78 |
+
***************************************************
|
79 |
+
drop zd
|
80 |
+
|
81 |
+
|
82 |
+
* number of lifetime citations and patents, by inventor
|
83 |
+
egen M = sum(citations), by(inventor_id )
|
84 |
+
egen MM = count(patent_id), by(inventor_id)
|
85 |
+
* The data are at the patent level. I want to count inventors
|
86 |
+
sort inventor_id year bea zd
|
87 |
+
by inventor_id year bea zd: g d1 = 1 if _n ==1
|
88 |
+
keep if d1 ==1
|
89 |
+
|
90 |
+
|
91 |
+
summ M MM, detail
|
92 |
+
* K's and H's are indicators if an inventor has lifetime patents or citations
|
93 |
+
* above a thereshold
|
94 |
+
g K = 0
|
95 |
+
g K2 = 0
|
96 |
+
g K3 = 0
|
97 |
+
g H = 0
|
98 |
+
g H2 = 0
|
99 |
+
g H3 = 0
|
100 |
+
|
101 |
+
replace K = d1 if M >= 5
|
102 |
+
replace K2 = d1 if M >= 10
|
103 |
+
replace K3 = d1 if M >= 20
|
104 |
+
|
105 |
+
replace H = d1 if MM >= 3
|
106 |
+
replace H2 = d1 if MM >= 5
|
107 |
+
replace H3 = d1 if MM >= 10
|
108 |
+
|
109 |
+
egen count = sum(K), by(bea zd year)
|
110 |
+
egen total = sum(K), by(zd year)
|
111 |
+
g density14_W1 = (count-K)/(total-K)
|
112 |
+
drop count total
|
113 |
+
|
114 |
+
egen count = sum(K2), by(bea zd year)
|
115 |
+
egen total = sum(K2), by(zd year)
|
116 |
+
g density14_W2 = (count-K2)/(total-K2)
|
117 |
+
drop count total
|
118 |
+
|
119 |
+
egen count = sum(K3), by(bea zd year)
|
120 |
+
egen total = sum(K3), by(zd year)
|
121 |
+
g density14_W3 = (count-K3)/(total-K3)
|
122 |
+
drop count total
|
123 |
+
|
124 |
+
|
125 |
+
egen count = sum(H), by(bea zd year)
|
126 |
+
egen total = sum(H), by(zd year)
|
127 |
+
g density14_WW1 = (count-H)/(total-H)
|
128 |
+
drop count total
|
129 |
+
|
130 |
+
egen count = sum(H2), by(bea zd year)
|
131 |
+
egen total = sum(H2), by(zd year)
|
132 |
+
g density14_WW2 = (count-H2)/(total-H2)
|
133 |
+
drop count total
|
134 |
+
|
135 |
+
egen count = sum(H3), by(bea zd year)
|
136 |
+
egen total = sum(H3), by(zd year)
|
137 |
+
g density14_WW3 = (count-H3)/(total-H3)
|
138 |
+
drop count total
|
139 |
+
|
140 |
+
|
141 |
+
g Den_bea_zd_W1 = density14_W1
|
142 |
+
g Den_bea_zd_W2 = density14_W2
|
143 |
+
g Den_bea_zd_W3 = density14_W3
|
144 |
+
g Den_bea_zd_WW1 = density14_WW1
|
145 |
+
g Den_bea_zd_WW2 = density14_WW2
|
146 |
+
g Den_bea_zd_WW3 = density14_WW3
|
147 |
+
drop density14_W*
|
148 |
+
|
149 |
+
|
150 |
+
***********************************************
|
151 |
+
* WEIGHTS
|
152 |
+
***********************************************
|
153 |
+
egen count = sum(M), by(bea zd year)
|
154 |
+
egen total = sum(M), by(zd year)
|
155 |
+
g density14_W4 = (count-M)/(total-M)
|
156 |
+
*replace density14_W4 = 0 if density14_W4 <0
|
157 |
+
drop count total
|
158 |
+
|
159 |
+
egen count = sum(MM), by(bea zd year)
|
160 |
+
egen total = sum(MM), by(zd year)
|
161 |
+
g density14_WW4 = (count-MM)/(total-MM)
|
162 |
+
*replace density14_WW4 = 0 if density14_WW4 <0
|
163 |
+
|
164 |
+
collapse density14_W4 density14_WW4 Den_bea_zd_W1 Den_bea_zd_W2 Den_bea_zd_W3 Den_bea_zd_WW1 Den_bea_zd_WW2 Den_bea_zd_WW3, by(inventor_id year)
|
165 |
+
g Den_bea_zd_W4 = density14_W4
|
166 |
+
g Den_bea_zd_WW4 = density14_WW4
|
167 |
+
sort inventor_id year
|
168 |
+
save $main/data2/density14_W, replace
|
169 |
+
summ
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
|
107/replication_package/AER_UPLOADED/data2/density_14_3_reshaped.do
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
use $main/data2/density14_3
|
3 |
+
drop density14B
|
4 |
+
rename density14 density
|
5 |
+
reshape wide density, i(bea year) j(zd)
|
6 |
+
summ
|
7 |
+
sort bea year
|
8 |
+
save $main/data2/density14_3_reshaped, replace
|
9 |
+
|
107/replication_package/AER_UPLOADED/data2/density_team.do
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
* This is like data_3, but instead of being at the inventor level it
|
4 |
+
* is at the team level. ( Based on Referee #2 suggestion)
|
5 |
+
*******************************************************************
|
6 |
+
********************************************************************
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
***********************************************
|
11 |
+
***********************************************
|
12 |
+
* CLEAN THE DATA
|
13 |
+
***********************************************
|
14 |
+
***********************************************
|
15 |
+
u $main/data/COMETS_Patent_ExtractForEnrico
|
16 |
+
|
17 |
+
keep if year >1970 & year <=2007
|
18 |
+
egen inventor_id = group(inventor)
|
19 |
+
drop if inventor_id ==.
|
20 |
+
drop if class ==.
|
21 |
+
|
22 |
+
drop if bea =="NOCOUNTRY"
|
23 |
+
drop if bea =="OTHER_USA"
|
24 |
+
drop if bea =="UNITED STATES"
|
25 |
+
destring bea, replace
|
26 |
+
drop if bea ==.
|
27 |
+
drop if bea ==0
|
28 |
+
|
29 |
+
* ZD is the broad technology class
|
30 |
+
* Here I create a ZD2 which is the numeric version
|
31 |
+
egen zd2 = group(zd)
|
32 |
+
tab zd zd2
|
33 |
+
drop if zd2 ==.
|
34 |
+
|
35 |
+
|
36 |
+
* Cases of patents with multiple inventors
|
37 |
+
*egen N = count(year), by(inventor_id patent_id)
|
38 |
+
*summ N
|
39 |
+
*drop N
|
40 |
+
|
41 |
+
* MERGE WITH NBER PATENT DATA
|
42 |
+
sort patent
|
43 |
+
merge m:m patent using $main/data/apat63_99
|
44 |
+
tab _merge
|
45 |
+
summ
|
46 |
+
drop _merge
|
47 |
+
drop if inventor_id ==.
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
****************************************************************
|
52 |
+
*****************************************************************
|
53 |
+
* DATA CHECK:
|
54 |
+
* MULTIPLE CITIES AND TECHNOLOGY PER YEAR
|
55 |
+
****************************************************************
|
56 |
+
*****************************************************************
|
57 |
+
* I drop if number of different cities or zd in a given year too large
|
58 |
+
g N = 1
|
59 |
+
sort inventor year bea
|
60 |
+
by inventor year: replace N = N[_n-1] + 1 if bea ~= bea[_n-1] & _n >1
|
61 |
+
egen NN = max(N), by(inventor)
|
62 |
+
drop if NN > 3 & NN ~=.
|
63 |
+
drop N NN
|
64 |
+
|
65 |
+
g N = 1
|
66 |
+
sort inventor year zd2
|
67 |
+
by inventor year: replace N = N[_n-1] + 1 if zd2 ~= zd2[_n-1] & _n >1
|
68 |
+
egen NN = max(N), by(inventor year)
|
69 |
+
drop if NN > 3 & NN ~=.
|
70 |
+
drop N NN
|
71 |
+
|
72 |
+
|
73 |
+
***********************************************
|
74 |
+
**************************************
|
75 |
+
* MEASURES OF CLUSTERS DENSITY
|
76 |
+
* I LEAVE OUT MEMBERS OF TEAM
|
77 |
+
***************************************
|
78 |
+
***********************************************
|
79 |
+
|
80 |
+
* Team size: number of inventors on a patent
|
81 |
+
egen team = count(inventor_id), by(patent_id)
|
82 |
+
summ team, detail
|
83 |
+
egen tt = mean(team), by(inventor_id year bea zd)
|
84 |
+
sort inventor_id year bea zd
|
85 |
+
by inventor_id year bea zd: g d1 = 1 if _n ==1
|
86 |
+
|
87 |
+
* this measure of densities varies across inventors depending on their mean
|
88 |
+
* team size
|
89 |
+
egen count = count(d1), by(bea zd year)
|
90 |
+
egen total = count(d1), by(zd year)
|
91 |
+
g density14_team = (count-tt)/(total-tt)
|
92 |
+
|
93 |
+
|
94 |
+
sort inventor_id year
|
95 |
+
collapse density14_team , by(inventor_id year)
|
96 |
+
save $main/data2/density_team, replace
|
97 |
+
summ
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
|
107/replication_package/AER_UPLOADED/data_3.do
ADDED
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
* This file reads the data used in the AER tax paper and creates 2 dataset
|
4 |
+
* a) data.dta is a balanced rectangual dataset at the inventor-year level
|
5 |
+
* b) data_patent_level is at the patent level, like the original data
|
6 |
+
*
|
7 |
+
* zd is a broad technological area
|
8 |
+
* class is a finer technology class
|
9 |
+
* bea is a locality code: it is a consolidated metro area
|
10 |
+
*
|
11 |
+
* Codebook can be found here: https://www.kauffman.org/microsites/comets/codebook
|
12 |
+
* Or google “Zucker-Darby COMETS patent data”
|
13 |
+
* Source of data is the AER paper with Dan W. Dan made original extract
|
14 |
+
*******************************************************************
|
15 |
+
********************************************************************
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
***********************************************
|
20 |
+
***********************************************
|
21 |
+
* CLEAN THE DATA
|
22 |
+
***********************************************
|
23 |
+
***********************************************
|
24 |
+
u $main/data/COMETS_Patent_ExtractForEnrico.dta
|
25 |
+
|
26 |
+
keep if year >1970 & year <=2007
|
27 |
+
egen inventor_id = group(inventor)
|
28 |
+
drop if inventor_id ==.
|
29 |
+
drop if class ==.
|
30 |
+
|
31 |
+
drop if bea =="NOCOUNTRY"
|
32 |
+
drop if bea =="OTHER_USA"
|
33 |
+
drop if bea =="UNITED STATES"
|
34 |
+
destring bea, replace
|
35 |
+
drop if bea ==.
|
36 |
+
drop if bea ==0
|
37 |
+
|
38 |
+
* ZD is the broad technology class
|
39 |
+
* Here I create a ZD2 which is the numeric version
|
40 |
+
egen zd2 = group(zd)
|
41 |
+
tab zd zd2
|
42 |
+
drop if zd2 ==.
|
43 |
+
|
44 |
+
|
45 |
+
* MERGE WITH NBER PATENT DATA
|
46 |
+
sort patent
|
47 |
+
merge m:m patent using $main/data/apat63_99
|
48 |
+
tab _merge
|
49 |
+
summ
|
50 |
+
drop _merge
|
51 |
+
drop if inventor_id ==.
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
*****************************************************************
|
56 |
+
g N = 1
|
57 |
+
sort inventor year bea
|
58 |
+
by inventor year: replace N = N[_n-1] + 1 if bea ~= bea[_n-1] & _n >1
|
59 |
+
egen NN = max(N), by(inventor)
|
60 |
+
drop if NN > 3 & NN ~=.
|
61 |
+
drop N NN
|
62 |
+
|
63 |
+
g N = 1
|
64 |
+
sort inventor year zd2
|
65 |
+
by inventor year: replace N = N[_n-1] + 1 if zd2 ~= zd2[_n-1] & _n >1
|
66 |
+
egen NN = max(N), by(inventor year)
|
67 |
+
drop if NN > 3 & NN ~=.
|
68 |
+
drop N NN
|
69 |
+
|
70 |
+
|
71 |
+
***********************************************
|
72 |
+
**************************************
|
73 |
+
* MEASURES OF CLUSTERS DENSITY
|
74 |
+
* LEAVE OUT MEANS
|
75 |
+
* I want to measure the thickness of the labor market
|
76 |
+
* I can measure it as (a) numbner of inventors or (2) number of firms
|
77 |
+
***************************************
|
78 |
+
***********************************************
|
79 |
+
|
80 |
+
* NUMBER OF INVENTORS
|
81 |
+
***************************
|
82 |
+
sort inventor_id year bea
|
83 |
+
by inventor_id year bea: g d1 = 1 if _n ==1
|
84 |
+
egen count = count(d1), by(bea year)
|
85 |
+
egen total = count(d1), by(year)
|
86 |
+
g density13 = (count -1)/(total-1)
|
87 |
+
drop count total d1
|
88 |
+
|
89 |
+
sort inventor_id year bea zd
|
90 |
+
by inventor_id year bea zd: g d1 = 1 if _n ==1
|
91 |
+
egen count = count(d1), by(bea zd year)
|
92 |
+
egen total = count(d1), by(zd year)
|
93 |
+
g density14 = (count-1)/(total-1)
|
94 |
+
save $main/data2/data_3_count, replace
|
95 |
+
drop count total d1
|
96 |
+
|
97 |
+
sort inventor_id year bea class
|
98 |
+
by inventor_id year bea class: g d1 = 1 if _n ==1
|
99 |
+
egen count = count(d1), by(bea class year)
|
100 |
+
egen total = count(d1), by(class year)
|
101 |
+
g density15 = (count-1)/(total-1)
|
102 |
+
drop count total d1
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
sort inventor_id year bea cat
|
107 |
+
by inventor_id year bea cat: g d1 = 1 if _n ==1
|
108 |
+
egen count = count(d1), by(bea cat year)
|
109 |
+
egen total = count(d1), by(cat year)
|
110 |
+
g density20 = (count-1)/(total-1)
|
111 |
+
drop count total d1
|
112 |
+
|
113 |
+
sort inventor_id year bea subcat
|
114 |
+
by inventor_id year bea subcat: g d1 = 1 if _n ==1
|
115 |
+
egen count = count(d1), by(bea subcat year)
|
116 |
+
egen total = count(d1), by(subcat year)
|
117 |
+
g density21 = (count-1)/(total-1)
|
118 |
+
drop count total d1
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
* NUMBER OF FIRMS
|
124 |
+
**********************************************
|
125 |
+
sort org_id year bea
|
126 |
+
by org_id year bea: g d1 = 1 if _n ==1
|
127 |
+
egen count = count(d1), by(bea year)
|
128 |
+
egen total = count(d1), by(year)
|
129 |
+
g density13B = (count -1)/(total-1)
|
130 |
+
drop count total d1
|
131 |
+
|
132 |
+
sort org_id year bea zd
|
133 |
+
by org_id year bea zd: g d1 = 1 if _n ==1
|
134 |
+
egen count = count(d1), by(bea zd year)
|
135 |
+
egen total = count(d1), by(zd year)
|
136 |
+
g density14B = (count-1)/(total-1)
|
137 |
+
drop count total d1
|
138 |
+
|
139 |
+
sort org_id year bea class
|
140 |
+
by org_id year bea class: g d1 = 1 if _n ==1
|
141 |
+
egen count = count(d1), by(bea class year)
|
142 |
+
egen total = count(d1), by(class year)
|
143 |
+
g density15B = (count-1)/(total-1)
|
144 |
+
drop count total d1
|
145 |
+
|
146 |
+
|
147 |
+
sort org_id year bea cat
|
148 |
+
by org_id year bea cat: g d1 = 1 if _n ==1
|
149 |
+
egen count = count(d1), by(bea cat year)
|
150 |
+
egen total = count(d1), by(cat year)
|
151 |
+
g density20B = (count-1)/(total-1)
|
152 |
+
drop count total d1
|
153 |
+
|
154 |
+
sort org_id year bea subcat
|
155 |
+
by org_id year bea subcat: g d1 = 1 if _n ==1
|
156 |
+
egen count = count(d1), by(bea subcat year)
|
157 |
+
egen total = count(d1), by(subcat year)
|
158 |
+
g density21B = (count-1)/(total-1)
|
159 |
+
drop count total d1
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
* I SAVE DENSITY MEASURES IN DATA FILES
|
164 |
+
* TO BE USED LATER
|
165 |
+
***********************************************
|
166 |
+
save $main/data2/data_patent_level_3, replace
|
167 |
+
summ
|
168 |
+
|
169 |
+
sort bea year
|
170 |
+
collapse density13 density13B, by(bea year)
|
171 |
+
save $main/data2/density13_3, replace
|
172 |
+
summ
|
173 |
+
|
174 |
+
u $main/data2/data_patent_level_3
|
175 |
+
sort bea zd2 year
|
176 |
+
collapse density14 density14B, by(bea zd2 year)
|
177 |
+
save $main/data2/density14_3, replace
|
178 |
+
summ
|
179 |
+
|
180 |
+
u $main/data2/data_patent_level_3
|
181 |
+
sort bea class year
|
182 |
+
collapse density15 density15B, by(bea class year)
|
183 |
+
save $main/data2/density15_3, replace
|
184 |
+
summ
|
185 |
+
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
u $main/data2/data_patent_level_3
|
190 |
+
sort bea cat year
|
191 |
+
collapse density20 density20B, by(bea cat year)
|
192 |
+
save $main/data2/density20_3, replace
|
193 |
+
summ
|
194 |
+
|
195 |
+
u $main/data2/data_patent_level_3
|
196 |
+
sort bea subcat year
|
197 |
+
collapse density21 density21B, by(bea subcat year)
|
198 |
+
save $main/data2/density21_3, replace
|
199 |
+
summ
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
* ORGANIZATION
|
204 |
+
u $main/data2/data_patent_level_3
|
205 |
+
drop if org_id ==""
|
206 |
+
g org_N = 1 if inventor_id ~=.
|
207 |
+
sort org_id bea year
|
208 |
+
collapse (sum) org_N, by(org_id org_norm_ bea year)
|
209 |
+
summ
|
210 |
+
save $main/data2/organizations_3, replace
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
*****************************************************
|
215 |
+
*****************************************************
|
216 |
+
* I COLLAPSE
|
217 |
+
* THE SAMPLE BECOMES AT THE INVENTOR-YEAR LEVEL
|
218 |
+
*
|
219 |
+
* IF AN INVENTOR HAS MORE THAN ONE CITY OR SECTOR IN A GIVEN
|
220 |
+
* YEAR, I USE MODAL CITY AND SECTOR.
|
221 |
+
******************************************************
|
222 |
+
******************************************************
|
223 |
+
u $main/data2/data_patent_level_3
|
224 |
+
|
225 |
+
* In cases where there are multiple cities, zd or classes within 1 year, pick mode
|
226 |
+
* I use maxmode to deal with ties. Minmode does not make a difference
|
227 |
+
egen main_bea = mode(bea), maxmode by(inventor_id year)
|
228 |
+
egen main_zd = mode(zd2), maxmode by(inventor_id year)
|
229 |
+
egen main_class = mode(class), maxmode by(inventor_id year)
|
230 |
+
egen main_org = mode(org_id), maxmode by(inventor_id year)
|
231 |
+
egen main_cat = mode(cat), maxmode by(inventor_id year)
|
232 |
+
egen main_subcat = mode(subcat), maxmode by(inventor_id year)
|
233 |
+
egen main_org_type = mode(org_typ), maxmode by(inventor_id year)
|
234 |
+
|
235 |
+
|
236 |
+
* When a patent is joint, I split it equally among inventors
|
237 |
+
egen tmp7 = count(inventor_id), by(patent_id)
|
238 |
+
summ tmp7, detail
|
239 |
+
tab tmp7 if tmp7 <=20
|
240 |
+
g number = 1/tmp7
|
241 |
+
replace citations = citations / tmp7
|
242 |
+
drop tmp7
|
243 |
+
|
244 |
+
* Team size: number of inventors on a patent
|
245 |
+
egen team = count(inventor_id), by(patent_id)
|
246 |
+
summ team, detail
|
247 |
+
* indicator for solo inventor
|
248 |
+
g team2 = (team ==1)
|
249 |
+
summ year team*
|
250 |
+
|
251 |
+
* Collapse by inventor_id year. Note that main_org main_org_type are constant within a
|
252 |
+
* inventor_id year pair. I include them in by() so that they are in the
|
253 |
+
* collapsed data
|
254 |
+
summ
|
255 |
+
sort inventor_id year
|
256 |
+
collapse main_bea main_zd main_class main_cat main_subcat general original team team2 (sum) number citat, by(inventor_id year main_org main_org_type )
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
********************************************
|
261 |
+
********************************************
|
262 |
+
* I FILLIN AND INTERPOLATE SMALL GAPS
|
263 |
+
* I CREATE INDICATORS FOR INTERPOLATION THAT ALLOW ME
|
264 |
+
* TO IDENTIFY AND DROP INTERPOLATED OBSERVATIONS
|
265 |
+
********************************************
|
266 |
+
********************************************
|
267 |
+
rename main_bea bea_code
|
268 |
+
rename main_zd zd2
|
269 |
+
rename main_class class
|
270 |
+
rename main_org org_id
|
271 |
+
rename main_org_type org_type
|
272 |
+
rename main_cat cat
|
273 |
+
rename main_subcat subcat
|
274 |
+
|
275 |
+
fillin inventor_id year
|
276 |
+
summ
|
277 |
+
|
278 |
+
g inter_bea =0
|
279 |
+
g inter_zd =0
|
280 |
+
g inter_class =0
|
281 |
+
g inter_bea2 =0
|
282 |
+
g inter_zd2 =0
|
283 |
+
g inter_class2 =0
|
284 |
+
|
285 |
+
* 1 YEAR GAP
|
286 |
+
sort inventor year
|
287 |
+
by inventor: replace inter_bea = 1 if bea ==. & bea[_n-1] == bea[_n+1] & bea[_n-1] ~=.
|
288 |
+
by inventor: replace bea = bea[_n-1] if inter_bea ==1
|
289 |
+
|
290 |
+
by inventor: replace inter_zd = 1 if zd ==. & zd[_n-1] == zd[_n+1] & zd[_n-1] ~=.
|
291 |
+
by inventor: replace zd = zd[_n-1] if inter_zd ==1
|
292 |
+
|
293 |
+
by inventor: replace inter_class = 1 if class ==. & class[_n-1] == class[_n+1] & class[_n-1] ~=.
|
294 |
+
by inventor: replace class = class[_n-1] if inter_class ==1
|
295 |
+
|
296 |
+
|
297 |
+
* 2 YEAR GAP
|
298 |
+
by inventor: replace inter_bea2 = 1 if bea ==. & bea[_n-1] ==. & bea[_n-2] == bea[_n+1] & bea[_n-2] ~=.
|
299 |
+
by inventor: replace bea = bea[_n-2] if inter_bea2 ==1
|
300 |
+
|
301 |
+
by inventor: replace inter_zd2 = 1 if zd ==. & zd[_n-1] ==. & zd[_n-2] == zd[_n+1] & zd[_n-2] ~=.
|
302 |
+
by inventor: replace zd = zd[_n-2] if inter_zd2 ==1
|
303 |
+
|
304 |
+
by inventor: replace inter_class2 = 1 if class ==. & class[_n-1] ==. & class[_n-2] == class[_n+1] & class[_n-2] ~=.
|
305 |
+
by inventor: replace class = class[_n-2] if inter_class2 ==1
|
306 |
+
|
307 |
+
|
308 |
+
summ inter*
|
309 |
+
summ bea if inter_bea ==0
|
310 |
+
summ bea if inter_bea ==1
|
311 |
+
summ class if inter_class ==0
|
312 |
+
summ class if inter_class ==1
|
313 |
+
|
314 |
+
summ bea if inter_bea2 ==0
|
315 |
+
summ bea if inter_bea2 ==1
|
316 |
+
summ class if inter_class2 ==0
|
317 |
+
summ class if inter_class2 ==1
|
318 |
+
|
319 |
+
|
320 |
+
*******************************************
|
321 |
+
*****************************
|
322 |
+
* MERGE MAIN DATA WITH
|
323 |
+
* MEASURES OF CLUSTER DENSITY
|
324 |
+
*****************************
|
325 |
+
********************************************
|
326 |
+
sum
|
327 |
+
sort bea year
|
328 |
+
merge m:1 bea year using $main/data2/density13_3
|
329 |
+
tab _merge
|
330 |
+
drop _merge
|
331 |
+
|
332 |
+
sort bea zd year
|
333 |
+
merge m:1 bea zd year using $main/data2/density14_3
|
334 |
+
tab _merge
|
335 |
+
drop _merge
|
336 |
+
|
337 |
+
sort bea class year
|
338 |
+
merge m:1 bea class year using $main/data2/density15_3
|
339 |
+
tab _merge
|
340 |
+
drop _merge
|
341 |
+
|
342 |
+
|
343 |
+
sort bea cat year
|
344 |
+
merge m:1 bea cat year using $main/data2/density20_3
|
345 |
+
tab _merge
|
346 |
+
drop _merge
|
347 |
+
|
348 |
+
|
349 |
+
sort bea subcat year
|
350 |
+
merge m:1 bea subcat year using $main/data2/density21_3
|
351 |
+
tab _merge
|
352 |
+
drop _merge
|
353 |
+
|
354 |
+
|
355 |
+
*************************************
|
356 |
+
*************************************
|
357 |
+
* SAVE
|
358 |
+
************************************
|
359 |
+
**************************************
|
360 |
+
g Den_bea = density13
|
361 |
+
g Den_bea_zd = density14
|
362 |
+
g Den_bea_class = density15
|
363 |
+
g Den_bea_cat = density20
|
364 |
+
g Den_bea_subcat = density21
|
365 |
+
|
366 |
+
g Den_beaB = density13B
|
367 |
+
g Den_bea_zdB = density14B
|
368 |
+
g Den_bea_classB = density15B
|
369 |
+
g Den_bea_catB = density20B
|
370 |
+
g Den_bea_subcatB = density21B
|
371 |
+
|
372 |
+
drop density* Den_bea_cat* Den_bea_subcatB* cat subcat
|
373 |
+
drop if inventor ==.
|
374 |
+
|
375 |
+
save $main/data2/data_3, replace
|
376 |
+
summ
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
|
107/replication_package/AER_UPLOADED/iv_new.do
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
* IV
|
8 |
+
********************************************************************
|
9 |
+
********************************************************************
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
********************************************************************
|
13 |
+
********************************************************************
|
14 |
+
clear
|
15 |
+
u $main/data2/data_3
|
16 |
+
|
17 |
+
egen total = sum(number), by(inventor)
|
18 |
+
|
19 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
20 |
+
replace bea =. if inter_bea ==1
|
21 |
+
replace zd =. if inter_zd ==1
|
22 |
+
replace class =. if inter_class ==1
|
23 |
+
replace bea =. if inter_bea2 ==1
|
24 |
+
replace zd =. if inter_zd2 ==1
|
25 |
+
replace class =. if inter_class2==1
|
26 |
+
|
27 |
+
|
28 |
+
drop if year ==.
|
29 |
+
drop if zd ==.
|
30 |
+
drop if org_id == ""
|
31 |
+
drop if bea ==.
|
32 |
+
egen org_new2 = group(org_id)
|
33 |
+
|
34 |
+
* This is the number of inventors in a firm in a given city (in a given field and year)
|
35 |
+
g n = 1
|
36 |
+
collapse (sum) n, by(year zd bea org_new)
|
37 |
+
|
38 |
+
* Now the level of observation is year field city firm
|
39 |
+
* This is the total number of inventors in a city across all firms (in a given field and year)
|
40 |
+
egen nn = sum(n), by(year zd bea)
|
41 |
+
|
42 |
+
* This is the share of inventors in a firm in a given city (in a given field and year)
|
43 |
+
g share = n/nn
|
44 |
+
summ n nn share, detail
|
45 |
+
|
46 |
+
* Lagged share
|
47 |
+
sort zd bea org_new year
|
48 |
+
by zd bea org_new: g share_1 = share[_n-1]
|
49 |
+
by zd bea org_new: g n_1 = n[_n-1]
|
50 |
+
|
51 |
+
|
52 |
+
* The data are now at the year field city firm level
|
53 |
+
* This is the total number of inventors by firm in the city (in a given year and field)
|
54 |
+
* It's the same as n above
|
55 |
+
egen r2 = sum(n), by(org_new year zd bea)
|
56 |
+
* This is the total number of inventors in a firm across all cities in the nation (in a given year and filed)
|
57 |
+
egen rr2 = sum(n), by(org_new year zd )
|
58 |
+
* For each firm, field city and year, this is the total number of inventors that the firm has
|
59 |
+
* in the nation outside the relevant city (in a year)
|
60 |
+
g DD = rr2 - r2
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
* This is the change over time in DD
|
65 |
+
* Note: it is non-missing only for firms that are present in a given city-field in year t-1 and t
|
66 |
+
* If a firm is not present in year t-1, DD1 is missing
|
67 |
+
sort zd org_new year
|
68 |
+
by zd org_new: g DD1 = DD - DD[_n-1]
|
69 |
+
by zd org_new: g DD2 = (DD - DD[_n-1]) / DD[_n-1]
|
70 |
+
by zd org_new: g DD3 = (DD - DD[_n-1]+1) / (DD[_n-1] +1)
|
71 |
+
by zd org_new: g DD4 = (DD - DD[_n-1]+0.01) / (DD[_n-1] +0.01)
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
* First Differences models are defined
|
76 |
+
* Only for Obs in Contiguous years
|
77 |
+
sort zd bea org_new year
|
78 |
+
by zd bea org_new: g Dyear = year - year[_n-1]
|
79 |
+
replace share_1 = . if Dyear ~=1
|
80 |
+
replace n_1 = . if Dyear ~=1
|
81 |
+
replace DD1 = . if Dyear ~=1
|
82 |
+
replace DD2 = . if Dyear ~=1
|
83 |
+
replace DD3 = . if Dyear ~=1
|
84 |
+
|
85 |
+
|
86 |
+
* Now I normalize DD1 by the relevant nationwide chnage
|
87 |
+
g tmp8 = DD1
|
88 |
+
egen tmp9 = sum(tmp8), by(zd year)
|
89 |
+
g iv8 = tmp8/tmp9
|
90 |
+
drop tmp8 tmp9
|
91 |
+
|
92 |
+
|
93 |
+
* * THIS IS THE TOTAL IN THE FOCAL CITY, FIELD ANF YEAR
|
94 |
+
save $main/data2/tmp1, replace
|
95 |
+
collapse (sum) iv8 , by(year zd bea )
|
96 |
+
summ
|
97 |
+
sort year zd bea
|
98 |
+
save $main/data2/tmp3, replace
|
99 |
+
|
100 |
+
|
101 |
+
* THIS IS THE CHANGE IN FOCAL FIRM
|
102 |
+
clear
|
103 |
+
u $main/data2/tmp1
|
104 |
+
rename iv8 hh8
|
105 |
+
collapse hh8 , by(year zd bea org_new2)
|
106 |
+
sort year zd bea
|
107 |
+
|
108 |
+
merge m:1 year zd bea using $main/data2/tmp3
|
109 |
+
tab _merge
|
110 |
+
drop _merge
|
111 |
+
|
112 |
+
* NOW I SUBTRACT THE CHANGE IN FOCAL FIRM FROM THE TOTAL SO THAT THE INSTRUMENT DOES NOT CONTAIN FOCAL FIRM
|
113 |
+
replace iv8 = iv8 - hh8 if hh8 ~=.
|
114 |
+
|
115 |
+
sort bea year zd org_new2
|
116 |
+
save $main/data2/iv_data_new, replace
|
117 |
+
summ
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
107/replication_package/AER_UPLOADED/kodak_stock.do
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* Source: Kodak: http://www.1stock1.com/1stock1_173.htm
|
2 |
+
insheet using $main/data/kodak_stock.csv
|
3 |
+
|
4 |
+
rename ending price
|
5 |
+
list year price
|
6 |
+
|
7 |
+
destring price, replace
|
8 |
+
keep if year >=1990 & year <2010
|
9 |
+
|
10 |
+
line price year , legend(off) lpattern(solid dot dot) lcolor(black black black) saving($main/tables/kodak_stock,replace)
|
11 |
+
graph export $main/tables/kodak_stock.pdf, replace
|
12 |
+
|
13 |
+
|
14 |
+
|
107/replication_package/AER_UPLOADED/reg.do
ADDED
@@ -0,0 +1,483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
|
8 |
+
|
9 |
+
********************************************************************
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
* READ DATA
|
13 |
+
********************************************************************
|
14 |
+
********************************************************************
|
15 |
+
********************************************************************
|
16 |
+
clear
|
17 |
+
u $main/data2/data_3
|
18 |
+
|
19 |
+
egen total = sum(number), by(inventor)
|
20 |
+
|
21 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
22 |
+
replace bea =. if inter_bea ==1
|
23 |
+
replace zd =. if inter_zd ==1
|
24 |
+
replace class =. if inter_class ==1
|
25 |
+
replace bea =. if inter_bea2 ==1
|
26 |
+
replace zd =. if inter_zd2 ==1
|
27 |
+
replace class =. if inter_class2==1
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
* CLUSTER SIZE
|
32 |
+
g x = log(Den_bea_zd )
|
33 |
+
sort inventor year
|
34 |
+
by inventor : g x_m1 = x[_n-1]
|
35 |
+
by inventor : g x_m2 = x[_n-2]
|
36 |
+
by inventor : g x_m3 = x[_n-3]
|
37 |
+
by inventor : g x_m4 = x[_n-4]
|
38 |
+
by inventor : g x_m5 = x[_n-5]
|
39 |
+
by inventor : g x_p1 = x[_n+1]
|
40 |
+
by inventor : g x_p2 = x[_n+2]
|
41 |
+
by inventor : g x_p3 = x[_n+3]
|
42 |
+
by inventor : g x_p4 = x[_n+4]
|
43 |
+
by inventor : g x_p5 = x[_n+5]
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
drop if year ==.
|
49 |
+
drop if zd ==.
|
50 |
+
drop if bea ==.
|
51 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
********************************************************************
|
56 |
+
********************************************************************
|
57 |
+
********************************************************************
|
58 |
+
********************************************************************
|
59 |
+
********************************************************************
|
60 |
+
********************************************************************
|
61 |
+
|
62 |
+
* NUMBER OF PATENTS IN A YEAR
|
63 |
+
g y = log(number)
|
64 |
+
|
65 |
+
* CITATIONS
|
66 |
+
* To avoid dropping the 0's, I add 0.00001
|
67 |
+
g y2 = log(citations+0.00001)
|
68 |
+
g y3 = log( (citations+0.00001) / number)
|
69 |
+
|
70 |
+
* SPECIALIZATION
|
71 |
+
*g y4 = 1-general
|
72 |
+
|
73 |
+
* NUMBER OF FIRMS
|
74 |
+
g x3 = log(Den_bea_zdB)
|
75 |
+
|
76 |
+
|
77 |
+
***********************
|
78 |
+
***********************
|
79 |
+
* STAR INVENTORS
|
80 |
+
* top 10% = 3.25
|
81 |
+
***********************
|
82 |
+
***********************
|
83 |
+
keep if total >=3.25
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
********************************************************************
|
88 |
+
********************************************************************
|
89 |
+
********************************************************************
|
90 |
+
* NEW VARIABLES
|
91 |
+
********************************************************************
|
92 |
+
********************************************************************
|
93 |
+
********************************************************************
|
94 |
+
egen cluster1 = group(bea zd)
|
95 |
+
egen cluster0 = group(bea zd year)
|
96 |
+
egen cluster2 = group(bea )
|
97 |
+
egen cluster_bea_year = group(bea year)
|
98 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
99 |
+
egen cluster_bea_class_year = group(bea class year)
|
100 |
+
egen cluster_zd_year = group(zd year)
|
101 |
+
egen cluster_bea_class = group(bea class)
|
102 |
+
egen cluster_class_year = group(class year)
|
103 |
+
egen org_new = group(org_id)
|
104 |
+
egen cluster_org_year = group(org_new year)
|
105 |
+
egen org_size = count(inventor), by(org_new year)
|
106 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
********************************************************************
|
111 |
+
********************************************************************
|
112 |
+
********************************************************************
|
113 |
+
* REGRESSIONS
|
114 |
+
********************************************************************
|
115 |
+
********************************************************************
|
116 |
+
********************************************************************
|
117 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
118 |
+
summ y y2 y3 x
|
119 |
+
summ number, detail
|
120 |
+
summ x Den_bea_zd , detail
|
121 |
+
tab zd
|
122 |
+
|
123 |
+
|
124 |
+
***************************************
|
125 |
+
*BASELINE
|
126 |
+
***************************************
|
127 |
+
|
128 |
+
* MAIN
|
129 |
+
eststo: reghdfe y x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
130 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
131 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
132 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
133 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
134 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
135 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
136 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
137 |
+
|
138 |
+
esttab using tables/table1.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
139 |
+
esttab using tables/table1, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
140 |
+
eststo clear
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
+
* NON LINEARITIES
|
145 |
+
summ x, detail
|
146 |
+
egen pctile25 = pctile(x), p(25) by(zd year)
|
147 |
+
egen pctile50 = pctile(x), p(50) by(zd year)
|
148 |
+
egen pctile75 = pctile(x), p(75) by(zd year)
|
149 |
+
g dd1 = 0
|
150 |
+
g dd2 = 0
|
151 |
+
g dd3 = 0
|
152 |
+
g dd4 = 0
|
153 |
+
replace dd1 =1 if x <= pctile25
|
154 |
+
replace dd2 =1 if x > pctile25 & x <= pctile50
|
155 |
+
replace dd3 =1 if x > pctile50 & x <= pctile75
|
156 |
+
replace dd4 =1 if x > pctile75
|
157 |
+
g x_dd1 = x*dd1
|
158 |
+
g x_dd2 = x*dd2
|
159 |
+
g x_dd3 = x*dd3
|
160 |
+
g x_dd4 = x*dd4
|
161 |
+
summ dd1 dd2 dd3 dd4
|
162 |
+
|
163 |
+
eststo: reghdfe y x_dd1 x_dd2 x_dd3 x_dd4 , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
164 |
+
test x_dd1 =x_dd2 =x_dd3 =x_dd4
|
165 |
+
|
166 |
+
eststo: reghdfe y x_dd1 x_dd2 x_dd3 x_dd4 , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new) vce(cluster cluster1) keepsin
|
167 |
+
test x_dd1 =x_dd2 =x_dd3 =x_dd4
|
168 |
+
|
169 |
+
esttab using tables/table90.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
170 |
+
esttab using tables/table90, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
171 |
+
eststo clear
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
+
* CITATIONS
|
176 |
+
eststo: reghdfe y2 x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
177 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
178 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
179 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
180 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
181 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
182 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
183 |
+
eststo: reghdfe y2 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
184 |
+
esttab using tables/table4.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
185 |
+
esttab using tables/table4, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
186 |
+
eststo clear
|
187 |
+
|
188 |
+
eststo: reghdfe y3 x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
189 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
190 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
191 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
192 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
193 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
194 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
195 |
+
eststo: reghdfe y3 x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
196 |
+
esttab using tables/table5.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
197 |
+
esttab using tables/table5, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
198 |
+
eststo clear
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
* CLUSTER SIZE IS NUMBER OF FIRMS
|
203 |
+
eststo: reghdfe y x3, absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
204 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
205 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
206 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
207 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
208 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
209 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
210 |
+
eststo: reghdfe y x3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
211 |
+
esttab using tables/table11.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
212 |
+
esttab using tables/table11, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
213 |
+
eststo clear
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
***************************************
|
218 |
+
* STAYERS
|
219 |
+
***************************************
|
220 |
+
preserve
|
221 |
+
|
222 |
+
* SAME CITY
|
223 |
+
egen max = max(bea), by(inventor)
|
224 |
+
egen min = min(bea), by(inventor)
|
225 |
+
keep if max == min
|
226 |
+
drop max min
|
227 |
+
|
228 |
+
eststo: reghdfe y x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
229 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
230 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
231 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
232 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
233 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
234 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
235 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
236 |
+
esttab using tables/table7.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
237 |
+
esttab using tables/table7, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
238 |
+
eststo clear
|
239 |
+
|
240 |
+
|
241 |
+
* SAME CITY AND FIELD
|
242 |
+
egen max = max(zd), by(inventor)
|
243 |
+
egen min = min(zd), by(inventor)
|
244 |
+
keep if max == min
|
245 |
+
drop max min
|
246 |
+
|
247 |
+
eststo: reghdfe y x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
248 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
249 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
250 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
251 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
252 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
253 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
254 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
255 |
+
esttab using tables/table71.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
256 |
+
esttab using tables/table71, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
257 |
+
eststo clear
|
258 |
+
|
259 |
+
|
260 |
+
* SAME FIELD
|
261 |
+
restore
|
262 |
+
preserve
|
263 |
+
egen max = max(zd), by(inventor)
|
264 |
+
egen min = min(zd), by(inventor)
|
265 |
+
keep if max == min
|
266 |
+
drop max min
|
267 |
+
|
268 |
+
eststo: reghdfe y x , absorb(year bea zd class ) vce(cluster cluster1) keepsin
|
269 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 ) vce(cluster cluster1) keepsin
|
270 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class ) vce(cluster cluster1) keepsin
|
271 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year ) vce(cluster cluster1) keepsin
|
272 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year ) vce(cluster cluster1) keepsin
|
273 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor ) vce(cluster cluster1) keepsin
|
274 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year) vce(cluster cluster1) keepsin
|
275 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
276 |
+
esttab using tables/table72.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
277 |
+
esttab using tables/table72, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
278 |
+
eststo clear
|
279 |
+
|
280 |
+
|
281 |
+
|
282 |
+
***************************************
|
283 |
+
*LEADS AND LAGS - BASELINE
|
284 |
+
***************************************
|
285 |
+
restore
|
286 |
+
preserve
|
287 |
+
eststo: reghdfe y x_p5 x_p4 x_p3 x_p2 x_p1 x x_m1 x_m2 x_m3 x_m4 x_m5 ,absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1)
|
288 |
+
eststo clear
|
289 |
+
|
290 |
+
g b1 = _b[x_p5]
|
291 |
+
g b2 = _b[x_p4]
|
292 |
+
g b3 = _b[x_p3]
|
293 |
+
g b4 = _b[x_p2]
|
294 |
+
g b5 = _b[x_p1]
|
295 |
+
g b6 = _b[x]
|
296 |
+
g b7 = _b[x_m1]
|
297 |
+
g b8 = _b[x_m2]
|
298 |
+
g b9 = _b[x_m3]
|
299 |
+
g b10= _b[x_m4]
|
300 |
+
g b11= _b[x_m5]
|
301 |
+
g se1 =_se[x_p5]
|
302 |
+
g se2 =_se[x_p4]
|
303 |
+
g se3 =_se[x_p3]
|
304 |
+
g se4 =_se[x_p2]
|
305 |
+
g se5 =_se[x_p1]
|
306 |
+
g se6 =_se[x]
|
307 |
+
g se7 =_se[x_m1]
|
308 |
+
g se8 =_se[x_m2]
|
309 |
+
g se9 =_se[x_m3]
|
310 |
+
g se10 =_se[x_m4]
|
311 |
+
g se11 =_se[x_m5]
|
312 |
+
|
313 |
+
lincom x_p5
|
314 |
+
g bb1 = r(estimate)
|
315 |
+
g sse1 = r(se)
|
316 |
+
lincom x_p5 + x_p4
|
317 |
+
g bb2 = r(estimate)
|
318 |
+
g sse2 = r(se)
|
319 |
+
lincom x_p5 + x_p4 + x_p3
|
320 |
+
g bb3 = r(estimate)
|
321 |
+
g sse3 = r(se)
|
322 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2
|
323 |
+
g bb4 = r(estimate)
|
324 |
+
g sse4 = r(se)
|
325 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1
|
326 |
+
g bb5 = r(estimate)
|
327 |
+
g sse5 = r(se)
|
328 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x
|
329 |
+
g bb6 = r(estimate)
|
330 |
+
g sse6 = r(se)
|
331 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1
|
332 |
+
g bb7 = r(estimate)
|
333 |
+
g sse7 = r(se)
|
334 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2
|
335 |
+
g bb8 = r(estimate)
|
336 |
+
g sse8 = r(se)
|
337 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3
|
338 |
+
g bb9 = r(estimate)
|
339 |
+
g sse9 = r(se)
|
340 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4
|
341 |
+
g bb10 = r(estimate)
|
342 |
+
g sse10 = r(se)
|
343 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4 + x_m5
|
344 |
+
g bb11 = r(estimate)
|
345 |
+
g sse11 = r(se)
|
346 |
+
|
347 |
+
keep if _n==1
|
348 |
+
keep b1-b11 se1-se11 bb* sse*
|
349 |
+
save beta1, replace
|
350 |
+
|
351 |
+
clear
|
352 |
+
u beta1
|
353 |
+
g n=_n
|
354 |
+
reshape long b se bb sse, i(n) j(j)
|
355 |
+
g t = j-6
|
356 |
+
g upper = b + 1.96*se
|
357 |
+
g lower = b - 1.96*se
|
358 |
+
|
359 |
+
|
360 |
+
line b upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) xlabel(-5 "{&beta}{sub:5}" -4 "{&beta}{sub:4}" -3 "{&beta}{sub:3}" -2 "{&beta}{sub:2}" -1 "{&beta}{sub:1}" 0 "{&beta}{sub:0}" 1 "{&beta}{sub:-1}" 2 "{&beta}{sub:-2}" 3 "{&beta}{sub:-3}" 4 "{&beta}{sub:-4}" 5 "{&beta}{sub:-5}" ) saving(fig1,replace)
|
361 |
+
graph export fig1.pdf, replace
|
362 |
+
! mv -f beta1.dta tables/
|
363 |
+
! mv -f fig1.pdf tables/
|
364 |
+
! mv -f fig1.gph tables/
|
365 |
+
|
366 |
+
drop upper lower
|
367 |
+
g upper = bb + 1.96*sse
|
368 |
+
g lower = bb - 1.96*sse
|
369 |
+
|
370 |
+
|
371 |
+
line bb upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) xlabel(-5 "{&mu}{sub:5}" -4 "{&mu}{sub:4}" -3 "{&mu}{sub:3}" -2 "{&mu}{sub:2}" -1 "{&mu}{sub:1}" 0 "{&mu}{sub:0}" 1 "{&mu}{sub:-1}" 2 "{&mu}{sub:-2}" 3 "{&mu}{sub:-3}" 4 "{&mu}{sub:-4}" 5 "{&mu}{sub:-5}" ) saving(fig1b,replace)
|
372 |
+
graph export fig1b.pdf, replace
|
373 |
+
! mv -f fig1b.pdf tables/
|
374 |
+
! mv -f fig1b.gph tables/
|
375 |
+
|
376 |
+
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
|
381 |
+
***************************************
|
382 |
+
*LEADS AND LAGS - DRUGS
|
383 |
+
***************************************
|
384 |
+
restore
|
385 |
+
preserve
|
386 |
+
keep if class == 424
|
387 |
+
eststo: reghdfe y x_p5 x_p4 x_p3 x_p2 x_p1 x x_m1 x_m2 x_m3 x_m4 x_m5 ,absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1)
|
388 |
+
eststo clear
|
389 |
+
|
390 |
+
g b1 = _b[x_p5]
|
391 |
+
g b2 = _b[x_p4]
|
392 |
+
g b3 = _b[x_p3]
|
393 |
+
g b4 = _b[x_p2]
|
394 |
+
g b5 = _b[x_p1]
|
395 |
+
g b6 = _b[x]
|
396 |
+
g b7 = _b[x_m1]
|
397 |
+
g b8 = _b[x_m2]
|
398 |
+
g b9 = _b[x_m3]
|
399 |
+
g b10= _b[x_m4]
|
400 |
+
g b11= _b[x_m5]
|
401 |
+
g se1 =_se[x_p5]
|
402 |
+
g se2 =_se[x_p4]
|
403 |
+
g se3 =_se[x_p3]
|
404 |
+
g se4 =_se[x_p2]
|
405 |
+
g se5 =_se[x_p1]
|
406 |
+
g se6 =_se[x]
|
407 |
+
g se7 =_se[x_m1]
|
408 |
+
g se8 =_se[x_m2]
|
409 |
+
g se9 =_se[x_m3]
|
410 |
+
g se10 =_se[x_m4]
|
411 |
+
g se11 =_se[x_m5]
|
412 |
+
|
413 |
+
lincom x_p5
|
414 |
+
g bb1 = r(estimate)
|
415 |
+
g sse1 = r(se)
|
416 |
+
lincom x_p5 + x_p4
|
417 |
+
g bb2 = r(estimate)
|
418 |
+
g sse2 = r(se)
|
419 |
+
lincom x_p5 + x_p4 + x_p3
|
420 |
+
g bb3 = r(estimate)
|
421 |
+
g sse3 = r(se)
|
422 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2
|
423 |
+
g bb4 = r(estimate)
|
424 |
+
g sse4 = r(se)
|
425 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1
|
426 |
+
g bb5 = r(estimate)
|
427 |
+
g sse5 = r(se)
|
428 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x
|
429 |
+
g bb6 = r(estimate)
|
430 |
+
g sse6 = r(se)
|
431 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1
|
432 |
+
g bb7 = r(estimate)
|
433 |
+
g sse7 = r(se)
|
434 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2
|
435 |
+
g bb8 = r(estimate)
|
436 |
+
g sse8 = r(se)
|
437 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3
|
438 |
+
g bb9 = r(estimate)
|
439 |
+
g sse9 = r(se)
|
440 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4
|
441 |
+
g bb10 = r(estimate)
|
442 |
+
g sse10 = r(se)
|
443 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4 + x_m5
|
444 |
+
g bb11 = r(estimate)
|
445 |
+
g sse11 = r(se)
|
446 |
+
|
447 |
+
|
448 |
+
|
449 |
+
keep if _n==1
|
450 |
+
keep b1-b11 se1-se11 bb* sse*
|
451 |
+
save beta2, replace
|
452 |
+
|
453 |
+
clear
|
454 |
+
u beta2
|
455 |
+
g n=_n
|
456 |
+
reshape long b se bb sse, i(n) j(j)
|
457 |
+
g t = j-6
|
458 |
+
g upper = b + 1.96*se
|
459 |
+
g lower = b - 1.96*se
|
460 |
+
|
461 |
+
|
462 |
+
line b upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) xlabel(-5 "{&beta}{sub:5}" -4 "{&beta}{sub:4}" -3 "{&beta}{sub:3}" -2 "{&beta}{sub:2}" -1 "{&beta}{sub:1}" 0 "{&beta}{sub:0}" 1 "{&beta}{sub:-1}" 2 "{&beta}{sub:-2}" 3 "{&beta}{sub:-3}" 4 "{&beta}{sub:-4}" 5 "{&beta}{sub:-5}" ) saving(fig2,replace)
|
463 |
+
graph export fig2.pdf, replace
|
464 |
+
! mv -f beta2.dta tables/
|
465 |
+
! mv -f fig2.pdf tables/
|
466 |
+
! mv -f fig2.gph tables/
|
467 |
+
|
468 |
+
drop upper lower
|
469 |
+
g upper = bb + 1.96*sse
|
470 |
+
g lower = bb - 1.96*sse
|
471 |
+
|
472 |
+
|
473 |
+
line bb upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) xlabel(-5 "{&mu}{sub:5}" -4 "{&mu}{sub:4}" -3 "{&mu}{sub:3}" -2 "{&mu}{sub:2}" -1 "{&mu}{sub:1}" 0 "{&mu}{sub:0}" 1 "{&mu}{sub:-1}" 2 "{&mu}{sub:-2}" 3 "{&mu}{sub:-3}" 4 "{&mu}{sub:-4}" 5 "{&mu}{sub:-5}" ) saving(fig2b,replace)
|
474 |
+
graph export fig2b.pdf, replace
|
475 |
+
! mv -f fig2b.pdf tables/
|
476 |
+
! mv -f fig2b.gph tables/
|
477 |
+
|
478 |
+
|
479 |
+
|
480 |
+
|
481 |
+
restore
|
482 |
+
*THE PART BELOW WAS MOVED TO REG23.DO
|
483 |
+
|
107/replication_package/AER_UPLOADED/reg11.do
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* IV -- BASELINE
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
|
9 |
+
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
********************************************************************
|
13 |
+
* READ DATA
|
14 |
+
********************************************************************
|
15 |
+
********************************************************************
|
16 |
+
********************************************************************
|
17 |
+
clear
|
18 |
+
u $main/data2/data_3
|
19 |
+
|
20 |
+
egen total = sum(number), by(inventor)
|
21 |
+
|
22 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
23 |
+
replace bea =. if inter_bea ==1
|
24 |
+
replace zd =. if inter_zd ==1
|
25 |
+
replace class =. if inter_class ==1
|
26 |
+
replace bea =. if inter_bea2 ==1
|
27 |
+
replace zd =. if inter_zd2 ==1
|
28 |
+
replace class =. if inter_class2==1
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
* CLUSTER SIZE
|
33 |
+
g x = log(Den_bea_zd )
|
34 |
+
sort inventor year
|
35 |
+
by inventor : g x_m1 = x[_n-1]
|
36 |
+
by inventor : g x_m2 = x[_n-2]
|
37 |
+
by inventor : g x_m3 = x[_n-3]
|
38 |
+
by inventor : g x_m4 = x[_n-4]
|
39 |
+
by inventor : g x_m5 = x[_n-5]
|
40 |
+
by inventor : g x_p1 = x[_n+1]
|
41 |
+
by inventor : g x_p2 = x[_n+2]
|
42 |
+
by inventor : g x_p3 = x[_n+3]
|
43 |
+
by inventor : g x_p4 = x[_n+4]
|
44 |
+
by inventor : g x_p5 = x[_n+5]
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
drop if year ==.
|
50 |
+
drop if zd ==.
|
51 |
+
drop if bea ==.
|
52 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
********************************************************************
|
57 |
+
********************************************************************
|
58 |
+
********************************************************************
|
59 |
+
********************************************************************
|
60 |
+
********************************************************************
|
61 |
+
********************************************************************
|
62 |
+
|
63 |
+
* NUMBER OF PATENTS IN A YEAR
|
64 |
+
g y = log(number)
|
65 |
+
|
66 |
+
* CITATIONS
|
67 |
+
* To avoid dropping the 0's, I add 0.00001
|
68 |
+
g y2 = log(citations+0.00001)
|
69 |
+
g y3 = log( (citations+0.00001) / number)
|
70 |
+
|
71 |
+
* SPECIALIZATION
|
72 |
+
*g y4 = 1-general
|
73 |
+
|
74 |
+
* NUMBER OF FIRMS
|
75 |
+
g x3 = log(Den_bea_zdB)
|
76 |
+
|
77 |
+
|
78 |
+
***********************
|
79 |
+
***********************
|
80 |
+
* DEFINE STAR INVENTORS
|
81 |
+
***********************
|
82 |
+
***********************
|
83 |
+
keep if total >=3.25
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
********************************************************************
|
88 |
+
********************************************************************
|
89 |
+
********************************************************************
|
90 |
+
* NEW VARIABLES
|
91 |
+
********************************************************************
|
92 |
+
********************************************************************
|
93 |
+
********************************************************************
|
94 |
+
egen cluster1 = group(bea zd)
|
95 |
+
egen cluster0 = group(bea zd year)
|
96 |
+
egen cluster2 = group(bea )
|
97 |
+
egen cluster_bea_year = group(bea year)
|
98 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
99 |
+
egen cluster_bea_class_year = group(bea class year)
|
100 |
+
egen cluster_zd_year = group(zd year)
|
101 |
+
egen cluster_bea_class = group(bea class)
|
102 |
+
egen cluster_class_year = group(class year)
|
103 |
+
egen org_new = group(org_id)
|
104 |
+
egen cluster_org_year = group(org_new year)
|
105 |
+
egen org_size = count(inventor), by(org_new year)
|
106 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
********************************************************************
|
111 |
+
********************************************************************
|
112 |
+
********************************************************************
|
113 |
+
* REGRESSIONS
|
114 |
+
********************************************************************
|
115 |
+
********************************************************************
|
116 |
+
********************************************************************
|
117 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
118 |
+
summ y y2 y3 x
|
119 |
+
summ number, detail
|
120 |
+
summ x Den_bea_zd , detail
|
121 |
+
tab zd
|
122 |
+
|
123 |
+
|
124 |
+
***************************************
|
125 |
+
*MODELS IN DIFFERENCES and IV
|
126 |
+
***************************************
|
127 |
+
preserve
|
128 |
+
|
129 |
+
|
130 |
+
drop if org_id == ""
|
131 |
+
sort org_new2 bea year zd
|
132 |
+
merge m:1 bea year zd org_new2 using $main/data2/iv_data_new
|
133 |
+
drop _merge
|
134 |
+
g IV = iv8
|
135 |
+
|
136 |
+
sort inventor year
|
137 |
+
by inventor: g Dy = y - y[_n-1]
|
138 |
+
by inventor: g Dx = x - x[_n-1]
|
139 |
+
by inventor: g Dyear = year - year[_n-1]
|
140 |
+
by inventor: g Dbea = 1 if bea_code == bea_code[_n-1]
|
141 |
+
by inventor: g Dy_2 = y - y[_n-2]
|
142 |
+
by inventor: g Dx_2 = x - x[_n-2]
|
143 |
+
by inventor: g Dyear_2 = year - year[_n-2]
|
144 |
+
by inventor: g Dbea_2 = 1 if bea_code == bea_code[_n-2]
|
145 |
+
by inventor: g Dx_m1 = x[_n-1] - x[_n-2]
|
146 |
+
by inventor: g Dx_m2 = x[_n-2] - x[_n-3]
|
147 |
+
by inventor: g Dx_m3 = x[_n-3] - x[_n-2]
|
148 |
+
egen cluster10 = group(bea )
|
149 |
+
|
150 |
+
|
151 |
+
* Models in first differences should only include observations in contiguous years
|
152 |
+
keep if Dyear ==1
|
153 |
+
keep if Dy ~=. & Dx ~=. & IV ~=.
|
154 |
+
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
+
* MODELS WITH LAGS: THEY CAN BE COMPARED TO f.e. MODELS BUT CAN'T USE IV's
|
159 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year ) vce(cluster cluster10)
|
160 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
161 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year zd ) vce(cluster cluster10)
|
162 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
163 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year zd class ) vce(cluster cluster10)
|
164 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
165 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year zd class org_new) vce(cluster cluster10)
|
166 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
167 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year zd class org_new cluster_zd_year ) vce(cluster cluster10)
|
168 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
169 |
+
eststo: reghdfe Dy Dx Dx_m1 Dx_m2 Dx_m3 , absorb(year zd class org_new cluster_zd_year cluster_class_year ) vce(cluster cluster10)
|
170 |
+
lincom Dx + Dx_m1 + Dx_m2 + Dx_m3
|
171 |
+
esttab using tables11/table29.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
172 |
+
esttab using tables11/table29, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
173 |
+
eststo clear
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
* OLS
|
178 |
+
eststo: reghdfe Dy Dx, absorb(year ) vce(cluster cluster10)
|
179 |
+
eststo: reghdfe Dy Dx, absorb(year zd ) vce(cluster cluster10)
|
180 |
+
eststo: reghdfe Dy Dx, absorb(year zd class ) vce(cluster cluster10)
|
181 |
+
eststo: reghdfe Dy Dx, absorb(year zd class org_new) vce(cluster cluster10)
|
182 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year org_new) vce(cluster cluster10)
|
183 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10)
|
184 |
+
|
185 |
+
esttab using tables11/table20.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
186 |
+
esttab using tables11/table20, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
187 |
+
eststo clear
|
188 |
+
|
189 |
+
* 2SLS
|
190 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year ) cluster(cluster10)
|
191 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd ) cluster(cluster10)
|
192 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class ) cluster(cluster10)
|
193 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class org_new) cluster(cluster10)
|
194 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year org_new ) cluster(cluster10)
|
195 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year cluster_class_year org_new) cluster(cluster10)
|
196 |
+
|
197 |
+
esttab using tables11/table22.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
198 |
+
esttab using tables11/table22, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
199 |
+
eststo clear
|
200 |
+
|
201 |
+
* First Stage
|
202 |
+
eststo: reghdfe Dx IV, absorb(year ) vce(cluster cluster10) res(v1)
|
203 |
+
test IV=0
|
204 |
+
eststo: reghdfe Dx IV, absorb(year zd ) vce(cluster cluster10) res(v2)
|
205 |
+
test IV=0
|
206 |
+
eststo: reghdfe Dx IV, absorb(year zd class ) vce(cluster cluster10) res(v3)
|
207 |
+
test IV=0
|
208 |
+
eststo: reghdfe Dx IV, absorb(year zd class org_new) vce(cluster cluster10) res(v4)
|
209 |
+
test IV=0
|
210 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year org_new) vce(cluster cluster10) res(v5)
|
211 |
+
test IV=0
|
212 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10) res(v6)
|
213 |
+
test IV=0
|
214 |
+
|
215 |
+
esttab using tables11/table21.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
216 |
+
esttab using tables11/table21, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
217 |
+
eststo clear
|
218 |
+
|
219 |
+
|
220 |
+
* EXOGENEITY TESTS
|
221 |
+
* XXX FSTAT
|
222 |
+
reghdfe Dy Dx v1, absorb(year ) vce(cluster cluster10)
|
223 |
+
test v1
|
224 |
+
reghdfe Dy Dx v2, absorb(year zd ) vce(cluster cluster10)
|
225 |
+
test v2
|
226 |
+
reghdfe Dy Dx v3, absorb(year zd class ) vce(cluster cluster10)
|
227 |
+
test v3
|
228 |
+
reghdfe Dy Dx v4, absorb(year zd class org_new) vce(cluster cluster10)
|
229 |
+
test v4
|
230 |
+
reghdfe Dy Dx v5, absorb(year zd class cluster_zd_year org_new) vce(cluster cluster10)
|
231 |
+
test v5
|
232 |
+
reghdfe Dy Dx v6, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10)
|
233 |
+
test v6
|
234 |
+
drop v1 v2 v3 v4 v5 v6
|
235 |
+
|
236 |
+
|
237 |
+
restore
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
|
242 |
+
|
107/replication_package/AER_UPLOADED/reg13.do
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* IV
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
|
9 |
+
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
********************************************************************
|
13 |
+
* READ DATA
|
14 |
+
********************************************************************
|
15 |
+
********************************************************************
|
16 |
+
********************************************************************
|
17 |
+
clear
|
18 |
+
u $main/data2/data_3
|
19 |
+
|
20 |
+
egen total = sum(number), by(inventor)
|
21 |
+
|
22 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
23 |
+
replace bea =. if inter_bea ==1
|
24 |
+
replace zd =. if inter_zd ==1
|
25 |
+
replace class =. if inter_class ==1
|
26 |
+
replace bea =. if inter_bea2 ==1
|
27 |
+
replace zd =. if inter_zd2 ==1
|
28 |
+
replace class =. if inter_class2==1
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
* CLUSTER SIZE
|
33 |
+
g x = log(Den_bea_zd )
|
34 |
+
sort inventor year
|
35 |
+
by inventor : g x_m1 = x[_n-1]
|
36 |
+
by inventor : g x_m2 = x[_n-2]
|
37 |
+
by inventor : g x_m3 = x[_n-3]
|
38 |
+
by inventor : g x_m4 = x[_n-4]
|
39 |
+
by inventor : g x_m5 = x[_n-5]
|
40 |
+
by inventor : g x_p1 = x[_n+1]
|
41 |
+
by inventor : g x_p2 = x[_n+2]
|
42 |
+
by inventor : g x_p3 = x[_n+3]
|
43 |
+
by inventor : g x_p4 = x[_n+4]
|
44 |
+
by inventor : g x_p5 = x[_n+5]
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
drop if year ==.
|
50 |
+
drop if zd ==.
|
51 |
+
drop if bea ==.
|
52 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
********************************************************************
|
57 |
+
********************************************************************
|
58 |
+
********************************************************************
|
59 |
+
********************************************************************
|
60 |
+
********************************************************************
|
61 |
+
********************************************************************
|
62 |
+
|
63 |
+
* NUMBER OF PATENTS IN A YEAR
|
64 |
+
g y = log(number)
|
65 |
+
|
66 |
+
* CITATIONS
|
67 |
+
* To avoid dropping the 0's, I add 0.00001
|
68 |
+
g y2 = log(citations+0.00001)
|
69 |
+
g y3 = log( (citations+0.00001) / number)
|
70 |
+
|
71 |
+
* SPECIALIZATION
|
72 |
+
*g y4 = 1-general
|
73 |
+
|
74 |
+
* NUMBER OF FIRMS
|
75 |
+
g x3 = log(Den_bea_zdB)
|
76 |
+
|
77 |
+
|
78 |
+
***********************
|
79 |
+
***********************
|
80 |
+
* DEFINE STAR INVENTORS
|
81 |
+
***********************
|
82 |
+
***********************
|
83 |
+
keep if total >=3.25
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
********************************************************************
|
88 |
+
********************************************************************
|
89 |
+
********************************************************************
|
90 |
+
* NEW VARIABLES
|
91 |
+
********************************************************************
|
92 |
+
********************************************************************
|
93 |
+
********************************************************************
|
94 |
+
egen cluster1 = group(bea zd)
|
95 |
+
egen cluster0 = group(bea zd year)
|
96 |
+
egen cluster2 = group(bea )
|
97 |
+
egen cluster_bea_year = group(bea year)
|
98 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
99 |
+
egen cluster_bea_class_year = group(bea class year)
|
100 |
+
egen cluster_zd_year = group(zd year)
|
101 |
+
egen cluster_bea_class = group(bea class)
|
102 |
+
egen cluster_class_year = group(class year)
|
103 |
+
egen org_new = group(org_id)
|
104 |
+
egen cluster_org_year = group(org_new year)
|
105 |
+
egen org_size = count(inventor), by(org_new year)
|
106 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
********************************************************************
|
111 |
+
********************************************************************
|
112 |
+
********************************************************************
|
113 |
+
* REGRESSIONS
|
114 |
+
********************************************************************
|
115 |
+
********************************************************************
|
116 |
+
********************************************************************
|
117 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
118 |
+
summ y y2 y3 x
|
119 |
+
summ number, detail
|
120 |
+
summ x Den_bea_zd , detail
|
121 |
+
tab zd
|
122 |
+
|
123 |
+
|
124 |
+
***************************************
|
125 |
+
*MODELS IN DIFFERENCES and IV
|
126 |
+
***************************************
|
127 |
+
preserve
|
128 |
+
|
129 |
+
|
130 |
+
drop if org_id == ""
|
131 |
+
sort org_new2 bea year zd
|
132 |
+
merge m:1 bea year zd org_new2 using $main/data2/iv_data_new
|
133 |
+
drop _merge
|
134 |
+
g IV = iv8
|
135 |
+
|
136 |
+
sort inventor year
|
137 |
+
by inventor: g Dy = y - y[_n-1]
|
138 |
+
by inventor: g Dx = x - x[_n-1]
|
139 |
+
by inventor: g Dyear = year - year[_n-1]
|
140 |
+
by inventor: g Dbea = 1 if bea_code == bea_code[_n-1]
|
141 |
+
by inventor: g Dy_2 = y - y[_n-2]
|
142 |
+
by inventor: g Dx_2 = x - x[_n-2]
|
143 |
+
by inventor: g Dyear_2 = year - year[_n-2]
|
144 |
+
by inventor: g Dbea_2 = 1 if bea_code == bea_code[_n-2]
|
145 |
+
by inventor: g Dx_m1 = x[_n-1] - x[_n-2]
|
146 |
+
by inventor: g Dx_m2 = x[_n-2] - x[_n-3]
|
147 |
+
by inventor: g Dx_m3 = x[_n-3] - x[_n-2]
|
148 |
+
egen cluster10 = group(bea )
|
149 |
+
|
150 |
+
|
151 |
+
* Models in first differences should only include observations in contiguous years
|
152 |
+
keep if Dyear ==1
|
153 |
+
keep if Dy ~=. & Dx ~=. & IV ~=.
|
154 |
+
|
155 |
+
|
156 |
+
|
157 |
+
*******************************************
|
158 |
+
sort inventor year
|
159 |
+
*by inventor: g Dy_m1 = Dy[_n-1]
|
160 |
+
*by inventor: g Dy_m2 = Dy[_n-2]
|
161 |
+
*by inventor: g Dy_m3 = Dy[_n-3]
|
162 |
+
|
163 |
+
*by inventor: g Dx_m1 = Dx[_n-1]
|
164 |
+
*by inventor: g Dx_m2 = Dx[_n-2]
|
165 |
+
*by inventor: g Dx_m3 = Dx[_n-3]
|
166 |
+
|
167 |
+
by inventor: g IV_p1 = IV[_n+1]
|
168 |
+
by inventor: g IV_p2 = IV[_n+2]
|
169 |
+
by inventor: g IV_p3 = IV[_n+3]
|
170 |
+
|
171 |
+
|
172 |
+
summ year Dy Dx IV*
|
173 |
+
|
174 |
+
|
175 |
+
* IV
|
176 |
+
eststo: ivreghdfe Dy (Dx =IV_p1), absorb(year zd class cluster_zd_year cluster_class_year org_new) cluster(cluster10)
|
177 |
+
|
178 |
+
*eststo: ivreghdfe Dy (Dx =IV_p1 IV_p2), absorb(year zd class cluster_zd_year cluster_class_year org_new) cluster(cluster10)
|
179 |
+
|
180 |
+
|
181 |
+
* First Stage
|
182 |
+
eststo: reghdfe Dx IV_p1, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10) res(v6)
|
183 |
+
|
184 |
+
*eststo: reghdfe Dx IV_p1 IV_p2, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10) res(v6)
|
185 |
+
|
186 |
+
eststo: reghdfe Dx IV IV_p1, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10) res(v88)
|
187 |
+
test IV=0
|
188 |
+
|
189 |
+
*eststo: reghdfe Dx IV IV_p1 IV_p2, absorb(year zd class cluster_zd_year cluster_class_year org_new) vce(cluster cluster10) res(v6)
|
190 |
+
*test IV=0
|
191 |
+
|
192 |
+
|
193 |
+
|
194 |
+
restore
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
|
107/replication_package/AER_UPLOADED/reg2.do
ADDED
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
* RANKINGS, SUMMARY STATS, BINSCATTER and COUNTERFACTUALS
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
********************************************************************
|
12 |
+
********************************************************************
|
13 |
+
******************************
|
14 |
+
* TOP PATENTERS
|
15 |
+
******************************
|
16 |
+
********************************************************************
|
17 |
+
********************************************************************
|
18 |
+
u $main/data2/organizations_3.dta
|
19 |
+
collapse (sum) org_N, by(org_norm)
|
20 |
+
gsort -org_N
|
21 |
+
g n = _n
|
22 |
+
keep if n <= 25
|
23 |
+
list
|
24 |
+
|
25 |
+
outfile org_norm org_N using tables2/table4.txt, replace
|
26 |
+
outsheet org_norm org_N using tables2/table4.csv, replace comma
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
********************************************************************
|
31 |
+
********************************************************************
|
32 |
+
******************************
|
33 |
+
* CLUSTER SIZE
|
34 |
+
******************************
|
35 |
+
********************************************************************
|
36 |
+
********************************************************************
|
37 |
+
clear
|
38 |
+
u $main/data2/density14_3
|
39 |
+
|
40 |
+
* Some city-industry are not in the data because they have no patents.
|
41 |
+
* Thus, I am missing some of the 0's
|
42 |
+
* Here I fillin do that I have every combinatiuon of city zd and year
|
43 |
+
* and I add the 0's
|
44 |
+
fillin bea_code zd2 year
|
45 |
+
replace density14 =0 if density14 ==.
|
46 |
+
replace density14B =0 if density14B ==.
|
47 |
+
|
48 |
+
|
49 |
+
* Add zd name and bea name
|
50 |
+
g zd_name = "Biology and Chemestry" if zd2 ==1
|
51 |
+
replace zd_name = "Computer Science" if zd2 ==2
|
52 |
+
replace zd_name = "Other Egineering" if zd2 ==3
|
53 |
+
replace zd_name = "Other Science" if zd2 ==4
|
54 |
+
replace zd_name = "Semiconductors" if zd2 ==5
|
55 |
+
|
56 |
+
sort bea_code
|
57 |
+
merge m:1 bea_code using $main/data/bea_codes
|
58 |
+
drop if _merge ==2
|
59 |
+
drop _merge
|
60 |
+
|
61 |
+
|
62 |
+
* Density Distribution
|
63 |
+
summ density14 if year ==2007 & zd_name == "Biology and Chemestry" , detail
|
64 |
+
summ density14 if year ==2007 & zd_name == "Computer Science" , detail
|
65 |
+
summ density14 if year ==2007 & zd_name == "Other Egineering" , detail
|
66 |
+
summ density14 if year ==2007 & zd_name == "Other Science" , detail
|
67 |
+
summ density14 if year ==2007 & zd_name == "Semiconductors" , detail
|
68 |
+
|
69 |
+
|
70 |
+
sort bea_code zd2 year
|
71 |
+
save $main/tables2/data, replace
|
72 |
+
|
73 |
+
|
74 |
+
* TOP 10
|
75 |
+
g top10 =0
|
76 |
+
gsort year zd2 -density14
|
77 |
+
by year zd2: replace top10 = 1 if _n >=1 & _n <=10
|
78 |
+
egen top10_sum = sum(density14) if top10 ==1, by(year zd_name)
|
79 |
+
|
80 |
+
summ top10_sum if year ==2007 & top10 ==1 & zd_name == "Semiconductors"
|
81 |
+
summ top10_sum if year ==2007 & top10 ==1 & zd_name == "Computer Science"
|
82 |
+
summ top10_sum if year ==2007 & top10 ==1 & zd_name == "Biology and Chemestry"
|
83 |
+
|
84 |
+
|
85 |
+
sort year
|
86 |
+
collapse top10_sum, by(year zd_name)
|
87 |
+
keep if year ==1971 | year ==1980 | year ==1990 | year ==2000 | year ==2007
|
88 |
+
|
89 |
+
sort year
|
90 |
+
line top10_sum year if zd_name == "Semiconductors", legend(off) ytitle("") xtitle("")
|
91 |
+
graph export fig7.pdf, replace
|
92 |
+
! mv -f fig7.pdf tables2/
|
93 |
+
|
94 |
+
line top10_sum year if zd_name == "Computer Science", legend(off) ytitle("") xtitle("")
|
95 |
+
graph export fig8.pdf, replace
|
96 |
+
! mv -f fig8.pdf tables2/
|
97 |
+
|
98 |
+
line top10_sum year if zd_name == "Biology and Chemestry", legend(off) ytitle("") xtitle("")
|
99 |
+
graph export fig9.pdf, replace
|
100 |
+
! mv -f fig9.pdf tables2/
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
************************************
|
107 |
+
***********************************
|
108 |
+
* PRODUCTIVITY
|
109 |
+
************************************
|
110 |
+
***********************************
|
111 |
+
clear
|
112 |
+
u $main/data2/data_3
|
113 |
+
egen total = sum(number), by(inventor)
|
114 |
+
|
115 |
+
* INCLUDE THE FOLLOWING 5 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
116 |
+
replace bea =. if inter_bea ==1
|
117 |
+
replace zd =. if inter_zd ==1
|
118 |
+
replace class =. if inter_class ==1
|
119 |
+
replace bea =. if inter_bea2 ==1
|
120 |
+
replace zd =. if inter_zd2 ==1
|
121 |
+
replace class =. if inter_class2==1
|
122 |
+
|
123 |
+
|
124 |
+
********************************************************************
|
125 |
+
********************************************************************
|
126 |
+
********************************************************************
|
127 |
+
********************************************************************
|
128 |
+
********************************************************************
|
129 |
+
********************************************************************
|
130 |
+
|
131 |
+
************************
|
132 |
+
************************
|
133 |
+
* DEFINE Y
|
134 |
+
***********************
|
135 |
+
***********************
|
136 |
+
* NUMBER OF PATENTS IN A YEAR
|
137 |
+
g y = log(number)
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
***********************
|
142 |
+
***********************
|
143 |
+
* DEFINE X
|
144 |
+
***********************
|
145 |
+
***********************
|
146 |
+
* NUMBER OF SCIENTISTS
|
147 |
+
*g x = Den_bea_zd
|
148 |
+
*g x2 = Den_bea_class
|
149 |
+
g x = log(Den_bea_zd )
|
150 |
+
*g x2 = log(Den_bea_class )
|
151 |
+
|
152 |
+
* NUMBER OF FIRMS
|
153 |
+
*g x = Den_bea_zdB
|
154 |
+
*g x2 = Den_bea_classB
|
155 |
+
|
156 |
+
|
157 |
+
***********************
|
158 |
+
***********************
|
159 |
+
***********************
|
160 |
+
***********************
|
161 |
+
keep if total >=3.25
|
162 |
+
|
163 |
+
|
164 |
+
|
165 |
+
********************************************************************
|
166 |
+
********************************************************************
|
167 |
+
* SUMMARY STATS FOR SAMPLE
|
168 |
+
********************************************************************
|
169 |
+
********************************************************************
|
170 |
+
egen cluster1 = group(bea zd)
|
171 |
+
keep if number~=. & zd2 ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=.
|
172 |
+
|
173 |
+
g corporate = 0 if org_type ~="" & org_type ~="OT"
|
174 |
+
replace corporate = 1 if org_type =="FI"
|
175 |
+
|
176 |
+
summ y Den_bea_zd number total corporate
|
177 |
+
|
178 |
+
* FIELD
|
179 |
+
tab zd2
|
180 |
+
|
181 |
+
|
182 |
+
* FIRM TYPE
|
183 |
+
* FI Firm
|
184 |
+
*UN University
|
185 |
+
*NL National Lab
|
186 |
+
*RI Research Institute
|
187 |
+
*UG US Government
|
188 |
+
*HO Hospital
|
189 |
+
*AS Academy of Science
|
190 |
+
*NO No organization recorded
|
191 |
+
*SC Schools (less than university level)
|
192 |
+
*OT Other
|
193 |
+
tab org_type
|
194 |
+
|
195 |
+
|
196 |
+
*******************************************************************
|
197 |
+
********************************************************************
|
198 |
+
*******************************
|
199 |
+
* BINSCATTERS
|
200 |
+
*******************************
|
201 |
+
*******************************************************************
|
202 |
+
********************************************************************
|
203 |
+
ssc install binscatter
|
204 |
+
|
205 |
+
binscatter y x, nquantiles(40) controls(i.bea i.year i.zd) reportreg
|
206 |
+
graph export figure4.pdf, replace
|
207 |
+
! mv -f figure4.pdf tables2/
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
|
212 |
+
*******************************************************************
|
213 |
+
********************************************************************
|
214 |
+
*******************************
|
215 |
+
* COLLAPSE AND MERGE WITH DENSITY DATA THAT HAVE EVERY
|
216 |
+
* COMBINATION OF CITY-ZD-YEAR
|
217 |
+
*
|
218 |
+
* DATA HAVE ALL COMBINATION OF CITY-ZD-YEAR
|
219 |
+
* I ADD 0's. THIS WAY I DO NOT DROP CELLS WITH NO PATENTS
|
220 |
+
*
|
221 |
+
*******************************
|
222 |
+
*******************************
|
223 |
+
*******************************************************************
|
224 |
+
********************************************************************
|
225 |
+
* COLLAPSE
|
226 |
+
sort year bea_code zd2
|
227 |
+
collapse y x numbe , by(year bea_co zd2)
|
228 |
+
summ
|
229 |
+
save $main/tmp, replace
|
230 |
+
|
231 |
+
* Merge with all combinations of bea_code zd2 year
|
232 |
+
clear
|
233 |
+
u $main/tables2/data
|
234 |
+
sort bea_code zd2 year
|
235 |
+
merge 1:1 bea_code zd2 year using $main/tmp
|
236 |
+
drop _merge
|
237 |
+
! rm $main/tmp.dta
|
238 |
+
rename density14 Den_bea_zd
|
239 |
+
rename density14B Den_bea_zdB
|
240 |
+
|
241 |
+
|
242 |
+
* I add the 0's
|
243 |
+
replace number = 0 if number ==.
|
244 |
+
|
245 |
+
|
246 |
+
*********************************
|
247 |
+
* RANKINGS OF SIZE
|
248 |
+
*********************************
|
249 |
+
gsort year -Den_bea_zd
|
250 |
+
outfile bea_name Den_bea_zd if year ==2007 & zd_name == "Semiconductors" using tables2/table2b.txt, replace
|
251 |
+
outsheet bea_name Den_bea_zd if year ==2007 & zd_name == "Semiconductors" using tables2/table2b.csv, replace comma
|
252 |
+
|
253 |
+
outfile bea_name Den_bea_zd if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table2c.txt, replace
|
254 |
+
outsheet bea_name Den_bea_zd if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table2c.csv, replace comma
|
255 |
+
|
256 |
+
outfile bea_name Den_bea_zd if year ==2007 & zd_name == "Computer Science" using tables2/table2d.txt, replace
|
257 |
+
outsheet bea_name Den_bea_zd if year ==2007 & zd_name == "Computer Science" using tables2/table2d.csv, replace comma
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
*******************************************************************
|
262 |
+
********************************************************************
|
263 |
+
*******************************
|
264 |
+
* COUNTERFACTUALS
|
265 |
+
*******************************
|
266 |
+
*******************************************************************
|
267 |
+
********************************************************************
|
268 |
+
drop _fillin Den_bea_zdB
|
269 |
+
|
270 |
+
* Estimated elasticity
|
271 |
+
g alpha = 0.067
|
272 |
+
|
273 |
+
* PERCENTILES
|
274 |
+
egen tmp95 = pctile(Den_bea_zd), p(95) by(year zd2)
|
275 |
+
egen tmp90 = pctile(Den_bea_zd), p(90) by(year zd2)
|
276 |
+
egen tmp75 = pctile(Den_bea_zd), p(75) by(year zd2)
|
277 |
+
egen tmp50 = pctile(Den_bea_zd), p(50) by(year zd2)
|
278 |
+
egen tmp25 = pctile(Den_bea_zd), p(25) by(year zd2)
|
279 |
+
|
280 |
+
|
281 |
+
* This is the counterfactual cluster size.
|
282 |
+
* I need to do the mean, so that the total
|
283 |
+
* number of scientsis in the US in the
|
284 |
+
* counterfactual is = to observed number
|
285 |
+
* I can't do median because it would change it
|
286 |
+
egen mean = mean(Den_bea_zd), by(year zd2)
|
287 |
+
|
288 |
+
|
289 |
+
* A log log model implies that the agglomeration effect in absolute amount of patents is cluster size to alpha
|
290 |
+
* DD is estimated change in inventor productivity, measured in number of patents (not percent)
|
291 |
+
g DD = (mean^alpha) - (Den_bea_zd^alpha)
|
292 |
+
* This is the percent change
|
293 |
+
g DDD = (mean^alpha - Den_bea_zd^alpha)*100/(Den_bea_zd^alpha)
|
294 |
+
|
295 |
+
* XXX TABLE 11
|
296 |
+
summ DDD if Den_bea_zd <=tmp25 & Den_bea_zd ~=.
|
297 |
+
summ DDD if Den_bea_zd >tmp25 & Den_bea_zd <= tmp50 & Den_bea_zd ~=.
|
298 |
+
summ DDD if Den_bea_zd >tmp50 & Den_bea_zd <= tmp75 & Den_bea_zd ~=.
|
299 |
+
summ DDD if Den_bea_zd >tmp75 & Den_bea_zd <= tmp90 & Den_bea_zd ~=.
|
300 |
+
summ DDD if Den_bea_zd >tmp90 & Den_bea_zd <= tmp95 & Den_bea_zd ~=.
|
301 |
+
summ DDD if Den_bea_zd >tmp95 & Den_bea_zd ~=.
|
302 |
+
drop tmp*
|
303 |
+
|
304 |
+
|
305 |
+
gsort year -Den_bea_zd
|
306 |
+
outfile bea_name DDD if year ==2007 & zd_name == "Semiconductors" using tables2/table3b.txt, replace
|
307 |
+
outsheet bea_name DDD if year ==2007 & zd_name == "Semiconductors" using tables2/table3b.csv, replace comma
|
308 |
+
outfile bea_name DDD if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table3c.txt, replace
|
309 |
+
outsheet bea_name DDD if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table3c.csv, replace comma
|
310 |
+
outfile bea_name DDD if year ==2007 & zd_name == "Computer Science" using tables2/table3d.txt, replace
|
311 |
+
outsheet bea_name DDD if year ==2007 & zd_name == "Computer Science" using tables2/table3d.csv, replace comma
|
312 |
+
|
313 |
+
|
314 |
+
* Change
|
315 |
+
g ZZ = Den_bea_zd*DD
|
316 |
+
g ZZZ = Den_bea_zd*(Den_bea_zd^alpha)
|
317 |
+
preserve
|
318 |
+
collapse (sum) ZZ ZZZ, by(year zd_name)
|
319 |
+
|
320 |
+
* Aggregate effect by field
|
321 |
+
* XXX TABLE 12 col 1
|
322 |
+
g change = ZZ / ZZZ
|
323 |
+
list zd change if year ==2007
|
324 |
+
|
325 |
+
|
326 |
+
* Aggregate effect -- All fields
|
327 |
+
* XXX TABLE 12 col 1
|
328 |
+
restore
|
329 |
+
collapse (sum) ZZ ZZZ, by(year)
|
330 |
+
g change = ZZ / ZZZ
|
331 |
+
list change if year ==2007
|
332 |
+
|
333 |
+
|
107/replication_package/AER_UPLOADED/reg20.do
ADDED
@@ -0,0 +1,605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* I ESTIMATE A NUMBER OF EXTENSIONS AND ROBUSNESS CHECKS
|
5 |
+
* I ALSO COMPUTE NEW SUMMARY STATS
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
clear
|
11 |
+
u $main/data2/data_3
|
12 |
+
|
13 |
+
egen total = sum(number), by(inventor)
|
14 |
+
|
15 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
16 |
+
replace bea =. if inter_bea ==1
|
17 |
+
replace zd =. if inter_zd ==1
|
18 |
+
replace class =. if inter_class ==1
|
19 |
+
replace bea =. if inter_bea2 ==1
|
20 |
+
replace zd =. if inter_zd2 ==1
|
21 |
+
replace class =. if inter_class2==1
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
* CLUSTER SIZE
|
26 |
+
g x = log(Den_bea_zd )
|
27 |
+
sort inventor year
|
28 |
+
by inventor : g x_m1 = x[_n-1]
|
29 |
+
by inventor : g x_m2 = x[_n-2]
|
30 |
+
by inventor : g x_m3 = x[_n-3]
|
31 |
+
by inventor : g x_m4 = x[_n-4]
|
32 |
+
by inventor : g x_m5 = x[_n-5]
|
33 |
+
by inventor : g x_p1 = x[_n+1]
|
34 |
+
by inventor : g x_p2 = x[_n+2]
|
35 |
+
by inventor : g x_p3 = x[_n+3]
|
36 |
+
by inventor : g x_p4 = x[_n+4]
|
37 |
+
by inventor : g x_p5 = x[_n+5]
|
38 |
+
|
39 |
+
|
40 |
+
drop if year ==.
|
41 |
+
drop if zd ==.
|
42 |
+
drop if bea ==.
|
43 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
********************************************************************
|
48 |
+
********************************************************************
|
49 |
+
********************************************************************
|
50 |
+
********************************************************************
|
51 |
+
********************************************************************
|
52 |
+
********************************************************************
|
53 |
+
|
54 |
+
* NUMBER OF PATENTS IN A YEAR
|
55 |
+
g y = log(number)
|
56 |
+
|
57 |
+
* CITATIONS
|
58 |
+
* To avoid dropping the 0's, I add 0.00001
|
59 |
+
g y2 = log(citations+0.00001)
|
60 |
+
g y3 = log( (citations+0.00001) / number)
|
61 |
+
|
62 |
+
* SPECIALIZATION
|
63 |
+
*g y4 = 1-general
|
64 |
+
|
65 |
+
* NUMBER OF FIRMS
|
66 |
+
g x3 = log(Den_bea_zdB)
|
67 |
+
|
68 |
+
|
69 |
+
***********************
|
70 |
+
***********************
|
71 |
+
* STAR INVENTORS
|
72 |
+
* top 10% = 3.25
|
73 |
+
***********************
|
74 |
+
***********************
|
75 |
+
keep if total >=3.25
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
********************************************************************
|
80 |
+
********************************************************************
|
81 |
+
********************************************************************
|
82 |
+
* NEW VARIABLES
|
83 |
+
********************************************************************
|
84 |
+
********************************************************************
|
85 |
+
********************************************************************
|
86 |
+
egen cluster1 = group(bea zd)
|
87 |
+
egen cluster0 = group(bea zd year)
|
88 |
+
egen cluster2 = group(bea )
|
89 |
+
egen cluster_bea_year = group(bea year)
|
90 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
91 |
+
egen cluster_bea_class_year = group(bea class year)
|
92 |
+
egen cluster_zd_year = group(zd year)
|
93 |
+
egen cluster_bea_class = group(bea class)
|
94 |
+
egen cluster_class_year = group(class year)
|
95 |
+
egen org_new = group(org_id)
|
96 |
+
egen cluster_org_year = group(org_new year)
|
97 |
+
egen org_size = count(inventor), by(org_new year)
|
98 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
99 |
+
|
100 |
+
|
101 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
102 |
+
summ y y2 y3 x
|
103 |
+
summ number, detail
|
104 |
+
summ x Den_bea_zd , detail
|
105 |
+
tab zd
|
106 |
+
|
107 |
+
|
108 |
+
save $main/data2/tmp10, replace
|
109 |
+
|
110 |
+
********************************************************************
|
111 |
+
********************************************************************
|
112 |
+
********************************************************************
|
113 |
+
* NON LINEARITIES
|
114 |
+
********************************************************************
|
115 |
+
********************************************************************
|
116 |
+
********************************************************************
|
117 |
+
g x_sq = x*x
|
118 |
+
g x_cu = x*x*x
|
119 |
+
reghdfe y x x_sq x_cu, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
120 |
+
|
121 |
+
test x_sq = x_cu = 0
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
********************************************************************
|
126 |
+
********************************************************************
|
127 |
+
********************************************************************
|
128 |
+
* CROSS-FIELD SPILLOVERS
|
129 |
+
********************************************************************
|
130 |
+
********************************************************************
|
131 |
+
********************************************************************
|
132 |
+
sort bea year
|
133 |
+
merge m:1 bea year using $main/data2/density14_3_reshaped
|
134 |
+
drop _merge
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
* Average cluster size in other fields in the same city
|
139 |
+
******************
|
140 |
+
|
141 |
+
egen x_other_fields1 = rowmean(density2 density3 density4 density5) if zd ==1
|
142 |
+
egen x_other_fields2 = rowmean(density1 density3 density4 density5) if zd ==2
|
143 |
+
egen x_other_fields3 = rowmean(density1 density2 density4 density5) if zd ==3
|
144 |
+
egen x_other_fields4 = rowmean(density1 density2 density3 density5) if zd ==4
|
145 |
+
egen x_other_fields5 = rowmean(density1 density2 density3 density4) if zd ==5
|
146 |
+
g x_other_fields = x_other_fields1 if zd ==1
|
147 |
+
replace x_other_fields = x_other_fields2 if zd ==2
|
148 |
+
replace x_other_fields = x_other_fields3 if zd ==3
|
149 |
+
replace x_other_fields = x_other_fields4 if zd ==4
|
150 |
+
replace x_other_fields = x_other_fields5 if zd ==5
|
151 |
+
|
152 |
+
* Logs
|
153 |
+
replace x_other_fields = log(x_other_fields)
|
154 |
+
replace density1 = log(density1)
|
155 |
+
replace density2 = log(density2)
|
156 |
+
replace density3 = log(density3)
|
157 |
+
replace density4 = log(density4)
|
158 |
+
replace density5 = log(density5)
|
159 |
+
|
160 |
+
* Correlations
|
161 |
+
reg x_other_fields x
|
162 |
+
|
163 |
+
reghdfe x_other_fields x, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
164 |
+
|
165 |
+
* Cross-field spillovers -- All fields together
|
166 |
+
eststo: reghdfe y x x_other_fields, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
167 |
+
|
168 |
+
* Cross-field spillovers -- 5 X 5 matrix
|
169 |
+
* Note: I need to drop bea*year effects due to multicollinearity
|
170 |
+
|
171 |
+
eststo: reghdfe y density1 density2 density3 density4 density5 if zd ==1, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
172 |
+
|
173 |
+
eststo: reghdfe y density1 density2 density3 density4 density5 if zd ==2, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
174 |
+
|
175 |
+
eststo: reghdfe y density1 density2 density3 density4 density5 if zd ==3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
176 |
+
|
177 |
+
eststo: reghdfe y density1 density2 density3 density4 density5 if zd ==4, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
178 |
+
|
179 |
+
eststo: reghdfe y density1 density2 density3 density4 density5 if zd==5, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
180 |
+
|
181 |
+
esttab using tables20/table3.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
182 |
+
esttab using tables20/table3, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
183 |
+
eststo clear
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
*****************************************
|
188 |
+
**********************************************
|
189 |
+
* MEASURES OF CLUSTER SIZE THAT PUT MORE WEIGHT ON BETTER INVENTORS
|
190 |
+
**********************************************
|
191 |
+
**********************************************
|
192 |
+
sort inventor year
|
193 |
+
merge m:1 inventor year using $main/data2/density14_W
|
194 |
+
tab _merge
|
195 |
+
drop _merge
|
196 |
+
|
197 |
+
|
198 |
+
* WEIGHT INVENTORS BASED ON NUMBER OF PATENTS OR CITATIONS
|
199 |
+
g x6 = log(Den_bea_zd_WW4)
|
200 |
+
|
201 |
+
eststo: reghdfe y x6, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
202 |
+
|
203 |
+
* COUNT INVENTORS WITH NUMBER OF PATENTS ABOVE A CERTAIN THRESHOLD
|
204 |
+
drop x6
|
205 |
+
g x6 = log(Den_bea_zd_WW1 )
|
206 |
+
|
207 |
+
eststo: reghdfe y x6, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
208 |
+
|
209 |
+
|
210 |
+
* WEIGHT INVENTORS BASED ON NUMBER OF PATENTS
|
211 |
+
drop x6
|
212 |
+
g x6 = log(Den_bea_zd_W4)
|
213 |
+
|
214 |
+
eststo: reghdfe y x6, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
215 |
+
|
216 |
+
* COUNT INVENTORS WITH NUMBER OF CITATIONS ABOVE A CERTAIN THRESHOLD
|
217 |
+
drop x6
|
218 |
+
g x6 = log(Den_bea_zd_W1 )
|
219 |
+
|
220 |
+
eststo: reghdfe y x6, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
********************************************************************
|
225 |
+
********************************************************************
|
226 |
+
********************************************************************
|
227 |
+
* TEAMS
|
228 |
+
********************************************************************
|
229 |
+
********************************************************************
|
230 |
+
********************************************************************
|
231 |
+
summ team team2, detail
|
232 |
+
|
233 |
+
* Control for quadratic in team size
|
234 |
+
drop x6
|
235 |
+
g x6 = x
|
236 |
+
g team_sq = team*team
|
237 |
+
eststo: reghdfe y x6 team team_sq, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
238 |
+
|
239 |
+
|
240 |
+
* Density is measured excluding all members of the team
|
241 |
+
sort inventor year
|
242 |
+
merge m:1 inventor_id year using $main/data2/density_team
|
243 |
+
drop _merge
|
244 |
+
drop x6
|
245 |
+
g x6 = log(density14_team)
|
246 |
+
|
247 |
+
eststo: reghdfe y x6, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
* Interact x with indicator for large team size
|
252 |
+
g cc = (team >=2)
|
253 |
+
g x_cc = x*cc
|
254 |
+
eststo: reghdfe y x6 x_cc cc , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
255 |
+
|
256 |
+
|
257 |
+
* Solo inventors -- Interactions
|
258 |
+
* Team2 is the share of patents that an inventor created alone in a given year
|
259 |
+
g jj = (team2 >=.9)
|
260 |
+
g x_team2 = x*(team2 >=.9)
|
261 |
+
drop x6
|
262 |
+
g x6 =x
|
263 |
+
eststo: reghdfe y x6 x_team2 jj, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
264 |
+
|
265 |
+
|
266 |
+
esttab using tables20/table87.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
267 |
+
esttab using tables20/table87, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
268 |
+
eststo clear
|
269 |
+
|
270 |
+
|
271 |
+
********************************************************************
|
272 |
+
********************************************************************
|
273 |
+
********************************************************************
|
274 |
+
* ADDITIONAL SPECIFICATIONS
|
275 |
+
********************************************************************
|
276 |
+
********************************************************************
|
277 |
+
********************************************************************
|
278 |
+
|
279 |
+
**********************************************
|
280 |
+
* Density defined at city level
|
281 |
+
* std errors are clustered by city
|
282 |
+
* I need to drop city*year effects
|
283 |
+
g xx = log(Den_bea )
|
284 |
+
eststo: reghdfe y xx , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new) vce(cluster cluster2) keepsin
|
285 |
+
|
286 |
+
|
287 |
+
**********************************************
|
288 |
+
* std errors are clustered by city in main model
|
289 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster2) keepsin
|
290 |
+
|
291 |
+
|
292 |
+
|
293 |
+
*************************************************************
|
294 |
+
* Lifecycle controls
|
295 |
+
sort inventor year
|
296 |
+
by inventor: g ttt = _n
|
297 |
+
g first_year = year if ttt ==1
|
298 |
+
egen first_year2 = min(first_year), by(inventor)
|
299 |
+
g age = year - first_year2
|
300 |
+
summ year ttt first*
|
301 |
+
drop ttt first_*
|
302 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new age ) vce(cluster cluster1) keepsin
|
303 |
+
|
304 |
+
|
305 |
+
esttab using tables20/table7.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
306 |
+
esttab using tables20/table7, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
307 |
+
eststo clear
|
308 |
+
|
309 |
+
|
310 |
+
|
311 |
+
********************************************************
|
312 |
+
****************************************************
|
313 |
+
************************************************
|
314 |
+
* Field Specific coefficients (REF 1)
|
315 |
+
* need to drop city*year effects
|
316 |
+
************************************************
|
317 |
+
****************************************************
|
318 |
+
*******************************************************
|
319 |
+
* Comp
|
320 |
+
eststo: reghdfe y x if zd ==2, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
321 |
+
* Bio
|
322 |
+
eststo: reghdfe y x if zd ==1, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
323 |
+
* Semi
|
324 |
+
eststo: reghdfe y x if zd ==5, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
325 |
+
* Other eng
|
326 |
+
eststo: reghdfe y x if zd ==3, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
327 |
+
* Other Sci
|
328 |
+
eststo: reghdfe y x if zd ==4, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor org_new ) vce(cluster cluster1) keepsin
|
329 |
+
|
330 |
+
esttab using tables20/table8.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
331 |
+
esttab using tables20/table8, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
332 |
+
eststo clear
|
333 |
+
|
334 |
+
|
335 |
+
*************************************************************
|
336 |
+
*************************************************************
|
337 |
+
*************************************************************
|
338 |
+
* Heterogeneity of the effect by firm productivity
|
339 |
+
*************************************************************
|
340 |
+
*************************************************************
|
341 |
+
*************************************************************
|
342 |
+
egen firm_output = mean(y), by(org_new zd)
|
343 |
+
|
344 |
+
summ firm_output , detail
|
345 |
+
egen pctile25 = pctile(firm_output) if y~=., p(25) by(zd )
|
346 |
+
egen pctile50 = pctile(firm_output) if y~=., p(50) by(zd )
|
347 |
+
egen pctile75 = pctile(firm_output) if y~=., p(75) by(zd )
|
348 |
+
g dd1 = 0 if firm_output ~=.
|
349 |
+
g dd2 = 0 if firm_output ~=.
|
350 |
+
g dd3 = 0 if firm_output ~=.
|
351 |
+
g dd4 = 0 if firm_output ~=.
|
352 |
+
replace dd1 =1 if firm_output <= pctile25 & firm_output ~=.
|
353 |
+
replace dd2 =1 if firm_output > pctile25 & firm_output <= pctile50 & firm_output ~=.
|
354 |
+
replace dd3 =1 if firm_output > pctile50 & firm_output <= pctile75 & firm_output ~=.
|
355 |
+
replace dd4 =1 if firm_output > pctile75 & firm_output ~=.
|
356 |
+
summ dd1 dd2 dd3 dd4
|
357 |
+
|
358 |
+
g x_dd1 = x*dd1
|
359 |
+
g x_dd2 = x*dd2
|
360 |
+
g x_dd3 = x*dd3
|
361 |
+
g x_dd4 = x*dd4
|
362 |
+
|
363 |
+
|
364 |
+
|
365 |
+
eststo: reghdfe y x_dd1 x_dd2 x_dd3 x_dd4 dd1 dd2 dd3 dd4, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year ) vce(cluster cluster1) keepsin
|
366 |
+
|
367 |
+
test x_dd1 =x_dd2 =x_dd3 =x_dd4
|
368 |
+
|
369 |
+
eststo: reghdfe y x_dd1 x_dd2 x_dd3 x_dd4 dd1 dd2 dd3 dd4, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new) vce(cluster cluster1) keepsin
|
370 |
+
|
371 |
+
test x_dd1 =x_dd2 =x_dd3 =x_dd4
|
372 |
+
|
373 |
+
|
374 |
+
esttab using tables20/table2.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
375 |
+
esttab using tables20/table2, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
376 |
+
eststo clear
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
*************************************************************
|
381 |
+
*************************************************************
|
382 |
+
*************************************************************
|
383 |
+
* QUALITY: LOCAL CITATIONS RECEIVED
|
384 |
+
*************************************************************
|
385 |
+
*************************************************************
|
386 |
+
*************************************************************
|
387 |
+
clear
|
388 |
+
u $main/data2/tmp10
|
389 |
+
merge 1:1 inventor year using $main/data2/citations_received
|
390 |
+
drop _merge
|
391 |
+
|
392 |
+
* Number of citations received by an inventor in a given year that are from same bea
|
393 |
+
summ same_bea
|
394 |
+
g y2_local = log( (citations*same_bea)+0.00001)
|
395 |
+
g y3_local = log(( (citations*same_bea) +0.00001) / number)
|
396 |
+
* Number of citations received by an inventor in a given year that are from different bea
|
397 |
+
g y2_nolocal = log( (citations*(1-same_bea))+0.00001)
|
398 |
+
g y3_nolocal = log(( (citations*(1-same_bea)) +0.00001) / number)
|
399 |
+
|
400 |
+
|
401 |
+
* Local
|
402 |
+
g YY = y2_local
|
403 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
404 |
+
|
405 |
+
* No Local
|
406 |
+
drop YY
|
407 |
+
g YY = y2_nolocal
|
408 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
409 |
+
|
410 |
+
esttab using tables20/table6.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
411 |
+
esttab using tables20/table6, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
412 |
+
eststo clear
|
413 |
+
|
414 |
+
* Local
|
415 |
+
drop YY
|
416 |
+
g YY = y3_local
|
417 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
418 |
+
|
419 |
+
* No local
|
420 |
+
drop YY
|
421 |
+
g YY = y3_nolocal
|
422 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
423 |
+
|
424 |
+
esttab using tables20/table7.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
425 |
+
esttab using tables20/table7, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
426 |
+
eststo clear
|
427 |
+
|
428 |
+
|
429 |
+
|
430 |
+
*************************************************************
|
431 |
+
*************************************************************
|
432 |
+
*************************************************************
|
433 |
+
* QUALITY: GENERALITY AND ORIGINALITY
|
434 |
+
*************************************************************
|
435 |
+
*************************************************************
|
436 |
+
*************************************************************
|
437 |
+
summ general original
|
438 |
+
drop YY
|
439 |
+
g YY = general
|
440 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
441 |
+
|
442 |
+
drop YY
|
443 |
+
g YY = original
|
444 |
+
eststo: reghdfe YY x , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
445 |
+
|
446 |
+
|
447 |
+
eststo clear
|
448 |
+
|
449 |
+
|
450 |
+
|
451 |
+
*************************************************************
|
452 |
+
*************************************************************
|
453 |
+
*************************************************************
|
454 |
+
* LOCAL CITATIONS MADE
|
455 |
+
*************************************************************
|
456 |
+
*************************************************************
|
457 |
+
*************************************************************
|
458 |
+
* identify stars
|
459 |
+
clear
|
460 |
+
u $main/data2/tmp10
|
461 |
+
g star =1
|
462 |
+
collapse star, by(inventor_id)
|
463 |
+
sort inventor_id
|
464 |
+
save $main/data2/stars, replace
|
465 |
+
|
466 |
+
|
467 |
+
clear
|
468 |
+
u $main/data2/citations_made
|
469 |
+
sort inventor_id
|
470 |
+
merge m:1 inventor_id using $main/data2/stars
|
471 |
+
|
472 |
+
|
473 |
+
* Descriptive means:
|
474 |
+
g diff_zd = 1-same_zd
|
475 |
+
summ same_bea same_zd diff_zd same_bea_zd same_bea_diff_zd if star ==1
|
476 |
+
summ same_bea same_zd diff_zd same_bea_zd same_bea_diff_zd if star ~=1
|
477 |
+
clear
|
478 |
+
|
479 |
+
|
480 |
+
* Effect of cluster size on citations, local citations, share of local citations
|
481 |
+
u $main/data2/tmp10
|
482 |
+
sort inventor_id year
|
483 |
+
merge 1:1 inventor_id year using $main/data2/citations_made
|
484 |
+
|
485 |
+
keep if x ~=.
|
486 |
+
summ x, detail
|
487 |
+
g N_same_bea = log(citations_made*same_bea )
|
488 |
+
g log_citations_made = log(citations_made)
|
489 |
+
|
490 |
+
g N_same_bea2 = log(citations_made*same_bea + 0.001)
|
491 |
+
g log_citations_made2 = log(citations_made + 0.001)
|
492 |
+
|
493 |
+
|
494 |
+
summ citations_made
|
495 |
+
g vv = citations_made*same_bea
|
496 |
+
summ vv
|
497 |
+
g vvv = citations_made*same_zd
|
498 |
+
summ vvv
|
499 |
+
|
500 |
+
|
501 |
+
|
502 |
+
summ log_citations_made
|
503 |
+
summ log_citations_made2
|
504 |
+
|
505 |
+
summ N_same_bea
|
506 |
+
summ N_same_bea2
|
507 |
+
|
508 |
+
summ same_bea
|
509 |
+
summ same_zd
|
510 |
+
|
511 |
+
|
512 |
+
g YY = log_citations_made
|
513 |
+
eststo: reghdfe YY x, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
514 |
+
|
515 |
+
drop YY
|
516 |
+
g YY = log(citations_made/number)
|
517 |
+
eststo: reghdfe YY x, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
518 |
+
|
519 |
+
|
520 |
+
drop YY
|
521 |
+
g YY =same_bea
|
522 |
+
eststo: reghdfe YY x, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
523 |
+
|
524 |
+
|
525 |
+
drop YY
|
526 |
+
g YY = same_zd
|
527 |
+
eststo: reghdfe YY x, absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
528 |
+
|
529 |
+
|
530 |
+
|
531 |
+
esttab using tables20/table72.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
532 |
+
esttab using tables20/table72, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
533 |
+
eststo clear
|
534 |
+
|
535 |
+
|
536 |
+
**********************************************
|
537 |
+
* I estimate baseline model on inventors who tend to cite patents in same field
|
538 |
+
* same_zd is a share, not a dummy
|
539 |
+
summ same_zd, detail
|
540 |
+
g bb = (same_zd>=.9)
|
541 |
+
g x_bb = x*bb
|
542 |
+
eststo: reghdfe y x x_bb bb , absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1) keepsin
|
543 |
+
|
544 |
+
|
545 |
+
|
546 |
+
|
547 |
+
|
548 |
+
***************************************
|
549 |
+
* SUMMARY STATISTICS
|
550 |
+
****************************************
|
551 |
+
clear
|
552 |
+
* patent level data
|
553 |
+
u $main/data2/data_patent_level_3
|
554 |
+
sort inventor_id
|
555 |
+
merge m:1 inventor_id using $main/data2/stars
|
556 |
+
tab _merge
|
557 |
+
drop _merge
|
558 |
+
replace star = 0 if star ==.
|
559 |
+
|
560 |
+
* tag one obs in each patent-city combination
|
561 |
+
sort patent_id bea
|
562 |
+
by patent_id bea: g hhh = _n
|
563 |
+
g h2 = 1 if hhh ==1
|
564 |
+
|
565 |
+
preserve
|
566 |
+
collapse star citations general original (count) team_size = inventor_id (sum) n_star = star n_bea = h2, by(patent_id)
|
567 |
+
summ
|
568 |
+
|
569 |
+
* team size
|
570 |
+
summ team_size if n_star >=1
|
571 |
+
summ team_size if n_star ==1
|
572 |
+
summ team_size if n_star ==0
|
573 |
+
|
574 |
+
* share of stars in a team
|
575 |
+
sum star
|
576 |
+
* number of stars in a team
|
577 |
+
sum n_star
|
578 |
+
|
579 |
+
* number of cities in the team
|
580 |
+
summ n_bea if n_star >=1
|
581 |
+
summ n_bea if n_star ==0
|
582 |
+
|
583 |
+
* number and type of citations
|
584 |
+
summ citations if n_star >=1
|
585 |
+
summ citations if n_star ==0
|
586 |
+
summ general if n_star >=1
|
587 |
+
summ general if n_star ==0
|
588 |
+
summ original if n_star >=1
|
589 |
+
summ original if n_star ==0
|
590 |
+
|
591 |
+
|
592 |
+
********************************
|
593 |
+
* number of fields an by inventor
|
594 |
+
restore
|
595 |
+
sort inventor_id zd2
|
596 |
+
by inventor_id zd2: g first = _n
|
597 |
+
keep if first ==1
|
598 |
+
|
599 |
+
collapse (count) zd2, by(inventor_id star)
|
600 |
+
summ zd2 if star ==1
|
601 |
+
summ zd2 if star ==0
|
602 |
+
|
603 |
+
|
604 |
+
|
605 |
+
|
107/replication_package/AER_UPLOADED/reg22.do
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
* KODAK -- MATCHING
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
u $main/data2/data_3
|
12 |
+
|
13 |
+
replace bea =. if inter_bea ==1
|
14 |
+
replace zd =. if inter_zd ==1
|
15 |
+
replace class =. if inter_class ==1
|
16 |
+
replace bea =. if inter_bea2 ==1
|
17 |
+
replace zd =. if inter_zd2 ==1
|
18 |
+
replace class =. if inter_class2==1
|
19 |
+
|
20 |
+
|
21 |
+
g y = log(number)
|
22 |
+
g x = log(Den_bea_zd )
|
23 |
+
|
24 |
+
egen cluster1 = group(bea zd)
|
25 |
+
egen cluster_bea_year = group(bea year)
|
26 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
27 |
+
egen cluster_class_year = group(bea class year)
|
28 |
+
egen cluster_zd_year = group(zd year)
|
29 |
+
egen cluster_bea_class = group(bea class)
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
******************************************************************************
|
34 |
+
* SAMPLE
|
35 |
+
* I KEEP ONLY NON-KODAK INVENTORS
|
36 |
+
* I KEEP ONLY 96 and 07
|
37 |
+
******************************************************************************
|
38 |
+
g kodak = 1 if org_id =="FI_1757"
|
39 |
+
g xerox = 1 if org_id =="FI_6225"
|
40 |
+
|
41 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
42 |
+
*keep if kodak ~=1
|
43 |
+
drop if class ==396 | class ==399
|
44 |
+
keep if year ==1996 | year ==2007
|
45 |
+
|
46 |
+
keep if kodak ~=1
|
47 |
+
|
48 |
+
|
49 |
+
* DUMMIES
|
50 |
+
****************
|
51 |
+
* rochester dummy
|
52 |
+
g roch = 0
|
53 |
+
replace roch = 1 if bea ==139
|
54 |
+
|
55 |
+
* dummy for 2007
|
56 |
+
g after = 0 if year ==1996
|
57 |
+
replace after = 1 if year ==2007
|
58 |
+
|
59 |
+
* Rochester * 2007
|
60 |
+
g roch_after = roch*after
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
* Compute population distribution in bea-level data
|
66 |
+
preserve
|
67 |
+
clear
|
68 |
+
u $main/data/read
|
69 |
+
sum
|
70 |
+
g roch = 0
|
71 |
+
replace roch = 1 if bea ==139
|
72 |
+
summ pop if roch ==1
|
73 |
+
summ pop if roch ~=1, detail
|
74 |
+
clear
|
75 |
+
|
76 |
+
|
77 |
+
* Add Population and other covariates
|
78 |
+
restore
|
79 |
+
sort bea
|
80 |
+
merge m:1 bea using $main/data/read
|
81 |
+
drop _merge
|
82 |
+
|
83 |
+
|
84 |
+
* Mean productvity and field distribution in 1996, by city
|
85 |
+
preserve
|
86 |
+
keep if year ==1996
|
87 |
+
g y_bea = y
|
88 |
+
g D1 = (zd2==1)
|
89 |
+
g D2 = (zd2==2)
|
90 |
+
g D3 = (zd2==3)
|
91 |
+
g D4 = (zd2==4)
|
92 |
+
g D5 = (zd2==5)
|
93 |
+
|
94 |
+
collapse y_bea D1 D2 D3 D4 D5, by(bea_code)
|
95 |
+
|
96 |
+
|
97 |
+
summ y_bea if bea ==139, detail
|
98 |
+
summ y_bea if bea ~=139, detail
|
99 |
+
sort bea
|
100 |
+
save tables22/bea_data, replace
|
101 |
+
clear
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
**************************************************************
|
106 |
+
**************************************************************
|
107 |
+
**************************************************************
|
108 |
+
**************************************************************
|
109 |
+
* VERSION 1: WEIGHT
|
110 |
+
**************************************************************
|
111 |
+
**************************************************************
|
112 |
+
**************************************************************
|
113 |
+
**************************************************************
|
114 |
+
restore
|
115 |
+
merge m:1 bea_code using $main/tables22/bea_data
|
116 |
+
drop _merge
|
117 |
+
save tmp22, replace
|
118 |
+
|
119 |
+
|
120 |
+
summ D1-D5 if roch ==1 & year ==1996
|
121 |
+
|
122 |
+
* D1 D3 and D4 are the 3 largest fields in Roshester in 1996
|
123 |
+
logit roch medfaminc90 trade90 agr90 const9 manuf90 nonwhite90 pop emp D1 D3 D4 y_bea if year == 1996
|
124 |
+
|
125 |
+
predict predicted
|
126 |
+
summ year predicted
|
127 |
+
g WW = 1/predicted if roch ==1
|
128 |
+
replace WW = 1/(1-predicted) if roch ==0
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
*****************
|
133 |
+
* CROSS-SECIONAL
|
134 |
+
*****************
|
135 |
+
g cluster3 = bea
|
136 |
+
preserve
|
137 |
+
eststo: reg y roch_after after roch [weight = WW], cluster(cluster3)
|
138 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(zd) cluster(cluster3) keepsin
|
139 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(cluster_zd_year) cluster(cluster3) keepsin
|
140 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
141 |
+
|
142 |
+
esttab using tables22/table2.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
143 |
+
esttab using tables22/table2, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
144 |
+
eststo clear
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
|
149 |
+
***************************
|
150 |
+
* 2SLS
|
151 |
+
***************************
|
152 |
+
* First stage Effect on cluster size
|
153 |
+
eststo: reg x roch_after after roch [weight = WW], cluster(cluster3)
|
154 |
+
test roch_after ==0
|
155 |
+
eststo: reghdfe x roch_after after roch [weight = WW], absorb(zd) cluster(cluster3) keepsin
|
156 |
+
test roch_after ==0
|
157 |
+
eststo: reghdfe x roch_after after roch [weight = WW], absorb(cluster_zd_year) cluster(cluster3) keepsin
|
158 |
+
test roch_after ==0
|
159 |
+
eststo: reghdfe x roch_after after roch [weight = WW], absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
160 |
+
test roch_after ==0
|
161 |
+
esttab using tables22/table5.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
162 |
+
esttab using tables22/table5, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
163 |
+
eststo clear
|
164 |
+
|
165 |
+
* IV
|
166 |
+
eststo: ivreg y (x =roch_after) after roch [weight = WW], cluster(cluster3)
|
167 |
+
eststo: ivreghdfe y (x =roch_after) after roch [weight = WW], absorb(zd ) cluster(cluster3)
|
168 |
+
eststo: ivreghdfe y (x =roch_after) after roch [weight = WW], absorb(cluster_zd_year ) cluster(cluster3)
|
169 |
+
eststo: ivreghdfe y (x =roch_after) after roch [weight = WW], absorb(cluster1 cluster_zd_year) cluster(cluster3)
|
170 |
+
|
171 |
+
|
172 |
+
esttab using tables22/table6.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
173 |
+
esttab using tables22/table6, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
174 |
+
eststo clear
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
****************************************
|
180 |
+
* WITHIN INVENTOR DIFFERENCES
|
181 |
+
*****************************************
|
182 |
+
restore
|
183 |
+
egen zzz = count(y), by(inventor)
|
184 |
+
tab zzz
|
185 |
+
keep if zzz ==2
|
186 |
+
drop zzz
|
187 |
+
preserve
|
188 |
+
|
189 |
+
|
190 |
+
* New rochester dummy for rochester status in 1996
|
191 |
+
* Note: if in Rochester in 1996, this dummy stays =1 both in 1996 and 2007
|
192 |
+
drop roch roch_after
|
193 |
+
g tmp6 = 0
|
194 |
+
replace tmp6 = 1 if bea ==139 & year == 1996
|
195 |
+
egen roch = max(tmp6), by(inventor)
|
196 |
+
g roch_after = roch*after
|
197 |
+
|
198 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor) cluster(cluster3) keepsin
|
199 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor zd) cluster(cluster3) keepsin
|
200 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
201 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
202 |
+
|
203 |
+
esttab using tables22/table3.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
204 |
+
esttab using tables22/table3, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
205 |
+
eststo clear
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
* New rochester dummy for rochester status in 1996 and 2007
|
210 |
+
* Note: it is =1 only of inventor is in rochester both in 1996 and 2007
|
211 |
+
clear
|
212 |
+
restore
|
213 |
+
drop roch roch_after
|
214 |
+
|
215 |
+
g tmp6 = 1 if bea ==139 & year == 1996
|
216 |
+
g tmp7 = 1 if bea ==139 & year == 2007
|
217 |
+
egen tmp8 = max(tmp6), by(inventor)
|
218 |
+
egen tmp9 = max(tmp7), by(inventor)
|
219 |
+
g roch = 0
|
220 |
+
replace roch = 1 if tmp8 ==1 & tmp9 ==1
|
221 |
+
g roch_after = roch*after
|
222 |
+
drop tmp*
|
223 |
+
|
224 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor) cluster(cluster3) keepsin
|
225 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor zd) cluster(cluster3) keepsin
|
226 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
227 |
+
eststo: reghdfe y roch_after after roch [weight = WW], absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
228 |
+
|
229 |
+
esttab using tables22/table4.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
230 |
+
esttab using tables22/table4, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
231 |
+
eststo clear
|
232 |
+
|
233 |
+
|
234 |
+
**************************************************************
|
235 |
+
**************************************************************
|
236 |
+
**************************************************************
|
237 |
+
**************************************************************
|
238 |
+
* VERSION 2: I DROP CITIES THAT ARE DIFFERENT FROM ROCHESTER
|
239 |
+
* BASED ON INITIAL CHARACERISTICS
|
240 |
+
**************************************************************
|
241 |
+
**************************************************************
|
242 |
+
**************************************************************
|
243 |
+
**************************************************************
|
244 |
+
clear
|
245 |
+
u tmp22
|
246 |
+
keep if pop >=580511
|
247 |
+
keep if medfaminc90 >= 27397
|
248 |
+
keep if y_bea >= -.77 & y_bea <= -.57
|
249 |
+
keep if D3 >= .40
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
|
254 |
+
*****************
|
255 |
+
* CROSS-SECIONAL
|
256 |
+
*****************
|
257 |
+
g cluster3 = bea
|
258 |
+
eststo: reg y roch_after after roch, cluster(cluster3)
|
259 |
+
eststo: reghdfe y roch_after after roch, absorb(zd) cluster(cluster3) keepsin
|
260 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster_zd_year) cluster(cluster3) keepsin
|
261 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
262 |
+
|
263 |
+
esttab using tables22/table2b.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
264 |
+
esttab using tables22/table2b, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
265 |
+
eststo clear
|
266 |
+
|
267 |
+
|
268 |
+
|
269 |
+
|
270 |
+
****************************************
|
271 |
+
* WITHIN INVENTOR
|
272 |
+
*****************************************
|
273 |
+
egen zzz = count(y), by(inventor)
|
274 |
+
tab zzz
|
275 |
+
keep if zzz ==2
|
276 |
+
drop zzz
|
277 |
+
preserve
|
278 |
+
|
279 |
+
* New rochester dummy for rochester status in 1996
|
280 |
+
* Note: if in Rochester in 1996, this dummy stays =1 both in 1996 and 2007
|
281 |
+
drop roch roch_after
|
282 |
+
g tmp6 = 0
|
283 |
+
replace tmp6 = 1 if bea ==139 & year == 1996
|
284 |
+
egen roch = max(tmp6), by(inventor)
|
285 |
+
g roch_after = roch*after
|
286 |
+
|
287 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor) cluster(cluster3) keepsin
|
288 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor zd) cluster(cluster3) keepsin
|
289 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
290 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
291 |
+
|
292 |
+
esttab using tables22/table3b.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
293 |
+
esttab using tables22/table3b, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
294 |
+
eststo clear
|
295 |
+
|
296 |
+
|
297 |
+
* New rochester dummy for rochester status in 1996 and 2007
|
298 |
+
* Note: it is =1 only of inventor is in rochester both in 1996 and 2007
|
299 |
+
clear
|
300 |
+
restore
|
301 |
+
preserve
|
302 |
+
drop roch roch_after
|
303 |
+
|
304 |
+
g tmp6 = 1 if bea ==139 & year == 1996
|
305 |
+
g tmp7 = 1 if bea ==139 & year == 2007
|
306 |
+
egen tmp8 = max(tmp6), by(inventor)
|
307 |
+
egen tmp9 = max(tmp7), by(inventor)
|
308 |
+
g roch = 0
|
309 |
+
replace roch = 1 if tmp8 ==1 & tmp9 ==1
|
310 |
+
g roch_after = roch*after
|
311 |
+
drop tmp*
|
312 |
+
|
313 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor) cluster(cluster3) keepsin
|
314 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor zd) cluster(cluster3) keepsin
|
315 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
316 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
317 |
+
|
318 |
+
esttab using tables22/table4b.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
319 |
+
esttab using tables22/table4b, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
320 |
+
eststo clear
|
321 |
+
|
322 |
+
|
323 |
+
|
324 |
+
rm tmp22.dta
|
325 |
+
restore
|
326 |
+
|
327 |
+
|
328 |
+
|
329 |
+
|
330 |
+
|
107/replication_package/AER_UPLOADED/reg23.do
ADDED
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* MOVERS - LEADS AND LAGS
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
|
9 |
+
********************************************************************
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
* READ DATA
|
13 |
+
********************************************************************
|
14 |
+
********************************************************************
|
15 |
+
********************************************************************
|
16 |
+
clear
|
17 |
+
u $main/data2/data_3
|
18 |
+
|
19 |
+
egen total = sum(number), by(inventor)
|
20 |
+
|
21 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
22 |
+
replace bea =. if inter_bea ==1
|
23 |
+
replace zd =. if inter_zd ==1
|
24 |
+
replace class =. if inter_class ==1
|
25 |
+
replace bea =. if inter_bea2 ==1
|
26 |
+
replace zd =. if inter_zd2 ==1
|
27 |
+
replace class =. if inter_class2==1
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
* CLUSTER SIZE
|
32 |
+
g x = log(Den_bea_zd )
|
33 |
+
sort inventor year
|
34 |
+
by inventor : g x_m1 = x[_n-1]
|
35 |
+
by inventor : g x_m2 = x[_n-2]
|
36 |
+
by inventor : g x_m3 = x[_n-3]
|
37 |
+
by inventor : g x_m4 = x[_n-4]
|
38 |
+
by inventor : g x_m5 = x[_n-5]
|
39 |
+
by inventor : g x_p1 = x[_n+1]
|
40 |
+
by inventor : g x_p2 = x[_n+2]
|
41 |
+
by inventor : g x_p3 = x[_n+3]
|
42 |
+
by inventor : g x_p4 = x[_n+4]
|
43 |
+
by inventor : g x_p5 = x[_n+5]
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
drop if year ==.
|
48 |
+
drop if zd ==.
|
49 |
+
drop if bea ==.
|
50 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
********************************************************************
|
55 |
+
********************************************************************
|
56 |
+
********************************************************************
|
57 |
+
********************************************************************
|
58 |
+
********************************************************************
|
59 |
+
********************************************************************
|
60 |
+
|
61 |
+
* NUMBER OF PATENTS IN A YEAR
|
62 |
+
g y = log(number)
|
63 |
+
|
64 |
+
* CITATIONS
|
65 |
+
* To avoid dropping the 0's, I add 0.00001
|
66 |
+
g y2 = log(citations+0.00001)
|
67 |
+
g y3 = log( (citations+0.00001) / number)
|
68 |
+
|
69 |
+
* SPECIALIZATION
|
70 |
+
*g y4 = 1-general
|
71 |
+
|
72 |
+
* NUMBER OF FIRMS
|
73 |
+
g x3 = log(Den_bea_zdB)
|
74 |
+
|
75 |
+
|
76 |
+
***********************
|
77 |
+
***********************
|
78 |
+
* DEFINE STAR INVENTORS
|
79 |
+
***********************
|
80 |
+
***********************
|
81 |
+
keep if total >=3.25
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
********************************************************************
|
86 |
+
********************************************************************
|
87 |
+
********************************************************************
|
88 |
+
* NEW VARIABLES
|
89 |
+
********************************************************************
|
90 |
+
********************************************************************
|
91 |
+
********************************************************************
|
92 |
+
egen cluster1 = group(bea zd)
|
93 |
+
egen cluster0 = group(bea zd year)
|
94 |
+
egen cluster2 = group(bea )
|
95 |
+
egen cluster_bea_year = group(bea year)
|
96 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
97 |
+
egen cluster_bea_class_year = group(bea class year)
|
98 |
+
egen cluster_zd_year = group(zd year)
|
99 |
+
egen cluster_bea_class = group(bea class)
|
100 |
+
egen cluster_class_year = group(class year)
|
101 |
+
egen org_new = group(org_id)
|
102 |
+
egen cluster_org_year = group(org_new year)
|
103 |
+
egen org_size = count(inventor), by(org_new year)
|
104 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
********************************************************************
|
109 |
+
********************************************************************
|
110 |
+
********************************************************************
|
111 |
+
* REGRESSIONS
|
112 |
+
********************************************************************
|
113 |
+
********************************************************************
|
114 |
+
********************************************************************
|
115 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
116 |
+
summ y y2 y3 x
|
117 |
+
summ number, detail
|
118 |
+
summ x Den_bea_zd , detail
|
119 |
+
tab zd
|
120 |
+
|
121 |
+
|
122 |
+
************************************************************************
|
123 |
+
************************************************************************
|
124 |
+
|
125 |
+
preserve
|
126 |
+
|
127 |
+
* Mover dummy
|
128 |
+
rename bea_code bea
|
129 |
+
sort inventor year
|
130 |
+
by inventor : g bea_m1 = bea[_n-1]
|
131 |
+
by inventor : g year_m1 = year[_n-1]
|
132 |
+
g move = 0
|
133 |
+
replace move = 1 if bea ~= bea_m1 & bea ~=. & bea_m1 ~=.
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
* Indicator for cases where an inventor is in a different city relative
|
138 |
+
* to last year she was observed, and last year observed is more than 1 year ago
|
139 |
+
* In these case, the exact time of the move in unknown
|
140 |
+
g dyear = year - year_m1
|
141 |
+
g large_gap = 1 if move ==1 & dyear >1
|
142 |
+
* Assign this dummy to all years when an inventor is observed
|
143 |
+
egen gapp = max(large_gap), by(inventor)
|
144 |
+
drop large_gap dyear
|
145 |
+
|
146 |
+
g move_year = year if move ==1
|
147 |
+
* Total number of moves by inventor
|
148 |
+
egen nn1 = total(move), by(inventor)
|
149 |
+
|
150 |
+
|
151 |
+
* move_year1 is year of first observed move
|
152 |
+
* It is defined only for those who move once
|
153 |
+
egen move_year1 = min(move_year), by(inventor)
|
154 |
+
*drop move_year
|
155 |
+
replace move_year1 = . if nn>1
|
156 |
+
* Time since move
|
157 |
+
g tt = year - move_year1
|
158 |
+
|
159 |
+
* Keep only movers, when time of the move is exactly identified
|
160 |
+
* For coding simplicity, I keep those who move once
|
161 |
+
keep if nn1 ==1
|
162 |
+
drop if gapp ==1
|
163 |
+
|
164 |
+
|
165 |
+
* Mean x in the 5 years before the move and the five years after the move
|
166 |
+
egen tmp_mm = mean(x) if tt >= -5 & tt <=-1, by(inventor)
|
167 |
+
egen tmp_pp = mean(x) if tt >= 1 & tt <= 5, by(inventor)
|
168 |
+
|
169 |
+
* tmp_mm and tmp_pp are constants, but they are defined only in the 5 years
|
170 |
+
* before the move and the 5 years after the move, repsctively. To run the regression,
|
171 |
+
* I assign tmp_mm and tmp_pp to an entire inventor life so that they are not missing
|
172 |
+
egen tmp_m = max(tmp_mm), by(inventor)
|
173 |
+
egen tmp_p = max(tmp_pp), by(inventor)
|
174 |
+
drop tmp_pp tmp_mm
|
175 |
+
|
176 |
+
|
177 |
+
* Now I interact the average x in the years before and after the move with
|
178 |
+
* indicators for numbeer of years since the move
|
179 |
+
g m1 = (tt==-1)
|
180 |
+
g m2 = (tt==-2)
|
181 |
+
g m3 = (tt==-3)
|
182 |
+
g m4 = (tt==-4)
|
183 |
+
g m5 = (tt==-5)
|
184 |
+
|
185 |
+
g p1 = (tt==1)
|
186 |
+
g p2 = (tt==2)
|
187 |
+
g p3 = (tt==3)
|
188 |
+
g p4 = (tt==4)
|
189 |
+
g p5 = (tt==5)
|
190 |
+
|
191 |
+
drop x_p* x_m*
|
192 |
+
g x_m1 = tmp_m*m1
|
193 |
+
g x_m2 = tmp_m*m2
|
194 |
+
g x_m3 = tmp_m*m3
|
195 |
+
g x_m4 = tmp_m*m4
|
196 |
+
g x_m5 = tmp_m*m5
|
197 |
+
g x_p1 = tmp_p*p1
|
198 |
+
g x_p2 = tmp_p*p2
|
199 |
+
g x_p3 = tmp_p*p3
|
200 |
+
g x_p4 = tmp_p*p4
|
201 |
+
g x_p5 = tmp_p*p5
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
* Regression
|
208 |
+
eststo: reghdfe y x_p5 x_p4 x_p3 x_p2 x_p1 x x_m1 x_m2 x_m3 x_m4 x_m5 ,absorb(year bea zd class cluster1 cluster_bea_class cluster_zd_year cluster_class_year inventor cluster_bea_year org_new ) vce(cluster cluster1)
|
209 |
+
eststo clear
|
210 |
+
|
211 |
+
g b1 = _b[x_p5]
|
212 |
+
g b2 = _b[x_p4]
|
213 |
+
g b3 = _b[x_p3]
|
214 |
+
g b4 = _b[x_p2]
|
215 |
+
g b5 = _b[x_p1]
|
216 |
+
g b6 = _b[x]
|
217 |
+
g b7 = _b[x_m1]
|
218 |
+
g b8 = _b[x_m2]
|
219 |
+
g b9 = _b[x_m3]
|
220 |
+
g b10= _b[x_m4]
|
221 |
+
g b11= _b[x_m5]
|
222 |
+
g se1 =_se[x_p5]
|
223 |
+
g se2 =_se[x_p4]
|
224 |
+
g se3 =_se[x_p3]
|
225 |
+
g se4 =_se[x_p2]
|
226 |
+
g se5 =_se[x_p1]
|
227 |
+
g se6 =_se[x]
|
228 |
+
g se7 =_se[x_m1]
|
229 |
+
g se8 =_se[x_m2]
|
230 |
+
g se9 =_se[x_m3]
|
231 |
+
g se10 =_se[x_m4]
|
232 |
+
g se11 =_se[x_m5]
|
233 |
+
|
234 |
+
|
235 |
+
lincom x_p5
|
236 |
+
g bb1 = r(estimate)
|
237 |
+
g sse1 = r(se)
|
238 |
+
lincom x_p5 + x_p4
|
239 |
+
g bb2 = r(estimate)
|
240 |
+
g sse2 = r(se)
|
241 |
+
lincom x_p5 + x_p4 + x_p3
|
242 |
+
g bb3 = r(estimate)
|
243 |
+
g sse3 = r(se)
|
244 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2
|
245 |
+
g bb4 = r(estimate)
|
246 |
+
g sse4 = r(se)
|
247 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1
|
248 |
+
g bb5 = r(estimate)
|
249 |
+
g sse5 = r(se)
|
250 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x
|
251 |
+
g bb6 = r(estimate)
|
252 |
+
g sse6 = r(se)
|
253 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1
|
254 |
+
g bb7 = r(estimate)
|
255 |
+
g sse7 = r(se)
|
256 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2
|
257 |
+
g bb8 = r(estimate)
|
258 |
+
g sse8 = r(se)
|
259 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3
|
260 |
+
g bb9 = r(estimate)
|
261 |
+
g sse9 = r(se)
|
262 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4
|
263 |
+
g bb10 = r(estimate)
|
264 |
+
g sse10 = r(se)
|
265 |
+
lincom x_p5 + x_p4 + x_p3 + x_p2 + x_p1 + x + x_m1 + x_m2 + x_m3 + x_m4 + x_m5
|
266 |
+
g bb11 = r(estimate)
|
267 |
+
g sse11 = r(se)
|
268 |
+
|
269 |
+
keep if _n==1
|
270 |
+
keep b1-b11 se1-se11 bb* sse*
|
271 |
+
save $main/data2/beta1_move, replace
|
272 |
+
|
273 |
+
|
274 |
+
clear
|
275 |
+
u $main/data2/beta1_move
|
276 |
+
g n=_n
|
277 |
+
reshape long b se bb sse, i(n) j(j)
|
278 |
+
g t = j-6
|
279 |
+
g upper = b + 1.96*se
|
280 |
+
g lower = b - 1.96*se
|
281 |
+
|
282 |
+
|
283 |
+
line b upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) xlabel(-5 "{&beta}{sub:5}" -4 "{&beta}{sub:4}" -3 "{&beta}{sub:3}" -2 "{&beta}{sub:2}" -1 "{&beta}{sub:1}" 0 "{&beta}{sub:0}" 1 "{&beta}{sub:-1}" 2 "{&beta}{sub:-2}" 3 "{&beta}{sub:-3}" 4 "{&beta}{sub:-4}" 5 "{&beta}{sub:-5}" ) saving(fig1_m,replace)
|
284 |
+
graph export fig1_m.pdf, replace
|
285 |
+
! mv -f beta1_move.dta tables23/
|
286 |
+
! mv -f fig1_m.pdf tables23/
|
287 |
+
! mv -f fig1_m.gph tables23/
|
288 |
+
|
289 |
+
drop upper lower
|
290 |
+
g upper = bb + 1.96*sse
|
291 |
+
g lower = bb - 1.96*sse
|
292 |
+
|
293 |
+
|
294 |
+
|
295 |
+
line bb upper lower t , legend(off) lpattern(solid dot dot) lcolor(black black black) yscale(range(-0.2 0.8)) ylabel(-0.2 0 0.2 0.4 0.6 0.8) xlabel(-5 "{&mu}{sub:5}" -4 "{&mu}{sub:4}" -3 "{&mu}{sub:3}" -2 "{&mu}{sub:2}" -1 "{&mu}{sub:1}" 0 "{&mu}{sub:0}" 1 "{&mu}{sub:-1}" 2 "{&mu}{sub:-2}" 3 "{&mu}{sub:-3}" 4 "{&mu}{sub:-4}" 5 "{&mu}{sub:-5}" ) saving(fig1b_m,replace)
|
296 |
+
graph export fig1b_m.pdf, replace
|
297 |
+
! mv -f fig1b_m.pdf tables23/
|
298 |
+
! mv -f fig1b_m.gph tables23/
|
299 |
+
|
300 |
+
|
301 |
+
|
302 |
+
restore
|
303 |
+
|
304 |
+
|
107/replication_package/AER_UPLOADED/reg27.do
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
* KODAK - IO TABLES
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
u $main/data/read1
|
11 |
+
summ
|
12 |
+
summ value, detail
|
13 |
+
rename class zd2
|
14 |
+
sort zd
|
15 |
+
save $main/data2/tmp27, replace
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
********************************************************
|
21 |
+
*****************************************
|
22 |
+
*****************************************
|
23 |
+
* PRODUCTIVITY
|
24 |
+
*****************************************
|
25 |
+
*****************************************
|
26 |
+
********************************************************
|
27 |
+
clear
|
28 |
+
u $main/data2/data_3
|
29 |
+
merge m:1 zd using $main/data2/tmp27
|
30 |
+
tab _merge
|
31 |
+
summ year zd value
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
replace bea =. if inter_bea ==1
|
36 |
+
replace zd =. if inter_zd ==1
|
37 |
+
replace class =. if inter_class ==1
|
38 |
+
replace bea =. if inter_bea2 ==1
|
39 |
+
replace zd =. if inter_zd2 ==1
|
40 |
+
replace class =. if inter_class2==1
|
41 |
+
|
42 |
+
|
43 |
+
g y = log(number)
|
44 |
+
g x = log(Den_bea_zd )
|
45 |
+
|
46 |
+
egen cluster1 = group(bea zd)
|
47 |
+
egen cluster_bea_year = group(bea year)
|
48 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
49 |
+
egen cluster_class_year = group(bea class year)
|
50 |
+
egen cluster_zd_year = group(zd year)
|
51 |
+
egen cluster_bea_class = group(bea class)
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
******************************************************************************
|
56 |
+
* SAMPLE
|
57 |
+
* I KEEP ONLY NON-KODAK INVENTORS
|
58 |
+
* I KEEP ONLY 96 and 07
|
59 |
+
******************************************************************************
|
60 |
+
g kodak = 1 if org_id =="FI_1757"
|
61 |
+
g xerox = 1 if org_id =="FI_6225"
|
62 |
+
|
63 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
64 |
+
keep if kodak ~=1
|
65 |
+
drop if class ==396 | class ==399
|
66 |
+
keep if year ==1996 | year ==2007
|
67 |
+
|
68 |
+
* DUMMIES
|
69 |
+
****************
|
70 |
+
* rochester dummy
|
71 |
+
g roch = 0
|
72 |
+
replace roch = 1 if bea ==139
|
73 |
+
|
74 |
+
* dummy for 2007
|
75 |
+
g after = 0 if year ==1996
|
76 |
+
replace after = 1 if year ==2007
|
77 |
+
|
78 |
+
* Rochester * 2007
|
79 |
+
g roch_after = roch*after
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
*****************
|
84 |
+
* CROSS-SECIONAL
|
85 |
+
* DIFF IN DIFF
|
86 |
+
*****************
|
87 |
+
summ value, detail
|
88 |
+
drop if value >0
|
89 |
+
|
90 |
+
g cluster3 = bea
|
91 |
+
preserve
|
92 |
+
eststo: reg y roch_after after roch, cluster(cluster3)
|
93 |
+
eststo: reghdfe y roch_after after roch, absorb(zd) cluster(cluster3) keepsin
|
94 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster_zd_year) cluster(cluster3) keepsin
|
95 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
96 |
+
* drop Xerox inventors
|
97 |
+
eststo: reghdfe y roch_after after roch if xerox ~=1, absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
**********************************************
|
103 |
+
****************************************
|
104 |
+
* WITHIN INVENTOR DIFFERENCES
|
105 |
+
* I ONLY KEEP INVENTORS OBSERVED IN 1996 and 2007
|
106 |
+
*****************************************
|
107 |
+
**********************************************
|
108 |
+
restore
|
109 |
+
egen zzz = count(y), by(inventor)
|
110 |
+
tab zzz
|
111 |
+
keep if zzz ==2
|
112 |
+
drop zzz
|
113 |
+
preserve
|
114 |
+
|
115 |
+
|
116 |
+
* New rochester dummy for rochester status in 1996
|
117 |
+
* Note: if in Rochester in 1996, this dummy stays =1 both in 1996 and 2007
|
118 |
+
drop roch roch_after
|
119 |
+
g tmp6 = 0
|
120 |
+
replace tmp6 = 1 if bea ==139 & year == 1996
|
121 |
+
egen roch = max(tmp6), by(inventor)
|
122 |
+
g roch_after = roch*after
|
123 |
+
|
124 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor) cluster(cluster3) keepsin
|
125 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor zd) cluster(cluster3) keepsin
|
126 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
127 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
128 |
+
|
129 |
+
|
130 |
+
restore
|
131 |
+
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
+
|
107/replication_package/AER_UPLOADED/reg29.do
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
* COUNTERFACTUAL WITH CURVATURE
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
************************************
|
12 |
+
***********************************
|
13 |
+
* PRODUCTIVITY
|
14 |
+
************************************
|
15 |
+
***********************************
|
16 |
+
clear
|
17 |
+
u $main/data2/data_3
|
18 |
+
egen total = sum(number), by(inventor)
|
19 |
+
|
20 |
+
* INCLUDE THE FOLLOWING 5 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
21 |
+
replace bea =. if inter_bea ==1
|
22 |
+
replace zd =. if inter_zd ==1
|
23 |
+
replace class =. if inter_class ==1
|
24 |
+
replace bea =. if inter_bea2 ==1
|
25 |
+
replace zd =. if inter_zd2 ==1
|
26 |
+
replace class =. if inter_class2==1
|
27 |
+
|
28 |
+
********************************************************************
|
29 |
+
********************************************************************
|
30 |
+
********************************************************************
|
31 |
+
********************************************************************
|
32 |
+
********************************************************************
|
33 |
+
********************************************************************
|
34 |
+
|
35 |
+
************************
|
36 |
+
************************
|
37 |
+
* DEFINE Y
|
38 |
+
***********************
|
39 |
+
***********************
|
40 |
+
* NUMBER OF PATENTS IN A YEAR
|
41 |
+
g y = log(number)
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
***********************
|
46 |
+
***********************
|
47 |
+
* DEFINE X
|
48 |
+
***********************
|
49 |
+
***********************
|
50 |
+
* NUMBER OF SCIENTISTS
|
51 |
+
*g x = Den_bea_zd
|
52 |
+
*g x2 = Den_bea_class
|
53 |
+
g x = log(Den_bea_zd )
|
54 |
+
*g x2 = log(Den_bea_class )
|
55 |
+
|
56 |
+
* NUMBER OF FIRMS
|
57 |
+
*g x = Den_bea_zdB
|
58 |
+
*g x2 = Den_bea_classB
|
59 |
+
|
60 |
+
|
61 |
+
***********************
|
62 |
+
***********************
|
63 |
+
* DEFINE STAR INVENTORS
|
64 |
+
***********************
|
65 |
+
***********************
|
66 |
+
keep if total >=3.25
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
*******************************************************************
|
71 |
+
********************************************************************
|
72 |
+
|
73 |
+
* THESE ARE THE 4 GROUPS USED IN THE ANALYSIS
|
74 |
+
* OF HETEROEGENITY BY CLUSTER SIZE
|
75 |
+
summ x, detail
|
76 |
+
egen pctile25 = pctile(x), p(25) by(zd2 year)
|
77 |
+
egen pctile50 = pctile(x), p(50) by(zd2 year)
|
78 |
+
egen pctile75 = pctile(x), p(75) by(zd2 year)
|
79 |
+
g dd1 = 0
|
80 |
+
g dd2 = 0
|
81 |
+
g dd3 = 0
|
82 |
+
g dd4 = 0
|
83 |
+
replace dd1 =1 if x <= pctile25
|
84 |
+
replace dd2 =1 if x > pctile25 & x <= pctile50
|
85 |
+
replace dd3 =1 if x > pctile50 & x <= pctile75
|
86 |
+
replace dd4 =1 if x > pctile75
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
*******************************************************************
|
93 |
+
********************************************************************
|
94 |
+
*******************************
|
95 |
+
* COLLAPSE AND MERGE WITH DENSITY DATA THAT HAVE EVERY
|
96 |
+
* COMBINATION OF CITY-ZD-YEAR
|
97 |
+
*
|
98 |
+
* DATA HAVE ALL COMBINATION OF CITY-ZD-YEAR
|
99 |
+
* I ADD 0's. THIS WAY I DO NOT DROP CELLS WITH NO PATENTS
|
100 |
+
*
|
101 |
+
*******************************
|
102 |
+
*******************************
|
103 |
+
*******************************************************************
|
104 |
+
********************************************************************
|
105 |
+
* COLLAPSE
|
106 |
+
sort year bea_code zd2
|
107 |
+
collapse y x numbe dd1 dd2 dd3 dd4, by(year bea_co zd2)
|
108 |
+
summ
|
109 |
+
|
110 |
+
tab dd1
|
111 |
+
tab dd2
|
112 |
+
tab dd3
|
113 |
+
tab dd4
|
114 |
+
save tmp, replace
|
115 |
+
|
116 |
+
* Merge with all combinations of bea_code zd2 year
|
117 |
+
clear
|
118 |
+
u tables2/data
|
119 |
+
sort bea_code zd2 year
|
120 |
+
merge 1:1 bea_code zd2 year using tmp
|
121 |
+
drop _merge
|
122 |
+
! rm tmp.dta
|
123 |
+
rename density14 Den_bea_zd
|
124 |
+
rename density14B Den_bea_zdB
|
125 |
+
|
126 |
+
|
127 |
+
*egen minx = min(x)
|
128 |
+
*egen miny = min(y)
|
129 |
+
* I add the 0's
|
130 |
+
replace number = 0 if number ==.
|
131 |
+
*replace x = 0.00001 if x ==.
|
132 |
+
*drop minx miny
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
+
*******************************************************************
|
137 |
+
********************************************************************
|
138 |
+
*******************************
|
139 |
+
* COUNTERFACTUALS
|
140 |
+
*******************************
|
141 |
+
*******************************************************************
|
142 |
+
********************************************************************
|
143 |
+
drop _fillin Den_bea_zdB
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
* These are eintries in the table on heterogenety by cluster size
|
148 |
+
g alpha = 0.0685 if dd1 ==1
|
149 |
+
replace alpha = 0.0743 if dd2 ==1
|
150 |
+
replace alpha = 0.0720 if dd3 ==1
|
151 |
+
replace alpha = 0.0776 if dd4 ==1
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
* PERCENTILES
|
157 |
+
egen tmp95 = pctile(Den_bea_zd), p(95) by(year zd2)
|
158 |
+
egen tmp90 = pctile(Den_bea_zd), p(90) by(year zd2)
|
159 |
+
egen tmp75 = pctile(Den_bea_zd), p(75) by(year zd2)
|
160 |
+
egen tmp50 = pctile(Den_bea_zd), p(50) by(year zd2)
|
161 |
+
egen tmp25 = pctile(Den_bea_zd), p(25) by(year zd2)
|
162 |
+
|
163 |
+
|
164 |
+
* This is the counterfactual cluster size.
|
165 |
+
* I need to do the mean, so that the total
|
166 |
+
* number of scientsis in the US in teh
|
167 |
+
* counterfactual is = to observed number
|
168 |
+
* I can't do median because it would change it
|
169 |
+
egen mean = mean(Den_bea_zd), by(year zd2)
|
170 |
+
|
171 |
+
|
172 |
+
* A log log model implies that the agglomeration effect in absolute amount of patents is cluster size to alpha
|
173 |
+
* DD is estimated change in inventor productivity, measured in number of patents (not percent)
|
174 |
+
g DD = (mean^alpha) - (Den_bea_zd^alpha)
|
175 |
+
* This is the percent change
|
176 |
+
g DDD = (mean^alpha - Den_bea_zd^alpha)*100/(Den_bea_zd^alpha)
|
177 |
+
|
178 |
+
summ DDD if Den_bea_zd <=tmp25 & Den_bea_zd ~=.
|
179 |
+
summ DDD if Den_bea_zd >tmp25 & Den_bea_zd <= tmp50 & Den_bea_zd ~=.
|
180 |
+
summ DDD if Den_bea_zd >tmp50 & Den_bea_zd <= tmp75 & Den_bea_zd ~=.
|
181 |
+
summ DDD if Den_bea_zd >tmp75 & Den_bea_zd <= tmp90 & Den_bea_zd ~=.
|
182 |
+
summ DDD if Den_bea_zd >tmp90 & Den_bea_zd <= tmp95 & Den_bea_zd ~=.
|
183 |
+
summ DDD if Den_bea_zd >tmp95 & Den_bea_zd ~=.
|
184 |
+
drop tmp*
|
185 |
+
|
186 |
+
|
187 |
+
gsort year -Den_bea_zd
|
188 |
+
*outfile bea_name DDD if year ==2007 & zd_name == "Semiconductors" using tables2/table3b.txt, replace
|
189 |
+
*outsheet bea_name DDD if year ==2007 & zd_name == "Semiconductors" using tables2/table3b.csv, replace comma
|
190 |
+
*outfile bea_name DDD if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table3c.txt, replace
|
191 |
+
*outsheet bea_name DDD if year ==2007 & zd_name == "Biology and Chemestry" using tables2/table3c.csv, replace comma
|
192 |
+
*outfile bea_name DDD if year ==2007 & zd_name == "Computer Science" using tables2/table3d.txt, replace
|
193 |
+
*outsheet bea_name DDD if year ==2007 & zd_name == "Computer Science" using tables2/table3d.csv, replace comma
|
194 |
+
|
195 |
+
|
196 |
+
* Change
|
197 |
+
g ZZ = Den_bea_zd*DD
|
198 |
+
g ZZZ = Den_bea_zd*(Den_bea_zd^alpha)
|
199 |
+
preserve
|
200 |
+
collapse (sum) ZZ ZZZ, by(year zd_name)
|
201 |
+
|
202 |
+
* Aggregate effect by field
|
203 |
+
* XXX TABLE 12 col 2
|
204 |
+
g change = ZZ / ZZZ
|
205 |
+
list zd change if year ==2007
|
206 |
+
|
207 |
+
|
208 |
+
* Aggregate effect -- All fields
|
209 |
+
* XXX TABLE 12 col 2
|
210 |
+
restore
|
211 |
+
collapse (sum) ZZ ZZZ, by(year)
|
212 |
+
g change = ZZ / ZZZ
|
213 |
+
list change if year ==2007
|
214 |
+
|
215 |
+
|
107/replication_package/AER_UPLOADED/reg3.do
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
********************************************************************
|
5 |
+
* KODAK
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
*******************************************************
|
12 |
+
*****************************************
|
13 |
+
*****************************************
|
14 |
+
* GRAPHS: KODAK INVENTORS IN ROCHESTER
|
15 |
+
*****************************************
|
16 |
+
*****************************************
|
17 |
+
*******************************************************
|
18 |
+
* Number of inventors in Kodak in Rochester
|
19 |
+
u $main/data2/data_patent_level_3
|
20 |
+
g kodak = 0
|
21 |
+
replace kodak = 1 if org_id =="FI_1757"
|
22 |
+
keep if kodak ==1 & bea_code ==139
|
23 |
+
sort inventor_id year
|
24 |
+
by inventor_id year : g d1 = 1 if _n ==1
|
25 |
+
egen count = count(d1), by(year)
|
26 |
+
g kodak_tot = count
|
27 |
+
|
28 |
+
collapse kodak_tot, by(year)
|
29 |
+
|
30 |
+
keep if year >=1990
|
31 |
+
line kodak_tot year, ytitle("") xtitle("")
|
32 |
+
graph export fig1.pdf, replace
|
33 |
+
! mv -f fig1.pdf tables3/
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
* Total number of inventors in Rochester
|
38 |
+
clear
|
39 |
+
u $main/data2/data_patent_level_3
|
40 |
+
keep if bea_code ==139
|
41 |
+
sort inventor_id year
|
42 |
+
by inventor_id year : g d1 = 1 if _n ==1
|
43 |
+
egen count = count(d1), by(year)
|
44 |
+
g rochester_tot = count
|
45 |
+
collapse rochester_tot, by(year)
|
46 |
+
keep if year >=1990
|
47 |
+
list if year ==1996 | year ==2007
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
********************************************************
|
52 |
+
*********************************************
|
53 |
+
****************************************
|
54 |
+
* LIST OF PATENTING COMPANIES IN ROCHESTER
|
55 |
+
*****************************************
|
56 |
+
*********************************************
|
57 |
+
********************************************************
|
58 |
+
* Top patenters in Rochester outside Kodaak and Xerox in 1996
|
59 |
+
clear
|
60 |
+
u $main/data2/organizations_3
|
61 |
+
keep if bea ==139 & year == 1996
|
62 |
+
drop if org_id =="FI_1757" | org_id =="FI_6225"
|
63 |
+
gsort -org_N
|
64 |
+
list org_norm org_N if org_N >10
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
********************************************************
|
69 |
+
*****************************************
|
70 |
+
*****************************************
|
71 |
+
* PRODUCTIVITY
|
72 |
+
*****************************************
|
73 |
+
*****************************************
|
74 |
+
********************************************************
|
75 |
+
clear
|
76 |
+
u $main/data2/data_3
|
77 |
+
|
78 |
+
replace bea =. if inter_bea ==1
|
79 |
+
replace zd =. if inter_zd ==1
|
80 |
+
replace class =. if inter_class ==1
|
81 |
+
replace bea =. if inter_bea2 ==1
|
82 |
+
replace zd =. if inter_zd2 ==1
|
83 |
+
replace class =. if inter_class2==1
|
84 |
+
|
85 |
+
|
86 |
+
g y = log(number)
|
87 |
+
g x = log(Den_bea_zd )
|
88 |
+
|
89 |
+
egen cluster1 = group(bea zd)
|
90 |
+
egen cluster_bea_year = group(bea year)
|
91 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
92 |
+
egen cluster_class_year = group(bea class year)
|
93 |
+
egen cluster_zd_year = group(zd year)
|
94 |
+
egen cluster_bea_class = group(bea class)
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
******************************************************************************
|
99 |
+
* SAMPLE
|
100 |
+
* I KEEP ONLY NON-KODAK INVENTORS
|
101 |
+
* I KEEP ONLY 96 and 07
|
102 |
+
******************************************************************************
|
103 |
+
g kodak = 1 if org_id =="FI_1757"
|
104 |
+
g xerox = 1 if org_id =="FI_6225"
|
105 |
+
|
106 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
107 |
+
keep if kodak ~=1
|
108 |
+
drop if class ==396 | class ==399
|
109 |
+
keep if year ==1996 | year ==2007
|
110 |
+
|
111 |
+
* DUMMIES
|
112 |
+
****************
|
113 |
+
* rochester dummy
|
114 |
+
g roch = 0
|
115 |
+
replace roch = 1 if bea ==139
|
116 |
+
|
117 |
+
* dummy for 2007
|
118 |
+
g after = 0 if year ==1996
|
119 |
+
replace after = 1 if year ==2007
|
120 |
+
|
121 |
+
* Rochester * 2007
|
122 |
+
g roch_after = roch*after
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
*****************
|
127 |
+
* CROSS-SECIONAL
|
128 |
+
* DIFF IN DIFF
|
129 |
+
*****************
|
130 |
+
g cluster3 = bea
|
131 |
+
preserve
|
132 |
+
eststo: reg y roch_after after roch, cluster(cluster3)
|
133 |
+
eststo: reghdfe y roch_after after roch, absorb(zd) cluster(cluster3) keepsin
|
134 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster_zd_year) cluster(cluster3) keepsin
|
135 |
+
eststo: reghdfe y roch_after after roch, absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
136 |
+
|
137 |
+
esttab using tables3/table2.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
138 |
+
esttab using tables3/table2, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
139 |
+
eststo clear
|
140 |
+
|
141 |
+
|
142 |
+
|
143 |
+
***************************
|
144 |
+
* 2SLS
|
145 |
+
***************************
|
146 |
+
* First stage Effect on cluster size
|
147 |
+
eststo: reg x roch_after after roch, cluster(cluster3)
|
148 |
+
test roch_after ==0
|
149 |
+
eststo: reghdfe x roch_after after roch, absorb(zd) cluster(cluster3) keepsin
|
150 |
+
test roch_after ==0
|
151 |
+
eststo: reghdfe x roch_after after roch, absorb(cluster_zd_year) cluster(cluster3) keepsin
|
152 |
+
test roch_after ==0
|
153 |
+
eststo: reghdfe x roch_after after roch, absorb(cluster1 cluster_zd_year) cluster(cluster3) keepsin
|
154 |
+
test roch_after ==0
|
155 |
+
esttab using tables3/table5.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
156 |
+
esttab using tables3/table5, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
157 |
+
eststo clear
|
158 |
+
|
159 |
+
* IV
|
160 |
+
eststo: ivreg y (x =roch_after) after roch, cluster(cluster3)
|
161 |
+
eststo: ivreghdfe y (x =roch_after) after roch, absorb(zd ) cluster(cluster3)
|
162 |
+
eststo: ivreghdfe y (x =roch_after) after roch, absorb(cluster_zd_year ) cluster(cluster3)
|
163 |
+
eststo: ivreghdfe y (x =roch_after) after roch, absorb(cluster1 cluster_zd_year) cluster(cluster3)
|
164 |
+
esttab using tables3/table6.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
165 |
+
esttab using tables3/table6, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
166 |
+
eststo clear
|
167 |
+
|
168 |
+
|
169 |
+
**********************************************
|
170 |
+
****************************************
|
171 |
+
* WITHIN INVENTOR DIFFERENCES
|
172 |
+
* I ONLY KEEP INVENTORS OBSERVED IN 1996 and 2007
|
173 |
+
*****************************************
|
174 |
+
**********************************************
|
175 |
+
restore
|
176 |
+
egen zzz = count(y), by(inventor)
|
177 |
+
tab zzz
|
178 |
+
keep if zzz ==2
|
179 |
+
drop zzz
|
180 |
+
preserve
|
181 |
+
|
182 |
+
|
183 |
+
* New rochester dummy for rochester status in 1996
|
184 |
+
* Note: if in Rochester in 1996, this dummy stays =1 both in 1996 and 2007
|
185 |
+
drop roch roch_after
|
186 |
+
g tmp6 = 0
|
187 |
+
replace tmp6 = 1 if bea ==139 & year == 1996
|
188 |
+
egen roch = max(tmp6), by(inventor)
|
189 |
+
g roch_after = roch*after
|
190 |
+
|
191 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor) cluster(cluster3) keepsin
|
192 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor zd) cluster(cluster3) keepsin
|
193 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
194 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
195 |
+
|
196 |
+
esttab using tables3/table3.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
197 |
+
esttab using tables3/table3, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
198 |
+
eststo clear
|
199 |
+
|
200 |
+
|
201 |
+
* New rochester dummy for rochester status in 1996 and 2007
|
202 |
+
* Note: it is =1 only of inventor is in rochester both in 1996 and 2007
|
203 |
+
clear
|
204 |
+
restore
|
205 |
+
preserve
|
206 |
+
drop roch roch_after
|
207 |
+
|
208 |
+
g tmp6 = 1 if bea ==139 & year == 1996
|
209 |
+
g tmp7 = 1 if bea ==139 & year == 2007
|
210 |
+
egen tmp8 = max(tmp6), by(inventor)
|
211 |
+
egen tmp9 = max(tmp7), by(inventor)
|
212 |
+
g roch = 0
|
213 |
+
replace roch = 1 if tmp8 ==1 & tmp9 ==1
|
214 |
+
g roch_after = roch*after
|
215 |
+
drop tmp*
|
216 |
+
|
217 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor) cluster(cluster3) keepsin
|
218 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor zd) cluster(cluster3) keepsin
|
219 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year) cluster(cluster3) keepsin
|
220 |
+
eststo: reghdfe y roch_after after roch, absorb(inventor cluster_zd_year cluster1 ) cluster(cluster3) keepsin
|
221 |
+
|
222 |
+
esttab using tables3/table4.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
223 |
+
esttab using tables3/table4, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
224 |
+
eststo clear
|
225 |
+
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
******************************************************************************
|
230 |
+
******************************************************************************
|
231 |
+
* PRODUCTIVITY FIGURES
|
232 |
+
******************************************************************************
|
233 |
+
******************************************************************************
|
234 |
+
clear
|
235 |
+
u $main/data2/data_3
|
236 |
+
|
237 |
+
replace bea =. if inter_bea ==1
|
238 |
+
replace zd =. if inter_zd ==1
|
239 |
+
replace class =. if inter_class ==1
|
240 |
+
replace bea =. if inter_bea2 ==1
|
241 |
+
replace zd =. if inter_zd2 ==1
|
242 |
+
replace class =. if inter_class2==1
|
243 |
+
|
244 |
+
g y = log(number)
|
245 |
+
|
246 |
+
egen cluster1 = group(bea zd)
|
247 |
+
g kodak = 1 if org_id =="FI_1757"
|
248 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
249 |
+
keep if kodak ~=1
|
250 |
+
keep if bea_code ==139
|
251 |
+
|
252 |
+
|
253 |
+
* RESIDUALIZED PRODUCTIVITY
|
254 |
+
xi: areg y , absorb(class)
|
255 |
+
predict fit3, xbd
|
256 |
+
g e3 = y-fit3
|
257 |
+
|
258 |
+
collapse y e3 , by(year bea)
|
259 |
+
|
260 |
+
* FIGURES
|
261 |
+
line e3 year if year >=1990 & bea ==139, xline(1996) yscale(r(-.3 .1)) ylabel(-.3 -.2 -.1 0 .1) ytitle("") xtitle("")
|
262 |
+
graph export fig11.pdf, replace
|
263 |
+
! mv -f fig11.pdf tables3/
|
264 |
+
|
265 |
+
|
266 |
+
|
267 |
+
restore
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
+
|
107/replication_package/AER_UPLOADED/reg30.do
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* INTERPOLATION
|
5 |
+
* log(1+patents)
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
u $main/data2/data_3
|
12 |
+
egen total = sum(number), by(inventor)
|
13 |
+
|
14 |
+
|
15 |
+
* BY COMMENTING OUT THESE 6 LINES,
|
16 |
+
* I DO NOT DROP INTERPOLATED DATA
|
17 |
+
*replace bea =. if inter_bea ==1
|
18 |
+
*replace zd =. if inter_zd ==1
|
19 |
+
*replace class =. if inter_class ==1
|
20 |
+
*replace bea =. if inter_bea2 ==1
|
21 |
+
*replace zd =. if inter_zd2 ==1
|
22 |
+
*replace class =. if inter_class2==1
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
********************************************************************
|
27 |
+
********************************************************************
|
28 |
+
********************************************************************
|
29 |
+
* OPTIONS
|
30 |
+
********************************************************************
|
31 |
+
********************************************************************
|
32 |
+
********************************************************************
|
33 |
+
|
34 |
+
************************
|
35 |
+
************************
|
36 |
+
* DEFINE Y
|
37 |
+
***********************
|
38 |
+
***********************
|
39 |
+
* NUMBER OF PATENTS IN A YEAR
|
40 |
+
g y = log(number)
|
41 |
+
|
42 |
+
* CITATIONS
|
43 |
+
*g y2 = log(citations+00001)
|
44 |
+
g y2 = log(citations)
|
45 |
+
|
46 |
+
* SPECIALIZATION
|
47 |
+
*g y = 1-general
|
48 |
+
|
49 |
+
|
50 |
+
***********************
|
51 |
+
***********************
|
52 |
+
* DEFINE X
|
53 |
+
***********************
|
54 |
+
***********************
|
55 |
+
* NUMBER OF SCIENTISTS
|
56 |
+
*g x = Den_bea_zd
|
57 |
+
*g x2 = Den_bea_class
|
58 |
+
g x = log(Den_bea_zd )
|
59 |
+
g x2 = log(Den_bea_class )
|
60 |
+
|
61 |
+
* NUMBER OF FIRMS
|
62 |
+
*g x = Den_bea_zdB
|
63 |
+
*g x2 = Den_bea_classB
|
64 |
+
|
65 |
+
|
66 |
+
***********************
|
67 |
+
***********************
|
68 |
+
* DEFINE STAR INVENTORS
|
69 |
+
***********************
|
70 |
+
***********************
|
71 |
+
*keep if total >=3.25
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
********************************************************************
|
76 |
+
********************************************************************
|
77 |
+
********************************************************************
|
78 |
+
* NEW VARIABLES
|
79 |
+
********************************************************************
|
80 |
+
********************************************************************
|
81 |
+
********************************************************************
|
82 |
+
egen cluster1 = group(bea zd)
|
83 |
+
egen cluster0 = group(bea zd year)
|
84 |
+
egen cluster2 = group(bea )
|
85 |
+
egen cluster_bea_year = group(bea year)
|
86 |
+
egen cluster_bea_class = group(bea class)
|
87 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
88 |
+
egen cluster_bea_class_year = group(bea class year)
|
89 |
+
egen cluster_zd_year = group(zd year)
|
90 |
+
egen cluster_class_year = group(class year)
|
91 |
+
egen org_new = group(org_id)
|
92 |
+
egen cluster_org_year = group(org_new year)
|
93 |
+
egen org_size = count(inventor), by(org_new year)
|
94 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
95 |
+
|
96 |
+
sort inventor year
|
97 |
+
by inventor : g x_m1 = x[_n-1]
|
98 |
+
by inventor : g x_m2 = x[_n-2]
|
99 |
+
by inventor : g x_m3 = x[_n-3]
|
100 |
+
by inventor : g x_m4 = x[_n-4]
|
101 |
+
by inventor : g x_m5 = x[_n-5]
|
102 |
+
by inventor : g x_p1 = x[_n+1]
|
103 |
+
by inventor : g x_p2 = x[_n+2]
|
104 |
+
by inventor : g x_p3 = x[_n+3]
|
105 |
+
by inventor : g x_p4 = x[_n+4]
|
106 |
+
by inventor : g x_p5 = x[_n+5]
|
107 |
+
by inventor : g x2_m1 = x2[_n-1]
|
108 |
+
by inventor : g x2_m2 = x2[_n-2]
|
109 |
+
by inventor : g x2_m3 = x2[_n-3]
|
110 |
+
by inventor : g x2_m4 = x2[_n-4]
|
111 |
+
by inventor : g x2_m5 = x2[_n-5]
|
112 |
+
by inventor : g x2_p1 = x2[_n+1]
|
113 |
+
by inventor : g x2_p2 = x2[_n+2]
|
114 |
+
by inventor : g x2_p3 = x2[_n+3]
|
115 |
+
by inventor : g x2_p4 = x2[_n+4]
|
116 |
+
by inventor : g x2_p5 = x2[_n+5]
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
********************************************************************
|
124 |
+
********************************************************************
|
125 |
+
********************************************************************
|
126 |
+
* INTERPOLATED DATA
|
127 |
+
********************************************************************
|
128 |
+
********************************************************************
|
129 |
+
********************************************************************
|
130 |
+
|
131 |
+
* I ADD THE 0's IN INTERPOLATED YEARS
|
132 |
+
drop y
|
133 |
+
g y = log(number+1)
|
134 |
+
replace y = log(1) if inter_bea ==1 | inter_zd ==1 | inter_class ==1
|
135 |
+
replace y = log(1) if inter_bea2==1 | inter_zd2==1 | inter_class2==1
|
136 |
+
|
137 |
+
|
138 |
+
sort inventor year
|
139 |
+
by inventor: g inter_org = 1 if org_new ==. & org_new[_n-1] == org_new[_n+1] & org_new[_n-1] ~=.
|
140 |
+
by inventor: replace org_new = org_new[_n-1] if inter_org ==1
|
141 |
+
|
142 |
+
by inventor: g inter_org2 = 1 if org_new ==. & org_new[_n-1] ==. & org_new[_n-2] == org_new[_n+1] & org_new[_n-2] ~=.
|
143 |
+
by inventor: replace org_new = org_new[_n-2] if inter_org2 ==1
|
144 |
+
|
145 |
+
|
146 |
+
* This is the baseline. It shpould be equal to the main table with no interpolation
|
147 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea ==0 & inter_zd ==0 & inter_class==0 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org ~=1 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
148 |
+
|
149 |
+
* This regression uses interpolated data: 1 year
|
150 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
151 |
+
|
152 |
+
* This regression uses interpolated data: 2 year2
|
153 |
+
eststo: reghdfe y x if total >=3.25, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
154 |
+
|
155 |
+
esttab using tables30/table1.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
156 |
+
esttab using tables30/table1.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
157 |
+
eststo clear
|
158 |
+
|
159 |
+
|
160 |
+
|
161 |
+
|
107/replication_package/AER_UPLOADED/reg31.do
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* INTERPOLATION
|
5 |
+
* inverse hyperbolic sine
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
|
10 |
+
|
11 |
+
u $main/data2/data_3
|
12 |
+
egen total = sum(number), by(inventor)
|
13 |
+
|
14 |
+
|
15 |
+
* BY COMMENTING OUT THESE 6 LINES,
|
16 |
+
* I DO NOT DROP INTERPOLATED DATA
|
17 |
+
*replace bea =. if inter_bea ==1
|
18 |
+
*replace zd =. if inter_zd ==1
|
19 |
+
*replace class =. if inter_class ==1
|
20 |
+
*replace bea =. if inter_bea2 ==1
|
21 |
+
*replace zd =. if inter_zd2 ==1
|
22 |
+
*replace class =. if inter_class2==1
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
********************************************************************
|
27 |
+
********************************************************************
|
28 |
+
********************************************************************
|
29 |
+
* OPTIONS
|
30 |
+
********************************************************************
|
31 |
+
********************************************************************
|
32 |
+
********************************************************************
|
33 |
+
|
34 |
+
************************
|
35 |
+
************************
|
36 |
+
* DEFINE Y
|
37 |
+
***********************
|
38 |
+
***********************
|
39 |
+
* NUMBER OF PATENTS IN A YEAR
|
40 |
+
g y = log(number)
|
41 |
+
|
42 |
+
* CITATIONS
|
43 |
+
*g y2 = log(citations+00001)
|
44 |
+
g y2 = log(citations)
|
45 |
+
|
46 |
+
* SPECIALIZATION
|
47 |
+
*g y = 1-general
|
48 |
+
|
49 |
+
|
50 |
+
***********************
|
51 |
+
***********************
|
52 |
+
* DEFINE X
|
53 |
+
***********************
|
54 |
+
***********************
|
55 |
+
* NUMBER OF SCIENTISTS
|
56 |
+
*g x = Den_bea_zd
|
57 |
+
*g x2 = Den_bea_class
|
58 |
+
g x = log(Den_bea_zd )
|
59 |
+
g x2 = log(Den_bea_class )
|
60 |
+
|
61 |
+
* NUMBER OF FIRMS
|
62 |
+
*g x = Den_bea_zdB
|
63 |
+
*g x2 = Den_bea_classB
|
64 |
+
|
65 |
+
|
66 |
+
***********************
|
67 |
+
***********************
|
68 |
+
* DEFINE STAR INVENTORS
|
69 |
+
***********************
|
70 |
+
***********************
|
71 |
+
*keep if total >=3.25
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
********************************************************************
|
76 |
+
********************************************************************
|
77 |
+
********************************************************************
|
78 |
+
* NEW VARIABLES
|
79 |
+
********************************************************************
|
80 |
+
********************************************************************
|
81 |
+
********************************************************************
|
82 |
+
egen cluster1 = group(bea zd)
|
83 |
+
egen cluster0 = group(bea zd year)
|
84 |
+
egen cluster2 = group(bea )
|
85 |
+
egen cluster_bea_year = group(bea year)
|
86 |
+
egen cluster_bea_class = group(bea class)
|
87 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
88 |
+
egen cluster_bea_class_year = group(bea class year)
|
89 |
+
egen cluster_zd_year = group(zd year)
|
90 |
+
egen cluster_class_year = group(class year)
|
91 |
+
egen org_new = group(org_id)
|
92 |
+
egen cluster_org_year = group(org_new year)
|
93 |
+
egen org_size = count(inventor), by(org_new year)
|
94 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
95 |
+
|
96 |
+
sort inventor year
|
97 |
+
by inventor : g x_m1 = x[_n-1]
|
98 |
+
by inventor : g x_m2 = x[_n-2]
|
99 |
+
by inventor : g x_m3 = x[_n-3]
|
100 |
+
by inventor : g x_m4 = x[_n-4]
|
101 |
+
by inventor : g x_m5 = x[_n-5]
|
102 |
+
by inventor : g x_p1 = x[_n+1]
|
103 |
+
by inventor : g x_p2 = x[_n+2]
|
104 |
+
by inventor : g x_p3 = x[_n+3]
|
105 |
+
by inventor : g x_p4 = x[_n+4]
|
106 |
+
by inventor : g x_p5 = x[_n+5]
|
107 |
+
by inventor : g x2_m1 = x2[_n-1]
|
108 |
+
by inventor : g x2_m2 = x2[_n-2]
|
109 |
+
by inventor : g x2_m3 = x2[_n-3]
|
110 |
+
by inventor : g x2_m4 = x2[_n-4]
|
111 |
+
by inventor : g x2_m5 = x2[_n-5]
|
112 |
+
by inventor : g x2_p1 = x2[_n+1]
|
113 |
+
by inventor : g x2_p2 = x2[_n+2]
|
114 |
+
by inventor : g x2_p3 = x2[_n+3]
|
115 |
+
by inventor : g x2_p4 = x2[_n+4]
|
116 |
+
by inventor : g x2_p5 = x2[_n+5]
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
********************************************************************
|
124 |
+
********************************************************************
|
125 |
+
********************************************************************
|
126 |
+
* INTERPOLATED DATA
|
127 |
+
********************************************************************
|
128 |
+
********************************************************************
|
129 |
+
********************************************************************
|
130 |
+
|
131 |
+
* I ADD THE 0's IN INTERPOLATED YEARS
|
132 |
+
drop y
|
133 |
+
summ year number
|
134 |
+
g y = asinh(number)
|
135 |
+
summ year number y
|
136 |
+
replace y = asinh(0) if inter_bea ==1 | inter_zd ==1 | inter_class ==1
|
137 |
+
replace y = asinh(0) if inter_bea2==1 | inter_zd2==1 | inter_class2==1
|
138 |
+
summ year number y
|
139 |
+
summ year number y if inter_bea ==1 | inter_zd ==1 | inter_class ==1
|
140 |
+
summ year number y if inter_bea2==1 | inter_zd2==1 | inter_class2==1
|
141 |
+
|
142 |
+
|
143 |
+
sort inventor year
|
144 |
+
by inventor: g inter_org = 1 if org_new ==. & org_new[_n-1] == org_new[_n+1] & org_new[_n-1] ~=.
|
145 |
+
by inventor: replace org_new = org_new[_n-1] if inter_org ==1
|
146 |
+
|
147 |
+
by inventor: g inter_org2 = 1 if org_new ==. & org_new[_n-1] ==. & org_new[_n-2] == org_new[_n+1] & org_new[_n-2] ~=.
|
148 |
+
by inventor: replace org_new = org_new[_n-2] if inter_org2 ==1
|
149 |
+
|
150 |
+
|
151 |
+
* This is the baseline. It shpould be equal to the main table with no interpolation
|
152 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea ==0 & inter_zd ==0 & inter_class==0 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org ~=1 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
153 |
+
|
154 |
+
* This regression uses interpolated data: 1 year
|
155 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
156 |
+
|
157 |
+
* This regression uses interpolated data: 2 year2
|
158 |
+
eststo: reghdfe y x if total >=3.25, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
159 |
+
|
160 |
+
esttab using tables31/table1.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
161 |
+
esttab using tables31/table1.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
162 |
+
eststo clear
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
|
107/replication_package/AER_UPLOADED/reg34.do
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* DIFFERENT TIME UNIT (1,2,3,6 MONTHS, 2, 3 YEAR) -- SUPERSTARS
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
*****************
|
12 |
+
* 1 MONTH
|
13 |
+
*****************
|
14 |
+
clear
|
15 |
+
u $main/data2/data_4a
|
16 |
+
egen total = sum(number), by(inventor)
|
17 |
+
|
18 |
+
g y = log(number)
|
19 |
+
g x = log(Den_bea_zd )
|
20 |
+
|
21 |
+
egen cluster1 = group(bea zd)
|
22 |
+
egen cluster_bea_year = group(bea year)
|
23 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
24 |
+
egen cluster_zd_year = group(zd year)
|
25 |
+
egen cluster_class_year = group(class year)
|
26 |
+
egen cluster_bea_class = group(bea class)
|
27 |
+
egen org_new2 = group(org_new)
|
28 |
+
drop org_new
|
29 |
+
|
30 |
+
keep if total >=13.6
|
31 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
32 |
+
summ y x
|
33 |
+
|
34 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
35 |
+
|
36 |
+
|
37 |
+
*****************
|
38 |
+
* 2 MONTHS
|
39 |
+
*****************
|
40 |
+
clear
|
41 |
+
u $main/data2/data_4e
|
42 |
+
egen total = sum(number), by(inventor)
|
43 |
+
|
44 |
+
g y = log(number)
|
45 |
+
g x = log(Den_bea_zd )
|
46 |
+
|
47 |
+
egen cluster1 = group(bea zd)
|
48 |
+
egen cluster_bea_year = group(bea year)
|
49 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
50 |
+
egen cluster_zd_year = group(zd year)
|
51 |
+
egen cluster_class_year = group(class year)
|
52 |
+
egen cluster_bea_class = group(bea class)
|
53 |
+
egen org_new2 = group(org_new)
|
54 |
+
drop org_new
|
55 |
+
|
56 |
+
keep if total >=13.6
|
57 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
58 |
+
summ y x
|
59 |
+
|
60 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
61 |
+
|
62 |
+
*****************
|
63 |
+
* 3 MONTH
|
64 |
+
*****************
|
65 |
+
clear
|
66 |
+
u $main/data2/data_4f
|
67 |
+
egen total = sum(number), by(inventor)
|
68 |
+
|
69 |
+
g y = log(number)
|
70 |
+
g x = log(Den_bea_zd )
|
71 |
+
|
72 |
+
egen cluster1 = group(bea zd)
|
73 |
+
egen cluster_bea_year = group(bea year)
|
74 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
75 |
+
egen cluster_zd_year = group(zd year)
|
76 |
+
egen cluster_class_year = group(class year)
|
77 |
+
egen cluster_bea_class = group(bea class)
|
78 |
+
egen org_new2 = group(org_new)
|
79 |
+
drop org_new
|
80 |
+
|
81 |
+
keep if total >=13.6
|
82 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
83 |
+
summ y x
|
84 |
+
|
85 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
86 |
+
|
87 |
+
|
88 |
+
*****************
|
89 |
+
* 6 MONTH
|
90 |
+
*****************
|
91 |
+
clear
|
92 |
+
u $main/data2/data_4b
|
93 |
+
egen total = sum(number), by(inventor)
|
94 |
+
|
95 |
+
g y = log(number)
|
96 |
+
g x = log(Den_bea_zd )
|
97 |
+
|
98 |
+
egen cluster1 = group(bea zd)
|
99 |
+
egen cluster_bea_year = group(bea year)
|
100 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
101 |
+
egen cluster_zd_year = group(zd year)
|
102 |
+
egen cluster_class_year = group(class year)
|
103 |
+
egen cluster_bea_class = group(bea class)
|
104 |
+
egen org_new2 = group(org_new)
|
105 |
+
drop org_new
|
106 |
+
|
107 |
+
|
108 |
+
keep if total >=13.6
|
109 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
110 |
+
summ y x
|
111 |
+
|
112 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
113 |
+
|
114 |
+
*****************
|
115 |
+
* 1 YEAR
|
116 |
+
*****************
|
117 |
+
clear
|
118 |
+
u $main/data2/data_3
|
119 |
+
egen total = sum(number), by(inventor)
|
120 |
+
|
121 |
+
g y = log(number)
|
122 |
+
g x = log(Den_bea_zd )
|
123 |
+
|
124 |
+
egen cluster1 = group(bea zd)
|
125 |
+
egen cluster_bea_year = group(bea year)
|
126 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
127 |
+
egen cluster_zd_year = group(zd year)
|
128 |
+
egen cluster_class_year = group(class year)
|
129 |
+
egen cluster_bea_class = group(bea class)
|
130 |
+
egen org_new = group(org_id)
|
131 |
+
|
132 |
+
keep if total >=13.6
|
133 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
134 |
+
summ y x
|
135 |
+
|
136 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
137 |
+
|
138 |
+
*****************
|
139 |
+
* 2 YEAR
|
140 |
+
*****************
|
141 |
+
clear
|
142 |
+
u $main/data2/data_4c
|
143 |
+
egen total = sum(number), by(inventor)
|
144 |
+
|
145 |
+
g y = log(number)
|
146 |
+
g x = log(Den_bea_zd )
|
147 |
+
|
148 |
+
egen cluster1 = group(bea zd)
|
149 |
+
egen cluster_bea_year = group(bea year)
|
150 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
151 |
+
egen cluster_zd_year = group(zd year)
|
152 |
+
egen cluster_class_year = group(class year)
|
153 |
+
egen cluster_bea_class = group(bea class)
|
154 |
+
egen org_new2 = group(org_new)
|
155 |
+
drop org_new
|
156 |
+
|
157 |
+
keep if total >=13.6
|
158 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
159 |
+
summ y x
|
160 |
+
|
161 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
162 |
+
|
163 |
+
*****************
|
164 |
+
* 3 YEAR
|
165 |
+
*****************
|
166 |
+
clear
|
167 |
+
u $main/data2/data_4d
|
168 |
+
egen total = sum(number), by(inventor)
|
169 |
+
|
170 |
+
g y = log(number)
|
171 |
+
g x = log(Den_bea_zd )
|
172 |
+
|
173 |
+
egen cluster1 = group(bea zd)
|
174 |
+
egen cluster_bea_year = group(bea year)
|
175 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
176 |
+
egen cluster_zd_year = group(zd year)
|
177 |
+
egen cluster_class_year = group(class year)
|
178 |
+
egen cluster_bea_class = group(bea class)
|
179 |
+
egen org_new2 = group(org_new)
|
180 |
+
drop org_new
|
181 |
+
|
182 |
+
|
183 |
+
keep if total >=13.6
|
184 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
185 |
+
summ y x
|
186 |
+
|
187 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
188 |
+
esttab using tables34/table9.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
189 |
+
esttab using tables34/table9.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
190 |
+
eststo clear
|
191 |
+
|
192 |
+
|
193 |
+
*restore
|
194 |
+
|
107/replication_package/AER_UPLOADED/reg36.do
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* IV in appendix
|
5 |
+
********************************************************************
|
6 |
+
********************************************************************
|
7 |
+
********************************************************************
|
8 |
+
|
9 |
+
|
10 |
+
********************************************************************
|
11 |
+
********************************************************************
|
12 |
+
********************************************************************
|
13 |
+
* READ DATA
|
14 |
+
********************************************************************
|
15 |
+
********************************************************************
|
16 |
+
********************************************************************
|
17 |
+
clear
|
18 |
+
u $main/data2/data_3
|
19 |
+
|
20 |
+
egen total = sum(number), by(inventor)
|
21 |
+
|
22 |
+
* INCLUDE THE FOLLOWING 6 LINES IF YOU DON'T WANT INTERPOLATED DATA
|
23 |
+
replace bea =. if inter_bea ==1
|
24 |
+
replace zd =. if inter_zd ==1
|
25 |
+
replace class =. if inter_class ==1
|
26 |
+
replace bea =. if inter_bea2 ==1
|
27 |
+
replace zd =. if inter_zd2 ==1
|
28 |
+
replace class =. if inter_class2==1
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
* CLUSTER SIZE
|
33 |
+
g x = log(Den_bea_zd )
|
34 |
+
sort inventor year
|
35 |
+
by inventor : g x_m1 = x[_n-1]
|
36 |
+
by inventor : g x_m2 = x[_n-2]
|
37 |
+
by inventor : g x_m3 = x[_n-3]
|
38 |
+
by inventor : g x_m4 = x[_n-4]
|
39 |
+
by inventor : g x_m5 = x[_n-5]
|
40 |
+
by inventor : g x_p1 = x[_n+1]
|
41 |
+
by inventor : g x_p2 = x[_n+2]
|
42 |
+
by inventor : g x_p3 = x[_n+3]
|
43 |
+
by inventor : g x_p4 = x[_n+4]
|
44 |
+
by inventor : g x_p5 = x[_n+5]
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
drop if year ==.
|
50 |
+
drop if zd ==.
|
51 |
+
drop if bea ==.
|
52 |
+
egen org_new2 = group(org_id) if org_id ~= ""
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
********************************************************************
|
57 |
+
********************************************************************
|
58 |
+
********************************************************************
|
59 |
+
********************************************************************
|
60 |
+
********************************************************************
|
61 |
+
********************************************************************
|
62 |
+
|
63 |
+
* NUMBER OF PATENTS IN A YEAR
|
64 |
+
g y = log(number)
|
65 |
+
|
66 |
+
* CITATIONS
|
67 |
+
* To avoid dropping the 0's, I add 0.00001
|
68 |
+
g y2 = log(citations+0.00001)
|
69 |
+
g y3 = log( (citations+0.00001) / number)
|
70 |
+
|
71 |
+
* SPECIALIZATION
|
72 |
+
*g y4 = 1-general
|
73 |
+
|
74 |
+
* NUMBER OF FIRMS
|
75 |
+
g x3 = log(Den_bea_zdB)
|
76 |
+
|
77 |
+
|
78 |
+
***********************
|
79 |
+
***********************
|
80 |
+
* DEFINE STAR INVENTORS
|
81 |
+
* top 10% = 3.25
|
82 |
+
***********************
|
83 |
+
***********************
|
84 |
+
keep if total >=3.25
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
********************************************************************
|
89 |
+
********************************************************************
|
90 |
+
********************************************************************
|
91 |
+
* NEW VARIABLES
|
92 |
+
********************************************************************
|
93 |
+
********************************************************************
|
94 |
+
********************************************************************
|
95 |
+
egen cluster1 = group(bea zd)
|
96 |
+
egen cluster0 = group(bea zd year)
|
97 |
+
egen cluster2 = group(bea )
|
98 |
+
egen cluster_bea_year = group(bea year)
|
99 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
100 |
+
egen cluster_bea_class_year = group(bea class year)
|
101 |
+
egen cluster_zd_year = group(zd year)
|
102 |
+
egen cluster_bea_class = group(bea class)
|
103 |
+
egen cluster_class_year = group(class year)
|
104 |
+
egen org_new = group(org_id)
|
105 |
+
egen cluster_org_year = group(org_new year)
|
106 |
+
egen org_size = count(inventor), by(org_new year)
|
107 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
********************************************************************
|
112 |
+
********************************************************************
|
113 |
+
********************************************************************
|
114 |
+
* REGRESSIONS
|
115 |
+
********************************************************************
|
116 |
+
********************************************************************
|
117 |
+
********************************************************************
|
118 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
119 |
+
summ y y2 y3 x
|
120 |
+
summ number, detail
|
121 |
+
summ x Den_bea_zd , detail
|
122 |
+
tab zd
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
***************************************
|
129 |
+
*MODELS IN DIFFERENCES and IV
|
130 |
+
***************************************
|
131 |
+
save tmp35, replace
|
132 |
+
|
133 |
+
|
134 |
+
* Now I indetify firms that have a presence in only 1 city
|
135 |
+
sort bea year org_new2
|
136 |
+
g jjj=1 if org_new2 ~= .
|
137 |
+
collapse jjj, by(bea year org_new2)
|
138 |
+
|
139 |
+
* number of cities a firm is present in a given year
|
140 |
+
egen NN2 = sum(jjj), by(year org_new2)
|
141 |
+
* max number of cities a firm has ever been present
|
142 |
+
egen NN3 = max(NN2), by(org_new2)
|
143 |
+
summ NN2 NN3, detail
|
144 |
+
sort bea year org_new2
|
145 |
+
save tmp89, replace
|
146 |
+
|
147 |
+
|
148 |
+
************************************
|
149 |
+
|
150 |
+
clear
|
151 |
+
u tmp35
|
152 |
+
|
153 |
+
drop if org_id == ""
|
154 |
+
sort org_new2 bea year zd
|
155 |
+
merge m:1 bea year zd org_new2 using $main/data2/iv_data_new
|
156 |
+
drop _merge
|
157 |
+
|
158 |
+
sort bea year org_new2
|
159 |
+
merge m:1 bea year org_new2 using tmp89
|
160 |
+
drop _merge
|
161 |
+
rm tmp89.dta
|
162 |
+
rm tmp35.dta
|
163 |
+
|
164 |
+
g IV = iv8
|
165 |
+
|
166 |
+
sort inventor year
|
167 |
+
by inventor: g Dy = y - y[_n-1]
|
168 |
+
by inventor: g Dx = x - x[_n-1]
|
169 |
+
by inventor: g Dyear = year - year[_n-1]
|
170 |
+
by inventor: g Dbea = 1 if bea_code == bea_code[_n-1]
|
171 |
+
by inventor: g Dy_2 = y - y[_n-2]
|
172 |
+
by inventor: g Dx_2 = x - x[_n-2]
|
173 |
+
by inventor: g Dyear_2 = year - year[_n-2]
|
174 |
+
by inventor: g Dbea_2 = 1 if bea_code == bea_code[_n-2]
|
175 |
+
by inventor: g Dx_m1 = x[_n-1] - x[_n-2]
|
176 |
+
by inventor: g Dx_m2 = x[_n-2] - x[_n-3]
|
177 |
+
by inventor: g Dx_m3 = x[_n-3] - x[_n-2]
|
178 |
+
egen cluster10 = group(bea )
|
179 |
+
|
180 |
+
|
181 |
+
* Models in first differences should only include observations in contiguous years
|
182 |
+
keep if Dyear ==1
|
183 |
+
keep if Dy ~=. & Dx ~=. & IV ~=.
|
184 |
+
|
185 |
+
|
186 |
+
drop if NN3 >1
|
187 |
+
|
188 |
+
|
189 |
+
* OLS
|
190 |
+
eststo: reghdfe Dy Dx, absorb(year zd class ) vce(cluster cluster10)
|
191 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year ) vce(cluster cluster10)
|
192 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10)
|
193 |
+
* 2SLS
|
194 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class ) cluster(cluster10)
|
195 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year ) cluster(cluster10)
|
196 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year cluster_class_year ) cluster(cluster10)
|
197 |
+
|
198 |
+
esttab using tables36/table22.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
199 |
+
esttab using tables36/table22, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
200 |
+
eststo clear
|
201 |
+
|
202 |
+
* First Stage
|
203 |
+
eststo: reghdfe Dx IV, absorb(year zd class ) vce(cluster cluster10) res(v4)
|
204 |
+
test IV=0
|
205 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year ) vce(cluster cluster10) res(v5)
|
206 |
+
test IV=0
|
207 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10) res(v6)
|
208 |
+
test IV=0
|
209 |
+
|
210 |
+
esttab using tables36/table21.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
211 |
+
esttab using tables36/table21, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
212 |
+
eststo clear
|
213 |
+
|
214 |
+
|
215 |
+
* EXOGENEITY TESTS
|
216 |
+
reghdfe Dy Dx v4, absorb(year zd class ) vce(cluster cluster10)
|
217 |
+
test v4
|
218 |
+
reghdfe Dy Dx v5, absorb(year zd class cluster_zd_year ) vce(cluster cluster10)
|
219 |
+
test v5
|
220 |
+
reghdfe Dy Dx v6, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10)
|
221 |
+
test v6
|
222 |
+
drop v4 v5 v6
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
***************************************
|
227 |
+
* SAME CITY AND FIELD
|
228 |
+
egen max = max(bea), by(inventor)
|
229 |
+
egen min = min(bea), by(inventor)
|
230 |
+
keep if max == min
|
231 |
+
drop max min
|
232 |
+
|
233 |
+
egen max = max(zd), by(inventor)
|
234 |
+
egen min = min(zd), by(inventor)
|
235 |
+
keep if max == min
|
236 |
+
drop max min
|
237 |
+
|
238 |
+
|
239 |
+
* OLS
|
240 |
+
eststo: reghdfe Dy Dx, absorb(year zd class ) vce(cluster cluster10)
|
241 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year ) vce(cluster cluster10)
|
242 |
+
eststo: reghdfe Dy Dx, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10)
|
243 |
+
* 2SLS
|
244 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class ) cluster(cluster10)
|
245 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year ) cluster(cluster10)
|
246 |
+
eststo: ivreghdfe Dy (Dx =IV), absorb(year zd class cluster_zd_year cluster_class_year ) cluster(cluster10)
|
247 |
+
|
248 |
+
esttab using tables36/table222.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
249 |
+
esttab using tables36/table222, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
250 |
+
eststo clear
|
251 |
+
|
252 |
+
* First Stage
|
253 |
+
eststo: reghdfe Dx IV, absorb(year zd class ) vce(cluster cluster10) res(v4)
|
254 |
+
test IV=0
|
255 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year ) vce(cluster cluster10) res(v5)
|
256 |
+
test IV=0
|
257 |
+
eststo: reghdfe Dx IV, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10) res(v6)
|
258 |
+
test IV=0
|
259 |
+
|
260 |
+
esttab using tables36/table221.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
261 |
+
esttab using tables36/table221, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
262 |
+
eststo clear
|
263 |
+
|
264 |
+
|
265 |
+
|
266 |
+
* EXOGENEITY TESTS
|
267 |
+
reghdfe Dy Dx v4, absorb(year zd class ) vce(cluster cluster10)
|
268 |
+
test v4
|
269 |
+
reghdfe Dy Dx v5, absorb(year zd class cluster_zd_year ) vce(cluster cluster10)
|
270 |
+
test v5
|
271 |
+
reghdfe Dy Dx v6, absorb(year zd class cluster_zd_year cluster_class_year ) vce(cluster cluster10)
|
272 |
+
test v6
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
restore
|
277 |
+
|
107/replication_package/AER_UPLOADED/reg4.do
ADDED
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************************************************
|
2 |
+
********************************************************************
|
3 |
+
********************************************************************
|
4 |
+
* ROBUSTNESS:
|
5 |
+
* INTERPOLATION; DIFFERENT AMOUNTS OF CENSORING; LAGGED X;
|
6 |
+
* DIFFERENT TIME UNIT (1,2,3,6 MONTHS, 2, 3 YEAR)
|
7 |
+
********************************************************************
|
8 |
+
********************************************************************
|
9 |
+
********************************************************************
|
10 |
+
|
11 |
+
|
12 |
+
u $main/data2/data_3
|
13 |
+
egen total = sum(number), by(inventor)
|
14 |
+
|
15 |
+
|
16 |
+
* BY COMMENTING OUT THESE 6 LINES,
|
17 |
+
* I DO NOT DROP INTERPOLATED DATA
|
18 |
+
*replace bea =. if inter_bea ==1
|
19 |
+
*replace zd =. if inter_zd ==1
|
20 |
+
*replace class =. if inter_class ==1
|
21 |
+
*replace bea =. if inter_bea2 ==1
|
22 |
+
*replace zd =. if inter_zd2 ==1
|
23 |
+
*replace class =. if inter_class2==1
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
********************************************************************
|
28 |
+
********************************************************************
|
29 |
+
********************************************************************
|
30 |
+
* OPTIONS
|
31 |
+
********************************************************************
|
32 |
+
********************************************************************
|
33 |
+
********************************************************************
|
34 |
+
|
35 |
+
************************
|
36 |
+
************************
|
37 |
+
* DEFINE Y
|
38 |
+
***********************
|
39 |
+
***********************
|
40 |
+
* NUMBER OF PATENTS IN A YEAR
|
41 |
+
g y = log(number)
|
42 |
+
|
43 |
+
* CITATIONS
|
44 |
+
*g y2 = log(citations+00001)
|
45 |
+
g y2 = log(citations)
|
46 |
+
|
47 |
+
* SPECIALIZATION
|
48 |
+
*g y = 1-general
|
49 |
+
|
50 |
+
|
51 |
+
***********************
|
52 |
+
***********************
|
53 |
+
* DEFINE X
|
54 |
+
***********************
|
55 |
+
***********************
|
56 |
+
* NUMBER OF SCIENTISTS
|
57 |
+
*g x = Den_bea_zd
|
58 |
+
*g x2 = Den_bea_class
|
59 |
+
g x = log(Den_bea_zd )
|
60 |
+
g x2 = log(Den_bea_class )
|
61 |
+
|
62 |
+
* NUMBER OF FIRMS
|
63 |
+
*g x = Den_bea_zdB
|
64 |
+
*g x2 = Den_bea_classB
|
65 |
+
|
66 |
+
|
67 |
+
***********************
|
68 |
+
***********************
|
69 |
+
* DEFINE STAR INVENTORS
|
70 |
+
***********************
|
71 |
+
***********************
|
72 |
+
*keep if total >=3.25
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
********************************************************************
|
77 |
+
********************************************************************
|
78 |
+
********************************************************************
|
79 |
+
* NEW VARIABLES
|
80 |
+
********************************************************************
|
81 |
+
********************************************************************
|
82 |
+
********************************************************************
|
83 |
+
egen cluster1 = group(bea zd)
|
84 |
+
egen cluster0 = group(bea zd year)
|
85 |
+
egen cluster2 = group(bea )
|
86 |
+
egen cluster_bea_year = group(bea year)
|
87 |
+
egen cluster_bea_class = group(bea class)
|
88 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
89 |
+
egen cluster_bea_class_year = group(bea class year)
|
90 |
+
egen cluster_zd_year = group(zd year)
|
91 |
+
egen cluster_class_year = group(class year)
|
92 |
+
egen org_new = group(org_id)
|
93 |
+
egen cluster_org_year = group(org_new year)
|
94 |
+
egen org_size = count(inventor), by(org_new year)
|
95 |
+
egen lab_size = count(inventor), by(org_new year bea)
|
96 |
+
|
97 |
+
sort inventor year
|
98 |
+
by inventor : g x_m1 = x[_n-1]
|
99 |
+
by inventor : g x_m2 = x[_n-2]
|
100 |
+
by inventor : g x_m3 = x[_n-3]
|
101 |
+
by inventor : g x_m4 = x[_n-4]
|
102 |
+
by inventor : g x_m5 = x[_n-5]
|
103 |
+
by inventor : g x_p1 = x[_n+1]
|
104 |
+
by inventor : g x_p2 = x[_n+2]
|
105 |
+
by inventor : g x_p3 = x[_n+3]
|
106 |
+
by inventor : g x_p4 = x[_n+4]
|
107 |
+
by inventor : g x_p5 = x[_n+5]
|
108 |
+
by inventor : g x2_m1 = x2[_n-1]
|
109 |
+
by inventor : g x2_m2 = x2[_n-2]
|
110 |
+
by inventor : g x2_m3 = x2[_n-3]
|
111 |
+
by inventor : g x2_m4 = x2[_n-4]
|
112 |
+
by inventor : g x2_m5 = x2[_n-5]
|
113 |
+
by inventor : g x2_p1 = x2[_n+1]
|
114 |
+
by inventor : g x2_p2 = x2[_n+2]
|
115 |
+
by inventor : g x2_p3 = x2[_n+3]
|
116 |
+
by inventor : g x2_p4 = x2[_n+4]
|
117 |
+
by inventor : g x2_p5 = x2[_n+5]
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
|
124 |
+
********************************************************************
|
125 |
+
********************************************************************
|
126 |
+
********************************************************************
|
127 |
+
* INTERPOLATED DATA
|
128 |
+
* NOTE: This analysis is out of date.
|
129 |
+
* log(0) is not defined. 0's are transformed using log(0.001)
|
130 |
+
* More recent versions of this table are in reg30.do and reg31.do
|
131 |
+
********************************************************************
|
132 |
+
********************************************************************
|
133 |
+
********************************************************************
|
134 |
+
|
135 |
+
* I ADD THE 0's IN INTERPOLATED YEARS
|
136 |
+
replace y = log(0.001) if inter_bea ==1 | inter_zd ==1 | inter_class ==1
|
137 |
+
replace y = log(0.001) if inter_bea2==1 | inter_zd2==1 | inter_class2==1
|
138 |
+
|
139 |
+
|
140 |
+
sort inventor year
|
141 |
+
by inventor: g inter_org = 1 if org_new ==. & org_new[_n-1] == org_new[_n+1] & org_new[_n-1] ~=.
|
142 |
+
by inventor: replace org_new = org_new[_n-1] if inter_org ==1
|
143 |
+
|
144 |
+
by inventor: g inter_org2 = 1 if org_new ==. & org_new[_n-1] ==. & org_new[_n-2] == org_new[_n+1] & org_new[_n-2] ~=.
|
145 |
+
by inventor: replace org_new = org_new[_n-2] if inter_org2 ==1
|
146 |
+
|
147 |
+
|
148 |
+
* This is the baseline. It shpould be equal to the main table with no interpolation
|
149 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea ==0 & inter_zd ==0 & inter_class==0 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org ~=1 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
150 |
+
|
151 |
+
* This regression uses interpolated data: 1 year
|
152 |
+
eststo: reghdfe y x if total >=3.25 & inter_bea2 ==0 & inter_zd2==0 & inter_class2==0 & inter_org2 ~=1, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
153 |
+
|
154 |
+
* This regression uses interpolated data: 2 year2
|
155 |
+
eststo: reghdfe y x if total >=3.25, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
156 |
+
|
157 |
+
esttab using tables4/table1.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
158 |
+
esttab using tables4/table1.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
159 |
+
eststo clear
|
160 |
+
|
161 |
+
|
162 |
+
********************************************************************
|
163 |
+
********************************************************************
|
164 |
+
********************************************************************
|
165 |
+
* DIFFERENT DEFINITIONS OF STARS
|
166 |
+
* (USING NON INTERPOLATED DATA)
|
167 |
+
********************************************************************
|
168 |
+
********************************************************************
|
169 |
+
********************************************************************
|
170 |
+
|
171 |
+
* DROP INTERPOLATED OBS
|
172 |
+
drop if inter_bea ==1
|
173 |
+
drop if inter_zd ==1
|
174 |
+
drop if inter_class ==1
|
175 |
+
drop if inter_bea2 ==1
|
176 |
+
drop if inter_zd2 ==1
|
177 |
+
drop if inter_class2==1
|
178 |
+
|
179 |
+
summ y x x2
|
180 |
+
|
181 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
182 |
+
eststo: reghdfe y x if total >=1.5, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
183 |
+
eststo: reghdfe y x if total >=3.25, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
184 |
+
eststo: reghdfe y x if total >=5.4, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
185 |
+
eststo: reghdfe y x if total >=13.6, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
186 |
+
eststo: reghdfe y x if total >=15, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
187 |
+
esttab using tables4/table2.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
188 |
+
esttab using tables4/table2.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
189 |
+
|
190 |
+
eststo clear
|
191 |
+
|
192 |
+
* Average number of years
|
193 |
+
egen n_year = count(y), by(inventor)
|
194 |
+
summ total n_year
|
195 |
+
drop n_year
|
196 |
+
egen n_year = count(y) if total >=1.5, by(inventor)
|
197 |
+
summ total n_year
|
198 |
+
drop n_year
|
199 |
+
egen n_year = count(y) if total >=3.25, by(inventor)
|
200 |
+
summ total n_year
|
201 |
+
drop n_year
|
202 |
+
egen n_year = count(y) if total >=5.4, by(inventor)
|
203 |
+
summ total n_year
|
204 |
+
drop n_year
|
205 |
+
egen n_year = count(y) if total >=13.6, by(inventor)
|
206 |
+
summ total n_year
|
207 |
+
drop n_year
|
208 |
+
egen n_year = count(y) if total >=15, by(inventor)
|
209 |
+
summ total n_year
|
210 |
+
drop n_year
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
+
********************************************************************
|
217 |
+
********************************************************************
|
218 |
+
********************************************************************
|
219 |
+
* TO AVOID MECHANICAL CORRELATION
|
220 |
+
* ASSIGN CLUSTER SIZE THAT EXISTED IN THE RELEVANT BEA-ZD LAST YEAR
|
221 |
+
* OR 2 YEARS AGO.
|
222 |
+
* NOTE: FOR A GIVEN INVENTOR, IT IS NOT
|
223 |
+
* THE LAGGED CLUSTER SIZE DUE TO MOBILITY
|
224 |
+
********************************************************************
|
225 |
+
********************************************************************
|
226 |
+
********************************************************************
|
227 |
+
preserve
|
228 |
+
|
229 |
+
* I MERGE CLUSTER DENSITY 1 YEAR AGO
|
230 |
+
g year2 = year
|
231 |
+
replace year = year -1
|
232 |
+
sort bea zd year
|
233 |
+
merge m:1 bea zd year using data2/density14_3
|
234 |
+
tab _merge
|
235 |
+
drop _merge
|
236 |
+
g Den_bea_zd_1 = density14
|
237 |
+
drop density14*
|
238 |
+
|
239 |
+
* I MERGE CLUSTER DENSITY 2 YEARS AGO
|
240 |
+
drop year
|
241 |
+
g year = year2-2
|
242 |
+
sort bea zd year
|
243 |
+
merge m:1 bea zd year using data2/density14_3
|
244 |
+
tab _merge
|
245 |
+
drop _merge
|
246 |
+
g Den_bea_zd_2 = density14
|
247 |
+
drop density14*
|
248 |
+
drop year
|
249 |
+
|
250 |
+
* SERIAL CORRELATION IN X
|
251 |
+
rename year2 year
|
252 |
+
g xx = log(Den_bea_zd_1)
|
253 |
+
g xxx = log(Den_bea_zd_2)
|
254 |
+
|
255 |
+
correlate(x xx)
|
256 |
+
correlate(x xxx)
|
257 |
+
reg x xx
|
258 |
+
reg x xxx
|
259 |
+
|
260 |
+
egen xxxx = rowmean(x xx xxx)
|
261 |
+
egen xxxxx = rowmin(x xx xxx)
|
262 |
+
egen xxxxxx = rowmax(x xx xxx)
|
263 |
+
|
264 |
+
|
265 |
+
keep if total >=3.25
|
266 |
+
|
267 |
+
* Baseline
|
268 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
269 |
+
|
270 |
+
* Using x that existed in the same cluster in the previous year
|
271 |
+
eststo: reghdfe y xx, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
272 |
+
|
273 |
+
* Using x that existed in the same cluster 2 years before
|
274 |
+
eststo: reghdfe y xxx, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
275 |
+
|
276 |
+
* Using mean, min or max over the last 3 years
|
277 |
+
eststo: reghdfe y xxxx, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
278 |
+
eststo: reghdfe y xxxxx, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
279 |
+
eststo: reghdfe y xxxxxx, absorb(year bea zd class cluster_bea_year cluster_zd_year inventor cluster1 cluster_bea_class cluster_class_year org_new) cluster(cluster1) keepsin
|
280 |
+
|
281 |
+
esttab using tables4/table3.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
282 |
+
esttab using tables4/table3.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
283 |
+
|
284 |
+
eststo clear
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
|
289 |
+
********************************************************************
|
290 |
+
********************************************************************
|
291 |
+
********************************************************************
|
292 |
+
* 1 MONTH; 2 MONTHS; 3 MONTHS; 6 MONTHS; 2 YEARS; 3 YEARS
|
293 |
+
********************************************************************
|
294 |
+
********************************************************************
|
295 |
+
********************************************************************
|
296 |
+
|
297 |
+
*****************
|
298 |
+
* 1 MONTH
|
299 |
+
*****************
|
300 |
+
clear
|
301 |
+
u $main/data2/data_4a
|
302 |
+
egen total = sum(number), by(inventor)
|
303 |
+
|
304 |
+
g y = log(number)
|
305 |
+
g x = log(Den_bea_zd )
|
306 |
+
|
307 |
+
egen cluster1 = group(bea zd)
|
308 |
+
egen cluster_bea_year = group(bea year)
|
309 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
310 |
+
egen cluster_zd_year = group(zd year)
|
311 |
+
egen cluster_class_year = group(class year)
|
312 |
+
egen cluster_bea_class = group(bea class)
|
313 |
+
egen org_new2 = group(org_new)
|
314 |
+
drop org_new
|
315 |
+
|
316 |
+
keep if total >=3.25
|
317 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
318 |
+
summ y x
|
319 |
+
|
320 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
321 |
+
|
322 |
+
|
323 |
+
*****************
|
324 |
+
* 2 MONTHS
|
325 |
+
*****************
|
326 |
+
clear
|
327 |
+
u $main/data2/data_4e
|
328 |
+
egen total = sum(number), by(inventor)
|
329 |
+
|
330 |
+
g y = log(number)
|
331 |
+
g x = log(Den_bea_zd )
|
332 |
+
|
333 |
+
egen cluster1 = group(bea zd)
|
334 |
+
egen cluster_bea_year = group(bea year)
|
335 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
336 |
+
egen cluster_zd_year = group(zd year)
|
337 |
+
egen cluster_class_year = group(class year)
|
338 |
+
egen cluster_bea_class = group(bea class)
|
339 |
+
egen org_new2 = group(org_new)
|
340 |
+
drop org_new
|
341 |
+
|
342 |
+
keep if total >=3.25
|
343 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
344 |
+
summ y x
|
345 |
+
|
346 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
347 |
+
|
348 |
+
*****************
|
349 |
+
* 3 MONTH
|
350 |
+
*****************
|
351 |
+
clear
|
352 |
+
u $main/data2/data_4f
|
353 |
+
egen total = sum(number), by(inventor)
|
354 |
+
|
355 |
+
g y = log(number)
|
356 |
+
g x = log(Den_bea_zd )
|
357 |
+
|
358 |
+
egen cluster1 = group(bea zd)
|
359 |
+
egen cluster_bea_year = group(bea year)
|
360 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
361 |
+
egen cluster_zd_year = group(zd year)
|
362 |
+
egen cluster_class_year = group(class year)
|
363 |
+
egen cluster_bea_class = group(bea class)
|
364 |
+
egen org_new2 = group(org_new)
|
365 |
+
drop org_new
|
366 |
+
|
367 |
+
keep if total >=3.25
|
368 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
369 |
+
summ y x
|
370 |
+
|
371 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
372 |
+
|
373 |
+
|
374 |
+
*****************
|
375 |
+
* 6 MONTH
|
376 |
+
*****************
|
377 |
+
clear
|
378 |
+
u $main/data2/data_4b
|
379 |
+
egen total = sum(number), by(inventor)
|
380 |
+
|
381 |
+
g y = log(number)
|
382 |
+
g x = log(Den_bea_zd )
|
383 |
+
|
384 |
+
egen cluster1 = group(bea zd)
|
385 |
+
egen cluster_bea_year = group(bea year)
|
386 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
387 |
+
egen cluster_zd_year = group(zd year)
|
388 |
+
egen cluster_class_year = group(class year)
|
389 |
+
egen cluster_bea_class = group(bea class)
|
390 |
+
egen org_new2 = group(org_new)
|
391 |
+
drop org_new
|
392 |
+
|
393 |
+
|
394 |
+
keep if total >=3.25
|
395 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
396 |
+
summ y x
|
397 |
+
|
398 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
399 |
+
|
400 |
+
*****************
|
401 |
+
* 1 YEAR
|
402 |
+
*****************
|
403 |
+
clear
|
404 |
+
u $main/data2/data_3
|
405 |
+
egen total = sum(number), by(inventor)
|
406 |
+
|
407 |
+
g y = log(number)
|
408 |
+
g x = log(Den_bea_zd )
|
409 |
+
|
410 |
+
egen cluster1 = group(bea zd)
|
411 |
+
egen cluster_bea_year = group(bea year)
|
412 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
413 |
+
egen cluster_zd_year = group(zd year)
|
414 |
+
egen cluster_class_year = group(class year)
|
415 |
+
egen cluster_bea_class = group(bea class)
|
416 |
+
egen org_new = group(org_id)
|
417 |
+
|
418 |
+
keep if total >=3.25
|
419 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
420 |
+
summ y x
|
421 |
+
|
422 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
423 |
+
|
424 |
+
*****************
|
425 |
+
* 2 YEAR
|
426 |
+
*****************
|
427 |
+
clear
|
428 |
+
u $main/data2/data_4c
|
429 |
+
egen total = sum(number), by(inventor)
|
430 |
+
|
431 |
+
g y = log(number)
|
432 |
+
g x = log(Den_bea_zd )
|
433 |
+
|
434 |
+
egen cluster1 = group(bea zd)
|
435 |
+
egen cluster_bea_year = group(bea year)
|
436 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
437 |
+
egen cluster_zd_year = group(zd year)
|
438 |
+
egen cluster_class_year = group(class year)
|
439 |
+
egen cluster_bea_class = group(bea class)
|
440 |
+
egen org_new2 = group(org_new)
|
441 |
+
drop org_new
|
442 |
+
|
443 |
+
keep if total >=3.25
|
444 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
445 |
+
summ y x
|
446 |
+
|
447 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
448 |
+
|
449 |
+
*****************
|
450 |
+
* 3 YEAR
|
451 |
+
*****************
|
452 |
+
clear
|
453 |
+
u $main/data2/data_4d
|
454 |
+
egen total = sum(number), by(inventor)
|
455 |
+
|
456 |
+
g y = log(number)
|
457 |
+
g x = log(Den_bea_zd )
|
458 |
+
|
459 |
+
egen cluster1 = group(bea zd)
|
460 |
+
egen cluster_bea_year = group(bea year)
|
461 |
+
egen cluster_bea_zd_year = group(bea zd year)
|
462 |
+
egen cluster_zd_year = group(zd year)
|
463 |
+
egen cluster_class_year = group(class year)
|
464 |
+
egen cluster_bea_class = group(bea class)
|
465 |
+
egen org_new2 = group(org_new)
|
466 |
+
drop org_new
|
467 |
+
|
468 |
+
|
469 |
+
keep if total >=3.25
|
470 |
+
keep if y~=. & zd ~=. & class ~=. & year ~=. & inventor ~=. & cluster1 ~=. & bea ~=.
|
471 |
+
summ y x
|
472 |
+
|
473 |
+
eststo: reghdfe y x , absorb(year bea zd class cluster_bea_year cluster_zd_year cluster_class_year inventor cluster1 cluster_bea_class cluster_class_year org_new) vce(cluster cluster1) keepsin
|
474 |
+
esttab using tables4/table9.tex, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
475 |
+
esttab using tables4/table9.txt, se compress replace star(* 0.10 ** 0.05 *** 0.01)
|
476 |
+
eststo clear
|
477 |
+
|
478 |
+
|
479 |
+
restore
|
480 |
+
|
107/replication_package/AER_UPLOADED/reg5.do
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
********************************
|
2 |
+
* Firm specific spillovers
|
3 |
+
********************************
|
4 |
+
|
5 |
+
|
6 |
+
u $main/data2/data_3_count
|
7 |
+
keep if year ==2007
|
8 |
+
keep bea zd2 year count total
|
9 |
+
summ
|
10 |
+
|
11 |
+
sort bea zd
|
12 |
+
collapse count total, by(bea zd)
|
13 |
+
save tmp, replace
|
14 |
+
summ
|
15 |
+
|
16 |
+
|
17 |
+
**********************************************************
|
18 |
+
u $main/data2/data_patent_level_3
|
19 |
+
drop if org_id ==""
|
20 |
+
keep if year ==2007
|
21 |
+
|
22 |
+
sort inventor_id bea zd
|
23 |
+
by inventor_id bea zd: g d1 = 1 if _n ==1
|
24 |
+
|
25 |
+
g org_N = d1
|
26 |
+
sort org_norm org_id zd2 bea
|
27 |
+
collapse (sum) org_N, by(org_norm org_id zd2 bea)
|
28 |
+
summ
|
29 |
+
|
30 |
+
* ADD COUNT data
|
31 |
+
sort bea zd
|
32 |
+
merge m:1 bea zd using tmp
|
33 |
+
tab _merge
|
34 |
+
drop _merge
|
35 |
+
|
36 |
+
|
37 |
+
* IMPACT OF FIRM
|
38 |
+
g share1 = org_N / count
|
39 |
+
g D_prod = 0.066*( log(count/total) - log((count-org_N)/total) )
|
40 |
+
|
41 |
+
summ share1 D_prod if zd ==2
|
42 |
+
summ share1 D_prod if zd ==1
|
43 |
+
summ share1 D_prod if zd ==5
|
44 |
+
|
45 |
+
|
46 |
+
* COMPUTER SCIENCE
|
47 |
+
* XXX SPILLOVERES
|
48 |
+
preserve
|
49 |
+
keep if zd2 ==2
|
50 |
+
gsort -org_N
|
51 |
+
g n = _n
|
52 |
+
keep if n <= 100
|
53 |
+
drop zd n
|
54 |
+
list
|
55 |
+
|
56 |
+
|
57 |
+
* BIOLOGY CHEMETYRY
|
58 |
+
* XXX SPILLOVERS
|
59 |
+
restore
|
60 |
+
preserve
|
61 |
+
keep if zd2 ==1
|
62 |
+
gsort -org_N
|
63 |
+
g n = _n
|
64 |
+
keep if n <= 100
|
65 |
+
drop zd n
|
66 |
+
list
|
67 |
+
|
68 |
+
|
69 |
+
* SEMICONDUCTORS
|
70 |
+
restore
|
71 |
+
preserve
|
72 |
+
keep if zd2 ==5
|
73 |
+
gsort -org_N
|
74 |
+
g n = _n
|
75 |
+
keep if n <= 100
|
76 |
+
drop zd n
|
77 |
+
list
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
107/replication_package/README.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1c7c5f5dcd8cf6a025631b08e8423ae45c201ccff006098d64b1b970c3e43fdd
|
3 |
+
size 354330
|
107/should_reproduce.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eccda9d44811a8d1afe36a59bbe6d69d50fda658b88215d8e0b8accc7753b1fc
|
3 |
+
size 16
|