File size: 29,202 Bytes
3e1c601 |
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
#install.packages("tidyverse")
#install.packages("stargazer")
library(tidyverse) ##data cleaning
library(stargazer) ##tex output
library(haven)
library(estimatr)
library(dplyr)
library(fixest)
library(modelsummary)
############################################
############## CREATING FIGURE 1 ###########
############################################
#Load in data
load("dyadic_data_1-4-22.Rdata")
dta <- updated_data
#### Remove unneeded variables
vars <- c("to_mp_number", "to_rile", "to_economy", "to_society", "year", "country",
"to_pfeml", "to_femaleleader")
dta <- dta[vars]
dta <- na.omit(dta)
### Identiy unique parties being evaluated
dta_unique <- unique(dta)
fig1 <- ggplot(dta_unique, aes(x = to_pfeml)) +
geom_histogram(color="black", fill="grey40", binwidth =0.1, center=0.25) +
scale_x_continuous(breaks = seq(0,1,0.1)) +
theme_minimal() +
theme(plot.title = element_text(size=12)) +
ylab("Frequency")+
xlab("Proportion of Women MPs");fig1
############################################
###### CREATING TABLE 1 COLUMNS 1 & 2 ######
############################################
#Out party % women, non-clustered SEs
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$cntryyr <-paste(dta$country, dta$year, sep = "")
## Removing smaller parties
dta <- subset(dta, dta$to_prior_seats >=4)
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "party_like", "cntryyr", "to_pfeml", "to_prior_seats", "to_mp_number")
dta <- dta[vars]
dta <- na.omit(dta)
table1.1 <-lm(party_like ~ to_pfeml + as.factor(cntryyr), data = dta)
table1.2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(cntryyr), data = dta)
### With clustered SEs
stargazer(table1.1, table1.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table1.1, table1.2,
clusters = dta$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
###### CREATING TABLE 1 COLUMNS 3 & 4 ######
############################################
## Note in gendered data, the party_like and party_dislike variable indicate mean levels of
## like/dislike for party by ALL partisans
## the "dislike" variable indicates level of dislike towards out-party by partisans of specified gender
dta <- readRDS("gender_disagregated_8-8-21.rds")
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
## Removing smaller parties
dta <- subset(dta, dta$to_prior_seats >=4)
### Create Like variable for gendered data from dislike
dta$like <- 10- dta$dislike
## Remove unneeded variables and NAs
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "to_pfeml",
"countryyear", "gender", "like", "dislike", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Only men subset
dta_male <- subset(dta, gender==1)
dta_female <- subset(dta, gender==2)
table1.3 <-lm(like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_female)
table1.4 <-lm(like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_male)
### With clustered SEs - women
stargazer(table1.3,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table1.3,
clusters = dta_female$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition", "to_pfeml2"))
### With clustered SEs - men
stargazer(table1.4,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table1.4,
clusters = dta_male$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition", "to_pfeml2"))
############################################
###### CREATING TABLE S2 COLUMNS 1 & 2 ######
############################################
#Out party % women, non-clustered SEs
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$cntryyr <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "party_like", "cntryyr", "to_pfeml", "to_prior_seats", "to_mp_number")
dta <- dta[vars]
dta <- na.omit(dta)
tableS2.1 <-lm(party_like ~ to_pfeml + as.factor(cntryyr), data = dta)
tableS2.2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(cntryyr), data = dta)
summary(tableS2.1)
summary(tableS2.2)
### With clustered SEs
stargazer(tableS2.1, tableS2.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(tableS2.1, tableS2.2,
clusters = dta$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
###### CREATING TABLE S2 COLUMNS 3 & 4 ######
############################################
dta <- readRDS("gender_disagregated_8-8-21.rds")
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
### Create Like variable for gendered data from dislike
dta$like <- 10- dta$dislike
## Remove unneeded variables and NAs
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "to_pfeml",
"countryyear", "gender", "like", "dislike", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Only men subset
dta_male <- subset(dta, gender==1)
dta_female <- subset(dta, gender==2)
tableS2.3 <-lm(like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_female)
tableS2.4 <-lm(like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_male)
summary(tableS2.3)
summary(tableS2.4)
### With clustered SEs - women
stargazer(tableS2.3,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(tableS2.3,
clusters = dta_female$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition", "to_pfeml2"))
### With clustered SEs - men
stargazer(tableS2.4,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(tableS2.4,
clusters = dta_male$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition", "to_pfeml2"))
############################################
############ CREATING TABLE S3 #############
############################################
## Read in data
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
colnames(dta)
#creating the country-year fixed effects
dta$cntryyr <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "cntryyr", "to_pfeml", "from_rile", "to_rile",
"from_left_bloc", "from_right_bloc", "to_left_bloc", "to_right_bloc", "from_parfam", "to_parfam",
"to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
dta_nrr <- subset(dta, dta$to_parfam!=70)
dta_nrr <- subset(dta_nrr, dta_nrr$from_parfam!=70)
## Remove small parties, with fewer than 4 seats
dta_small_nrr <- subset(dta_nrr, dta_nrr$to_prior_seats >=4)
table.S3 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(country), data = dta_small_nrr)
summary(table.S3)
stargazer(table.S3,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S3,
clusters = dta_small_nrr$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING TABLE S3B ############
############################################
## Load
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "party_like", "to_parfam", "to_left_bloc", "to_right_bloc", "cntryyr", "to_pfeml",
"to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Remove small parties, with fewer than 4 seats
dta_small <- subset(dta, dta$to_prior_seats >=4)
table.3B.1 <-lm(party_like ~ to_pfeml + as.factor(cntryyr), data = dta_small)
table.3B.2 <-lm(party_like ~ to_pfeml + rile_distance_s + to_left_bloc + prior_coalition + prior_opposition + as.factor(cntryyr), data = dta_small)
summary(table.3B.2)
### With clustered SEs
stargazer(table.3B.1, table.3B.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.3B.1, table.3B.2,
clusters = dta_small$country),
keep = c("to_pfeml", "rile_distance_s", "to_left_bloc", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING TABLE S4 ############
############################################
## Read in data
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "countryyear", "to_pfeml", "from_rile", "to_rile",
"logDM", "to_left_bloc", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
### Split by year, 1996-2006 and 2007-2017
dta_early <- subset(dta, dta$year<=2006)
dta_late <- subset(dta, dta$year>=2007)
table.early <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_early)
table.late <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_late)
### Without small parties
dta_early_small <- subset(dta_early, dta_early$to_prior_seats >=4)
dta_late_small <- subset(dta_late, dta_late$to_prior_seats >=4)
table.4.1 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_early_small)
table.4.2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_late_small)
summary(table.4.1)
summary(table.4.2)
### With clustered SEs
stargazer(table.4.1,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.4.1,
clusters = dta_early_small$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition"
))
### With clustered SEs
stargazer(table.4.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.4.2,
clusters = dta_late_small$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition"
))
############################################
############ CREATING TABLE S5 #############
############################################
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "party_like", "countryyear",
"to_pfeml", "from_pfeml", "diff_pfeml", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Remove small parties, with fewer than 4 seats
dta_small <- subset(dta, dta$to_prior_seats >=4)
table.S5.1 <-lm(party_like ~ to_pfeml + from_pfeml + diff_pfeml + as.factor(countryyear), data = dta_small)
table.S5.2 <-lm(party_like ~ to_pfeml + from_pfeml + diff_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_small)
summary(table.S5.1)
summary(table.S5.2)
### With clustered SEs
stargazer(table.S5.1, table.S5.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S5.1, table.S5.2,
clusters = dta_small$country),
keep = c("to_pfeml", "from_pfeml", "diff_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING FIG. S1 #############
############################################
### Create Plot Data
## All values of Out-Party % women
plot_1 <- as.data.frame((unique(dta$to_pfeml)))
colnames(plot_1) <- c("to_pfeml")
## All 1 Sd above mean of In-party % women
plot_1$from_pfeml <- mean(dta$from_pfeml, na.rm=T) + sd(dta$from_pfeml, na.rm=T)
## Create difference between in-and out-party women
plot_1$diff_pfeml <- abs(plot_1$to_pfeml - plot_1$from_pfeml)
## Select other values (mean RILE distance, opposition together, France 2012 country year)
plot_1$rile_distance_s <- mean(dta$rile_distance_s, na.rm=T)
plot_1$prior_coalition <- 0
plot_1$prior_opposition <- 1
plot_1$countryyear <- "France2012"
plot_1$to_mp_number <- "31320"
plot_1$group <- "above_mean"
## All values of Out-Party % women
plot_2 <- as.data.frame((unique(dta$to_pfeml)))
colnames(plot_2) <- c("to_pfeml")
## All 1 Sd below mean of In-party % women
plot_2$from_pfeml <- mean(dta$from_pfeml, na.rm=T) - sd(dta$from_pfeml, na.rm=T)
## Create difference between in-and out-party women
plot_2$diff_pfeml <- abs(plot_2$to_pfeml - plot_2$from_pfeml)
## Select other values (opposition together, France 2012 country year)
plot_2$rile_distance_s <- mean(dta$rile_distance_s, na.rm=T)
plot_2$prior_coalition <- 0
plot_2$prior_opposition <- 1
plot_2$countryyear <- "France2012"
plot_2$to_mp_number <- "31320"
plot_2$group <- "below_mean"
plot_dta <- rbind(plot_1, plot_2)
###### Plot based on table.S5.2
figureS1.data <- as.data.frame(predict(table.S5.2, newdata = plot_dta, interval = "confidence"))
plot_dta$fit <- figureS1.data$fit
plot_dta$lwr <- figureS1.data$lwr
plot_dta$upr <- figureS1.data$upr
figS1 <- ggplot(plot_dta, aes(x=to_pfeml, y=fit, lty=group))
figS1 <- figS1 + geom_line() +
geom_ribbon(aes(x = to_pfeml, y = fit, ymin = lwr,
ymax = upr),
lwd = 1/2, alpha=0.1) +
theme_minimal() +
theme(plot.title = element_text(size=12)) +
ylab("Predicted Out-Party Thermometer Rating")+
xlab("Proportion of Out-Party Women MPs") +
theme(legend.position = "none") +
geom_text(x=0.70, y=5.3, label="in-party % of women is \n1 SD above the mean") +
geom_text(x=0.70, y=4.0, label="in-party % of women is \n1 SD below the mean", color="grey37") +
ylim(c(2.5,6.5));figS1
pdf("figS1.pdf")
figS1
dev.off()
############################################
############ CREATING TABLE S6 #############
############################################
## Read in data
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "countryyear", "to_pfeml", "from_rile", "to_rile",
"logDM", "to_left_bloc", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
dta_small <- subset(dta, dta$to_prior_seats >=4)
table.S6.1 <-lm(party_like ~ to_pfeml + rile_distance_s + logDM + prior_coalition + prior_opposition + as.factor(year), data = dta_small)
table.S6.2 <-lm(party_like ~ to_pfeml*logDM + rile_distance_s + prior_coalition + prior_opposition + as.factor(year), data = dta_small)
table.S6.3 <-lm(party_like ~ to_pfeml*logDM + rile_distance_s*logDM + prior_coalition*logDM + prior_opposition*logDM + as.factor(year), data = dta_small)
summary(table.S6.1)
summary(table.S6.2)
summary(table.S6.3)
stargazer(table.S6.1, table.S6.2, table.S6.3,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S6.1, table.S6.2, table.S6.3,
clusters = dta_small$country),
keep = c("to_pfeml", "rile_distance_s", "logDM", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING TABLE S7 #############
############################################
#Out party % women, non-clustered SEs
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
#creating the country-year fixed effects
dta$cntryyr <-paste(dta$country, dta$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "party_like", "cntryyr", "to_pfeml", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Creating squared term for out-party % women
dta$to_pfeml2 <- dta$to_pfeml^2
## Remove small parties, with fewer than 4 seats
dta <- subset(dta, dta$to_prior_seats >=4)
table.S7.1 <-lm(party_like ~ to_pfeml + to_pfeml2 + as.factor(cntryyr), data = dta)
table.S7.2 <-lm(party_like ~ to_pfeml + to_pfeml2 + rile_distance_s + prior_coalition + prior_opposition + as.factor(cntryyr), data = dta)
summary(table.S7.1)
summary(table.S7.2)
### With clustered SEs
stargazer(table.S7.1, table.S7.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S7.1, table.S7.2,
clusters = dta$country),
keep = c("to_pfeml", "to_pfeml2", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING FIG. S2 #############
############################################
### Create Plot Data
## All values of Out-Party % women
plot_S2 <- as.data.frame((unique(dta$to_pfeml)))
colnames(plot_S2) <- c("to_pfeml")
## Create difference between in-and out-party women
plot_S2$to_pfeml2 <- plot_S2$to_pfeml^2
## Select other values (mean RILE distance, opposition together, France 2012 country year)
plot_S2$rile_distance_s <- mean(dta$rile_distance_s, na.rm=T)
plot_S2$prior_coalition <- 0
plot_S2$prior_opposition <- 1
plot_S2$cntryyr <- "France2012"
plot_S2$to_mp_number <- "31320"
figureS2.data <- as.data.frame(predict(table.S7.2, newdata = plot_S2, interval = "confidence"))
plot_S2$fit <- figureS2.data$fit
plot_S2$lwr <- figureS2.data$lwr
plot_S2$upr <- figureS2.data$upr
figS2 <- ggplot(plot_S2, aes(x=to_pfeml, y=fit))
figS2 <- figS2 + geom_line() +
geom_ribbon(aes(x = to_pfeml, y = fit, ymin = lwr,
ymax = upr),
lwd = 1/2, alpha=0.1) +
theme_minimal() +
theme(plot.title = element_text(size=12)) +
ylab("Predicted Out-Party Thermometer Rating")+
xlab("Proportion of Out-Party Women MPs") +
ylim(c(2,5));figS2
pdf("figS2.pdf")
figS2
dev.off()
############################################
############ CREATING TABLE S8 #############
############################################
#Women-led parties
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
dta_womenlead <- subset(dta, dta$to_femaleleader==1)
#creating the country-year fixed effects
dta_womenlead$countryyear <-paste(dta_womenlead$country, dta_womenlead$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "countryyear", "to_pfeml", "to_prior_seats")
dta_womenlead <- dta_womenlead[vars]
dta_womenlead <- na.omit(dta_womenlead)
## Exclude small parties
dta_womenlead <- subset(dta_womenlead, dta_womenlead$to_prior_seats >=4)
table.S8A1 <-lm(party_like ~ to_pfeml + as.factor(countryyear), data = dta_womenlead)
table.S8A2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_womenlead)
summary(table.S8A1)
summary(table.S8A2)
### With clustered SEs
stargazer(table.S8A1, table.S8A2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S8A1, table.S8A2,
clusters = dta_womenlead$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
#Male-led parties
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
dta_malelead <- subset(dta, dta$to_femaleleader==0)
#creating the country-year fixed effects
dta_malelead$countryyear <-paste(dta_malelead$country, dta_malelead$year, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "countryyear", "to_pfeml", "to_prior_seats")
dta_malelead <- dta_malelead[vars]
dta_malelead <- na.omit(dta_malelead)
## Exclude small parties
dta_malelead <- subset(dta_malelead, dta_malelead$to_prior_seats >=4)
table.S8B1 <-lm(party_like ~ to_pfeml + as.factor(countryyear), data = dta_malelead)
table.S8B2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta_malelead)
summary(table.S8B1)
summary(table.S8B2)
### With clustered SEs
stargazer(table.S8B1, table.S8B2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S8B1, table.S8B2,
clusters = dta_malelead$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING TABLE S9 #############
############################################
## Read in data
load("dyadic_data_1-4-22.Rdata")
dta <- updated_data
#creating the country-year fixed effects
dta$countryyear <-paste(dta$country, dta$year, sep = "")
#creating the party fixed effects / cluster
dta$partydyad <-paste(dta$from_mp_number, dta$to_mp_number, sep = "")
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike","party_like", "countryyear", "to_pfeml",
"from_rile", "to_rile", "to_mp_number", "partydyad", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Exclude small parties
dta <- subset(dta, dta$to_prior_seats >=4)
table.S9 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(countryyear), data = dta)
summary(table.S9)
### With clustered SEs
stargazer(table.S9,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Out-Party Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S9,
clusters = dta$partydyad),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
############################################
############ CREATING TABLE 10 #############
############################################
load("dyadic_data_1-4-22.Rdata")
dta <-updated_data
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "party_dislike", "to_pfeml", "party_like", "to_prior_seats")
dta <- dta[vars]
dta <- na.omit(dta)
## Remove small parties, with fewer than 4 seats
dta_small <- subset(dta, dta$to_prior_seats >=4)
table.S10.1 <-lm(party_like ~ to_pfeml + as.factor(country), data = dta_small)
table.S10.2 <-lm(party_like ~ to_pfeml + rile_distance_s + prior_coalition + prior_opposition + as.factor(country), data = dta_small)
summary(table.S10.2)
### With clustered SEs
stargazer(table.S10.1, table.S10.2,
add.lines = list(c("Country-Year Fixed Effects?", "Yes"), c("Country-Level Clustered SEs?", "Yes")),
se = starprep(table.S10.1, table.S10.2,
clusters = dta_small$country),
keep = c("to_pfeml", "rile_distance_s", "prior_coalition", "prior_opposition",
"econ_distance_s", "society_distance_s"))
##################################################
############ CREATING TABLES 11 & 12 #############
##################################################
load("Data/multilevel_1-5-22.Rdata")
indiv_data <-multilevel_data
vars <- c("rile_distance_s", "prior_coalition", "prior_opposition", "econ_distance_s", "society_distance_s",
"year", "country", "cntryyr", "to_pfeml", "from_pfeml", "thermometer_score", "ID", "party_to", "party_from",
"from_partyname", "to_partyname", "to_left_bloc", "from_left_bloc",
"to_right_bloc", "from_right_bloc", "gender", "to_parfam", "from_parfam", "to_prior_seats",
"from_mp_number", "to_mp_number")
indiv_data <- indiv_data[vars]
## Create gender variable
indiv_data <-mutate(indiv_data, gender = ifelse(gender == "1", "male",
ifelse(gender == "2", "female", NA)))
indiv_data$gender <-as.factor(indiv_data$gender)
##filter out parties with no data, mainly parties who were not in parliament plus a few cases from early 1990s
indiv_data <-filter(indiv_data, is.na(to_pfeml) == F)
### Create dyads for FEs/Clustered SEs
indiv_data$dyad <-paste(indiv_data$from_mp_number, indiv_data$to_mp_number, sep ="_to_")
### Create Table 11, column 1, with Standard errors clustered at country-year, party-dyad, and individual levels
table11A.1.1 <-feols(thermometer_score ~ to_pfeml | ID, data = indiv_data, cluster = ~cntryyr)
table11A.1.2 <-feols(thermometer_score ~ to_pfeml | ID, data = indiv_data, cluster = ~dyad)
table11A.1.3 <-feols(thermometer_score ~ to_pfeml | ID, data = indiv_data, cluster = ~ID)
### Create Table 11, column 2, with Standard errors clustered at country-year, party-dyad, and individual levels
table11A.2.1 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | ID, data = indiv_data, cluster = ~cntryyr)
table11A.2.2 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | ID, data = indiv_data, cluster = ~dyad)
table11A.2.3 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | ID, data = indiv_data, cluster = ~ID)
### Create Table 11B, column 1, with Standard errors clustered at country-year, party-dyad, and individual levels
table11B.1.1 <-feols(thermometer_score ~ to_pfeml | cntryyr, data = indiv_data, cluster = ~cntryyr)
table11B.1.2 <-feols(thermometer_score ~ to_pfeml | cntryyr, data = indiv_data, cluster = ~dyad)
table11B.1.3 <-feols(thermometer_score ~ to_pfeml | cntryyr, data = indiv_data, cluster = ~ID)
### Create Table 11B, column 2, with Standard errors clustered at country-year, party-dyad, and individual levels
table11B.2.1 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | cntryyr, data = indiv_data, cluster = ~cntryyr)
table11B.2.2 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | cntryyr, data = indiv_data, cluster = ~dyad)
table11B.2.3 <-feols(thermometer_score ~ to_pfeml + + rile_distance_s + prior_coalition + prior_opposition | cntryyr, data = indiv_data, cluster = ~ID)
|