-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalys.do
executable file
·73 lines (45 loc) · 2.91 KB
/
analys.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
*** Analysera EU-valet 2024
clear all
cd "D:\Dropbox\eu election"
use "munip_valkod.dta"
destring valdistriktskod, replace
save "munip_valkod.dta", replace
import delimited using "n_calls.demographic_data.valdistrikt.csv", clear
merge 1:1 valdistriktskod using "munip_valkod.dta"
destring prop_of_valid_votes_v_2024, force replace
replace n_calls = "0" if n_calls == "NA"
destring n_calls, replace
replace prop_of_valid_votes_v_2019 = "0" if prop_of_valid_votes_v_2019 == "NA"
destring prop_of_valid_votes_v_2019, replace
replace prop_of_valid_votes_mp_2019 = "0" if prop_of_valid_votes_mp_2019 == "NA"
destring prop_of_valid_votes_mp_2019, replace
gen turnout = prop_voting_s_2024
gen turnout_19 = prop_voting_s_2019
replace turnout_19 = "0" if turnout_19 == "NA"
destring turnout_19, replace
encode Kommun, generate(kommun_id)
replace prop_of_valid_votes_v_2024 = prop_of_valid_votes_v_2024*100
replace turnout = turnout*100
gen log_calls = ln(1+n_calls)
binscatter prop_of_valid_votes_v_2024 n_calls, n(100) control(c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id)
twoway (scatter prop_of_valid_votes_v_2024 log_calls) (lfit prop_of_valid_votes_v_2024 log_calls)
* Main regression
reg prop_of_valid_votes_v_2024 c.n_calls c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id, robust
outreg2 using "C:\Users\wilsk523\Dropbox\eu election/regressions.doc", keep(n_calls) replace
* Turnout as outcome
reg turnout c.n_calls c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id, robust
outreg2 using "C:\Users\wilsk523\Dropbox\eu election/regressions.doc", keep(n_calls) append
merge 1:1 valdistriktskod using "C:\Users\wilsk523\Dropbox\eu election/deso_joined.dta", nogen
**
reg prop_of_valid_votes_v_2024 c.n_calls c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id uned_share, robust
* Low-ed interaction
reg prop_of_valid_votes_v_2024 c.n_calls##c.uned_share c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id , robust
outreg2 using "C:\Users\wilsk523\Dropbox\eu election/regressions.doc", keep(n_calls uned_share c.n_calls##c.uned_share) append
margins, dydx(n_calls) at(c.uned_share = (0.03(0.02)0.2))
marginsplot
* Low-ed turnout interaction
reg turnout c.n_calls##c.uned_share c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id , robust
outreg2 using "C:\Users\wilsk523\Dropbox\eu election/regressions.doc", keep(n_calls uned_share c.n_calls##c.uned_share) append
reg prop_of_valid_votes_v_2024 c.n_calls##c.highed_share c.prop_of_valid_votes_mp_2019 prop_of_valid_votes_v_2019 turnout_19 i.kommun_id , robust
reg prop_of_valid_votes_v_2024 c.n_calls##c.prop_of_valid_votes_v_2019 c.uned_share c.prop_of_valid_votes_mp_2019 turnout_19 i.kommun_id , robust
reg turnout log_calls turnout_19