Testing the Robustness of Gubernatorial Partisanship in the Timing of COVID-19 Policies

MSc. dissertation submitted to the London School of Economics and Political Science, School of Government

Tony Chen1

24/08/2021


Author’s notes

This is the HTML version of my MSc. dissertation, “Testing the Robustness of Gubernatorial Partisanship in the Timing of COVID-19 Policies”, submitted to School of Government at the London School of Economics and Political Science for the completion of my dual degree in Public Administration and Government. The HTML version offers interactive elements that the submitted (static) version lacked. For example, graphs offer additional information when the cursor hovers over points, and views are adjustable so the reader is free to explore the data further. Additionally, the HTML assists in reproduction, as the relevant R code directly precedes applicable segments.

Demonstration
A quick demonstration. All graphics are interactive with many features to explore.

All efforts have been taken so the HTML version mirrors the submitted version as much as possible. Only one change has been made to the text: the submitted version incorrectly referred to an infinity error as arising from logging one. This has been corrected to state that the logging error results from trying to log zero.

Abstract

Using the USA subnational dataset compiled under the Oxford COVID Government Response Tracker, this paper investigates the robustness of the party affiliations of American state governors against the timings of policies in response to COVID-19. A series of Cox proportional hazards models are run against 15 containment and closure, economic, and health system policies. For further sensitivity checks, different levels of policy intensity and geographic scope are also modelled, along with 14 alternative variables. This paper contributes to existing research that has similarly used event history analysis to gauge the effects of partisanship on lockdown orders. This paper expands on the literature by applying this technique to a greater multitude of policies. In support of past research, this paper finds that the governor’s political affiliation significantly explains variations in some lockdown orders. Further, this paper additionally finds that certain economic and health policies vary according to the partisanship of the state executive. Most importantly, this paper finds that the governor’s party affiliation is not a robust predictor for types of policies and under several policy parameters.

Acknowledgements

I send my sincerest gratitude to my parents, who have always supported me and are the reason that I am so lucky to be typing these words right now. Thank you to all the professors and staff at the London School of Economics and Political Science for trying their best during the COVID-19 to make this year as enjoyable as possible. I am also extremely grateful for the friends and classmates that I have met, who made me look forward to going to class every day (when we still could). Thank you to the anonymous strangers on the internet who ask and answer questions on Stack Overflow and the OXCGRT team; I would have never managed this dissertation in time otherwise. Lastly, special thanks to Ridge, who saved me from exhaustion.

Introduction

This paper investigates the timings at which governors in the United States adopt policies in response to the COVID-19 pandemic. Whereas previous research has largely focused on the enactment of lockdown orders, this paper examines whether the political affiliation of the governor is a robust determinant of the time before policy enactment across a wide range of containment, economic, and health policies. This paper relies on policy data is drawn from Oxford COVID-19 Government Response Tracker (OXCGRT), USA dataset (Hallas et al. 2021), and uses a series of Cox proportional hazards models to derive the hazard ratios of gubernatorial party affiliation for time-to-policies while controlling for covariates and across different policy types.

The threat to public health posed by the COVID-19 pandemic has necessitated strong and centralized government responses. High rates of infections, hospitalizations, and deaths recurrently overwhelmed public health systems (McMinn et al. 2021). In the initial absence of recognized pharmaceutical interventions like vaccines, authorities resorted to containment and closure policies, often known as “nonpharmaceutical interventions” (NPIs), that include the closure of schools and businesses and restrictions on gatherings and travel in order to promote social distancing and slow the transmission of the coronavirus (Sebhatu et al. 2020, 21202). To help alleviate the economic repercussions of these policies, governments have also initiated financial assistance programs, like income support and debt or contract relief for households. When COVID-19 vaccines became available, governments took significant responsibilities over their procurement and distribution. Aside from vaccine policy, governments enacted a range of health-related directives, such as the dissemination of information to the public, COVID testing, contact tracing, recommending or requiring the wearing of facial coverings, and special protections for those especially vulnerable (such as the elderly in care homes). Under one interpretation of these policies, COVID-19 has comprehensively engaged the “tools” of government: nodality (the collection and dispensing of information), authority (the powers to “determine” in a legal sense and to back determinations with police powers), treasure (the dispersion of government funds), and organization (the availability and use of the government’s own personnel) (Hood and Margetts 2007, chap. 1).

The timing of some policies has been key to slowing the spread of COVID-19. Nearly immediate lockdowns in China during the onset of the pandemic in 2020 seemed to have drastically curbed the transmission of the coronavirus (Baccini and Brodeur 2021, 215). For example, in an assessment of the efficacy of early NPIs in the United States from March 15, 2020, to May 3, 2020, Pei, Kandula, and Shaman (2020, 1) estimate that 56.5% of reported infections and 54.0% of reported deaths as of May 3, 2020, may have been averted had the same social distancing and contact restriction controls been implemented one week earlier.

However, given the novelty of COVID-19, especially during its initial spread, the efficacy of different policy options was necessarily ambiguous. Sebhatu et al. (2020, 21202–3) suggest that policy diffusion between neighbouring countries played an important role in triggering similar policies across otherwise heterogeneous countries during times of uncertainty. Furthermore, the costs of policies were highly salient to political decision-makers. Closing schools, businesses, and depriving people of basic liberties carry severe and long-lasting social and economic costs, and some governments may lack the economic capacity to offset the resulting deprivations their citizens would face (Adolph et al. 2021, 4). There is also the political risk of “overreacting,” whereby the public bears the costs of policies that are too successful without appreciating the benefits. Lastly, enacting policies earlier or wider is not necessarily better. For example, while late lockdowns may lead to spiralling infections, NPIs that are introduced too early or too uniformly may increase the risk of resurging infections once the interventions end (Sebhatu et al. 2020, 21207). These conditions created an environment of extreme uncertainty under which political executives must make policy decisions.

American Federalism and COVID-19

In the United States, executive powers to manage the COVID-19 pandemic have largely fallen to state governors. For example, the statutory powers to impose the most stringent policies (quarantine and isolation) are derived from the state (often directly from the governor or indirectly through the state health officer or health board) (“State Quarantine and Isolation Statutes” 2020). In at least two states, Hawaii and Virginia, statutes also expressly grant the state with powers to require immunization on individuals within the state. Constitutionally, the federal government is limited in its authority to impose public health measures by the Tenth Amendment, which reserves all powers not delegated to the United States by the Constitution to the states or the people (“The Bill of Rights: A Transcription” 2015). As a 2014 Congressional Research Service report neatly summarizes the division of labour:

“The authority of the federal government to prescribe quarantine and other health measures is based on the Commerce Clause, which gives Congress exclusive authority to regulate interstate and foreign commerce. Thus, state and local governments have the primary authority to control the spread of dangerous diseases within their jurisdictions, and the federal government has the authority to quarantine and impose other health measures to prevent the spread of diseases from foreign countries and between states. In addition, the federal government may assist state efforts to prevent the spread of communicable diseases if requested by a state or if state efforts are inadequate to halt the spread of disease.” (Cole 2014, sec. Summary)

Aside from legal constraints, the federal government often failed to take charge and coordinate policy across the levels of government, and even occasionally sought to undermine the policies of subnational governments. Counter to the messages of public health leaders, the White House under President Trump downplayed the severity of the pandemic and urged states to reopen, culminating in a series of tweets by the former president to “liberate” their states (Adolph et al. 2021, 4; Warner and Zhang 2021, 178). During this period, public opinion on COVID-19 also became politically divided, as did media coverage. In turn, the early federal response to COVID-19 under President Trump not only compelled subnational governments to compensate for the lack of coordination but also further contributed to the uncertainty of the decision-making environment by politicizing the issue.

Given the politicization and uncertainty around COVID-19 in the U.S., it is possible that the political affiliation of governors played a key role in the timings of COVID-related policies. This is a conclusion supported by Baccini and Brodeur (2021), Wang, Devine, and Molina-Sieiro (2021), Adolph et al. (2021), and Warner and Zhang (2021) in their event history analyses, commonly known as “survival analysis.”

Wang, Devine, and Molina-Sieiro (2021, 8–15) argue that upper echelons theory (UET) may help explain these results. UET originates from the field of management and is premised on the bounded rationality of executives to interpret complex and uncertain situations comprehensively and objectively, which means that executive actions are likely based on construed, value-based realities than on calculations of optimal decisions. Governors, then, as the political equivalents to business executives at the subnational level in terms of their hierarchical position, discretionary powers, and responsibilities, are likely to have based their COVID-policy enactments on their political affiliations, which approximates philosophical divergences in value preferences (e.g., the Democratic Party prefers a big or more active government while the Republican Party prefers smaller government).

On the other hand, Adolph et al. (2021, 13–14) offer a more realpolitik explanation for the significance of partisanship. The authors argue that Republicans simply had fewer incentives to act quickly. First, partisans have a tendency of minimizing failure by their own leaders. For example, Republicans expressed more concern about Ebola under President Obama than about COVID-19 under President Trump. Second, building on the inherent difficulty in accurately comprehending small but non-zero risks, Republican voters were more likely to erroneously equate the fatality rate and disease burden of COVID-19 to that of the flu. Third, partisans follow the cues put out by their leaders, and President Trump heavily insinuated that COVID-19 may be an overblown issue or a hoax in the early stages of the pandemic. Lastly, the authors argue that Republican officials were most certainly aware of the possible reprisals they may face. Given the propensity of President Trump to attack fellow party members perceived to be disloyal, Republican governors likely appreciated the threat to their political careers and the discretionary federal spending to their states if they did not tow the party line.

While this paper is primarily occupied with evaluating the empirical robustness of the governor’s party affiliation to policy enactments per state, as opposed to presenting a theoretical explanation of why partisanship may or may not have an effect, these hypotheses are nevertheless important for setting expectations for the performance of the variable against a multitude of COVID-related policies. We may stylize our null hypothesis broadly as:

  \(H_{0}\): the governor’s party affiliation is not significant in explaining the time-to-policy i, or
\(H_{0}\): \(\beta_{AFFILIATION,i}=0\)
Equation 1. Null hypothesis

Where i refers to some policy tracked by OXCGRT at some predefined ordinal level of intensity that includes either state-wide orders only or any order and 0 as the true effect of governors’ political affiliations on timing and enacting policies. The significance level is set at the 5% or 0.05 level for all hypothesis tests. However, due to ongoing debates regarding the weight and reporting of p-values and statistical significance, this paper is largely devoted to contextualizing model results against a series of robustness checks and qualitative evidence.

Data

Response Variables

Policy data is drawn from the OXCGRT USA subnational dataset (Hallas et al. 2021). Daily policy indicators are measured either on an ordinal scale, denoting policy intensity, or in USD when the policy being tracked pertains to a type of spending (e.g., stimulus spending). Policies recorded in USD are excluded due to formatting issues for event history analysis and the low numbers of enactments (i.e., “events”). OXCGRT organizes COVID-related policies into five groups of policy indicators, and this paper focuses on three groups of 15 policies after these exclusions: 7 containment and closure policies, 2 economic policies, and 6 health system policies, as depicted in Figure 1. The observation period starts on 9 January 2020, when the World Health Organization (WHO) first announced the emergence of coronavirus-related pneumonia in Wuhan, China (“A Timeline of COVID-19 Developments in 2020” 2021). This eliminates the possibility of left-censored data, especially with policies enacted early (such as uncoordinated public information campaigns and airport screenings). More importantly, this accurately reflects the point at which governments first became “susceptible” to the possibility of enacting COVID-related policies.

Figure 9. Cumulative hazard graphs for all evaluated policies.
library(tidyverse)
library(plotly)
library(RCurl)
library(lubridate)
library(survival)
library(survminer)
library(zoo)
library(readxl)
library(My.stepwise)
library(kableExtra)
library(texreg)
library(stringr)
library(DT)
library(tilemaps)
library(sf)
library(gtsummary)
library(labelled)
source("c3aidatalake.R")

githubfile <- getURL('https://raw.githubusercontent.com/OxCGRT/USA-covid-policy/master/data/OxCGRT_US_latest.csv') #Oxford CGRT USA Data

policies <- read.csv(text = githubfile)
policies <- policies %>%
  mutate(RegionName = as.character(RegionName %>% na_if(.,""))) %>%
  mutate(RegionName = replace_na(RegionName, "USA")) %>%
  mutate(Day = as.Date(paste(policies$Date, sep = ""), "%Y%m%d"), flag_dummy = 1)

# Panel data to survival data conversion functions: reaction speed for any policy (targeted or general/state-wide)
panel_to_surv_any_speed <- function(policy, level) {
  policies %>%
  select(Day, RegionName, policy) %>%
  rename(pol = policy) %>%
  drop_na() %>%
  filter(Day >= "2020-01-09") %>%
  filter(Day <= "2021-07-09") %>%
  group_by(RegionName) %>%
  arrange(Day) %>%
  mutate(tstart = row_number() - 1, tstop = row_number(), temp = cumsum(pol >= level)) %>%
  group_by(RegionName) %>%
  mutate(status = ifelse(pol >= level, 1, 0)) %>%
  filter(temp <= 1) %>%
  mutate(endpt = max(status), start = min(tstart), stop = max(tstop)) %>%
  slice_max(order_by = tstop) %>%
  select(dates = Day, RegionName, start, stop, status, tstart, tstop, endpt) %>%
  filter(RegionName != "USA" && RegionName != "Washington DC") %>%
  ungroup()
}

# Panel data to survival data conversion functions: reaction speed for state-wide policies only
panel_to_surv_general_speed <- function(policy, flag, level) {
  policies %>%
  select(Day, RegionName, policy, flag) %>%
  rename(pol = policy, polflag = flag) %>%
  filter(Day >= "2020-01-09") %>%
  filter(Day <= "2021-07-09") %>%
  mutate(general_only = ifelse(polflag == 1, pol, 0)) %>%
  mutate(general_only = replace_na(general_only, 0)) %>%
  group_by(RegionName) %>%
  arrange(Day) %>%
  mutate(tstart = row_number() - 1, tstop = row_number(), temp = cumsum(general_only >= level), cumtemp = cumsum(temp)) %>%
  group_by(RegionName) %>%
  mutate(status = ifelse(general_only >= level, 1, 0)) %>%
  filter(cumtemp <= 1) %>%
  mutate(endpt = max(status), start = min(tstart), stop = max(tstop)) %>%
  slice_max(order_by = tstop) %>%
  select(dates = Day, RegionName, start, stop, status, tstart, tstop, endpt) %>%
  filter(RegionName != "USA" && RegionName != "Washington DC") %>%
  ungroup()  
}

C1_general_speed_2 <- panel_to_surv_general_speed("C1_School.closing", "C1_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C2_general_speed_2 <- panel_to_surv_general_speed("C2_Workplace.closing", "C2_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C3_general_speed_2 <- panel_to_surv_general_speed("C3_Cancel.public.events", "C3_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C4_general_speed_1 <- panel_to_surv_general_speed("C4_Restrictions.on.gatherings", "C4_Flag", 1) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C5_general_speed_2 <- panel_to_surv_general_speed("C5_Close.public.transport", "C5_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C6_general_speed_2 <- panel_to_surv_general_speed("C6_Stay.at.home.requirements", "C6_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C7_general_speed_2 <- panel_to_surv_general_speed("C7_Restrictions.on.internal.movement", "C7_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C8_any_speed_1 <- panel_to_surv_any_speed("C8_International.travel.controls", 1) #No flag

E1_any_speed_1 <- panel_to_surv_any_speed("E1_Income.support", 1) #Binary flag for sectoral scope: 0 - formal sector workers only or informal sector workers only, 1 - all workers
E2_any_speed_1 <- panel_to_surv_any_speed("E2_Debt.contract.relief", 1) #No flag

H1_general_speed_2 <- panel_to_surv_general_speed("H1_Public.information.campaigns", "H1_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
H2_any_speed_1 <- panel_to_surv_any_speed("H2_Testing.policy", 1) #No flag
H3_any_speed_1 <- panel_to_surv_any_speed("H3_Contact.tracing", 1) #No flag
H6_general_speed_2 <- panel_to_surv_general_speed("H6_Facial.Coverings", "H6_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
H7_any_speed_1 <- panel_to_surv_any_speed("H7_Vaccination.policy", 1) #Binary flag for cost: 0 - At cost to individual (or funded by NGO, insurance, or partially government funded), 1- No or minimal cost to individual (government funded or subsidised), Blank - no data
H8_general_speed_2 <- panel_to_surv_general_speed("H8_Protection.of.elderly.people", "H8_Flag", 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data

# Governor data
governors <- read.csv("us-governors.csv") %>% # Current governors data from Civil Service USA downloaded 2021/07/06 https://github.com/CivilServiceUSA/us-governors 
  select(RegionName = state_name, governor_party = party, governor_name = name, governor_gender = gender, governor_date_of_birth = date_of_birth, governor_entered_office = entered_office, governor_term_end = term_end) %>%
  # Add governors active during 2020/before elections or retirement
  add_row(RegionName = "Montana", governor_party = "democrat", governor_name = "Steve Bullock", governor_gender = "male", governor_date_of_birth = "1966-04-11", governor_entered_office = "2013-01-07", governor_term_end = "2021-01-04") %>%
  add_row(RegionName = "Utah", governor_party = "republican", governor_name = "Gary Herbert", governor_gender = "male", governor_date_of_birth = "1947-05-07", governor_entered_office = "2009-08-11", governor_term_end = "2021-01-04") %>%
  add_row(RegionName = "Rhode Island", governor_party = "democrat", governor_name = "Gina Raimondo", governor_gender = "female", governor_date_of_birth = "1971-05-17", governor_entered_office = "2015-01-06", governor_term_end = "2021-03-02") %>%  
  add_row(RegionName = "Mississippi", governor_party = "republican", governor_name = "Dewey Phillip Bryant", governor_gender = "male", governor_date_of_birth = "1954-12-09", governor_entered_office = "2012-01-10", governor_term_end = "2020-01-14") %>%  
  # Party of James Justice (West Virginia) is incorrectly listed as democrat; should be republican
  add_row(RegionName = "West Virginia", governor_party = "republican", governor_name = "James Justice", governor_gender = "male", governor_date_of_birth = "1951-04-27", governor_entered_office = "2017-01-16", governor_term_end = "2023-01-01") %>%
  slice(-c(48)) %>%
  # Calculate ages/times
  mutate(governor_date_of_birth = as.Date(governor_date_of_birth), governor_entered_office = as.Date(governor_entered_office), governor_term_end = as.Date(governor_term_end)) %>%
  mutate(governor_age = floor(time_length(interval(governor_date_of_birth, as.Date("2020-01-09")), "years"))) %>%
  # Capitalize
  mutate(governor_party = str_to_title(governor_party), governor_gender = str_to_title(governor_gender))

states_abbreviations <- read.csv("states.csv") %>% # states and abbreviations downloaded 2021/08/15 https://github.com/jasonong/List-of-US-States/blob/master/states.csv
  rename(RegionName = State)

cumhazardplotdata <- function(data, policy, pol) {
  data %>%
  arrange(dates) %>%
  inner_join(governors, by = "RegionName") %>%
  inner_join(states_abbreviations, by = "RegionName") %>%
  mutate(in_office = ifelse(governor_entered_office < dates & governor_term_end > dates, 1, 0)) %>%
  filter(in_office == 1) %>%
  mutate(count = cumsum(status)/50, policy = policy, pol = pol)
}

ccpolicies_cumhazarddata <- cumhazardplotdata(C1_general_speed_2, "C1 Close some schools", "C1") %>%
  bind_rows(cumhazardplotdata(C2_general_speed_2, "C2 Close some workplaces", "C2")) %>%
  bind_rows(cumhazardplotdata(C3_general_speed_2, "C3 Cancel public events", "C3")) %>%
  bind_rows(cumhazardplotdata(C4_general_speed_1, "C4 No gatherings >1000 people", "C4")) %>%
  bind_rows(cumhazardplotdata(C5_general_speed_2, "C5 Close public transit", "C5")) %>%
  bind_rows(cumhazardplotdata(C6_general_speed_2, "C6 Require stay at home with exceptions", "C6")) %>%
  bind_rows(cumhazardplotdata(C7_general_speed_2, "C7 Restrict internal movement", "C7")) %>%
  bind_rows(cumhazardplotdata(C8_any_speed_1, "C8 Screen international arrivals", "C8"))

ecpolicies_cumhazarddata <- cumhazardplotdata(E1_any_speed_1, "E1 Income support (<50% salary/median salary)", "E1") %>%
  bind_rows(cumhazardplotdata(E2_any_speed_1, "E2 Narrow debt/contract relief", "E2"))

hepolicies_cumhazarddata <- cumhazardplotdata(H1_general_speed_2, "H1 Coordinated information campaign", "H1") %>%
  bind_rows(cumhazardplotdata(H2_any_speed_1, "H2 Selective testing (symptomatic + other criteria)", "H2")) %>%
  bind_rows(cumhazardplotdata(H3_any_speed_1, "H3 Limited contract tracing", "H3")) %>%
  bind_rows(cumhazardplotdata(H6_general_speed_2, "H6 Require face coverings sometimes", "H6")) %>%
  bind_rows(cumhazardplotdata(H7_any_speed_1, "H7 Vaccines available for only 1 key group", "H7")) %>%
  bind_rows(cumhazardplotdata(H8_general_speed_2, "H8 Narrow restrictions to protect elderly", "H8"))

plot_ly() %>%
  add_trace(data = ccpolicies_cumhazarddata, x = ~dates, y = ~jitter(count, 1), type = "scatter", mode = "lines+markers", opacity = 1, name = ~policy, symbol = ~policy, marker = list(size = 5, colors = ~governor_party), line = list(width = 1), 
            text = ~RegionName, meta = ~governor_name, customdata = ~str_to_title(governor_party),
            hovertemplate = paste('State: %{text}<br>',
                                  'Governor: %{meta}</b></br>',
                                  'Party: %{customdata}</b></br>',
                                  'Date: %{x}<br>',
                                  'Enactment: %{y:.0%}')) %>%
  plotly::config(modeBarButtonsToAdd = list('drawopenpath', 'eraseshape'), displaylogo = FALSE) %>%
  layout(title = 'Containment and Closure',
         xaxis = list(title = "", range = c("2020-01-09", "2020-05-09")), 
         yaxis = list(title = "Percentage of states adopted (%)", tickformat = "%"), 
         font = list(family = "Times New Roman"), 
         legend = list(borderwidth = 1, orientation = "h"),
         margin = list(t = 50))
plot_ly() %>%
  add_trace(data = ecpolicies_cumhazarddata, x = ~dates, y = ~jitter(count, 1), type = "scatter", mode = "lines+markers", opacity = 1, name = ~policy, symbol = ~policy, marker = list(size = 5, colors = ~governor_party), line = list(width = 1), 
            text = ~RegionName, meta = ~governor_name, customdata = ~str_to_title(governor_party),
            hovertemplate = paste('State: %{text}<br>',
                                  'Governor: %{meta}</b></br>',
                                  'Party: %{customdata}</b></br>',
                                  'Date: %{x}<br>',
                                  'Enactment: %{y:.0%}')) %>%
  plotly::config(modeBarButtonsToAdd = list('drawopenpath', 'eraseshape'), displaylogo = FALSE) %>%
  layout(title = 'Economic',
         xaxis = list(title = "", range = c("2020-01-09", "2020-05-09")), 
         yaxis = list(title = "Percentage of states adopted (%)", tickformat = "%"), 
         font = list(family = "Times New Roman"), 
         legend = list(borderwidth = 1, orientation = "h"),
         margin = list(t = 50))
plot_ly() %>%
  add_trace(data = hepolicies_cumhazarddata, x = ~dates, y = ~jitter(count, 1), type = "scatter", mode = "lines+markers", opacity = 1, name = ~policy, symbol = ~policy, marker = list(size = 5, colors = ~governor_party), line = list(width = 1), 
            text = ~RegionName, meta = ~governor_name, customdata = ~str_to_title(governor_party),
            hovertemplate = paste('State: %{text}<br>',
                                  'Governor: %{meta}</b></br>',
                                  'Party: %{customdata}</b></br>',
                                  'Date: %{x}<br>',
                                  'Enactment: %{y:.0%}')) %>%
  plotly::config(modeBarButtonsToAdd = list('drawopenpath', 'eraseshape'), displaylogo = FALSE) %>%
  layout(title = 'Health',
         xaxis = list(title = "", range = c("2020-01-09", "2020-05-09")), 
         yaxis = list(title = "Percentage of states adopted (%)", tickformat = "%"),
         font = list(family = "Times New Roman"), 
         legend = list(borderwidth = 1, orientation = "h"),
         margin = list(t = 50))

Note: Cumulative hazard ratios for policies grouped by function (from top to bottom: containment and closure, economic, and health).

The end date to the observation period is set as 9 July 2021, which provides for data from the last twelve months of Donald Trump’s presidency and the first six months of Joe Biden’s presidency. This also provides for policy data after vaccines first became available in the United States in December 2020. States that do not enact a policy before the end of this period are treated as right-censored.

In the ordinal scale of policy strictness, recommendations from governments tend to be coded as “1” (with “0” representing no measures). While dispensing information and influencing the public is a major exercise of the nodality tool of government, it is not sufficiently effectual to be of the greatest relevance to our research question. As such, policies recorded with ordinal levels representing the first level of imposition or above (for example, a coordinated policy action mobilizing the bureaucracy or the implementation of legal requirements and restrictions) will be used for our primary analysis.

Many policy indicators are also accompanied by a binary flag for geographic scope. For our primary analysis, only generally applied, state-wide policies are examined. This exclusion exists for two reasons. First, it ensures that the order could only have come from the state government, and not from a municipal government. Event history analysis conducted by Brandtner et al. (2021) showed that municipal city and county governments often compensated for a lack of action at the state-level by instituting shelter-in-place orders ahead of state governments, so the exclusion of geographically targeted orders is a precaution against interpreting a false equivalency between county orders and state orders. Second, while geographically targeted policies may have originated from state officials, they do not represent a level of stringency that is most relevant to the research question.

Where there is no binary flag or the flag denotes another aspect (like cost or sector), the policy is presumed to only exist as a state-wide or general policy given the nature of those policies (for example, international travel controls or vaccination policies). Finally, the closure of public transportation is excluded because only two states, Maine and Maryland, enacted these policies. In total, 684 policy enactments are recorded under these criteria.

Containment and Closure Policies

The 7 containment and closure policies included here are C1 school closures, C2 workplace closures, C3 cancellation of public events, C4 restrictions on gatherings, C6 stay at home requirements, C7 restrictions on internal movement, and C8 international travel controls.

For C1, only state-wide enactments recorded at level “2” of policy strictness or above out of 3 possible levels are counted, with level 2 representing the closure of only some levels or categories of schools or universities. This results in 50 recorded policy events, or universal adoption. Here, C2 records, at the minimum, state-wide requirements to close or to work from home for some sectors or categories of workers and produces 50 policy events. C3 records required cancellations of public events across states and has 49 events. C4 records limits on gatherings in terms of the number of people allowed to congregate, and there are 49 recorded restrictions on very large gatherings (over 1,000 people) or more restrictive requirements. Requirements to stay at home, except for exercise, grocery shopping or other essential trips, or even more restrictive shelter-in-place policies are recorded with C6, totalling at 39 enactments. C7 records 30 internal movement restrictions enacted, or restrictions on movement between cities or regions. C8 pertains to international travel controls (that is to say, policies directed at foreign travellers, not citizens) and does not carry a binary flag for geographic scope. Here, policies mandating the screening arrivals or more restrictive policies (like the quarantining or outright bans of arrivals) are counted to a sum of 34 policy events. The distributions of containment and closure policies by the political affiliation of the enacting governor are illustrated in Figure 2.

Figure 2. Distribution of containment and closure policies by party.
summary_policies <- ccpolicies_cumhazarddata %>%
    mutate(category = "Containment and closure policies") %>%
    bind_rows(mutate(ecpolicies_cumhazarddata, category = "Economic policies")) %>%
    bind_rows(mutate(hepolicies_cumhazarddata, category = "Health system policies")) %>%
    group_by(policy, governor_party) %>%
    mutate(nevents = sum(endpt)) %>%
    filter(endpt != 0) %>%
    mutate(median = median(tstop), q25 = quantile(tstop, prob = 0.25), q75 = quantile(tstop,
        prob = 0.75), logdays = log(tstop), weeks_since = time_length(interval("2020-01-09",
        dates), "weeks"), months_since = time_length(interval("2020-01-09", dates),
        "months")) %>%
    arrange(desc(pol))

closures_violin <- filter(summary_policies, category == "Containment and closure policies") %>%
    filter(pol != "C5" & pol != "C6" & pol != "C7" & pol != "C8") %>%
    plot_ly(type = "violin", orientation = "h", sort = FALSE)
closures_violin <- closures_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Democrat"], x = ~logdays[summary_policies$governor_party ==
        "Democrat"], legendgroup = "Democrat governor", scalegroup = "Democrat governor",
        name = "Democrat governor", side = "positive", box = list(visible = F), meanline = list(visible = T),
        color = I("blue"), hoveron = "kde+points")
closures_violin <- closures_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Republican"], x = ~logdays[summary_policies$governor_party ==
        "Republican"], legendgroup = "Republican governor", scalegroup = "Republican governor",
        name = "Republican governor", side = "negative", box = list(visible = F),
        meanline = list(visible = T), color = I("red"), hoveron = "kde+points")
closures_violin <- closures_violin %>%
    layout(yaxis = list(title = "Closure requirements", range = c(-0.75, 3.75), showgrid = T,
        tickangle = -45), xaxis = list(title = "Log days", zeroline = F, showgrid = T),
        font = list(family = "Times New Roman"), legend = list(borderwidth = 1),
        violingap = 0, violingroupgap = 0, violinmode = "overlay")

containment_violin <- filter(summary_policies, category == "Containment and closure policies") %>%
    filter(pol != "C5" & pol != "C1" & pol != "C2" & pol != "C3" & pol != "C4") %>%
    plot_ly(type = "violin", orientation = "h", sort = FALSE)
containment_violin <- containment_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Democrat"], x = ~logdays[summary_policies$governor_party ==
        "Democrat"], legendgroup = "Democrat governor", scalegroup = "Democrat governor",
        name = "Democrat governor", side = "positive", box = list(visible = F), meanline = list(visible = T),
        color = I("blue"), hoveron = "kde+points", showlegend = F)
containment_violin <- containment_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Republican"], x = ~logdays[summary_policies$governor_party ==
        "Republican"], legendgroup = "Republican governor", scalegroup = "Republican governor",
        name = "Republican governor", side = "negative", box = list(visible = F),
        meanline = list(visible = T), color = I("red"), hoveron = "kde+points", showlegend = F)
containment_violin <- containment_violin %>%
    layout(yaxis = list(title = "Containment policies", showgrid = T, range = c(-0.5,
        2.75), side = "right", tickangle = 45), xaxis = list(title = "Log days",
        zeroline = F, showgrid = T), font = list(family = "Times New Roman"), legend = list(borderwidth = 1),
        violingap = 0, violingroupgap = 0, violinmode = "overlay")

cc_violin <- subplot(closures_violin, containment_violin, nrows = 1, shareX = TRUE) %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE)

cc_violin

Economic Policies

The two economic policies measured on an ordinal scale are E1 income support and E2 debt or contract relief. Neither E1 nor E2 carry binary flags for geographic scope. For E1, a policy intensity level of 1 denotes replacing less than 50% of lost salary or less than 50% of median salary if flat sum and level 2 denotes more than 50%, and 46 policy enactments at level 1 or higher are counted. E1 only counts payments to firms if they are explicitly linked to supporting payroll or salaries. E2 records any government freezes of financial obligations for households, such as loan repayments, not stopping utilities for non-payment, or banning evictions. All 50 states recorded at least some enactment of narrow relief, specific to one kind of contract (level 1), or broad debt or contract relief (level 2). Distributions of these policies by the enacting governor’s party are represented in Figure 3.

Figure 3. Distribution of economic policies by party.
economic_violin <- filter(summary_policies, category == "Economic policies") %>%
    plot_ly(type = "violin", orientation = "h", sort = FALSE)
economic_violin <- economic_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Democrat"], x = ~logdays[summary_policies$governor_party ==
        "Democrat"], legendgroup = "Democrat governor", scalegroup = "Democrat governor",
        name = "Democrat governor", side = "positive", box = list(visible = F), meanline = list(visible = T),
        color = I("blue"), hoveron = "kde+points")
economic_violin <- economic_violin %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Republican"], x = ~logdays[summary_policies$governor_party ==
        "Republican"], legendgroup = "Republican governor", scalegroup = "Republican governor",
        name = "Republican governor", side = "negative", box = list(visible = F),
        meanline = list(visible = T), color = I("red"), hoveron = "kde+points")
economic_violin <- economic_violin %>%
    layout(yaxis = list(title = "Economic policies", showgrid = T, range = c(-0.5,
        1.15), tickangle = -45), xaxis = list(title = "Log days", zeroline = F, showgrid = T),
        font = list(family = "Times New Roman"), legend = list(borderwidth = 1),
        violingap = 0, violingroupgap = 0, violinmode = "overlay")

economic_violin %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE)

Health system policies

Six health system policies are analyzed: H1 public information campaigns, H2 testing policy, H3 contact tracing, H6 facial coverings, and H7 vaccination policy, and H8 protection of elderly people. H1 public information campaigns are counted at the second level of intensity, describing coordinated public information campaigns, which total at 50 enactments. For H2, policies that grant COVID-19 testing access to only those with both symptoms and meet some other criteria (such as employment in essential services, hospital admission, contact with a positive case, or returning from overseas) or those that provide greater access are counted, culminating in 50 events. H3 records contact tracing policies and programs that are likely to identify all individuals who may be exposed to the coronavirus. Either limited contact tracing (level 1) or comprehensive programs (level 2) are counted, which total at 50 events. Neither H2 nor H3 carries binary flags for geographic scope. H6 records policies on the wearing of facial coverings outside of the home, and totals at 39 policies enactments at level 2 (required in some specified share or public spaces outside of the home in the presence of others, or when social distancing is impossible) or above. Policies for vaccination delivery are denoted by H7, with policies at level 1 (exclusive availability for only either key workers, the clinically vulnerable but nonelderly, or the elderly) or above totalling at 50 events. The partisan distribution of health system policies is shown in Figures 4 and 5.

Figure 4. Distribution of preventative health policies by party.
health_violin1 <- filter(summary_policies, category == "Health system policies") %>%
    filter(pol != "H7") %>%
    plot_ly(type = "violin", orientation = "h", sort = FALSE)
health_violin1 <- health_violin1 %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Democrat"], x = ~logdays[summary_policies$governor_party ==
        "Democrat"], legendgroup = "Democrat governor", scalegroup = "Democrat governor",
        name = "Democrat governor", side = "positive", box = list(visible = F), meanline = list(visible = T),
        color = I("blue"), hoveron = "kde+points")
health_violin1 <- health_violin1 %>%
    add_trace(y = ~policy[summary_policies$governor_party == "Republican"], x = ~logdays[summary_policies$governor_party ==
        "Republican"], legendgroup = "Republican governor", scalegroup = "Republican governor",
        name = "Republican governor", side = "negative", box = list(visible = F),
        meanline = list(visible = T), color = I("red"), hoveron = "kde+points")
health_violin1 <- health_violin1 %>%
    layout(yaxis = list(title = "Preventative health policies", showgrid = T, range = c(-0.5,
        4.5), tickangle = -25), xaxis = list(title = "Log days", zeroline = F, showgrid = T),
        font = list(family = "Times New Roman"), legend = list(borderwidth = 1),
        violingap = 0, violingroupgap = 0, violinmode = "overlay")

health_violin1 %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE)

Figure 5. Distribution of vaccination policies by party.
health_violin2 <- filter(summary_policies, pol == "H7") %>%
  plot_ly(type = 'violin',
    orientation = "h",
    sort = FALSE) 
health_violin2 <- health_violin2 %>%
  add_trace(
    y = ~policy[summary_policies$governor_party == 'Democrat'],
    x = ~logdays[summary_policies$governor_party == 'Democrat'],
    legendgroup = 'Democrat governor',
    scalegroup = 'Democrat governor',
    name = 'Democrat governor',
    side = 'positive',
    box = list(
      visible = F
    ),
    meanline = list(
      visible = T
    ),
    color = I("blue"),
    hoveron = "kde+points"
  ) 
health_violin2 <- health_violin2 %>%
  add_trace(
    y = ~policy[summary_policies$governor_party == 'Republican'],
    x = ~logdays[summary_policies$governor_party == 'Republican'],
    legendgroup = 'Republican governor',
    scalegroup = 'Republican governor',
    name = 'Republican governor',
    side = 'negative',
    box = list(
      visible = F
    ),
    meanline = list(
      visible = T
    ),
    color = I("red"),
    hoveron = "kde+points"
  ) 
health_violin2 <- health_violin2 %>%
  layout(
    yaxis = list(
      title = "Vaccination policies",
      showgrid = T,
      side = "right",
      range = c(-0.5, 0.5),
      tickangle = 45
    ),
    xaxis = list(
      title = "Log days",
      zeroline = F,
      showgrid = T
    ), 
#    font = list(family = "Times New Roman"), 
    legend = list(borderwidth = 1),
    violingap = 0,
    violingroupgap = 0,
    violinmode = 'overlay'
  )

health_violin2 %>%
  plotly::config(modeBarButtonsToAdd = list('drawopenpath', 'eraseshape'), displaylogo = FALSE)

Explanatory and Control Variables

In 2020, there were 26 Republican governors and 24 Democrat governors, but this changed to 27 Republican governors and 23 Democrat governors in 2021 when Governor Greg Gianforte (R.) replaced former Governor Steve Bullock (D.) in Montana on 4 January 2021 (“State Partisan Composition” 2021). At this time, changes in governors also happened in Mississippi (14 January 2020), Rhode Island (2 March 2021), and Utah (4 January 2021), but incoming governors were of the same party affiliation as the incumbents (Schmalfeldt, O’Neill, and Seither 2021). As such, the governor’s party affiliation is coded as a time-varying covariate in our Cox regression models, with 0 representing Democrat affiliation and 1 representing Republican. The distribution of governors by their party affiliations and changes during the observation period is visualized in Figure 6.

Figure 6. Tile map of the United States by governor affiliations from 2020-2021
coordinates <- tilemaps::governors %>%
    mutate(tile_map = generate_map(geometry, square = FALSE, flat_topped = TRUE))

all_states <- coordinates %>%
    select(-party) %>%
    add_row(abbreviation = "AK", tile_map = create_island(coordinates$tile_map, "lower left")) %>%
    add_row(abbreviation = "HI", tile_map = create_island(coordinates$tile_map, c(-12050000,
        3008338)))

name_conversions <- tibble(name = c("Alabama_UnitedStates", "Alaska_UnitedStates",
    "Arizona_UnitedStates", "Arkansas_UnitedStates", "California_UnitedStates", "Colorado_UnitedStates",
    "Connecticut_UnitedStates", "Delaware_UnitedStates", "Florida_UnitedStates",
    "Georgia_UnitedStates", "Hawaii_UnitedStates", "Idaho_UnitedStates", "Illinois_UnitedStates",
    "Indiana_UnitedStates", "Iowa_UnitedStates", "Kansas_UnitedStates", "Kentucky_UnitedStates",
    "Louisiana_UnitedStates", "Maine_UnitedStates", "Maryland_UnitedStates", "Massachusetts_UnitedStates",
    "Michigan_UnitedStates", "Minnesota_UnitedStates", "Mississippi_UnitedStates",
    "Missouri_UnitedStates", "Montana_UnitedStates", "Nebraska_UnitedStates", "Nevada_UnitedStates",
    "NewHampshire_UnitedStates", "NewJersey_UnitedStates", "NewMexico_UnitedStates",
    "NewYork_UnitedStates", "NorthCarolina_UnitedStates", "NorthDakota_UnitedStates",
    "Ohio_UnitedStates", "Oklahoma_UnitedStates", "Oregon_UnitedStates", "Pennsylvania_UnitedStates",
    "RhodeIsland_UnitedStates", "SouthCarolina_UnitedStates", "SouthDakota_UnitedStates",
    "Tennessee_UnitedStates", "Texas_UnitedStates", "Utah_UnitedStates", "Vermont_UnitedStates",
    "Virginia_UnitedStates", "Washington_UnitedStates", "WestVirginia_UnitedStates",
    "Wisconsin_UnitedStates", "Wyoming_UnitedStates"), RegionName = c("Alabama",
    "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware",
    "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
    "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota",
    "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
    "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio",
    "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
    "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia",
    "Wisconsin", "Wyoming"), ST = c("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE",
    "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA",
    "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND",
    "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA",
    "WV", "WI", "WY"))

usamap <- governors %>%
    mutate(governor_partyrepublican = ifelse(governor_party == "Republican", 2, 1)) %>%
    group_by(RegionName) %>%
    arrange(governor_entered_office) %>%
    mutate(transition = ifelse(n() > 1, 1, 0), incoming_gov = ifelse(transition ==
        1, lead(governor_partyrepublican, n = 1L), 0)) %>%
    ungroup() %>%
    drop_na() %>%
    mutate(incoming_gov_party = ifelse(incoming_gov == 2, "Republican", ifelse(incoming_gov ==
        1, "Democrat", "No change"))) %>%
    full_join(name_conversions, by = "RegionName") %>%
    full_join(all_states, by = c(ST = "abbreviation")) %>%
    mutate(governor_party = str_to_title(governor_party)) %>%
    mutate(ST = ifelse(transition == 1, paste0(ST, "*"), ST))

### NEW CODE

usamap_plus <- inner_join(usamap %>%
    filter(transition == 1), governors %>%
    rename(delete_party = governor_party, incoming_gov_gender = governor_gender,
        incoming_gov_name = governor_name, incoming_gov_dob = governor_date_of_birth,
        incoming_gov_start = governor_entered_office, incoming_gov_end = governor_term_end,
        incoming_gov_age = governor_age), by = "RegionName") %>%
    group_by(RegionName) %>%
    slice_max(incoming_gov_end) %>%
    ungroup() %>%
    bind_rows(usamap %>%
        filter(transition != 1) %>%
        inner_join(., governors %>%
            rename(delete_party = governor_party, incoming_gov_name = governor_name,
                incoming_gov_gender = governor_gender, incoming_gov_dob = governor_date_of_birth,
                incoming_gov_start = governor_entered_office, incoming_gov_end = governor_term_end,
                incoming_gov_age = governor_age), by = "RegionName")) %>%
    select(-delete_party)

gg_usamap <- ggplot(usamap_plus) + geom_sf(aes(geometry = tile_map, fill = governor_party,
    color = incoming_gov_party, size = incoming_gov_party, text = paste0("State: ",
        RegionName, "</br></br>Incoming governor: ", incoming_gov_name, ", ", incoming_gov_party,
        "</br>Gender: ", str_to_title(incoming_gov_gender), ". Age: ", incoming_gov_age,
        "</br>Term start: ", incoming_gov_start, ". Term end: ", incoming_gov_end))) +
    geom_sf_text(aes(geometry = tile_map, label = ST, text = paste0("State: ", RegionName,
        "</br></br>Governor: ", governor_name, ", ", governor_party, "</br>Gender: ",
        str_to_title(governor_gender), ". Age: ", governor_age, "</br>Term start: ",
        governor_entered_office, ". Term end: ", governor_term_end, "</br>Incoming governor: ",
        incoming_gov_party)), fun.geometry = function(x) st_centroid(x), color = "white") +
    scale_fill_brewer(name = "Governor", palette = "Set1", direction = -1) + scale_color_manual(name = "Incoming governor",
    values = c(Democrat = "deepskyblue1", Republican = "lightpink", `No change` = "white")) +
    scale_size_manual(values = c(Democrat = 3, Republican = 3, `No change` = 1)) +
    guides(size = FALSE, fill = guide_legend(order = 1), color = guide_legend(order = 2,
        override.aes = aes(fill = NA))) + theme_void()

plotly_usamap <- ggplotly(gg_usamap, tooltip = "text")

plotly_usamap$x$data[[2]]$name <- "Democrat → Democrat"
plotly_usamap$x$data[[3]]$legendgroup <- "Democrat"
plotly_usamap$x$data[[3]]$name <- "Democrat (no change)"
plotly_usamap$x$data[[4]]$legendgroup <- "Democrat"
plotly_usamap$x$data[[4]]$name <- "Democrat → Republican"
plotly_usamap$x$data[[5]]$legendgroup <- "Republican"
plotly_usamap$x$data[[5]]$name <- "Republican (no change)"
plotly_usamap$x$data[[6]]$legendgroup <- "Republican"
plotly_usamap$x$data[[6]]$name <- "Republican → Republican"

plotly_usamap$x$layout$annotations <- NULL

plotly_usamap %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE)
### END NEW CODE

Given the heterogeneity across the 50 states and the fact that Democratic governors are usually found in wealthier, coastal, and more urban states, several potential confounders must be introduced into our primary models so the effect of party affiliation can be isolated. As there are only 50 states in existence, the number of potential events is inherently limited. In turn, the number of covariates must be kept to a minimum. Seven control variables were selected for their capacity to control for broad differences in demographics, economics, the urgency or threat of COVID-19, health system capacity, connectivity, and policy diffusion.

Five control variables are time-invariant. First, the log of state populations in 2019 is introduced to control for the differences in population sizes across the country (“Creating a Unified COVID-19 Global Resource in Record Time” n.d.). Second, the nominal Gross Domestic Product per capita in 2019 is included to approximately control for differences in state wealth. Third, the 2019 GINI coefficients of each state are added to account for the role that income inequality may affect the politics and policies of a state, as there is some evidence that COVID-19 has had disproportionate health and economic impacts in marginalized communities (who, in turn, may require different forms of policy assistance from their governments) (Warner and Zhang 2021, 177–79; Wang, Devine, and Molina-Sieiro 2021, 23; “GINI Index of Income Inequality” n.d.). To approximate the linear effect that the healthcare capacity of each state may have on policy enactment, the log of the number of primary care physicians in 2018 is included as well (“2019 State Physician Workforce Data Report” 2019). Finally, as places that are well-connected to the rest of the world are especially vulnerable to the spread of infectious diseases, the log of total enplanements in 2019 plus one (to avoid an infinity error from logging zero, as Delaware did not have an operating commercial service airport from 2019 to 2021) is included (“Passenger Boarding (Enplanement) and All-Cargo Data for U.S. Airports – Airports” n.d.).2

The two remaining control variables are time-varying. First, changes in daily COVID cases per 100 thousand individuals, averaged over seven days, are included to control for both the pressing urgency of the virus and the different times at which it arrived in states. Second, a count variable of the number of neighbouring states (i.e., states that share a land or water border) with the modelled mandate in place, at the state or municipal level and at the intensity greater or equal to the one defined per model, is created to factor in the potential effects of policy diffusion. Summary statistics of these main control variables are presented in Table 1.

Table 1. Summary statistics of main control variables by the variable of interest.
### ORIGINAL CODE - NOT RUN - RUNNING ON 24/11/2021 CAUSED ERRORS AS QUERYING
### POPULATION DATA FROM C3.AI RETURNED MISSING VALUES - SAVED DATA FROM
### 23/11/2021 USED INSTEAD ###

## TO UNCOMMENT ON RSTUDIO - COPY & PASTE INTO AN RMD FILE: SELECT CODE -> CTRL
## + SHIFT + C (COMMAND + SHIFT + C IF ON MACOS) ##

# # Total population states_list <- list(
# 'Alabama_UnitedStates','Alaska_UnitedStates','Arizona_UnitedStates',
# 'Arkansas_UnitedStates','California_UnitedStates','Colorado_UnitedStates',
# 'Connecticut_UnitedStates','Delaware_UnitedStates',
# 'Florida_UnitedStates','Georgia_UnitedStates','Hawaii_UnitedStates',
# 'Idaho_UnitedStates','Illinois_UnitedStates','Indiana_UnitedStates',
# 'Iowa_UnitedStates','Kansas_UnitedStates','Kentucky_UnitedStates',
# 'Louisiana_UnitedStates','Maine_UnitedStates','Maryland_UnitedStates',
# 'Massachusetts_UnitedStates','Michigan_UnitedStates','Minnesota_UnitedStates',
# 'Mississippi_UnitedStates','Missouri_UnitedStates','Montana_UnitedStates',
# 'Nebraska_UnitedStates','Nevada_UnitedStates','NewHampshire_UnitedStates',
# 'NewJersey_UnitedStates','NewMexico_UnitedStates','NewYork_UnitedStates',
# 'NorthCarolina_UnitedStates','NorthDakota_UnitedStates','Ohio_UnitedStates',
# 'Oklahoma_UnitedStates','Oregon_UnitedStates','Pennsylvania_UnitedStates',
# 'RhodeIsland_UnitedStates','SouthCarolina_UnitedStates',
# 'SouthDakota_UnitedStates','Tennessee_UnitedStates','Texas_UnitedStates',
# 'Utah_UnitedStates','Vermont_UnitedStates','Virginia_UnitedStates',
# 'Washington_UnitedStates','WestVirginia_UnitedStates','Wisconsin_UnitedStates',
# 'Wyoming_UnitedStates' ) today <- '2021-08-10' #changed from Sys.Date() -
# ddays(14) totalpopulation <- evalmetrics( 'outbreaklocation', list( spec =
# list( ids = states_list, expressions = list('TotalPopulation'), #US Census
# Bureau: Demographic Estimates start = '2015-01-01', end = '2020-01-01',
# interval = 'YEAR' ) ), get_all = TRUE ) totalpopulation <- totalpopulation
# %>% inner_join(name_conversions, by = 'name') # COVID Cases and Deaths
# casecounts <- evalmetrics( 'outbreaklocation', list( spec = list( ids =
# states_list, expressions = list('JHU_ConfirmedCases', #Johns Hopkins
# University: COVID-19 Data Repository 'JHU_ConfirmedDeaths'), start =
# '2020-01-01', end = today, interval = 'DAY' ) ), get_all = TRUE ) casecounts
# <- casecounts %>% inner_join(name_conversions, by = 'name') # COVID case
# rates caseincrease <- casecounts %>% filter(value_id == 'JHU_ConfirmedCases')
# %>% group_by(name) %>% arrange(dates) %>% mutate(datamax = rollmax(data, 60,
# align = 'right', fill = 0), daily_increase = datamax - lag(datamax)) %>%
# mutate(daily_increase_smoothed = rollmean(daily_increase, 7, align = 'right',
# fill = NA)) %>% ungroup() %>% full_join(filter(totalpopulation, dates ==
# '2019-01-01') %>% dplyr::select('name', 'data'), by = c(name = 'name')) %>%
# mutate(daily_increase_smoothed_per_100k = 100000 *
# daily_increase_smoothed/data.y) %>% filter(!is.na(daily_increase_smoothed)) #
# Airport activity commercial_service_enplanements_cy19 <-
# read_excel('cy19-commercial-service-enplanements.xlsx') # from FAA:
# https://www.faa.gov/airports/planning_capacity/passenger_allcargo_stats/passenger/media/cy19-commercial-service-enplanements.xlsx
# names(commercial_service_enplanements_cy19) <-
# str_replace_all(names(commercial_service_enplanements_cy19), c(' ' = '.' ,
# ',' = '' )) commercial_service_enplanements_cy19 <-
# commercial_service_enplanements_cy19 %>% full_join(name_conversions, by =
# 'ST') %>% drop_na(RegionName) %>% group_by(ST) %>% mutate(totalenplanements19
# = sum(CY.19.Enplanements)) %>% ungroup() %>% select(RegionName,
# totalenplanements19) %>% arrange(RegionName) %>% distinct() %>% # No airports
# are listed in the FAA's commercial service enplanements; given the state's
# small size, small population, and proximity to nearby states, commercial air
# traffic relies on airports in nearby states (e.g., Philadelphia
# International) replace_na(list(totalenplanements19 = 0)) # Neighbor mandates
# function neighbors_any_na <- function(policy, level) { policies %>%
# select(dates = Day, neighbors = RegionName, policy) %>% rename(pol = policy)
# %>% filter(., neighbors == 'Mississippi' | neighbors == 'Tennessee' |
# neighbors == 'Florida' | neighbors == 'Georgia') %>% group_by(dates) %>%
# mutate(RegionName = 'Alabama', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) %>% bind_rows( policies %>%
# select(dates = Day, RegionName) %>% filter(RegionName == 'Alaska') %>%
# mutate(RegionName = 'Alaska', number.neighbors = 0, neighbor.mandates.any =
# 0) ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy) %>% rename(pol = policy) %>% filter(., neighbors == 'Nevada' |
# neighbors == 'New Mexico' | neighbors == 'Utah' | neighbors == 'California' |
# neighbors == 'Colorado') %>% group_by(dates) %>% mutate(RegionName =
# 'Arizona', number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Oklahoma' | neighbors == 'Tennessee' | neighbors == 'Texas' |
# neighbors == 'Louisiana' | neighbors == 'Mississippi' | neighbors ==
# 'Missouri') %>% group_by(dates) %>% mutate(RegionName = 'Arkansas',
# number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Arizona' | neighbors == 'Nevada') %>%
# group_by(dates) %>% mutate(RegionName = 'California', number.neighbors = 3,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'New Mexico' | neighbors
# == 'Oklahoma' | neighbors == 'Utah' | neighbors == 'Wyoming' | neighbors ==
# 'Arizona' | neighbors == 'Kansas' | neighbors == 'Nebraska') %>%
# group_by(dates) %>% mutate(RegionName = 'Colorado', number.neighbors = 7,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'New York' | neighbors ==
# 'Rhode Island' | neighbors == 'Massachusetts') %>% group_by(dates) %>%
# mutate(RegionName = 'Connecticut', number.neighbors = 3, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'New Jersey' | neighbors == 'Pennsylvania'
# | neighbors == 'Maryland') %>% group_by(dates) %>% mutate(RegionName =
# 'Delaware', number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Georgia' | neighbors == 'Alabama') %>% group_by(dates) %>%
# mutate(RegionName = 'Florida', number.neighbors = 2, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'North Carolina' | neighbors == 'South
# Carolina' | neighbors == 'Tennessee' | neighbors == 'Alabama' | neighbors ==
# 'Florida') %>% group_by(dates) %>% mutate(RegionName = 'Georgia',
# number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, RegionName) %>% filter(RegionName == 'Hawaii') %>% mutate(RegionName =
# 'Hawaii', number.neighbors = 0, neighbor.mandates.any = 0) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy) %>%
# rename(pol = policy) %>% filter(., neighbors == 'Utah' | neighbors ==
# 'Washington' | neighbors == 'Wyoming' | neighbors == 'Montana' | neighbors ==
# 'Nevada' | neighbors == 'Oregon') %>% group_by(dates) %>% mutate(RegionName =
# 'Idaho', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Kentucky' | neighbors == 'Missouri' | neighbors == 'Wisconsin'
# | neighbors == 'Indiana' | neighbors == 'Iowa' | neighbors == 'Michigan') %>%
# group_by(dates) %>% mutate(RegionName = 'Illinois', number.neighbors = 6,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Michigan' | neighbors ==
# 'Ohio' | neighbors == 'Illinois' | neighbors == 'Kentucky') %>%
# group_by(dates) %>% mutate(RegionName = 'Indiana', number.neighbors = 4, temp
# = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nebraska' | neighbors ==
# 'South Dakota' | neighbors == 'Wisconsin' | neighbors == 'Illinois' |
# neighbors == 'Minnesota' | neighbors == 'Missouri') %>% group_by(dates) %>%
# mutate(RegionName = 'Iowa', number.neighbors = 6, temp = ifelse(pol >= level,
# 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy) %>% rename(pol = policy)
# %>% filter(., neighbors == 'Nebraska' | neighbors == 'Oklahoma' | neighbors
# == 'Colorado' | neighbors == 'Missouri') %>% group_by(dates) %>%
# mutate(RegionName = 'Kansas', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Tennessee' | neighbors == 'Virginia' |
# neighbors == 'West Virginia' | neighbors == 'Illinois' | neighbors ==
# 'Indiana' | neighbors == 'Missouri' | neighbors == 'Ohio') %>%
# group_by(dates) %>% mutate(RegionName = 'Kentucky', number.neighbors = 7,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Texas' | neighbors ==
# 'Arkansas' | neighbors == 'Mississippi') %>% group_by(dates) %>%
# mutate(RegionName = 'Louisiana', number.neighbors = 3, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'New Hampshire') %>% group_by(dates) %>%
# mutate(RegionName = 'Maine', number.neighbors = 1, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Virginia' | neighbors == 'West Virginia'
# | neighbors == 'Delaware' | neighbors == 'Pennsylvania') %>% group_by(dates)
# %>% mutate(RegionName = 'Maryland', number.neighbors = 4, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'New York' | neighbors == 'Rhode Island' |
# neighbors == 'Vermont' | neighbors == 'Connecticut' | neighbors == 'New
# Hampshire') %>% group_by(dates) %>% mutate(RegionName = 'Massachusetts',
# number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Ohio' | neighbors == 'Wisconsin' | neighbors == 'Illinois' |
# neighbors == 'Indiana' | neighbors == 'Minnesota') %>% group_by(dates) %>%
# mutate(RegionName = 'Michigan', number.neighbors = 5, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'North Dakota' | neighbors == 'South
# Dakota' | neighbors == 'Wisconsin' | neighbors == 'Iowa' | neighbors ==
# 'Michigan') %>% group_by(dates) %>% mutate(RegionName = 'Minnesota',
# number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Louisiana' | neighbors == 'Tennessee' | neighbors == 'Alabama'
# | neighbors == 'Arkansas') %>% group_by(dates) %>% mutate(RegionName =
# 'Mississippi', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'Oklahoma' | neighbors == 'Tennessee'
# | neighbors == 'Arkansas' | neighbors == 'Illinois' | neighbors == 'Iowa' |
# neighbors == 'Kansas' | neighbors == 'Kentucky') %>% group_by(dates) %>%
# mutate(RegionName = 'Missouri', number.neighbors = 8, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'South Dakota' | neighbors == 'Wyoming' |
# neighbors == 'Idaho' | neighbors == 'North Dakota') %>% group_by(dates) %>%
# mutate(RegionName = 'Montana', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Missouri' | neighbors == 'South Dakota' |
# neighbors == 'Wyoming' | neighbors == 'Colorado' | neighbors == 'Iowa' |
# neighbors == 'Kansas') %>% group_by(dates) %>% mutate(RegionName =
# 'Nebraska', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Idaho' | neighbors == 'Oregon' | neighbors == 'Utah' |
# neighbors == 'Arizona' | neighbors == 'California') %>% group_by(dates) %>%
# mutate(RegionName = 'Nevada', number.neighbors = 5, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Vermont' | neighbors == 'Maine' |
# neighbors == 'Massachusetts') %>% group_by(dates) %>% mutate(RegionName =
# 'New Hampshire', number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Delaware' | neighbors == 'New
# York') %>% group_by(dates) %>% mutate(RegionName = 'New Jersey',
# number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Oklahoma' | neighbors == 'Texas' | neighbors == 'Utah' |
# neighbors == 'Arizona' | neighbors == 'Colorado') %>% group_by(dates) %>%
# mutate(RegionName = 'New Mexico', number.neighbors = 5, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Pennsylvania' | neighbors == 'Rhode
# Island' | neighbors == 'Vermont' | neighbors == 'Connecticut' | neighbors ==
# 'Massachusetts' | neighbors == 'New Jersey') %>% group_by(dates) %>%
# mutate(RegionName = 'New York', number.neighbors = 6, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Tennessee' | neighbors == 'Virginia' |
# neighbors == 'Georgia' | neighbors == 'South Carolina') %>% group_by(dates)
# %>% mutate(RegionName = 'North Carolina', number.neighbors = 4, temp =
# ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'South Dakota' |
# neighbors == 'Minnesota' | neighbors == 'Montana') %>% group_by(dates) %>%
# mutate(RegionName = 'North Dakota', number.neighbors = 3, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Michigan' | neighbors == 'Pennsylvania' |
# neighbors == 'West Virginia' | neighbors == 'Indiana' | neighbors ==
# 'Kentucky') %>% group_by(dates) %>% mutate(RegionName = 'Ohio',
# number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Missouri' | neighbors == 'New Mexico' | neighbors == 'Texas' |
# neighbors == 'Arkansas' | neighbors == 'Colorado' | neighbors == 'Kansas')
# %>% group_by(dates) %>% mutate(RegionName = 'Oklahoma', number.neighbors = 6,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nevada' | neighbors ==
# 'Washington' | neighbors == 'California' | neighbors == 'Idaho') %>%
# group_by(dates) %>% mutate(RegionName = 'Oregon', number.neighbors = 4, temp
# = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'New York' | neighbors ==
# 'Ohio' | neighbors == 'West Virginia' | neighbors == 'Delaware' | neighbors
# == 'Maryland' | neighbors == 'New Jersey') %>% group_by(dates) %>%
# mutate(RegionName = 'Pennsylvania', number.neighbors = 6, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Massachusetts' | neighbors == 'New York'
# | neighbors == 'Connecticut') %>% group_by(dates) %>% mutate(RegionName =
# 'Rhode Island', number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'Georgia') %>% group_by(dates)
# %>% mutate(RegionName = 'South Carolina', number.neighbors = 2, temp =
# ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nebraska' | neighbors ==
# 'North Dakota' | neighbors == 'Wyoming' | neighbors == 'Iowa' | neighbors ==
# 'Minnesota' | neighbors == 'Montana') %>% group_by(dates) %>%
# mutate(RegionName = 'South Dakota', number.neighbors = 6, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Mississippi' | neighbors == 'Missouri' |
# neighbors == 'North Carolina' | neighbors == 'Virginia' | neighbors ==
# 'Alabama' | neighbors == 'Arkansas' | neighbors == 'Georgia' | neighbors ==
# 'Kentucky') %>% group_by(dates) %>% mutate(RegionName = 'Tennessee',
# number.neighbors = 8, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'New Mexico' | neighbors == 'Oklahoma' | neighbors == 'Arkansas'
# | neighbors == 'Louisiana') %>% group_by(dates) %>% mutate(RegionName =
# 'Texas', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nevada' | neighbors == 'New Mexico' | neighbors == 'Wyoming' |
# neighbors == 'Arizona' | neighbors == 'Colorado' | neighbors == 'Idaho') %>%
# group_by(dates) %>% mutate(RegionName = 'Utah', number.neighbors = 6, temp =
# ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'New Hampshire' |
# neighbors == 'New York' | neighbors == 'Massachusetts') %>% group_by(dates)
# %>% mutate(RegionName = 'Vermont', number.neighbors = 3, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'North Carolina' | neighbors ==
# 'Tennessee' | neighbors == 'West Virginia' | neighbors == 'Kentucky' |
# neighbors == 'Maryland') %>% group_by(dates) %>% mutate(RegionName =
# 'Virginia', number.neighbors = 5, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Idaho') %>% group_by(dates) %>%
# mutate(RegionName = 'Washington', number.neighbors = 2, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Pennsylvania' | neighbors == 'Virginia' |
# neighbors == 'Kentucky' | neighbors == 'Maryland' | neighbors == 'Ohio') %>%
# group_by(dates) %>% mutate(RegionName = 'West Virginia', number.neighbors =
# 5, temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy) %>% rename(pol = policy) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Minnesota' | neighbors == 'Illinois' | neighbors == 'Iowa') %>%
# group_by(dates) %>% mutate(RegionName = 'Wisconsin', number.neighbors = 4,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nebraska' | neighbors ==
# 'South Dakota' | neighbors == 'Utah' | neighbors == 'Colorado' | neighbors ==
# 'Idaho' | neighbors == 'Montana') %>% group_by(dates) %>% mutate(RegionName =
# 'Wyoming', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% ungroup() select(dates, RegionName,
# number.neighbors, neighbor.mandates.any) %>% group_by(dates, RegionName) %>%
# slice_head() } neighbors_any <- function(policy, level) { policies %>%
# select(dates = Day, neighbors = RegionName, policy) %>% rename(pol = policy)
# %>% filter(., neighbors == 'Mississippi' | neighbors == 'Tennessee' |
# neighbors == 'Florida' | neighbors == 'Georgia') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Alabama', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) %>% bind_rows( policies %>% select(dates =
# Day, RegionName) %>% filter(RegionName == 'Alaska') %>% mutate(RegionName =
# 'Alaska', number.neighbors = 0, neighbor.mandates.any = 0) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy) %>%
# rename(pol = policy) %>% filter(., neighbors == 'Nevada' | neighbors == 'New
# Mexico' | neighbors == 'Utah' | neighbors == 'California' | neighbors ==
# 'Colorado') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Arizona', number.neighbors = 5, temp
# = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Oklahoma' | neighbors ==
# 'Tennessee' | neighbors == 'Texas' | neighbors == 'Louisiana' | neighbors ==
# 'Mississippi' | neighbors == 'Missouri') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Arkansas', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Arizona' | neighbors == 'Nevada') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'California', number.neighbors = 3, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'New Mexico' | neighbors == 'Oklahoma' |
# neighbors == 'Utah' | neighbors == 'Wyoming' | neighbors == 'Arizona' |
# neighbors == 'Kansas' | neighbors == 'Nebraska') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Colorado', number.neighbors = 7, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'New York' | neighbors == 'Rhode Island' | neighbors ==
# 'Massachusetts') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Connecticut', number.neighbors = 3,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'New Jersey' | neighbors
# == 'Pennsylvania' | neighbors == 'Maryland') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Delaware', number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Georgia' | neighbors == 'Alabama') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Florida', number.neighbors = 2, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'South Carolina' | neighbors ==
# 'Tennessee' | neighbors == 'Alabama' | neighbors == 'Florida') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Georgia', number.neighbors = 5, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, RegionName) %>% filter(RegionName == 'Hawaii') %>%
# mutate(RegionName = 'Hawaii', number.neighbors = 0, neighbor.mandates.any =
# 0) ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy) %>% rename(pol = policy) %>% filter(., neighbors == 'Utah' |
# neighbors == 'Washington' | neighbors == 'Wyoming' | neighbors == 'Montana' |
# neighbors == 'Nevada' | neighbors == 'Oregon') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Idaho', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Kentucky' | neighbors == 'Missouri' | neighbors == 'Wisconsin'
# | neighbors == 'Indiana' | neighbors == 'Iowa' | neighbors == 'Michigan') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Illinois', number.neighbors = 6, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Michigan' | neighbors == 'Ohio' |
# neighbors == 'Illinois' | neighbors == 'Kentucky') %>% group_by(neighbors)
# %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Indiana', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'South Dakota' | neighbors ==
# 'Wisconsin' | neighbors == 'Illinois' | neighbors == 'Minnesota' | neighbors
# == 'Missouri') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Iowa', number.neighbors = 6, temp =
# ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nebraska' | neighbors ==
# 'Oklahoma' | neighbors == 'Colorado' | neighbors == 'Missouri') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Kansas', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Tennessee' | neighbors == 'Virginia' |
# neighbors == 'West Virginia' | neighbors == 'Illinois' | neighbors ==
# 'Indiana' | neighbors == 'Missouri' | neighbors == 'Ohio') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Kentucky', number.neighbors = 7, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Texas' | neighbors == 'Arkansas' |
# neighbors == 'Mississippi') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Louisiana',
# number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'New Hampshire') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Maine',
# number.neighbors = 1, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Virginia' | neighbors == 'West Virginia' | neighbors ==
# 'Delaware' | neighbors == 'Pennsylvania') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Maryland', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'New York' | neighbors == 'Rhode Island' | neighbors ==
# 'Vermont' | neighbors == 'Connecticut' | neighbors == 'New Hampshire') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Massachusetts', number.neighbors = 5, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Ohio' | neighbors == 'Wisconsin' |
# neighbors == 'Illinois' | neighbors == 'Indiana' | neighbors == 'Minnesota')
# %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates)
# %>% mutate(RegionName = 'Michigan', number.neighbors = 5, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'North Dakota' | neighbors == 'South
# Dakota' | neighbors == 'Wisconsin' | neighbors == 'Iowa' | neighbors ==
# 'Michigan') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Minnesota', number.neighbors = 5,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Louisiana' | neighbors
# == 'Tennessee' | neighbors == 'Alabama' | neighbors == 'Arkansas') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Mississippi', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Nebraska' | neighbors == 'Oklahoma' |
# neighbors == 'Tennessee' | neighbors == 'Arkansas' | neighbors == 'Illinois'
# | neighbors == 'Iowa' | neighbors == 'Kansas' | neighbors == 'Kentucky') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Missouri', number.neighbors = 8, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'South Dakota' | neighbors == 'Wyoming' |
# neighbors == 'Idaho' | neighbors == 'North Dakota') %>% group_by(neighbors)
# %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Montana', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Missouri' | neighbors == 'South Dakota' | neighbors ==
# 'Wyoming' | neighbors == 'Colorado' | neighbors == 'Iowa' | neighbors ==
# 'Kansas') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Nebraska', number.neighbors = 6,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Idaho' | neighbors ==
# 'Oregon' | neighbors == 'Utah' | neighbors == 'Arizona' | neighbors ==
# 'California') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Nevada', number.neighbors = 5, temp
# = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Vermont' | neighbors ==
# 'Maine' | neighbors == 'Massachusetts') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'New
# Hampshire', number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Delaware' | neighbors == 'New
# York') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'New Jersey', number.neighbors = 3,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Oklahoma' | neighbors ==
# 'Texas' | neighbors == 'Utah' | neighbors == 'Arizona' | neighbors ==
# 'Colorado') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'New Mexico', number.neighbors = 5,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Pennsylvania' |
# neighbors == 'Rhode Island' | neighbors == 'Vermont' | neighbors ==
# 'Connecticut' | neighbors == 'Massachusetts' | neighbors == 'New Jersey') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'New York', number.neighbors = 6, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Tennessee' | neighbors == 'Virginia' |
# neighbors == 'Georgia' | neighbors == 'South Carolina') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'North Carolina', number.neighbors = 4, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'South Dakota' | neighbors == 'Minnesota'
# | neighbors == 'Montana') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'North Dakota',
# number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Michigan' | neighbors == 'Pennsylvania' | neighbors == 'West
# Virginia' | neighbors == 'Indiana' | neighbors == 'Kentucky') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Ohio', number.neighbors = 5, temp = ifelse(pol >= level,
# 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy) %>% rename(pol = policy)
# %>% filter(., neighbors == 'Missouri' | neighbors == 'New Mexico' | neighbors
# == 'Texas' | neighbors == 'Arkansas' | neighbors == 'Colorado' | neighbors ==
# 'Kansas') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Oklahoma', number.neighbors = 6,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Nevada' | neighbors ==
# 'Washington' | neighbors == 'California' | neighbors == 'Idaho') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Oregon', number.neighbors = 4, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'New York' | neighbors == 'Ohio' |
# neighbors == 'West Virginia' | neighbors == 'Delaware' | neighbors ==
# 'Maryland' | neighbors == 'New Jersey') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Pennsylvania', number.neighbors = 6, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Massachusetts' | neighbors == 'New York' | neighbors ==
# 'Connecticut') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Rhode Island', number.neighbors = 3,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'North Carolina' |
# neighbors == 'Georgia') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'South Carolina',
# number.neighbors = 2, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'North Dakota' | neighbors ==
# 'Wyoming' | neighbors == 'Iowa' | neighbors == 'Minnesota' | neighbors ==
# 'Montana') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'South Dakota', number.neighbors = 6,
# temp = ifelse(pol >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>%
# bind_rows( policies %>% select(dates = Day, neighbors = RegionName, policy)
# %>% rename(pol = policy) %>% filter(., neighbors == 'Mississippi' | neighbors
# == 'Missouri' | neighbors == 'North Carolina' | neighbors == 'Virginia' |
# neighbors == 'Alabama' | neighbors == 'Arkansas' | neighbors == 'Georgia' |
# neighbors == 'Kentucky') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Tennessee',
# number.neighbors = 8, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'New Mexico' | neighbors == 'Oklahoma' | neighbors == 'Arkansas'
# | neighbors == 'Louisiana') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Texas',
# number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nevada' | neighbors == 'New Mexico' | neighbors == 'Wyoming' |
# neighbors == 'Arizona' | neighbors == 'Colorado' | neighbors == 'Idaho') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Utah', number.neighbors = 6, temp = ifelse(pol >= level,
# 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy) %>% rename(pol = policy)
# %>% filter(., neighbors == 'New Hampshire' | neighbors == 'New York' |
# neighbors == 'Massachusetts') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Vermont',
# number.neighbors = 3, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'Tennessee' | neighbors == 'West
# Virginia' | neighbors == 'Kentucky' | neighbors == 'Maryland') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Virginia', number.neighbors = 5, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Oregon' | neighbors == 'Idaho') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Washington', number.neighbors = 2, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Pennsylvania' | neighbors == 'Virginia' |
# neighbors == 'Kentucky' | neighbors == 'Maryland' | neighbors == 'Ohio') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'West Virginia', number.neighbors = 5, temp = ifelse(pol
# >= level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies
# %>% select(dates = Day, neighbors = RegionName, policy) %>% rename(pol =
# policy) %>% filter(., neighbors == 'Michigan' | neighbors == 'Minnesota' |
# neighbors == 'Illinois' | neighbors == 'Iowa') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Wisconsin', number.neighbors = 4, temp = ifelse(pol >= level, 1, 0),
# neighbor.mandates.any = sum(temp)) ) %>% bind_rows( policies %>% select(dates
# = Day, neighbors = RegionName, policy) %>% rename(pol = policy) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'South Dakota' | neighbors == 'Utah' |
# neighbors == 'Colorado' | neighbors == 'Idaho' | neighbors == 'Montana') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Wyoming', number.neighbors = 6, temp = ifelse(pol >=
# level, 1, 0), neighbor.mandates.any = sum(temp)) ) %>% ungroup() %>%
# select(dates, RegionName, number.neighbors, neighbor.mandates.any) %>%
# group_by(dates, RegionName) %>% slice_head() } # nominal gdp nominalgdp <-
# evalmetrics( 'outbreaklocation', list( spec = list( ids = states_list,
# expressions = list('BEA_NominalGDP_AllIndustryTotal_Dollars'),#US Bureau of
# Economic Analyses start = '2019-01-01', end = '2020-01-01', interval = 'YEAR'
# ) ), get_all = TRUE ) nominalgdp <- nominalgdp %>%
# inner_join(name_conversions, by = 'name') nominalgdp_percapita <- nominalgdp
# %>% select(name, RegionName, dates, nominalgdp = data) %>%
# inner_join(filter(totalpopulation, dates == '2019-01-01') %>% select(name,
# totalpopulation = data), by = 'name') %>% mutate(nominalgdp_percap =
# nominalgdp/totalpopulation) # Gini coefficient gini2019 <-
# read.csv('~/Documents/RPubs/Survival
# Analysis/ACSDT1Y2019.B19083_data_with_overlays_2021-06-21T164217.csv') %>%
# slice(-c(1)) %>% select(RegionName = NAME, gini2019 = B19083_001E) %>%
# mutate(gini2019 = as.numeric(gini2019)) # physicians physicians2018 <-
# tibble( # from AAMC
# https://store.aamc.org/downloadable/download/sample/sample_id/305/ RegionName
# = c( 'Alabama','Alaska','Arizona', 'Arkansas','California','Colorado',
# 'Connecticut','Delaware', 'Florida','Georgia','Hawaii',
# 'Idaho','Illinois','Indiana', 'Iowa','Kansas','Kentucky',
# 'Louisiana','Maine','Maryland', 'Massachusetts','Michigan','Minnesota',
# 'Mississippi','Missouri','Montana', 'Nebraska','Nevada','New Hampshire', 'New
# Jersey','New Mexico','New York', 'North Carolina','North Dakota','Ohio',
# 'Oklahoma','Oregon','Pennsylvania', 'Rhode Island','South Carolina', 'South
# Dakota','Tennessee','Texas', 'Utah','Vermont','Virginia', 'Washington','West
# Virginia','Wisconsin', 'Wyoming'), primary_care_physicians2018 = c( 3480,
# 779, 5249, 2260, 34466, 5061, 3348, 843, 17069, 7559, 1487, 1209, 11106,
# 4980, 2458, 2343, 3258, 3530, 1602, 5895, 7910, 8758, 5384, 1829, 4840, 935,
# 1549, 1971, 1351, 7791, 1720, 18518, 8110, 605, 9783, 2701, 4231, 11299,
# 1127, 3674, 748, 5265, 19097, 1965, 761, 6957, 6913, 1615, 5022, 440 ),
# physicians_per_100k_2018 = c( 71.2, 105.6, 73.2, 75.0, 87.1, 88.9, 93.7,
# 87.2, 80.1, 71.9, 104.7, 68.9, 87.2, 74.4, 77.9, 80.5, 72.9, 75.8, 119.7,
# 97.6, 114.6, 87.6, 96.0, 61.2, 79.0, 88.0, 80.3, 65.0, 99.6, 87.5, 82.1,
# 94.8, 78.1, 79.6, 83.7, 68.5, 101.0, 88.2, 106.6, 72.3, 84.8, 77.8, 66.5,
# 62.2, 121.5, 81.7, 91.7, 89.4, 86.4, 76.2 ) ) # Fortify with variables ## Any
# order fortify_any_speed <- function(policy, level) { policies %>% select(Day,
# RegionName, policy) %>% rename(pol = policy) %>% filter(Day >= '2020-01-09')
# %>% filter(Day <= '2021-07-09') %>% group_by(RegionName) %>% arrange(Day) %>%
# mutate(tstart = row_number() - 1, tstop = row_number(), temp = cumsum(pol >=
# level)) %>% drop_na() %>% group_by(temp, .add=TRUE) %>% group_by(RegionName)
# %>% mutate(status = ifelse(pol >= level, 1, 0)) %>% filter(temp <= 1) %>%
# mutate(endpt = max(status), start = min(tstart), stop = max(tstop)) %>%
# select(dates = Day, RegionName, start, stop, status, tstart, tstop, endpt)
# %>% filter(RegionName != 'USA' && RegionName != 'Washington DC') %>% #
# Governor data inner_join(governors %>% select(RegionName, governor_party,
# governor_entered_office, governor_term_end), by = 'RegionName') %>%
# mutate(governor_time_on = time_length(interval(governor_entered_office,
# dates), 'years'), governor_time_left = time_length(interval(dates,
# governor_term_end), 'years')) %>% filter(governor_time_on >= 0) %>%
# filter(governor_time_left > 0) %>% # Population data (total pop)
# inner_join(totalpopulation %>% filter(dates == '2019-01-01') %>%
# select(RegionName, totalpopulation = data), by = 'RegionName') %>%
# mutate(log_totalpopulation = log(totalpopulation)) %>% # COVID Case rates
# left_join(caseincrease %>% select(dates, RegionName,
# daily_increase_smoothed_per_100k), by = c('RegionName', 'dates')) %>% #
# Airport Activity left_join(commercial_service_enplanements_cy19, by =
# 'RegionName') %>% mutate(log_totalenplanements19plus1 =
# log(totalenplanements19 + 1)) %>% # Neighbor mandates
# left_join(neighbors_any(policy, level), by = c('RegionName', 'dates')) %>% #
# GDP & GDP per capita inner_join(nominalgdp_percapita %>% select(RegionName,
# nominalgdp, nominalgdp_percap), by = 'RegionName') %>% # GINI coefficient
# left_join(gini2019, by = 'RegionName') %>% # hospital capacity
# left_join(physicians2018, by = 'RegionName') %>% mutate(log_physicians2018 =
# log(primary_care_physicians2018)) %>% ungroup() } fortify_general_speed <-
# function(policy, flag, level) { policies %>% select(Day, RegionName, policy,
# flag) %>% rename(pol = policy, polflag = flag) %>% filter(Day >=
# '2020-01-09') %>% filter(Day <= '2021-07-09') %>% mutate(general_only =
# ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% group_by(RegionName) %>% arrange(Day) %>%
# mutate(tstart = row_number() - 1, tstop = row_number(), temp =
# cumsum(general_only >= level)) %>% group_by(temp, .add=TRUE) %>%
# group_by(RegionName) %>% mutate(status = ifelse(general_only >= level, 1, 0))
# %>% filter(temp <= 1) %>% mutate(endpt = max(status), start = min(tstart),
# stop = max(tstop)) %>% select(dates = Day, RegionName, start, stop, status,
# tstart, tstop, endpt) %>% filter(RegionName != 'USA' && RegionName !=
# 'Washington DC') %>% # Governor data inner_join(governors %>%
# select(RegionName, governor_party, governor_entered_office,
# governor_term_end), by = 'RegionName') %>% mutate(governor_time_on =
# time_length(interval(governor_entered_office, dates), 'years'),
# governor_time_left = time_length(interval(dates, governor_term_end),
# 'years')) %>% filter(governor_time_on >= 0) %>% filter(governor_time_left >
# 0) %>% # Population data (total pop) inner_join(totalpopulation %>%
# filter(dates == '2019-01-01') %>% select(RegionName, totalpopulation = data),
# by = 'RegionName') %>% mutate(log_totalpopulation = log(totalpopulation)) %>%
# # COVID Case rates left_join(caseincrease %>% select(dates, RegionName,
# daily_increase_smoothed_per_100k), by = c('RegionName', 'dates')) %>% #
# Airport Activity left_join(commercial_service_enplanements_cy19, by =
# 'RegionName') %>% mutate(log_totalenplanements19plus1 =
# log(totalenplanements19 + 1)) %>% # Neighbor mandates
# left_join(neighbors_any(policy, level), by = c('RegionName', 'dates')) %>% #
# GDP & GDP per capita inner_join(nominalgdp_percapita %>% select(RegionName,
# nominalgdp, nominalgdp_percap), by = 'RegionName') %>% # GINI coefficient
# left_join(gini2019, by = 'RegionName') %>% # hospital capacity
# left_join(physicians2018, by = 'RegionName') %>% mutate(log_physicians2018 =
# log(primary_care_physicians2018)) %>% ungroup() } C1_general_speed_fort <-
# fortify_general_speed('C1_School.closing', 'C1_Flag', 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C2_general_speed_fort <- fortify_general_speed('C2_Workplace.closing',
# 'C2_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data C3_general_speed_fort <-
# fortify_general_speed('C3_Cancel.public.events', 'C3_Flag', 2) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# C4_general_speed_fort <-
# fortify_general_speed('C4_Restrictions.on.gatherings', 'C4_Flag', 1) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# #C5_general_speed_fort <- fortify_general_speed('C5_Close.public.transport',
# 'C5_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data C6_general_speed_fort <-
# fortify_general_speed('C6_Stay.at.home.requirements', 'C6_Flag', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C7_general_speed_fort <-
# fortify_general_speed('C7_Restrictions.on.internal.movement', 'C7_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C8_any_speed_fort <- fortify_any_speed('C8_International.travel.controls', 1)
# #No flag E1_any_speed_fort <- fortify_any_speed('E1_Income.support', 1)
# #Binary flag for sectoral scope: 0 - formal sector workers only or informal
# sector workers only, 1 - all workers E2_any_speed_fort <-
# fortify_any_speed('E2_Debt.contract.relief', 1) #No flag
# H1_general_speed_fort <-
# fortify_general_speed('H1_Public.information.campaigns', 'H1_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# H2_any_speed_fort <- fortify_any_speed('H2_Testing.policy', 1) #No flag
# H3_any_speed_fort <- fortify_any_speed('H3_Contact.tracing', 1) #No flag
# H6_general_speed_fort <- fortify_general_speed('H6_Facial.Coverings',
# 'H6_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data H7_any_speed_fort <-
# fortify_any_speed('H7_Vaccination.policy', 1) #Binary flag for cost: 0 - At
# cost to individual (or funded by NGO, insurance, or partially government
# funded), 1- No or minimal cost to individual (government funded or
# subsidised), Blank - no data H8_general_speed_fort <-
# fortify_general_speed('H8_Protection.of.elderly.people', 'H8_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# END ORIGINAL CODE ###

load("2021:08:23.RData")

### ORIGINAL CODE ###
set_my_basic_labels <- function(data) {
    data %>%
        set_variable_labels(governor_party = "Governor's party", log_totalpopulation = "Log(Population, 2019)",
            daily_increase_smoothed_per_100k = "Case increases per 100K, 7-day avg.",
            log_totalenplanements19plus1 = "Log(Total enplanements + 1, 2019)", neighbor.mandates.any = "Neighbours with mandates",
            nominalgdp_percap = "Nominal GDP per capita, 2019", gini2019 = "GINI coefficient, 2019",
            log_physicians2018 = "Log(Physicians, 2018)")
}

C1_general_speed_fort <- set_my_basic_labels(C1_general_speed_fort)
C2_general_speed_fort <- set_my_basic_labels(C2_general_speed_fort)
C3_general_speed_fort <- set_my_basic_labels(C3_general_speed_fort)
C4_general_speed_fort <- set_my_basic_labels(C4_general_speed_fort)
C6_general_speed_fort <- set_my_basic_labels(C6_general_speed_fort)
C7_general_speed_fort <- set_my_basic_labels(C7_general_speed_fort)
C8_any_speed_fort <- set_my_basic_labels(C8_any_speed_fort)

E1_any_speed_fort <- set_my_basic_labels(E1_any_speed_fort)
E2_any_speed_fort <- set_my_basic_labels(E2_any_speed_fort)

H1_general_speed_fort <- set_my_basic_labels(H1_general_speed_fort)
H2_any_speed_fort <- set_my_basic_labels(H2_any_speed_fort)
H3_any_speed_fort <- set_my_basic_labels(H3_any_speed_fort)
H6_general_speed_fort <- set_my_basic_labels(H6_general_speed_fort)
H7_any_speed_fort <- set_my_basic_labels(H7_any_speed_fort)
H8_general_speed_fort <- set_my_basic_labels(H8_general_speed_fort)
# summary_stats_data <- C1_general_speed_fort %>% mutate(pol = 'C1') %>%
# bind_rows(C2_general_speed_fort %>% mutate(pol = 'C2')) %>%
# bind_rows(C3_general_speed_fort %>% mutate(pol = 'C3')) %>%
# bind_rows(C4_general_speed_fort %>% mutate(pol = 'C4')) %>%
# bind_rows(C6_general_speed_fort %>% mutate(pol = 'C6')) %>%
# bind_rows(C7_general_speed_fort %>% mutate(pol = 'C7')) %>%
# bind_rows(C8_any_speed_fort %>% mutate(pol = 'C8')) %>%
# bind_rows(E1_any_speed_fort %>% mutate(pol = 'E1')) %>%
# bind_rows(E2_any_speed_fort %>% mutate(pol = 'E2')) %>%
# bind_rows(H1_general_speed_fort %>% mutate(pol = 'H1')) %>%
# bind_rows(H2_any_speed_fort %>% mutate(pol = 'H2')) %>%
# bind_rows(H3_any_speed_fort %>% mutate(pol = 'H3')) %>%
# bind_rows(H6_general_speed_fort %>% mutate(pol = 'H6')) %>%
# bind_rows(H7_any_speed_fort %>% mutate(pol = 'H7')) %>%
# bind_rows(H8_general_speed_fort %>% mutate(pol = 'H8')) %>% select(pol,
# dates, RegionName, stop, endpt, governor_party, log_totalpopulation,
# daily_increase_smoothed_per_100k, log_totalenplanements19plus1,
# neighbor.mandates.any, nominalgdp_percap, gini2019, log_physicians2018)
# summary_stats_data <- set_my_basic_labels(summary_stats_data)

summary_stats_data %>%
    select(-c(pol, dates, RegionName, stop, endpt)) %>%
    mutate(governor_party = str_to_title(governor_party)) %>%
    tbl_summary(by = governor_party) %>%
    modify_header(label ~ "**State characteristics**", stat_by = "**{level}**<br>N = {n}") %>%
    add_overall(col_label = "**All governors**<br>N = {N}") %>%
    modify_footnote(all_stat_cols() ~ "State-day observations. Median (IQR) or frequency (%).")
State characteristics All governors
N = 1102381
Democrat
N = 446191
Republican
N = 656191
Log(Population, 2019) 15.31 (14.48, 15.78) 15.35 (14.88, 16.00) 14.98 (14.40, 15.74)
Case increases per 100K, 7-day avg. 2 (0, 13) 0 (0, 9) 3 (0, 16)
Log(Total enplanements + 1, 2019) 15.57 (14.62, 17.00) 16.71 (15.03, 17.16) 15.13 (14.00, 16.41)
Neighbours with mandates
0 71,977 (65%) 32,076 (72%) 39,901 (61%)
1 14,962 (14%) 5,533 (12%) 9,429 (14%)
2 9,218 (8.4%) 3,608 (8.1%) 5,610 (8.5%)
3 4,996 (4.5%) 1,291 (2.9%) 3,705 (5.6%)
4 4,288 (3.9%) 1,232 (2.8%) 3,056 (4.7%)
5 2,805 (2.5%) 808 (1.8%) 1,997 (3.0%)
6 1,346 (1.2%) 48 (0.1%) 1,298 (2.0%)
7 181 (0.2%) 23 (<0.1%) 158 (0.2%)
8 465 (0.4%) 0 (0%) 465 (0.7%)
Nominal GDP per capita, 2019 60,442 (52,409, 68,757) 60,830 (57,445, 73,452) 59,893 (51,746, 66,070)
GINI coefficient, 2019 0.463 (0.443, 0.475) 0.469 (0.450, 0.478) 0.460 (0.440, 0.475)
Physicians per 100K, 2018 80 (73, 88) 88 (82, 94) 78 (72, 80)

1 State-day observations. Median (IQR) or frequency (%).

Methadology and Results

Primary Analysis

Event history analysis models the duration of time until an event occurs. This paper primarily relies on the Cox proportional hazards model. This semi-parametric model is the most common approach to event history analysis, wherein the treatment effects between groups can be measured with or without additional covariates. This model is used here because they make no assumptions about the shape of hazard rates distributions and their capability to handle right-censored data (Ozga, Kieser, and Rauch 2018, 3; Brandtner et al. 2021, 8).

These models have the functional form

\(h_{ij}(t)=h_{0}(t)*\exp(\beta_iX_i)\)
Equation 2. Cox Proportional Hazards.

In this paper, time t represents the number of days elapsed since 9 January 2020 to enact policy j in state i. This is modelled as a function of a baseline hazard rate h and a set of exponentiated coefficients β of time-fixed covariates X. This model’s proportional hazards assumption derives from h, which represents the instance where covariates are 0, and changes proportionally to changes in covariates (Sebhatu et al. 2020, 21205). The Cox model may be extended to allow for time-varying covariates with the form

\(h_{ij}(t)=h_{0}(t)*\exp(\beta_iX_i+\gamma_iXg(t))\)
Equation 3. Cox Proportional Hazards with time-varying covariates.

where \(\gamma\) represents the coefficients of time-varying covariates (Zhang et al. 2018, 2). For each included policy, a model taking this form loaded with the aforementioned variables is run. Ties in survival times are handled using the Efron method given its superior accuracy and computational efficiency (Therneau et al. 2021, 33).

To fit the data to these models, a function is run in R for each policy to automatically record the stopping point of observation per state, or the number of days until a policy meeting the specified parameters (i.e., minimum policy intensity and geographic scope) is recorded or the end of the observation period is reached in each state. As per guidelines set out by Zhang et al. (2018, 3), start and stop variables defining daily time intervals corresponding with the date are introduced to accommodate time-varying covariates, and a status variable binarily records whether an event occurred within each start and stop interval. The data of the explanatory variables are then joined to match rows by state and applicable dates, after which the Cox proportional hazards models are run against a significance level of 5%, or 0.05.

Figure 7. Dot-dash plot of variable of interest in primary models across policy types.
mincox <- function(data) {
    coxph(Surv(tstart, tstop, status) ~ governor_party + log_totalpopulation + daily_increase_smoothed_per_100k +
        log_totalenplanements19plus1 + neighbor.mandates.any + nominalgdp_percap +
        gini2019 + log_physicians2018, data = data)
}

C1prit <- tbl_regression(mincox(C1_general_speed_fort), exponentiate = TRUE)
C2prit <- tbl_regression(mincox(C2_general_speed_fort), exponentiate = TRUE)
C3prit <- tbl_regression(mincox(C3_general_speed_fort), exponentiate = TRUE)
C4prit <- tbl_regression(mincox(C4_general_speed_fort), exponentiate = TRUE)
C6prit <- tbl_regression(mincox(C6_general_speed_fort), exponentiate = TRUE)
C7prit <- tbl_regression(mincox(C7_general_speed_fort), exponentiate = TRUE)
C8anyt <- tbl_regression(mincox(C8_any_speed_fort), exponentiate = TRUE)

E1anyt <- tbl_regression(mincox(E1_any_speed_fort), exponentiate = TRUE)
E2anyt <- tbl_regression(mincox(E2_any_speed_fort), exponentiate = TRUE)

H1prit <- tbl_regression(mincox(H1_general_speed_fort), exponentiate = TRUE)
H2anyt <- tbl_regression(mincox(H2_any_speed_fort), exponentiate = TRUE)
H3anyt <- tbl_regression(mincox(H3_any_speed_fort), exponentiate = TRUE)
H6prit <- tbl_regression(mincox(H6_general_speed_fort), exponentiate = TRUE)
H7anyt <- tbl_regression(mincox(H7_any_speed_fort), exponentiate = TRUE)
H8prit <- tbl_regression(mincox(H8_general_speed_fort), exponentiate = TRUE)


## Summary table
Group <- c("Containment and Closure", "Containment and Closure", "Containment and Closure",
    "Containment and Closure", "Containment and Closure", "Containment and Closure",
    "Containment and Closure", "Economic", "Economic", "Health", "Health", "Health",
    "Health", "Health", "Health")

Policy <- c("C1 School Closing", "C2 Workplace Closing", "C3 Cancel Public Events",
    "C4 Restrictions on Gatherings", "C6 Stay at Home Requirements", "C7 Restrictions on Internal Movement",
    "C8 International Travel Controls", "E1 Income Support", "E2 Debt/Contract Relief",
    "H1 Public Information Campaigns", "H2 Testing Policy", "H3 Contact Tracing",
    "H6 Facial Coverings", "H7 Vaccination Policy", "H8 Protection of Elderly People")

events <- c(summary(mincox(C1_general_speed_fort))$nevent, summary(mincox(drop_na(C2_general_speed_fort)))$nevent,
    summary(mincox(C3_general_speed_fort))$nevent, summary(mincox(drop_na(C4_general_speed_fort)))$nevent,
    summary(mincox(drop_na(C6_general_speed_fort)))$nevent, summary(mincox(drop_na(C7_general_speed_fort)))$nevent,
    summary(mincox(drop_na(C8_any_speed_fort)))$nevent, summary(mincox(drop_na(E1_any_speed_fort)))$nevent,
    summary(mincox(E2_any_speed_fort))$nevent, summary(mincox(H1_general_speed_fort))$nevent,
    summary(mincox(H2_any_speed_fort))$nevent, summary(mincox(H3_any_speed_fort))$nevent,
    summary(mincox(drop_na(H6_general_speed_fort)))$nevent, summary(mincox(H7_any_speed_fort))$nevent,
    summary(mincox(drop_na(H8_general_speed_fort)))$nevent)

n <- c(summary(mincox(C1_general_speed_fort))$n, summary(mincox(drop_na(C2_general_speed_fort)))$n,
    summary(mincox(C3_general_speed_fort))$n, summary(mincox(drop_na(C4_general_speed_fort)))$n,
    summary(mincox(drop_na(C6_general_speed_fort)))$n, summary(mincox(drop_na(C7_general_speed_fort)))$n,
    summary(mincox(drop_na(C8_any_speed_fort)))$n, summary(mincox(drop_na(E1_any_speed_fort)))$n,
    summary(mincox(E2_any_speed_fort))$n, summary(mincox(H1_general_speed_fort))$n,
    summary(mincox(H2_any_speed_fort))$n, summary(mincox(H3_any_speed_fort))$n, summary(mincox(drop_na(H6_general_speed_fort)))$n,
    summary(mincox(H7_any_speed_fort))$n, summary(mincox(drop_na(H8_general_speed_fort)))$n)

Coef <- c(summary(mincox(C1_general_speed_fort))$coefficients[1, 1], summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,
    1], summary(mincox(C3_general_speed_fort))$coefficients[1, 1], summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,
    1], summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1, 1], summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,
    1], summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1, 1], summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,
    1], summary(mincox(E2_any_speed_fort))$coefficients[1, 1], summary(mincox(H1_general_speed_fort))$coefficients[1,
    1], summary(mincox(H2_any_speed_fort))$coefficients[1, 1], summary(mincox(H3_any_speed_fort))$coefficients[1,
    1], summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1, 1], summary(mincox(H7_any_speed_fort))$coefficients[1,
    1], summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1, 1])

Std.Err <- c(summary(mincox(C1_general_speed_fort))$coefficients[1, 3], summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,
    3], summary(mincox(C3_general_speed_fort))$coefficients[1, 3], summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,
    3], summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1, 3], summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,
    3], summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1, 3], summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,
    3], summary(mincox(E2_any_speed_fort))$coefficients[1, 3], summary(mincox(H1_general_speed_fort))$coefficients[1,
    3], summary(mincox(H2_any_speed_fort))$coefficients[1, 3], summary(mincox(H3_any_speed_fort))$coefficients[1,
    3], summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1, 3], summary(mincox(H7_any_speed_fort))$coefficients[1,
    3], summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1, 3])

p <- c(summary(mincox(C1_general_speed_fort))$coefficients[1, 5], summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,
    5], summary(mincox(C3_general_speed_fort))$coefficients[1, 5], summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,
    5], summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1, 5], summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,
    5], summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1, 5], summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,
    5], summary(mincox(E2_any_speed_fort))$coefficients[1, 5], summary(mincox(H1_general_speed_fort))$coefficients[1,
    5], summary(mincox(H2_any_speed_fort))$coefficients[1, 5], summary(mincox(H3_any_speed_fort))$coefficients[1,
    5], summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1, 5], summary(mincox(H7_any_speed_fort))$coefficients[1,
    5], summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1, 5])

exp_coef <- c(summary(mincox(C1_general_speed_fort))$conf.int[1, 1], summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,
    1], summary(mincox(C3_general_speed_fort))$conf.int[1, 1], summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,
    1], summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1, 1], summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,
    1], summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1, 1], summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,
    1], summary(mincox(E2_any_speed_fort))$conf.int[1, 1], summary(mincox(H1_general_speed_fort))$conf.int[1,
    1], summary(mincox(H2_any_speed_fort))$conf.int[1, 1], summary(mincox(H3_any_speed_fort))$conf.int[1,
    1], summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1, 1], summary(mincox(H7_any_speed_fort))$conf.int[1,
    1], summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1, 1])

lower_95 <- c(summary(mincox(C1_general_speed_fort))$conf.int[1, 3], summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,
    3], summary(mincox(C3_general_speed_fort))$conf.int[1, 3], summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,
    3], summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1, 3], summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,
    3], summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1, 3], summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,
    3], summary(mincox(E2_any_speed_fort))$conf.int[1, 3], summary(mincox(H1_general_speed_fort))$conf.int[1,
    3], summary(mincox(H2_any_speed_fort))$conf.int[1, 3], summary(mincox(H3_any_speed_fort))$conf.int[1,
    3], summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1, 3], summary(mincox(H7_any_speed_fort))$conf.int[1,
    3], summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1, 3])

upper_95 <- c(summary(mincox(C1_general_speed_fort))$conf.int[1, 4], summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,
    4], summary(mincox(C3_general_speed_fort))$conf.int[1, 4], summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,
    4], summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1, 4], summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,
    4], summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1, 4], summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,
    4], summary(mincox(E2_any_speed_fort))$conf.int[1, 4], summary(mincox(H1_general_speed_fort))$conf.int[1,
    4], summary(mincox(H2_any_speed_fort))$conf.int[1, 4], summary(mincox(H3_any_speed_fort))$conf.int[1,
    4], summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1, 4], summary(mincox(H7_any_speed_fort))$conf.int[1,
    4], summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1, 4])

ph <- c(cox.zph(mincox(C1_general_speed_fort))$table[1, 3], cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[1,
    3], cox.zph(mincox(C3_general_speed_fort))$table[1, 3], cox.zph(mincox(drop_na(C4_general_speed_fort)))$table[1,
    3], cox.zph(mincox(drop_na(C6_general_speed_fort)))$table[1, 3], cox.zph(mincox(drop_na(C7_general_speed_fort)))$table[1,
    3], cox.zph(mincox(drop_na(C8_any_speed_fort)))$table[1, 3], cox.zph(mincox(drop_na(E1_any_speed_fort)))$table[1,
    3], cox.zph(mincox(E2_any_speed_fort))$table[1, 3], cox.zph(mincox(H1_general_speed_fort))$table[1,
    3], cox.zph(mincox(H2_any_speed_fort))$table[1, 3], cox.zph(mincox(H3_any_speed_fort))$table[1,
    3], cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[1, 3], cox.zph(mincox(H7_any_speed_fort))$table[1,
    3], cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[1, 3])

ph_global <- c(cox.zph(mincox(C1_general_speed_fort))$table[9, 3], cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[9,
    3], cox.zph(mincox(C3_general_speed_fort))$table[9, 3], cox.zph(mincox(drop_na(C4_general_speed_fort)))$table[9,
    3], cox.zph(mincox(drop_na(C6_general_speed_fort)))$table[9, 3], cox.zph(mincox(drop_na(C7_general_speed_fort)))$table[9,
    3], cox.zph(mincox(drop_na(C8_any_speed_fort)))$table[9, 3], cox.zph(mincox(drop_na(E1_any_speed_fort)))$table[9,
    3], cox.zph(mincox(E2_any_speed_fort))$table[9, 3], cox.zph(mincox(H1_general_speed_fort))$table[9,
    3], cox.zph(mincox(H2_any_speed_fort))$table[9, 3], cox.zph(mincox(H3_any_speed_fort))$table[9,
    3], cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[9, 3], cox.zph(mincox(H7_any_speed_fort))$table[9,
    3], cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[9, 3])

aic <- c(AIC(mincox(C1_general_speed_fort)), AIC(mincox(drop_na(C2_general_speed_fort))),
    AIC(mincox(C3_general_speed_fort)), AIC(mincox(drop_na(C4_general_speed_fort))),
    AIC(mincox(drop_na(C6_general_speed_fort))), AIC(mincox(drop_na(C7_general_speed_fort))),
    AIC(mincox(drop_na(C8_any_speed_fort))), AIC(mincox(drop_na(E1_any_speed_fort))),
    AIC(mincox(E2_any_speed_fort)), AIC(mincox(H1_general_speed_fort)), AIC(mincox(H2_any_speed_fort)),
    AIC(mincox(H3_any_speed_fort)), AIC(mincox(drop_na(H6_general_speed_fort))),
    AIC(mincox(H7_any_speed_fort)), AIC(mincox(drop_na(H8_general_speed_fort))))

model_summary <- tibble(Group, Policy, Coef, Std.Err, p, exp_coef, lower_95, upper_95,
    ph, ph_global, aic, events, n)

model_summary <- model_summary %>%
    arrange(Policy)

### NEW CODE

gg_primary <- ggplot(model_summary, aes(x = Policy, y = exp_coef, text = paste0(Policy,
    "</br></br>Hazard ratio: ", round(exp_coef, 3), "</br>95% CI: ", round(lower_95,
        3), " - ", round(upper_95, 3), "</br><i>p</i>-value: ", round(p, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ",
    round(ph, 3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global, 3),
    "</br>AIC: ", round(aic, 3), "</br>Events: ", round(events, 3), "</br>N (days): ",
    round(n, 3)))) + geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes(x = Policy,
    y = exp_coef, color = p)) + geom_linerange(aes(ymin = lower_95, ymax = upper_95,
    color = p)) + scale_color_gradient2(low = "deepskyblue", high = "midnightblue",
    mid = "dodgerblue3", midpoint = 0.05, guide = "colourbar", aesthetics = "color",
    limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = "p-values") + scale_y_continuous(name = "Hazard Ratios",
    limits = c(0, 3.8), sec.axis = sec_axis(trans ~ . * 1, name = "Relative to Democrat governors, enactments by Republican governors are...",
        breaks = c(0.5, 1, 2, 3), labels = c("1/2 as likely", "As likely", "2x as likely",
            "3x as likely"))) + scale_x_discrete(limits = rev(Policy)) + coord_flip() +
    theme_light() + theme(axis.text.x.top = element_text(size = 8, angle = 15))

ax <- list(overlaying = "x", side = "top", showticklabels = TRUE, range = c(0, 3.8),
    tickmode = "array", tickvals = c(0.5, 1, 2, 3), ticktext = list("1/2 as likely",
        "As likely", "2x as likely", "3x as likely"), tickfont = list(size = 8),
    scaleanchor = "x", scalerato = "1", title = list(text = "Relative to Democrat governors, enactments by Republican governors are...",
        font = list(size = 11.5)))

plotly_primary <- ggplotly(gg_primary, tooltip = "text") %>%
    add_markers(x = 0, y = "y", data = NULL, inherit = TRUE, xaxis = "x2") %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE,
        modeBarButtonsToRemove = list("autoScale2d")) %>%
    layout(xaxis2 = ax, margin = list(t = 40))


plotly_primary
### END NEW CODE

Note: Symbols represent hazard ratios and lines represent the 95% confidence interval.

Figure 7 presents the coefficient values and 95% confidence intervals of the main covariate of interest, the party affiliation of governors with Republican governors coded as 1, across the 15 tracked policies. The results of this variable from the models for C2 (\(\exp(\beta)\)=0.394, 95% CI: 0.192 to 0.809, p<0.05, \(n_{events}\)=50) and C6 (\(\exp(\beta)\)=0.359, 95% CI: 0.167 to 0.771, p<0.01, \(n_{events}\)=39) support earlier studies that found states with Republican governors were less likely to enact closures and stay-at-home orders and more likely to enact them later than states with Democratic governors, and results from the model for H6 (\(\exp(\beta)\)=0.330, 95% CI: 0.154 to 0.708, p<0.01, \(n_{events}\)=39) supports the intuition that mask mandates were more common and happened sooner in states led by Democratic governors. These results additionally suggest that the timings of economic policies varied between governors’ party affiliations, with strong evidence that Republican governors oversaw fewer or later E1 income support programs (\(\exp(\beta)\)=0.358, 95% CI: 0.180 to 0.714, p<0.01, \(n_{events}\)=45) and mixed evidence for less or slower rollouts of E2 debt or contract relief policies (\(\exp(\beta)\)=0.535, 95% CI: 0.275 to 1.043, p=0.067, \(n_{events}\)=50). Perhaps the most important results are the lack of substantively meaningful differences in policy enactments between states with Republican and Democratic governors for policies C1 school closures, C3 cancellation of public events, C4 restrictions on gatherings, C7 restrictions on internal movement, C8 international travel controls, H1 public information policies, H2 testing policy, H3 contact tracing programs, H7 vaccination policies, and H8 protections for the elderly.

Robustness Tests

Alternative Geographic Scope

To evaluate the sensitivity of these results against different parameters, several robustness checks are conducted. First, this paper evaluates whether locally targeted or municipally enacted policies follow similar hazard distributions along party lines of the state governor. As depicted in Figure 8, there are no statistically significant differences in policy enactments between Republican and Democrat-led states for any of the policies evaluated when geographically targeted policies are also counted as events. These results support Brandtner et al.’s (2021) finding of a compensatory effect at the county level, wherein Republican-led states that are slow or fail to enact policies will see their cities or counties implement policies and programs themselves. As the coding structure of the OXCGRT dataset does not differentiate between geographically targeted policies issued by the state or a municipal authority, it is also possible that some state governments may prefer the lower political costs of enacting smaller scale policies across counties than for the entire state at once, even if such policies are more ineffectual. As discussed by Adolph et al. (2021), governors were under intense scrutiny and potential political repercussions under President Trump, and smaller-scale policies may have offered a subtler route for action.

Figure 8. Dot-dash plot of variable of interest with alternative geographic scope.
# C1_any_speed_fort <- fortify_any_speed('C1_School.closing', 2) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# C2_any_speed_fort <- fortify_any_speed('C2_Workplace.closing', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C3_any_speed_fort <- fortify_any_speed('C3_Cancel.public.events', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C4_any_speed_fort <- fortify_any_speed('C4_Restrictions.on.gatherings', 1)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C5_any_speed_fort <- fortify_any_speed('C5_Close.public.transport', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C6_any_speed_fort <- fortify_any_speed('C6_Stay.at.home.requirements', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C7_any_speed_fort <-
# fortify_any_speed('C7_Restrictions.on.internal.movement', 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# #C8_any_speed_fort <- fortify_any_speed('C8_International.travel.controls',
# 1) #No flag #E1_any_speed_fort <- fortify_any_speed('E1_Income.support', 1)
# #Binary flag for sectoral scope: 0 - formal sector workers only or informal
# sector workers only, 1 - all workers #E2_any_speed_fort <-
# fortify_any_speed('E2_Debt.contract.relief', 1) #No flag H1_any_speed_fort <-
# fortify_any_speed('H1_Public.information.campaigns', 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# #H2_any_speed_fort <- fortify_any_speed('H2_Testing.policy', 1) #No flag
# #H3_any_speed_fort <- fortify_any_speed('H3_Contact.tracing', 1) #No flag
# H6_any_speed_fort <- fortify_any_speed('H6_Facial.Coverings', 2) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# #H7_any_speed_fort <- fortify_any_speed('H7_Vaccination.policy', 1) #Binary
# flag for cost: 0 - At cost to individual (or funded by NGO, insurance, or
# partially government funded), 1- No or minimal cost to individual (government
# funded or subsidised), Blank - no data H8_any_speed_fort <-
# fortify_any_speed('H8_Protection.of.elderly.people', 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
C1_any_speed_fort <- set_my_basic_labels(C1_any_speed_fort)
C2_any_speed_fort <- set_my_basic_labels(C2_any_speed_fort)
C3_any_speed_fort <- set_my_basic_labels(C3_any_speed_fort)
C4_any_speed_fort <- set_my_basic_labels(C4_any_speed_fort)
C5_any_speed_fort <- set_my_basic_labels(C5_any_speed_fort)
C6_any_speed_fort <- set_my_basic_labels(C6_any_speed_fort)
C7_any_speed_fort <- set_my_basic_labels(C7_any_speed_fort)
# C8_any_speed_fort <- set_my_basic_labels(C8_any_speed_fort)

# E1_any_speed_fort <- set_my_basic_labels(E1_any_speed_fort) E2_any_speed_fort
# <- set_my_basic_labels(E2_any_speed_fort)

H1_any_speed_fort <- set_my_basic_labels(H1_any_speed_fort)
# H2_any_speed_fort <- set_my_basic_labels(H2_any_speed_fort) H3_any_speed_fort
# <- set_my_basic_labels(H3_any_speed_fort)
H6_any_speed_fort <- set_my_basic_labels(H6_any_speed_fort)
# H7_any_speed_fort <- set_my_basic_labels(H7_any_speed_fort)
H8_any_speed_fort <- set_my_basic_labels(H8_any_speed_fort)
#
C1anyt <- tbl_regression(mincox(C1_any_speed_fort), exponentiate = TRUE)
C2anyt <- tbl_regression(mincox(C2_any_speed_fort), exponentiate = TRUE)
C3anyt <- tbl_regression(mincox(C3_any_speed_fort), exponentiate = TRUE)
C4anyt <- tbl_regression(mincox(C4_any_speed_fort), exponentiate = TRUE)
C5anyt <- tbl_regression(mincox(C5_any_speed_fort), exponentiate = TRUE)
C6anyt <- tbl_regression(mincox(C6_any_speed_fort), exponentiate = TRUE)
C7anyt <- tbl_regression(mincox(C7_any_speed_fort), exponentiate = TRUE)
# C8anyt <- tbl_regression(mincox(C8_any_speed_fort), exponentiate = TRUE)

# E1anyt <- tbl_regression(mincox(E1_any_speed_fort), exponentiate = TRUE)
# E2anyt <- tbl_regression(mincox(E2_any_speed_fort), exponentiate = TRUE)

H1anyt <- tbl_regression(mincox(H1_any_speed_fort), exponentiate = TRUE)
# H2anyt <- tbl_regression(mincox(H2_any_speed_fort), exponentiate = TRUE)
# H3anyt <- tbl_regression(mincox(H3_any_speed_fort), exponentiate = TRUE)
H6anyt <- tbl_regression(mincox(H6_any_speed_fort), exponentiate = TRUE)
# H7anyt <- tbl_regression(mincox(H7_any_speed_fort), exponentiate = TRUE)
H8anyt <- tbl_regression(mincox(H8_any_speed_fort), exponentiate = TRUE)
# Group_plusC5 <- c('Containment and Closure', 'Containment and Closure',
# 'Containment and Closure', 'Containment and Closure', 'Containment and
# Closure', 'Containment and Closure', 'Containment and Closure', 'Containment
# and Closure', 'Economic', 'Economic', 'Health', 'Health', 'Health', 'Health',
# 'Health', 'Health') Policy_plusC5 <- c('C1 School Closing', 'C2 Workplace
# Closing', 'C3 Cancel Public Events', 'C4 Restrictions on Gatherings', 'C5
# Close Public Transport', 'C6 Stay at Home Requirements', 'C7 Restrictions on
# Internal Movement', 'C8 International Travel Controls', 'E1 Income Support',
# 'E2 Debt/Contract Relief', 'H1 Public Information Campaigns', 'H2 Testing
# Policy', 'H3 Contact Tracing', 'H6 Facial Coverings', 'H7 Vaccination
# Policy', 'H8 Protection of Elderly People') Coef_any <- c(
# summary(mincox(C1_any_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C2_any_speed_fort)))$coefficients[1,1],
# summary(mincox(C3_any_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C4_any_speed_fort)))$coefficients[1,1],
# summary(mincox(C5_any_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C6_any_speed_fort)))$coefficients[1,1],
# summary(mincox(drop_na(C7_any_speed_fort)))$coefficients[1,1], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$coefficients[1,1], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$coefficients[1,1], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$coefficients[1,1]) Std.Err_any <-
# c( summary(mincox(C1_any_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C2_any_speed_fort)))$coefficients[1,3],
# summary(mincox(C3_any_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C4_any_speed_fort)))$coefficients[1,3],
# summary(mincox(C5_any_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C6_any_speed_fort)))$coefficients[1,3],
# summary(mincox(drop_na(C7_any_speed_fort)))$coefficients[1,3], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$coefficients[1,3], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$coefficients[1,3], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$coefficients[1,3]) p_any <- c(
# summary(mincox(C1_any_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C2_any_speed_fort)))$coefficients[1,5],
# summary(mincox(C3_any_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C4_any_speed_fort)))$coefficients[1,5],
# summary(mincox(C5_any_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C6_any_speed_fort)))$coefficients[1,5],
# summary(mincox(drop_na(C7_any_speed_fort)))$coefficients[1,5], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$coefficients[1,5], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$coefficients[1,5], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$coefficients[1,5]) exp_coef_any
# <- c( summary(mincox(C1_any_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C2_any_speed_fort)))$conf.int[1,1],
# summary(mincox(C3_any_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C4_any_speed_fort)))$conf.int[1,1],
# summary(mincox(C5_any_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C6_any_speed_fort)))$conf.int[1,1],
# summary(mincox(drop_na(C7_any_speed_fort)))$conf.int[1,1], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$conf.int[1,1], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$conf.int[1,1], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$conf.int[1,1]) lower_95_any <- c(
# summary(mincox(C1_any_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C2_any_speed_fort)))$conf.int[1,3],
# summary(mincox(C3_any_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C4_any_speed_fort)))$conf.int[1,3],
# summary(mincox(C5_any_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C6_any_speed_fort)))$conf.int[1,3],
# summary(mincox(drop_na(C7_any_speed_fort)))$conf.int[1,3], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$conf.int[1,3], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$conf.int[1,3], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$conf.int[1,3]) upper_95_any <- c(
# summary(mincox(C1_any_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C2_any_speed_fort)))$conf.int[1,4],
# summary(mincox(C3_any_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C4_any_speed_fort)))$conf.int[1,4],
# summary(mincox(C5_any_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C6_any_speed_fort)))$conf.int[1,4],
# summary(mincox(drop_na(C7_any_speed_fort)))$conf.int[1,4], NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$conf.int[1,4], NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$conf.int[1,4], NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$conf.int[1,4]) ph_any <- c(
# cox.zph(mincox(C1_any_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C2_any_speed_fort)))$table[1,3],
# cox.zph(mincox(C3_any_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C4_any_speed_fort)))$table[1,3],
# cox.zph(mincox(C5_any_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C6_any_speed_fort)))$table[1,3],
# cox.zph(mincox(drop_na(C7_any_speed_fort)))$table[1,3], NA, NA, NA,
# cox.zph(mincox(H1_any_speed_fort))$table[1,3], NA, NA,
# cox.zph(mincox(drop_na(H6_any_speed_fort)))$table[1,3], NA,
# cox.zph(mincox(drop_na(H8_any_speed_fort)))$table[1,3]) ph_global_any <- c(
# cox.zph(mincox(C1_any_speed_fort))$table[nrow(cox.zph(mincox(C1_any_speed_fort))$table),3],
# cox.zph(mincox(drop_na(C2_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C2_any_speed_fort)))$table),3],
# cox.zph(mincox(C3_any_speed_fort))$table[nrow(cox.zph(mincox(C3_any_speed_fort))$table),3],
# cox.zph(mincox(drop_na(C4_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C4_any_speed_fort)))$table),3],
# cox.zph(mincox(drop_na(C5_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C5_any_speed_fort)))$table),3],
# cox.zph(mincox(drop_na(C6_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C6_any_speed_fort)))$table),3],
# cox.zph(mincox(drop_na(C7_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C7_any_speed_fort)))$table),3],
# NA, NA, NA,
# cox.zph(mincox(H1_any_speed_fort))$table[nrow(cox.zph(mincox(H1_any_speed_fort))$table),3],
# NA, NA,
# cox.zph(mincox(drop_na(H6_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(H6_any_speed_fort)))$table),3],
# NA,
# cox.zph(mincox(drop_na(H8_any_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(H8_any_speed_fort)))$table),3])
# aic_any <- c( AIC(mincox(C1_any_speed_fort)),
# AIC(mincox(drop_na(C2_any_speed_fort))), AIC(mincox(C3_any_speed_fort)),
# AIC(mincox(drop_na(C4_any_speed_fort))),
# AIC(mincox(drop_na(C5_any_speed_fort))),
# AIC(mincox(drop_na(C6_any_speed_fort))),
# AIC(mincox(drop_na(C7_any_speed_fort))), NA, NA, NA,
# AIC(mincox(H1_any_speed_fort)), NA, NA,
# AIC(mincox(drop_na(H6_any_speed_fort))), NA,
# AIC(mincox(drop_na(H8_any_speed_fort)))) events_any <-
# c(summary(mincox(C1_any_speed_fort))$nevent,
# summary(mincox(C2_any_speed_fort))$nevent,
# summary(mincox(C3_any_speed_fort))$nevent,
# summary(mincox(C4_any_speed_fort))$nevent,
# summary(mincox(drop_na(C5_any_speed_fort)))$nevent,
# summary(mincox(drop_na(C6_any_speed_fort)))$nevent,
# summary(mincox(drop_na(C7_any_speed_fort)))$nevent, NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$nevent, NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$nevent, NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$nevent) n_any <-
# c(summary(mincox(C1_any_speed_fort))$n, summary(mincox(C2_any_speed_fort))$n,
# summary(mincox(C3_any_speed_fort))$n, summary(mincox(C4_any_speed_fort))$n,
# summary(mincox(drop_na(C5_any_speed_fort)))$n,
# summary(mincox(drop_na(C6_any_speed_fort)))$n,
# summary(mincox(drop_na(C7_any_speed_fort)))$n, NA, NA, NA,
# summary(mincox(H1_any_speed_fort))$n, NA, NA,
# summary(mincox(drop_na(H6_any_speed_fort)))$n, NA,
# summary(mincox(drop_na(H8_any_speed_fort)))$n) model_any_summary <- tibble(
# Group_plusC5, Policy_plusC5, Coef_any, Std.Err_any, p_any, exp_coef_any,
# lower_95_any, upper_95_any, ph_any, ph_global_any, aic_any, events_any, n_any
# ) ggplot(model_any_summary, aes (x = Policy_plusC5, y = exp_coef_any)) +
# geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes( x =
# Policy_plusC5, y = exp_coef_any, color = p_any)) + geom_linerange(aes( ymin =
# lower_95_any, ymax = upper_95_any, color = p_any )) +
# scale_color_gradient2(low = 'deepskyblue', high = 'midnightblue', mid =
# 'dodgerblue3', midpoint = 0.05, guide = 'colourbar', aesthetics = 'color',
# limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = 'p-values') +
# scale_y_continuous(name = 'Hazard Ratios', limits = c(0,4), breaks = c(0,
# 0.5, 1:3), sec.axis = sec_axis(trans~.*1, name = 'Relative to Democrat
# governors, enactments by Republican governors are...', breaks = c(0.5, 1:3),
# labels = c('1/2 as likely', 'As likely', '2x as likely', '3x as likely'))) +
# scale_x_discrete(limits = rev(Policy_plusC5)) + xlab('Policy') + coord_flip()
# + theme_light() + theme(axis.text.x.top = element_text(size = 8, angle = 15))
# model_any_general_summary <- model_summary %>% #filter(ph > 0.05 & ph_global
# > 0.05) %>% full_join(model_any_summary #%>% filter(ph_any > 0.05 &
# ph_global_any > 0.05) , by = c('Policy' = 'Policy_plusC5')) %>%
# #full_join(tibble(Group_plusC5, Policy_plusC5), by = c('Policy' =
# 'Policy_plusC5')) %>% arrange(Policy)

### NEW CODE

gg_any <- ggplot(model_any_general_summary, aes(x = Policy_plusC5, y = exp_coef_any)) +
    geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes(x = Policy_plusC5,
    y = exp_coef_any, color = p_any, shape = "Any orders", text = paste0(Policy,
        " - Any", "</br></br>Hazard ratio: ", round(exp_coef_any, 3), "</br>95% CI: ",
        round(lower_95_any, 3), " - ", round(upper_95_any, 3), "</br><i>p</i>-value: ",
        round(p_any, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ", round(ph_any,
            3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global_any, 3),
        "</br>AIC: ", round(aic_any, 3), "</br>Events: ", round(events_any, 3), "</br>N (days): ",
        round(n_any, 3))), size = 2, position = position_nudge(x = 0.25)) + geom_linerange(aes(ymin = lower_95_any,
    ymax = upper_95_any, color = p_any), size = 1.01, position = position_nudge(x = 0.25)) +
    geom_point(aes(x = Policy, y = exp_coef, color = p, shape = "State-wide only",
        text = paste0(Policy, "</br></br>Hazard ratio: ", round(exp_coef, 3), "</br>95% CI: ",
            round(lower_95, 3), " - ", round(upper_95, 3), "</br><i>p</i>-value: ",
            round(p, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ", round(ph,
                3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global, 3),
            "</br>AIC: ", round(aic, 3), "</br>Events: ", round(events, 3), "</br>N (days): ",
            round(n, 3))), position = position_nudge(x = -0.25)) + geom_linerange(aes(ymin = lower_95,
    ymax = upper_95, color = p), linetype = "dotdash", position = position_nudge(x = -0.25)) +
    scale_color_gradient2(low = "deepskyblue", high = "midnightblue", mid = "dodgerblue3",
        midpoint = 0.05, guide = "colourbar", aesthetics = "color", limits = c(0,
            0.15), breaks = c(0, 0.05, 0.1, 0.15), name = "p-values") + scale_y_continuous(name = "Hazard Ratios",
    limits = c(0, 4), breaks = c(0, 0.5, 1:4), sec.axis = sec_axis(trans ~ . * 1,
        name = "Relative to Democrat governors, enactments by Republican governors are...",
        breaks = c(0.5, 1:4), labels = c("1/2 as likely", "As likely", "2x as likely",
            "3x as likely", "4x as likely"))) + scale_x_discrete(limits = rev(Policy)) +
    scale_shape_manual(name = "Geography", values = c(`Any orders` = 8, `State-wide only` = 1)) +
    labs(x = "Policy") + coord_flip() + theme_light() + theme(axis.text.x.top = element_text(size = 8,
    angle = 15))

ax <- list(overlaying = "x", side = "top", showticklabels = TRUE, range = c(0, 4),
    tickmode = "array", tickvals = c(0.5, 1, 2, 3, 4), ticktext = list("1/2 as likely",
        "As likely", "2x as likely", "3x as likely", "4x as likely"), tickfont = list(size = 8),
    scaleanchor = "x", scalerato = "1", title = list(text = "Relative to Democrat governors, enactments by Republican governors are...",
        font = list(size = 11.5)))

plotly_any <- ggplotly(gg_any, tooltip = "text") %>%
    add_markers(x = 0, y = "y", data = NULL, inherit = TRUE, xaxis = "x2", showlegend = F) %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE,
        modeBarButtonsToRemove = list("autoScale2d")) %>%
    layout(xaxis2 = ax, margin = list(t = 50))

for (i in 2:13) {
    plotly_any$x$data[[i]]$name = "Any orders"
    plotly_any$x$data[[i]]$legendgroup <- "Any orders"
}

for (i in 14:29) {
    plotly_any$x$data[[i]]$name = "State-wide only"
    plotly_any$x$data[[i]]$legendgroup = "State-wide only"
}

plotly_any$x$data[[16]]$x = 0.368531
plotly_any$x$data[[16]]$error_x$array = 0.7349433 - plotly_any$x$data[[16]]$x
plotly_any$x$data[[16]]$error_x$arrayminus = plotly_any$x$data[[16]]$x - 0.1847967

plotly_any$x$data[[19]]$x = 0.5181892
plotly_any$x$data[[19]]$error_x$array = 1.00482 - plotly_any$x$data[[19]]$x
plotly_any$x$data[[19]]$error_x$arrayminus = plotly_any$x$data[[19]]$x - 0.267232

plotly_any$x$data[[25]]$x = 0.8354546
plotly_any$x$data[[25]]$error_x$array = 1.539648 - plotly_any$x$data[[25]]$x
plotly_any$x$data[[25]]$error_x$arrayminus = plotly_any$x$data[[25]]$x - 0.4533402

plotly_any$x$data[[26]]$x = 0.8139178
plotly_any$x$data[[26]]$error_x$array = 1.789175 - plotly_any$x$data[[26]]$x
plotly_any$x$data[[26]]$error_x$arrayminus = plotly_any$x$data[[26]]$x - 0.3702613

plotly_any$x$data[[27]]$x = 1.1762111
plotly_any$x$data[[27]]$error_x$array = 2.213091 - plotly_any$x$data[[27]]$x
plotly_any$x$data[[27]]$error_x$arrayminus = plotly_any$x$data[[27]]$x - 0.6251313

plotly_any$x$data[[29]]$x = 0.9792494
plotly_any$x$data[[29]]$error_x$array = 2.063281 - plotly_any$x$data[[29]]$x
plotly_any$x$data[[29]]$error_x$arrayminus = plotly_any$x$data[[29]]$x - 0.4647595

plotly_any$x$layout$annotations[[1]]$y <- 0.4
plotly_any$x$layout$annotations[[1]]$x <- 1.04

plotly_any
### END NEW CODE

Note: Symbols represent hazard ratios and lines represent the 95% confidence interval.

Alternative Levels for Policy Intensity

Second, the robustness of political affiliation is tested against different levels of policy intensity. Where possible, models are run on policies with minimal intensity set as one level more and one level less than the policies levels run in the primary analysis.

As depicted in Figure 9, Republican governors were approximately as unlikely to recommend closing workplaces (\(\exp⁡(\beta)\)=0.481, 95% CI: 0.240 to 0.963, p<0.05, \(n_{events}\)=50) or recommend staying at home (\(\exp⁡(\beta)\)=0.476,95% CI: 0.238 to 0.949,p<0.05,\(n_{events}\)=50) as they were to require those measures, and there is some evidence to suggest that Republican governors were still less likely to recommend facial coverings than their Democratic colleagues (\(\exp⁡(\beta)\)=0.560,95% CI: 0.286 to 1.098,p=0.092,\(n_{events}\)=48). Otherwise, states with Republican governors appear as likely to engage in “soft” policies, such as recommendations and uncoordinated public information campaigns, as states with Democratic governors.

Figure 9. Dot-dash plot of variable of interest with alternative policy intensities.
# Minus 1 level intensity C1_general_speed_fort <-
# fortify_general_speed('C1_School.closing', 'C1_Flag', 1) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C2_general_speed_fort <- fortify_general_speed('C2_Workplace.closing',
# 'C2_Flag', 1) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data C3_general_speed_fort <-
# fortify_general_speed('C3_Cancel.public.events', 'C3_Flag', 1) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# #C4_general_speed_fort <-
# fortify_general_speed('C4_Restrictions.on.gatherings', 'C4_Flag', 1) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C5_general_speed_fort <- fortify_general_speed('C5_Close.public.transport',
# 'C5_Flag', 1) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data C6_general_speed_fort <-
# fortify_general_speed('C6_Stay.at.home.requirements', 'C6_Flag', 1) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C7_general_speed_fort <-
# fortify_general_speed('C7_Restrictions.on.internal.movement', 'C7_Flag', 1)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# #C8_any_speed_fort <- fortify_any_speed('C8_International.travel.controls',
# 1) #No flag #E1_any_speed_fort <- fortify_any_speed('E1_Income.support', 1)
# #Binary flag for sectoral scope: 0 - formal sector workers only or informal
# sector workers only, 1 - all workers #E2_any_speed_fort <-
# fortify_any_speed('E2_Debt.contract.relief', 1) #No flag
# H1_general_speed_fort <-
# fortify_general_speed('H1_Public.information.campaigns', 'H1_Flag', 1)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# #H2_any_speed_fort <- fortify_any_speed('H2_Testing.policy', 1) #No flag
# #H3_any_speed_fort <- fortify_any_speed('H3_Contact.tracing', 1) #No flag
# H6_general_speed_fort <- fortify_general_speed('H6_Facial.Coverings',
# 'H6_Flag', 1) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data #H7_any_speed_fort <-
# fortify_any_speed('H7_Vaccination.policy', 1) #Binary flag for cost: 0 - At
# cost to individual (or funded by NGO, insurance, or partially government
# funded), 1- No or minimal cost to individual (government funded or
# subsidised), Blank - no data H8_general_speed_fort <-
# fortify_general_speed('H8_Protection.of.elderly.people', 'H8_Flag', 1)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C1_general_speed_fort <- set_my_basic_labels(C1_general_speed_fort)
C2_general_speed_fort <- set_my_basic_labels(C2_general_speed_fort)
C3_general_speed_fort <- set_my_basic_labels(C3_general_speed_fort)
# C4_any_speed_fort <- set_my_basic_labels(C4_any_speed_fort)
C5_general_speed_fort <- set_my_basic_labels(C5_general_speed_fort)
C6_general_speed_fort <- set_my_basic_labels(C6_general_speed_fort)
C7_general_speed_fort <- set_my_basic_labels(C7_general_speed_fort)
# C8_any_speed_fort <- set_my_basic_labels(C8_any_speed_fort)

# E1_any_speed_fort <- set_my_basic_labels(E1_any_speed_fort) E2_any_speed_fort
# <- set_my_basic_labels(E2_any_speed_fort)

H1_general_speed_fort <- set_my_basic_labels(H1_general_speed_fort)
# H2_any_speed_fort <- set_my_basic_labels(H2_any_speed_fort) H3_any_speed_fort
# <- set_my_basic_labels(H3_any_speed_fort)
H6_general_speed_fort <- set_my_basic_labels(H6_general_speed_fort)
# H7_any_speed_fort <- set_my_basic_labels(H7_any_speed_fort)
H8_general_speed_fort <- set_my_basic_labels(H8_general_speed_fort)
#
C1mint <- tbl_regression(mincox(C1_general_speed_fort), exponentiate = TRUE)
C2mint <- tbl_regression(mincox(C2_general_speed_fort), exponentiate = TRUE)
C3mint <- tbl_regression(mincox(C3_general_speed_fort), exponentiate = TRUE)
# C4mint <- tbl_regression(mincox(C4_general_speed_fort), exponentiate = TRUE)
C5mint <- tbl_regression(mincox(C5_general_speed_fort), exponentiate = TRUE)
C6mint <- tbl_regression(mincox(C6_general_speed_fort), exponentiate = TRUE)
C7mint <- tbl_regression(mincox(C7_general_speed_fort), exponentiate = TRUE)
# C8mint <- tbl_regression(mincox(C8_any_speed_fort), exponentiate = TRUE)

# E1mint <- tbl_regression(mincox(E1_any_speed_fort), exponentiate = TRUE)
# E2mint <- tbl_regression(mincox(E2_any_speed_fort), exponentiate = TRUE)

H1mint <- tbl_regression(mincox(H1_general_speed_fort), exponentiate = TRUE)
# H2mint <- tbl_regression(mincox(H2_any_speed_fort), exponentiate = TRUE)
# H3mint <- tbl_regression(mincox(H3_any_speed_fort), exponentiate = TRUE)
H6mint <- tbl_regression(mincox(H6_general_speed_fort), exponentiate = TRUE)
# H7mint <- tbl_regression(mincox(H7_any_speed_fort), exponentiate = TRUE)
H8mint <- tbl_regression(mincox(H8_general_speed_fort), exponentiate = TRUE)
# Coef_minus1 <- c( summary(mincox(C1_general_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,1],
# summary(mincox(C3_general_speed_fort))$coefficients[1,1], NA,
# summary(mincox(C5_general_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1,1],
# summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,1], NA, NA,
# NA, summary(mincox(H1_general_speed_fort))$coefficients[1,1], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,1], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,1])
# Std.Err_minus1 <- c(
# summary(mincox(C1_general_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,3],
# summary(mincox(C3_general_speed_fort))$coefficients[1,3], NA,
# summary(mincox(C5_general_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1,3],
# summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,3], NA, NA,
# NA, summary(mincox(H1_general_speed_fort))$coefficients[1,3], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,3], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,3]) p_minus1
# <- c( summary(mincox(C1_general_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,5],
# summary(mincox(C3_general_speed_fort))$coefficients[1,5], NA,
# summary(mincox(C5_general_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C6_general_speed_fort)))$coefficients[1,5],
# summary(mincox(drop_na(C7_general_speed_fort)))$coefficients[1,5], NA, NA,
# NA, summary(mincox(H1_general_speed_fort))$coefficients[1,5], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,5], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,5])
# exp_coef_minus1 <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,1],
# summary(mincox(C3_general_speed_fort))$conf.int[1,1], NA,
# summary(mincox(C5_general_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1,1],
# summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,1], NA, NA, NA,
# summary(mincox(H1_general_speed_fort))$conf.int[1,1], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,1], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,1])
# lower_95_minus1 <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,3],
# summary(mincox(C3_general_speed_fort))$conf.int[1,3], NA,
# summary(mincox(C5_general_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1,3],
# summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,3], NA, NA, NA,
# summary(mincox(H1_general_speed_fort))$conf.int[1,3], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,3], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,3])
# upper_95_minus1 <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,4],
# summary(mincox(C3_general_speed_fort))$conf.int[1,4], NA,
# summary(mincox(C5_general_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C6_general_speed_fort)))$conf.int[1,4],
# summary(mincox(drop_na(C7_general_speed_fort)))$conf.int[1,4], NA, NA, NA,
# summary(mincox(H1_general_speed_fort))$conf.int[1,4], NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,4], NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,4]) ph_minus1 <-
# c( cox.zph(mincox(C1_general_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[1,3],
# cox.zph(mincox(C3_general_speed_fort))$table[1,3], NA,
# cox.zph(mincox(C5_general_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C6_general_speed_fort)))$table[1,3],
# cox.zph(mincox(drop_na(C7_general_speed_fort)))$table[1,3], NA, NA, NA,
# cox.zph(mincox(H1_general_speed_fort))$table[1,3], NA, NA,
# cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[1,3], NA,
# cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[1,3]) ph_global_minus1
# <- c(
# cox.zph(mincox(C1_general_speed_fort))$table[nrow(cox.zph(mincox(C1_general_speed_fort))$table),3],
# cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C2_general_speed_fort)))$table),3],
# cox.zph(mincox(C3_general_speed_fort))$table[nrow(cox.zph(mincox(C3_general_speed_fort))$table),3],
# NA,
# cox.zph(mincox(drop_na(C5_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C5_general_speed_fort)))$table),3],
# cox.zph(mincox(drop_na(C6_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C6_general_speed_fort)))$table),3],
# cox.zph(mincox(drop_na(C7_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(C7_general_speed_fort)))$table),3],
# NA, NA, NA,
# cox.zph(mincox(H1_general_speed_fort))$table[nrow(cox.zph(mincox(H1_general_speed_fort))$table),3],
# NA, NA,
# cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(H6_general_speed_fort)))$table),3],
# NA,
# cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[nrow(cox.zph(mincox(drop_na(H8_general_speed_fort)))$table),3])
# aic_minus1 <- c( AIC(mincox(C1_general_speed_fort)),
# AIC(mincox(drop_na(C2_general_speed_fort))),
# AIC(mincox(C3_general_speed_fort)), NA,
# AIC(mincox(drop_na(C5_general_speed_fort))),
# AIC(mincox(drop_na(C6_general_speed_fort))),
# AIC(mincox(drop_na(C7_general_speed_fort))), NA, NA, NA,
# AIC(mincox(H1_general_speed_fort)), NA, NA,
# AIC(mincox(drop_na(H6_general_speed_fort))), NA,
# AIC(mincox(drop_na(H8_general_speed_fort)))) events_minus1 <-
# c(summary(mincox(C1_general_speed_fort))$nevent,
# summary(mincox(C2_general_speed_fort))$nevent,
# summary(mincox(C3_general_speed_fort))$nevent, NA,
# summary(mincox(drop_na(C5_general_speed_fort)))$nevent,
# summary(mincox(drop_na(C6_general_speed_fort)))$nevent,
# summary(mincox(drop_na(C7_general_speed_fort)))$nevent, NA, NA, NA,
# summary(mincox(H1_general_speed_fort))$nevent, NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$nevent, NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$nevent) n_minus1 <-
# c(summary(mincox(C1_general_speed_fort))$n,
# summary(mincox(C2_general_speed_fort))$n,
# summary(mincox(C3_general_speed_fort))$n, NA,
# summary(mincox(drop_na(C5_general_speed_fort)))$n,
# summary(mincox(drop_na(C6_general_speed_fort)))$n,
# summary(mincox(drop_na(C7_general_speed_fort)))$n, NA, NA, NA,
# summary(mincox(H1_general_speed_fort))$n, NA, NA,
# summary(mincox(drop_na(H6_general_speed_fort)))$n, NA,
# summary(mincox(drop_na(H8_general_speed_fort)))$n) model_minus1_summary <-
# tibble( Group_plusC5, Policy_plusC5, Coef_minus1, Std.Err_minus1, p_minus1,
# exp_coef_minus1, lower_95_minus1, upper_95_minus1, ph_minus1,
# ph_global_minus1, aic_minus1, events_minus1, n_minus1 )
# ggplot(model_minus1_summary, aes (x = Policy_plusC5, y = exp_coef_minus1)) +
# geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes( x =
# Policy_plusC5, y = exp_coef_minus1, color = p_minus1)) + geom_linerange(aes(
# ymin = lower_95_minus1, ymax = upper_95_minus1, color = p_minus1 )) +
# scale_color_gradient2(low = 'deepskyblue', high = 'midnightblue', mid =
# 'dodgerblue3', midpoint = 0.05, guide = 'colourbar', aesthetics = 'color',
# limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = 'p-values') +
# scale_y_continuous(name = 'Hazard Ratios', limits = c(0,4), breaks = c(0,
# 0.5, 1:3), sec.axis = sec_axis(trans~.*1, name = 'Relative to Democrat
# governors, enactments by Republican governors are...', breaks = c(0.5, 1:3),
# labels = c('1/2 as likely', 'As likely', '2x as likely', '3x as likely'))) +
# scale_x_discrete(limits = rev(Policy_plusC5)) + xlab('Policy') + coord_flip()
# + theme_light() + theme(axis.text.x.top = element_text(size = 8, angle = 15))
# # Plus 1 level intensity C1_general_speed_fort <-
# fortify_general_speed('C1_School.closing', 'C1_Flag', 3) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C2_general_speed_fort <- fortify_general_speed('C2_Workplace.closing',
# 'C2_Flag', 3) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data #C3_general_speed_fort <-
# fortify_general_speed('C3_Cancel.public.events', 'C3_Flag', 2) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# C4_general_speed_fort <-
# fortify_general_speed('C4_Restrictions.on.gatherings', 'C4_Flag', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# #C5_general_speed_fort <- fortify_general_speed('C5_Close.public.transport',
# 'C5_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data #C6_general_speed_fort <-
# fortify_general_speed('C6_Stay.at.home.requirements', 'C6_Flag', 3) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data; NO
# POLICIES ENACTED AT LEVEL 3 #C7_general_speed_fort <-
# fortify_general_speed('C7_Restrictions.on.internal.movement', 'C7_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C8_any_speed_fort <- fortify_any_speed('C8_International.travel.controls', 2)
# #No flag E1_any_speed_fort <- fortify_any_speed('E1_Income.support', 2)
# #Binary flag for sectoral scope: 0 - formal sector workers only or informal
# sector workers only, 1 - all workers E2_any_speed_fort <-
# fortify_any_speed('E2_Debt.contract.relief', 2) #No flag
# #H1_general_speed_fort <-
# fortify_general_speed('H1_Public.information.campaigns', 'H1_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# H2_any_speed_fort <- fortify_any_speed('H2_Testing.policy', 2) #No flag
# H3_any_speed_fort <- fortify_any_speed('H3_Contact.tracing', 2) #No flag
# H6_general_speed_fort <- fortify_general_speed('H6_Facial.Coverings',
# 'H6_Flag', 3) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data H7_any_speed_fort <-
# fortify_any_speed('H7_Vaccination.policy', 2) #Binary flag for cost: 0 - At
# cost to individual (or funded by NGO, insurance, or partially government
# funded), 1- No or minimal cost to individual (government funded or
# subsidised), Blank - no data H8_general_speed_fort <-
# fortify_general_speed('H8_Protection.of.elderly.people', 'H8_Flag', 3)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
C1_general_speed_fort <- set_my_basic_labels(C1_general_speed_fort)
C2_general_speed_fort <- set_my_basic_labels(C2_general_speed_fort)
# C3_general_speed_fort <- set_my_basic_labels(C3_general_speed_fort)
C4_general_speed_fort <- set_my_basic_labels(C4_general_speed_fort)
# C5_any_speed_fort <- set_my_basic_labels(C5_any_speed_fort) C6_any_speed_fort
# <- set_my_basic_labels(C6_any_speed_fort) C7_any_speed_fort <-
# set_my_basic_labels(C7_any_speed_fort)
C8_any_speed_fort <- set_my_basic_labels(C8_any_speed_fort)

E1_any_speed_fort <- set_my_basic_labels(E1_any_speed_fort)
E2_any_speed_fort <- set_my_basic_labels(E2_any_speed_fort)

# H1_general_speed_fort <- set_my_basic_labels(H1_general_speed_fort)
H2_any_speed_fort <- set_my_basic_labels(H2_any_speed_fort)
H3_any_speed_fort <- set_my_basic_labels(H3_any_speed_fort)
H6_general_speed_fort <- set_my_basic_labels(H6_general_speed_fort)
H7_any_speed_fort <- set_my_basic_labels(H7_any_speed_fort)
H8_general_speed_fort <- set_my_basic_labels(H8_general_speed_fort)
#
C1plust <- tbl_regression(mincox(C1_general_speed_fort), exponentiate = TRUE)
C2plust <- tbl_regression(mincox(C2_general_speed_fort), exponentiate = TRUE)
# C3plust <- tbl_regression(mincox(C3_general_speed_fort), exponentiate = TRUE)
C4plust <- tbl_regression(mincox(C4_general_speed_fort), exponentiate = TRUE)
# C6plust <- tbl_regression(mincox(C6_general_speed_fort), exponentiate = TRUE)
# C7plust <- tbl_regression(mincox(C7_general_speed_fort), exponentiate = TRUE)
C8plust <- tbl_regression(mincox(C8_any_speed_fort), exponentiate = TRUE)

E1plust <- tbl_regression(mincox(E1_any_speed_fort), exponentiate = TRUE)
E2plust <- tbl_regression(mincox(E2_any_speed_fort), exponentiate = TRUE)

# H1plust <- tbl_regression(mincox(H1_general_speed_fort), exponentiate = TRUE)
H2plust <- tbl_regression(mincox(H2_any_speed_fort), exponentiate = TRUE)
H3plust <- tbl_regression(mincox(H3_any_speed_fort), exponentiate = TRUE)
H6plust <- tbl_regression(mincox(H6_general_speed_fort), exponentiate = TRUE)
H7plust <- tbl_regression(mincox(H7_any_speed_fort), exponentiate = TRUE)
H8plust <- tbl_regression(mincox(H8_general_speed_fort), exponentiate = TRUE)
# events_plus1 <- c( summary(mincox(C1_general_speed_fort))$nevent,
# summary(mincox(drop_na(C2_general_speed_fort)))$nevent, NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$nevent, NA, NA, NA,
# summary(mincox(drop_na(C8_any_speed_fort)))$nevent,
# summary(mincox(drop_na(E1_any_speed_fort)))$nevent,
# summary(mincox(E2_any_speed_fort))$nevent, NA,
# summary(mincox(H2_any_speed_fort))$nevent,
# summary(mincox(H3_any_speed_fort))$nevent,
# summary(mincox(drop_na(H6_general_speed_fort)))$nevent,
# summary(mincox(H7_any_speed_fort))$nevent,
# summary(mincox(drop_na(H8_general_speed_fort)))$nevent) n_plus1 <- c(
# summary(mincox(C1_general_speed_fort))$n,
# summary(mincox(drop_na(C2_general_speed_fort)))$n, NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$n, NA, NA, NA,
# summary(mincox(drop_na(C8_any_speed_fort)))$n,
# summary(mincox(drop_na(E1_any_speed_fort)))$n,
# summary(mincox(E2_any_speed_fort))$n, NA,
# summary(mincox(H2_any_speed_fort))$n, summary(mincox(H3_any_speed_fort))$n,
# summary(mincox(drop_na(H6_general_speed_fort)))$n,
# summary(mincox(H7_any_speed_fort))$n,
# summary(mincox(drop_na(H8_general_speed_fort)))$n) Coef_plus1 <- c(
# summary(mincox(C1_general_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,1], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,1], NA, NA,
# NA, summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1,1],
# summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,1],
# summary(mincox(E2_any_speed_fort))$coefficients[1,1], NA,
# summary(mincox(H2_any_speed_fort))$coefficients[1,1],
# summary(mincox(H3_any_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,1],
# summary(mincox(H7_any_speed_fort))$coefficients[1,1],
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,1])
# Std.Err_plus1 <- c( summary(mincox(C1_general_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,3], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,3], NA, NA,
# NA, summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1,3],
# summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,3],
# summary(mincox(E2_any_speed_fort))$coefficients[1,3], NA,
# summary(mincox(H2_any_speed_fort))$coefficients[1,3],
# summary(mincox(H3_any_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,3],
# summary(mincox(H7_any_speed_fort))$coefficients[1,3],
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,3]) p_plus1 <-
# c( summary(mincox(C1_general_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(C2_general_speed_fort)))$coefficients[1,5], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$coefficients[1,5], NA, NA,
# NA, summary(mincox(drop_na(C8_any_speed_fort)))$coefficients[1,5],
# summary(mincox(drop_na(E1_any_speed_fort)))$coefficients[1,5],
# summary(mincox(E2_any_speed_fort))$coefficients[1,5], NA,
# summary(mincox(H2_any_speed_fort))$coefficients[1,5],
# summary(mincox(H3_any_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(H6_general_speed_fort)))$coefficients[1,5],
# summary(mincox(H7_any_speed_fort))$coefficients[1,5],
# summary(mincox(drop_na(H8_general_speed_fort)))$coefficients[1,5])
# exp_coef_plus1 <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,1], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,1], NA, NA, NA,
# summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1,1],
# summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,1],
# summary(mincox(E2_any_speed_fort))$conf.int[1,1], NA,
# summary(mincox(H2_any_speed_fort))$conf.int[1,1],
# summary(mincox(H3_any_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,1],
# summary(mincox(H7_any_speed_fort))$conf.int[1,1],
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,1]) lower_95_plus1
# <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,3], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,3], NA, NA, NA,
# summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1,3],
# summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,3],
# summary(mincox(E2_any_speed_fort))$conf.int[1,3], NA,
# summary(mincox(H2_any_speed_fort))$conf.int[1,3],
# summary(mincox(H3_any_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,3],
# summary(mincox(H7_any_speed_fort))$conf.int[1,3],
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,3]) upper_95_plus1
# <- c( summary(mincox(C1_general_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(C2_general_speed_fort)))$conf.int[1,4], NA,
# summary(mincox(drop_na(C4_general_speed_fort)))$conf.int[1,4], NA, NA, NA,
# summary(mincox(drop_na(C8_any_speed_fort)))$conf.int[1,4],
# summary(mincox(drop_na(E1_any_speed_fort)))$conf.int[1,4],
# summary(mincox(E2_any_speed_fort))$conf.int[1,4], NA,
# summary(mincox(H2_any_speed_fort))$conf.int[1,4],
# summary(mincox(H3_any_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(H6_general_speed_fort)))$conf.int[1,4],
# summary(mincox(H7_any_speed_fort))$conf.int[1,4],
# summary(mincox(drop_na(H8_general_speed_fort)))$conf.int[1,4]) ph_plus1 <- c(
# cox.zph(mincox(C1_general_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[1,3], NA,
# cox.zph(mincox(drop_na(C4_general_speed_fort)))$table[1,3], NA, NA, NA,
# cox.zph(mincox(drop_na(C8_any_speed_fort)))$table[1,3],
# cox.zph(mincox(drop_na(E1_any_speed_fort)))$table[1,3],
# cox.zph(mincox(E2_any_speed_fort))$table[1,3], NA,
# cox.zph(mincox(H2_any_speed_fort))$table[1,3],
# cox.zph(mincox(H3_any_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[1,3],
# cox.zph(mincox(H7_any_speed_fort))$table[1,3],
# cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[1,3]) ph_global_plus1
# <- c( cox.zph(mincox(C1_general_speed_fort))$table[9,3],
# cox.zph(mincox(drop_na(C2_general_speed_fort)))$table[9,3], NA,
# cox.zph(mincox(drop_na(C4_general_speed_fort)))$table[9,3], NA, NA, NA,
# cox.zph(mincox(drop_na(C8_any_speed_fort)))$table[9,3],
# cox.zph(mincox(drop_na(E1_any_speed_fort)))$table[9,3],
# cox.zph(mincox(E2_any_speed_fort))$table[9,3], NA,
# cox.zph(mincox(H2_any_speed_fort))$table[9,3],
# cox.zph(mincox(H3_any_speed_fort))$table[9,3],
# cox.zph(mincox(drop_na(H6_general_speed_fort)))$table[9,3],
# cox.zph(mincox(H7_any_speed_fort))$table[9,3],
# cox.zph(mincox(drop_na(H8_general_speed_fort)))$table[9,3]) aic_plus1 <- c(
# AIC(mincox(C1_general_speed_fort)),
# AIC(mincox(drop_na(C2_general_speed_fort))), NA,
# AIC(mincox(drop_na(C4_general_speed_fort))), NA, NA, NA,
# AIC(mincox(drop_na(C8_any_speed_fort))),
# AIC(mincox(drop_na(E1_any_speed_fort))), AIC(mincox(E2_any_speed_fort)), NA,
# AIC(mincox(H2_any_speed_fort)), AIC(mincox(H3_any_speed_fort)),
# AIC(mincox(drop_na(H6_general_speed_fort))), AIC(mincox(H7_any_speed_fort)),
# AIC(mincox(drop_na(H8_general_speed_fort)))) model_plus1_summary <- tibble(
# Group_plusC5, Policy_plusC5, Coef_plus1, Std.Err_plus1, p_plus1,
# exp_coef_plus1, lower_95_plus1, upper_95_plus1, ph_plus1, ph_global_plus1,
# aic_plus1, events_plus1, n_plus1 )

# ggplot(model_plus1_summary, aes (x = Policy_plusC5, y = exp_coef_plus1)) +
# geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes( x =
# Policy_plusC5, y = exp_coef_plus1, color = p_plus1)) + geom_linerange(aes(
# ymin = lower_95_plus1, ymax = upper_95_plus1, color = p_plus1 )) +
# scale_color_gradient2(low = 'deepskyblue', high = 'midnightblue', mid =
# 'dodgerblue3', midpoint = 0.05, guide = 'colourbar', aesthetics = 'color',
# limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = 'p-values') +
# scale_y_continuous(name = 'Hazard Ratios', limits = c(0,5), breaks = c(0,
# 0.5, 1:4), sec.axis = sec_axis(trans~.*1, name = 'Relative to Democrat
# governors, enactments by Republican governors are...', breaks = c(0.5, 1:4),
# labels = c('1/2 as likely', 'As likely', '2x as likely', '3x as likely', '4x
# as likely'))) + scale_x_discrete(limits = rev(Policy_plusC5)) +
# xlab('Policy') + coord_flip() + theme_light() + theme(axis.text.x.top =
# element_text(size = 8, angle = 15))

# model_levels_summary <- model_summary %>% #filter(ph > 0.05 & ph_global >
# 0.05) %>% full_join(model_minus1_summary #%>% filter(ph_minus1 > 0.05 &
# ph_global_minus1 > 0.05) , by = c('Policy' = 'Policy_plusC5')) %>%
# full_join(model_plus1_summary #%>% filter(ph_plus1 > 0.05 & ph_global_plus1 >
# 0.05) , by = c('Policy' = 'Policy_plusC5')) %>%
# #full_join(tibble(Group_plusC5, Policy_plusC5), by = c('Policy' =
# 'Policy_plusC5')) %>% filter(Policy != 'C5 Close Public Transport') %>%
# arrange(Policy)

### NEW CODE

gg_levels <- ggplot(data = model_levels_summary, aes(x = Policy, y = exp_coef)) +
    geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes(x = Policy,
    y = exp_coef_minus1, color = p_minus1, shape = "1", text = paste0(Policy, " - Level 1 instensity",
        "</br></br>Hazard ratio: ", round(exp_coef_minus1, 3), "</br>95% CI: ", round(lower_95_minus1,
            3), " - ", round(upper_95_minus1, 3), "</br><i>p</i>-value: ", round(p_minus1,
            3), "</br>Schoenfeld test on 'party' <i>p</i>: ", round(ph_minus1, 3),
        "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global_minus1, 3), "</br>AIC: ",
        round(aic_minus1, 3), "</br>Events: ", round(events_minus1, 3), "</br>N (days): ",
        round(n_minus1, 3))), size = 2, position = position_nudge(x = -0.25)) + geom_linerange(aes(ymin = lower_95_minus1,
    ymax = upper_95_minus1, color = p_minus1), size = 1.01, position = position_nudge(x = -0.25)) +
    geom_point(aes(x = Policy, y = exp_coef, color = p, shape = "2", text = paste0(Policy,
        " - Level 2 instensity", "</br></br>Hazard ratio: ", round(exp_coef, 3),
        "</br>95% CI: ", round(lower_95, 3), " - ", round(upper_95, 3), "</br><i>p</i>-value: ",
        round(p, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ", round(ph, 3),
        "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global, 3), "</br>AIC: ",
        round(aic, 3), "</br>Events: ", round(events, 3), "</br>N (days): ", round(n,
            3)))) + geom_linerange(aes(ymin = lower_95, ymax = upper_95, color = p),
    linetype = "dotdash") + geom_point(aes(x = Policy, y = exp_coef_plus1, color = p_plus1,
    shape = "3", text = paste0(Policy, " - Level 3 instensity", "</br></br>Hazard ratio: ",
        round(exp_coef_plus1, 3), "</br>95% CI: ", round(lower_95_plus1, 3), " - ",
        round(upper_95_plus1, 3), "</br><i>p</i>-value: ", round(p_plus1, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ",
        round(ph_plus1, 3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global_plus1,
            3), "</br>AIC: ", round(aic_plus1, 3), "</br>Events: ", round(events_plus1,
            3), "</br>N (days): ", round(n_plus1, 3))), size = 2, position = position_nudge(x = 0.25)) +
    geom_linerange(aes(ymin = lower_95_plus1, ymax = upper_95_plus1, color = p_plus1),
        size = 1.01, position = position_nudge(x = 0.25)) + scale_color_gradient2(low = "deepskyblue",
    high = "midnightblue", mid = "dodgerblue3", midpoint = 0.05, guide = "colourbar",
    aesthetics = "color", limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = "p-values") +
    scale_y_continuous(name = "Hazard Ratios", limits = c(0, 5), breaks = c(0, 0.5,
        1:5), sec.axis = sec_axis(trans ~ . * 1, name = "Relative to Democrat governors, enactments by Republican governors are...",
        breaks = c(0.5, 1:5), labels = c("1/2 as likely", "As likely", "2x as likely",
            "3x as likely", "4x as likely", "5x as likely"))) + scale_x_discrete(limits = rev(Policy)) +
    scale_shape_manual(name = "Intensity", values = c(`3` = 2, `2` = 1, `1` = 6)) +
    labs(x = "Policy") + coord_flip() + theme_light() + theme(axis.text.x.top = element_text(size = 8,
    angle = 15))

ax <- list(overlaying = "x", side = "top", showticklabels = TRUE, range = c(0, 5),
    tickmode = "array", tickvals = c(0.5, 1, 2, 3, 4, 5), ticktext = list("1/2 as likely",
        "As likely", "2x as likely", "3x as likely", "4x as likely", "5x as likely"),
    tickfont = list(size = 8), scaleanchor = "x", scalerato = "1", title = list(text = "Relative to Democrat governors, enactments by Republican governors are...",
        font = list(size = 11.5)))

plotly_levels <- ggplotly(gg_levels, tooltip = "text") %>%
    add_markers(x = 0, y = "y", data = NULL, inherit = TRUE, xaxis = "x2", showlegend = F) %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE,
        modeBarButtonsToRemove = list("autoScale2d")) %>%
    layout(xaxis2 = ax, margin = list(t = 50), legend = list(traceorder = "reversed"))

for (i in 2:12) {
    plotly_levels$x$data[[i]]$name = "1"
    plotly_levels$x$data[[i]]$legendgroup <- "1"
}

for (i in 13:29) {
    plotly_levels$x$data[[i]]$name = "2"
    plotly_levels$x$data[[i]]$legendgroup <- "2"
}

for (i in 13:29) {
    plotly_levels$x$data[[i]]$name = "2"
    plotly_levels$x$data[[i]]$legendgroup <- "2"
}

for (i in 30:42) {
    plotly_levels$x$data[[i]]$name = "3"
    plotly_levels$x$data[[i]]$legendgroup <- "3"
}

plotly_levels$x$layout$annotations[[1]]$y <- 0.4
plotly_levels$x$layout$annotations[[1]]$x <- 1.04

plotly_levels
### END NEW CODE

Note: Symbols represent hazard ratios and lines represent the 95% confidence interval.

Republican governors were still less likely to require more intense mask mandates relative to Democrat governors (\(\exp⁡(\beta)\)=0.396, 95% CI: 0.176 to 0.890, p<0.05, \(n_{events}\)=35), but the range of possible hazard ratios is broader and stretched closer to 1 than that for the intensity level modelled in the primary analysis. On the other hand, Republican-led states may have enacted more intense workplace closures at similar rates to Democrat-led states (\(\exp⁡(\beta)\)=0.560, 95% CI: 0.273 to 1.316, p=0.202, \(n_{events}\)=33). Furthermore, these results suggest that more generous income support (\(\exp⁡(\beta)\)=1.331, 95% CI: 0.383 to 4.625, p=0.652, \(n_{events}\)=11) was enacted at similar rates amongst Republican and Democrat-led states. Similarly, comprehensive debt or contract relief resulted in less significant differences (\(\exp⁡(\beta)\)=0.574, 95% CI: 0.261 to 1.21, p=0.167, \(n_{events}\)=34).

Most surprisingly, Republican-led states seem to have enacted more comprehensive contact tracing programs (\(\exp⁡(\beta)\)=1.762, 95% CI: 0.870 to 3.568, p=0.116, \(n_{events}\)=41) at higher rates than Democrat-led rates. It is possible that higher rates of contact tracing programs graded as comprehensive under Republican governors may be due to a combination of OXCGRT coding protocols and how COVID spread through the United States. First infections and outbreaks occurred in blue states with larger populations, thus overwhelming fledgling contact tracing programs that must then be recorded as “limited” under OXCGRT coding protocols, while red states initially had a period of low case rates to establish programs that credibly tracked those cases.

Kaplan-Meier Log-Rank Tests

Table 2. Log-rank tests for differences between governors’ parties in policy enactments.
# # KM Log-Rank test ## Function km_survdiff_gubpartyonly_general <-
# function(policy, flag, level) { exp_var <-
# panel_to_surv_general_speed(policy, flag, level) %>% # Governor data
# inner_join(governors %>% select(RegionName, governor_party,
# governor_entered_office, governor_term_end), by = 'RegionName') %>%
# mutate(governor_time_on = time_length(interval(governor_entered_office,
# dates), 'years'), governor_time_left = time_length(interval(dates,
# governor_term_end), 'years')) %>% filter(governor_time_on >= 0) %>%
# filter(governor_time_left > 0) %>% group_by(RegionName) %>% slice_max(dates)
# # Compute Log-Rank test comparing survival curves survdiff(Surv(stop, endpt)
# ~ governor_party, data = exp_var) } km_survdiff_gubpartyonly_any <-
# function(policy, level) { exp_var <- panel_to_surv_any_speed(policy, level)
# %>% # Governor data inner_join(governors %>% select(RegionName,
# governor_party, governor_entered_office, governor_term_end), by =
# 'RegionName') %>% mutate(governor_time_on =
# time_length(interval(governor_entered_office, dates), 'years'),
# governor_time_left = time_length(interval(dates, governor_term_end),
# 'years')) %>% filter(governor_time_on >= 0) %>% filter(governor_time_left >
# 0) %>% group_by(RegionName) %>% slice_max(dates) # Compute Log-Rank test
# comparing survival curves survdiff(Surv(stop, endpt) ~ governor_party, data =
# exp_var) } # KM fits C1_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C1_School.closing', 'C1_Flag', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C2_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C2_Workplace.closing', 'C2_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C3_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C3_Cancel.public.events', 'C3_Flag', 2)
# #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C4_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C4_Restrictions.on.gatherings', 'C4_Flag',
# 1) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no
# dat C6_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C6_Stay.at.home.requirements', 'C6_Flag',
# 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no
# data C7_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('C7_Restrictions.on.internal.movement',
# 'C7_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data C8_any_speed_km_survdiff <-
# km_survdiff_gubpartyonly_any('C8_International.travel.controls', 1) #No flag
# E1_any_speed_km_survdiff <- km_survdiff_gubpartyonly_any('E1_Income.support',
# 1) #Binary flag for sectoral scope: 0 - formal sector workers only or
# informal sector workers only, 1 - all workers E2_any_speed_km_survdiff <-
# km_survdiff_gubpartyonly_any('E2_Debt.contract.relief', 1) #No flag
# H1_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('H1_Public.information.campaigns',
# 'H1_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data H2_any_speed_km_survdiff <-
# km_survdiff_gubpartyonly_any('H2_Testing.policy', 1) #No flag
# H3_any_speed_km_survdiff <-
# km_survdiff_gubpartyonly_any('H3_Contact.tracing', 1) #No flag
# H6_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('H6_Facial.Coverings', 'H6_Flag', 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# H7_any_speed_km_survdiff <-
# km_survdiff_gubpartyonly_any('H7_Vaccination.policy', 1) #Binary flag for
# cost: 0 - At cost to individual (or funded by NGO, insurance, or partially
# government funded), 1- No or minimal cost to individual (government funded or
# subsidised), Blank - no data H8_general_speed_km_survdiff <-
# km_survdiff_gubpartyonly_general('H8_Protection.of.elderly.people',
# 'H8_Flag', 2) #Binary flag for geographic scope: 0 - targeted, 1- general,
# Blank - no data kmpvals_gubonly <- tibble( Group, Policy, log.rank.p = c(
# broom::glance(C1_general_speed_km_survdiff)$p.value,
# broom::glance(C2_general_speed_km_survdiff)$p.value,
# broom::glance(C3_general_speed_km_survdiff)$p.value,
# broom::glance(C4_general_speed_km_survdiff)$p.value,
# broom::glance(C6_general_speed_km_survdiff)$p.value,
# broom::glance(C7_general_speed_km_survdiff)$p.value,
# broom::glance(C8_any_speed_km_survdiff)$p.value,
# broom::glance(E1_any_speed_km_survdiff)$p.value,
# broom::glance(E2_any_speed_km_survdiff)$p.value,
# broom::glance(H1_general_speed_km_survdiff)$p.value,
# broom::glance(H2_any_speed_km_survdiff)$p.value,
# broom::glance(H3_any_speed_km_survdiff)$p.value,
# broom::glance(H6_general_speed_km_survdiff)$p.value,
# broom::glance(H7_any_speed_km_survdiff)$p.value,
# broom::glance(H8_general_speed_km_survdiff)$p.value ), ) kmpvals_gubonly <-
# kmpvals_gubonly %>% arrange(Policy)

kbl(kmpvals_gubonly, col.names = c("Group", "Policy", "Log-Rank p-value"), digits = 3) %>%
    kable_classic() %>%
    kable_classic(full_width = F) %>%
    kable_styling(bootstrap_options = c("hover", "condensed", "responsive")) %>%
    column_spec(1, bold = T) %>%
    column_spec(3, bold = ifelse(kmpvals_gubonly$log.rank.p < 0.05, T, F)) %>%
    collapse_rows(columns = 1:1, valign = "top")
Group Policy Log-Rank p-value
Containment and Closure C1 School Closing 0.332
C2 Workplace Closing 0.004
C3 Cancel Public Events 0.675
C4 Restrictions on Gatherings 0.003
C6 Stay at Home Requirements 0.002
C7 Restrictions on Internal Movement 0.043
C8 International Travel Controls 0.326
Economic E1 Income Support 0.000
E2 Debt/Contract Relief 0.022
Health H1 Public Information Campaigns 0.894
H2 Testing Policy 0.443
H3 Contact Tracing 0.653
H6 Facial Coverings 0.000
H7 Vaccination Policy 0.852
H8 Protection of Elderly People 0.678

For each policy, log-rank tests are run comparing Kaplan-Meier (KM) survival curves for states with Republican governors at the end of the observation period against those with Democratic governors. Unlike the Cox proportional hazards model, KM survival estimates are non-parametric. This means that they may be able to better capture non-proportional hazard rates, which may be present in policies C3 (PH \(p_{affiliation}\)=0.448, PH \(p_{global}\)=0.001), C6 (PH \(p_{affiliation}\)=0.923, PH \(p_{global}\)=0.035), C8 (PH \(p_{affiliation}\)=0.619, PH \(p_{global}\)=0.001) and H8 (PH \(p_{affiliation}\)=0.023, PH \(p_{global}\)=0.232), H2 (PH \(p_{affiliation}\)=0.190, PH \(p_{global}\)=0.001) and H8 (PH \(p_{affiliation}\)=0.023, PH \(p_{global}\)=0.232). KM curves here are also univariate, as the curves are only differentiated by the main variable of interest, the governor’s political affiliation at the end of the observation period. The log-rank test is non-parametric, meaning it does not make any assumptions about survival distributions. Its null hypothesis assumes that the survival curves of Republican states are identical to that of Democratic states.

As shown in Table 2, there are no statistically significant differences at the 5% level between the survival curves of Republican-led states and Democratic-led states for the policies H7 and H8. Furthermore, these results support the finding that partisan differences in the enactments of policies C2, C6, E1, E2, and H6 are statistically significant. Interestingly, this non-parametric and univariate analysis also suggests that there are statistically significant partisan differences for policies C4 and C7 as well.

Alternative models

Given the above results and the distinct possibility that a standard model across 15 different outcome policy variables may not consistently produce the best fit, 14 alternative variables tracking other dimensions of governors’ personal characteristics, state politics, demographics, economics, and healthcare capacity are introduced: time spent as governor, term time left as governor, governor’s age and gender (Schmalfeldt, O’Neill, and Seither 2021), partisan control of the state (i.e., if the governor shares the same party as the majority in the state legislature) (“State Partisan Composition” 2021), the population over 65 and the population under 18 as fractions of the total (“Creating a Unified COVID-19 Global Resource in Record Time” n.d., 3), the number of people per square mile (US Census Bureau n.d.), the fraction of the population that is urban (as opposed to rural) (“USDA ERS - State Fact Sheets” n.d.), the 7-day average of increases in deaths per 100 thousand people (“Creating a Unified COVID-19 Global Resource in Record Time” n.d.), the number of neighbouring states that a state shares land or water borders with (“U.S. States And Their Border States” n.d.), the monthly unemployment rate (“Creating a Unified COVID-19 Global Resource in Record Time” n.d.), the number of hospital beds per 1,000 (“Total Hospital Beds | KFF” n.d.), and the log of the number of physicians in 2021 (“Professionally Active Physicians” 2021). For policies with binary flags differentiating geographic scope, a variable tracking only the number of neighbours with the state-wide version of the mandate is also included (for summary statistics of all variables, see Annex A).

Due to the large number of explanatory variables across several dependent variables, two methods of automatic bidirectional stepwise model construction are deployed. Stepwise regressions refer to a procedure of iterative model building in which variables are either introduced to an empty model one at a time (i.e., “forward selection”), with the variables most statistically significant kept in the model, or variables are deleted one at a time from a model loaded with all variables (“backward elimination”). Bidirectional methods combine forward and backward approaches to find a combination of independent variables that best explains the variance in a dependent variable. Problems with stepwise regressions are well-documented, particularly with regards to their potential to exclude variables with real causal power while retaining variables with only spurious relationships (thus fitting in-samples well but performing poorly out-of-sample) (Smith 2018). As such, models constructed with this technique should only be considered as additional guides for potential issues, such as missing variables, with the primary model, which relies on expert knowledge and existing research. Further, concerns with poor out-of-sample performance are partially alleviated by the design of the research question and data, which is only concerned with a population of 50 states during a specific observation window.

The first method selects variables to maximize the Akaike information criterion (AIC) value of the final model. The AIC scores the explanatory power of the model, relative to other models, by rewarding goodness of fit (\(\hat{L}\), or the model’s maximum likelihood function) but penalizing the addition of more variables (\(k\)), and is calculated as

\(AIC = -2\ln(\hat{L})+k\) (Akaike 1974).
Equation 4. Akaike Information Criterion.

Where the governor’s party affiliation does not help achieve this method’s goal, it is excluded from the final model.

The second stepwise method used selects and drops variables based on their statistical significance until all variables are significant at the 5% alpha level. For these models, the inclusion of the governor’s party affiliation is forced, so the process best attempts to create models in which the main variable of interest is statistically significant in explaining the variance in policy speeds; however, it is not always able to do so.

As illustrated in Figure 10, models produced by the two methods (“max AIC” and “max significance”) produce relatively similar effect sizes and confidence intervals; when the variable is not included in the max AIC model, it is also statistically insignificant in the max p model. Max AIC (\(\exp(\beta)\)=0.401, 95% CI: 0.178 to 0.904, p<0.05, \(n_{events}\)=49) and max significance (\(\exp(\beta)\)=0.417, 95% CI: 0.224 to 0.773, p<0.01, \(n_{events}\)=49) stepwise models support the Kaplan-Meier analysis result that there may be statistically significant differences in survival curves between Republican-led states and Democratic-led states in restricting gatherings, which the primary analysis did not suggest. However, the models did not support the possibility that there were significant differences in restrictions on internal movement; party affiliation was not included in the max AIC model and was not statistically significant at the 0.05 level in the max significance model.

Figure 10. Dot-dash plot of variable of interest in stepwise models.
# #### By significance # Alternative variables # Partisan control of states; 1
# = the same party controls both the governor's office & the legislature
# statecontrol <- tibble( RegionName = c( 'Alabama','Alaska','Arizona',
# 'Arkansas','California','Colorado', 'Connecticut','Delaware',
# 'Florida','Georgia','Hawaii', 'Idaho','Illinois','Indiana',
# 'Iowa','Kansas','Kentucky', 'Louisiana','Maine','Maryland',
# 'Massachusetts','Michigan','Minnesota', 'Mississippi','Missouri','Montana',
# 'Montana', 'Nebraska','Nevada','New Hampshire', 'New Hampshire', 'New
# Jersey','New Mexico','New York', 'North Carolina','North Dakota','Ohio',
# 'Oklahoma','Oregon','Pennsylvania', 'Rhode Island','South Carolina', 'South
# Dakota','Tennessee','Texas', 'Utah','Vermont','Virginia', 'Washington','West
# Virginia','Wisconsin', 'Wyoming'), statecontrol = c( 1, 1, 1, 1, 1, 1, 1, 1,
# 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1,
# 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1 ), state_start = c(
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2021-01-04', '2020-01-01', '2020-01-01', '2020-01-01',
# '2021-01-06', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01', '2020-01-01',
# '2020-01-01', '2020-01-01' ), state_end = c( '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-01-04', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-01-06', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10',
# '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10', '2021-07-10' ) ) #
# Under 18 population under18population <- evalmetrics( 'outbreaklocation',
# list( spec = list( ids = states_list, expressions =
# list('MaleAndFemale_Under18_Population'), #US Census Bureau: Demographic
# Estimates start = '2019-01-01', end = '2019-01-01', interval = 'YEAR' ) ),
# get_all = TRUE ) under18population <- under18population %>%
# inner_join(name_conversions, by = 'name') # Over 65 population
# over65population <- evalmetrics( 'outbreaklocation', list( spec = list( ids =
# states_list, expressions = list('MaleAndFemale_AtLeast65_Population'), #US
# Census Bureau: Demographic Estimates start = '2019-01-01', end =
# '2019-01-01', interval = 'YEAR' ) ), get_all = TRUE ) over65population <-
# over65population %>% inner_join(name_conversions, by = 'name') # Population
# density
# (https://www.census.gov/data/datasets/time-series/demo/popest/2010s-state-total.html#par_textimage_1873399417)
# density2020 <- read.csv('~/Documents/RPubs/Survival Analysis/Survival
# Analysis html fourth draft/apportionment.csv') %>% filter(Geography.Type ==
# 'State' & Year == '2020' & Name != 'District of Columbia' & Name != 'Puerto
# Rico') %>% select(RegionName = Name, density2020 =
# Resident.Population.Density) %>% mutate(density2020 =
# as.numeric(str_remove(density2020, ','))) # Urban/rural populations
# (https://www.ers.usda.gov/data-products/state-fact-sheets/) urbanrural2019 <-
# tibble( RegionName = c('Alabama', 'Alaska', 'Arizona', 'Arkansas',
# 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia',
# 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky',
# 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
# 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
# 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
# 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South
# Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
# 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'), ruralpop
# = c('1,135,428', '238,379', '352,770', '1,124,911', '837,284', '715,485',
# '180,333', '0', '718,558', '1,804,346', '273,806', '578,544', '1,443,236',
# '1,459,274', '1,260,285', '911,973', '1,826,673', '742,352', '545,287',
# '150,952', '98,911', '1,797,835', '1,243,226', '1,582,360', '1,539,427',
# '694,966', '660,417', '281,883', '502,284', '0', '686,300', '1,358,973',
# '2,220,128', '377,509', '2,347,371', '1,331,558', '680,754', '1,446,887',
# '0', '743,306', '449,416', '1,524,020', '3,075,261', '335,301', '403,578',
# '1,034,447', '762,984', '682,651', '1,502,031', '399,401'), urbanpop =
# c('3,767,757', '493,166', '6,925,947', '1,892,893', '38,674,939',
# '5,043,251', '3,384,954', '973,764', '20,759,179', '8,813,077', '1,142,066',
# '1,208,521', '11,228,585', '5,272,945', '1,894,785', '2,001,341',
# '2,641,000', '3,906,442', '798,925', '5,894,728', '6,793,592', '8,189,022',
# '4,396,406', '1,393,789', '4,598,001', '373,812', '1,273,991', '2,798,273',
# '857,427', '8,882,190', '1,410,529', '18,094,588', '8,267,956', '384,553',
# '9,341,729', '2,625,413', '3,536,983', '11,355,102', '1,059,361',
# '4,405,408', '435,243', '5,305,154', '25,920,620', '2,870,657', '220,411',
# '7,501,072', '6,851,909', '1,109,496', '4,320,403', '179,358') )
# urbanrural2019 <- urbanrural2019 %>% mutate(ruralpop =
# as.numeric(str_remove_all(ruralpop, ',')), urbanpop =
# as.numeric(str_remove_all(urbanpop, ',')), totalpop = ruralpop + urbanpop,
# ruralfrac = ruralpop/totalpop, urbanfrac = urbanpop/totalpop) # Change in
# daily COVID death rates deathincrease <- casecounts %>% filter(value_id ==
# 'JHU_ConfirmedDeaths') %>% group_by(name) %>% arrange(dates) %>%
# mutate(datamax = rollmax(data, 90, align = 'right', fill = 0), daily_increase
# = datamax - lag(datamax)) %>% mutate(daily_increase_smoothed =
# rollmean(daily_increase, 7, align = 'right', fill = NA)) %>% ungroup() %>%
# full_join(filter(totalpopulation, dates == '2019-01-01') %>%
# dplyr::select('name', 'data'), by = c(name = 'name')) %>%
# mutate(death_increase_smoothed_per_100k = 100000 *
# daily_increase_smoothed/data.y) %>%
# filter(!is.na(death_increase_smoothed_per_100k)) # Neighbor mandates: general
# only neighbors_general_na <- function(policy, level, flag) { policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Mississippi' | neighbors == 'Tennessee' | neighbors ==
# 'Florida' | neighbors == 'Georgia') %>% group_by(dates) %>% mutate(RegionName
# = 'Alabama', number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) %>% bind_rows( policies %>%
# select(dates = Day, RegionName) %>% filter(RegionName == 'Alaska') %>%
# mutate(RegionName = 'Alaska', number.neighbors = 0, neighbor.mandates.general
# = 0) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'New Mexico' | neighbors == 'Utah' | neighbors == 'California' | neighbors
# == 'Colorado') %>% group_by(dates) %>% mutate(RegionName = 'Arizona',
# number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Oklahoma' | neighbors == 'Tennessee' | neighbors == 'Texas' |
# neighbors == 'Louisiana' | neighbors == 'Mississippi' | neighbors ==
# 'Missouri') %>% group_by(dates) %>% mutate(RegionName = 'Arkansas',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Arizona' | neighbors == 'Nevada') %>%
# group_by(dates) %>% mutate(RegionName = 'California', number.neighbors = 3,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Mexico' |
# neighbors == 'Oklahoma' | neighbors == 'Utah' | neighbors == 'Wyoming' |
# neighbors == 'Arizona' | neighbors == 'Kansas' | neighbors == 'Nebraska') %>%
# group_by(dates) %>% mutate(RegionName = 'Colorado', number.neighbors = 7,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New York' |
# neighbors == 'Rhode Island' | neighbors == 'Massachusetts') %>%
# group_by(dates) %>% mutate(RegionName = 'Connecticut', number.neighbors = 3,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Jersey' |
# neighbors == 'Pennsylvania' | neighbors == 'Maryland') %>% group_by(dates)
# %>% mutate(RegionName = 'Delaware', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Georgia' | neighbors
# == 'Alabama') %>% group_by(dates) %>% mutate(RegionName = 'Florida',
# number.neighbors = 2, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'South Carolina' | neighbors ==
# 'Tennessee' | neighbors == 'Alabama' | neighbors == 'Florida') %>%
# group_by(dates) %>% mutate(RegionName = 'Georgia', number.neighbors = 5, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, RegionName) %>%
# filter(RegionName == 'Hawaii') %>% mutate(RegionName = 'Hawaii',
# number.neighbors = 0, neighbor.mandates.general = 0) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy, flag) %>%
# rename(pol = policy, polflag = flag) %>% mutate(general_only = ifelse(polflag
# == 1, pol, 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>%
# filter(., neighbors == 'Utah' | neighbors == 'Washington' | neighbors ==
# 'Wyoming' | neighbors == 'Montana' | neighbors == 'Nevada' | neighbors ==
# 'Oregon') %>% group_by(dates) %>% mutate(RegionName = 'Idaho',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Kentucky' | neighbors == 'Missouri' | neighbors == 'Wisconsin'
# | neighbors == 'Indiana' | neighbors == 'Iowa' | neighbors == 'Michigan') %>%
# group_by(dates) %>% mutate(RegionName = 'Illinois', number.neighbors = 6,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Ohio' | neighbors == 'Illinois' | neighbors == 'Kentucky') %>%
# group_by(dates) %>% mutate(RegionName = 'Indiana', number.neighbors = 4, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'South Dakota' | neighbors == 'Wisconsin' | neighbors ==
# 'Illinois' | neighbors == 'Minnesota' | neighbors == 'Missouri') %>%
# group_by(dates) %>% mutate(RegionName = 'Iowa', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'Oklahoma' | neighbors == 'Colorado' | neighbors == 'Missouri')
# %>% group_by(dates) %>% mutate(RegionName = 'Kansas', number.neighbors = 4,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Tennessee' |
# neighbors == 'Virginia' | neighbors == 'West Virginia' | neighbors ==
# 'Illinois' | neighbors == 'Indiana' | neighbors == 'Missouri' | neighbors ==
# 'Ohio') %>% group_by(dates) %>% mutate(RegionName = 'Kentucky',
# number.neighbors = 7, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Texas' | neighbors == 'Arkansas' | neighbors == 'Mississippi')
# %>% group_by(dates) %>% mutate(RegionName = 'Louisiana', number.neighbors =
# 3, temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Hampshire') %>%
# group_by(dates) %>% mutate(RegionName = 'Maine', number.neighbors = 1, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Virginia' |
# neighbors == 'West Virginia' | neighbors == 'Delaware' | neighbors ==
# 'Pennsylvania') %>% group_by(dates) %>% mutate(RegionName = 'Maryland',
# number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'New York' | neighbors == 'Rhode Island' | neighbors ==
# 'Vermont' | neighbors == 'Connecticut' | neighbors == 'New Hampshire') %>%
# group_by(dates) %>% mutate(RegionName = 'Massachusetts', number.neighbors =
# 5, temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Ohio' | neighbors ==
# 'Wisconsin' | neighbors == 'Illinois' | neighbors == 'Indiana' | neighbors ==
# 'Minnesota') %>% group_by(dates) %>% mutate(RegionName = 'Michigan',
# number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'North Dakota' | neighbors == 'South Dakota' | neighbors ==
# 'Wisconsin' | neighbors == 'Iowa' | neighbors == 'Michigan') %>%
# group_by(dates) %>% mutate(RegionName = 'Minnesota', number.neighbors = 5,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Louisiana' |
# neighbors == 'Tennessee' | neighbors == 'Alabama' | neighbors == 'Arkansas')
# %>% group_by(dates) %>% mutate(RegionName = 'Mississippi', number.neighbors =
# 4, temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'Oklahoma' | neighbors == 'Tennessee' | neighbors == 'Arkansas'
# | neighbors == 'Illinois' | neighbors == 'Iowa' | neighbors == 'Kansas' |
# neighbors == 'Kentucky') %>% group_by(dates) %>% mutate(RegionName =
# 'Missouri', number.neighbors = 8, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'South Dakota' | neighbors == 'Wyoming' | neighbors == 'Idaho' |
# neighbors == 'North Dakota') %>% group_by(dates) %>% mutate(RegionName =
# 'Montana', number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Missouri' | neighbors == 'South Dakota' | neighbors ==
# 'Wyoming' | neighbors == 'Colorado' | neighbors == 'Iowa' | neighbors ==
# 'Kansas') %>% group_by(dates) %>% mutate(RegionName = 'Nebraska',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Idaho' | neighbors == 'Oregon' | neighbors == 'Utah' |
# neighbors == 'Arizona' | neighbors == 'California') %>% group_by(dates) %>%
# mutate(RegionName = 'Nevada', number.neighbors = 5, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Vermont' | neighbors
# == 'Maine' | neighbors == 'Massachusetts') %>% group_by(dates) %>%
# mutate(RegionName = 'New Hampshire', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Pennsylvania' |
# neighbors == 'Delaware' | neighbors == 'New York') %>% group_by(dates) %>%
# mutate(RegionName = 'New Jersey', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Oklahoma' |
# neighbors == 'Texas' | neighbors == 'Utah' | neighbors == 'Arizona' |
# neighbors == 'Colorado') %>% group_by(dates) %>% mutate(RegionName = 'New
# Mexico', number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Rhode Island' | neighbors ==
# 'Vermont' | neighbors == 'Connecticut' | neighbors == 'Massachusetts' |
# neighbors == 'New Jersey') %>% group_by(dates) %>% mutate(RegionName = 'New
# York', number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Tennessee' | neighbors == 'Virginia' | neighbors == 'Georgia' |
# neighbors == 'South Carolina') %>% group_by(dates) %>% mutate(RegionName =
# 'North Carolina', number.neighbors = 4, temp = ifelse(general_only > level,
# 1, 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'South Dakota' | neighbors == 'Minnesota' | neighbors ==
# 'Montana') %>% group_by(dates) %>% mutate(RegionName = 'North Dakota',
# number.neighbors = 3, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Michigan' | neighbors == 'Pennsylvania' | neighbors == 'West
# Virginia' | neighbors == 'Indiana' | neighbors == 'Kentucky') %>%
# group_by(dates) %>% mutate(RegionName = 'Ohio', number.neighbors = 5, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Missouri' |
# neighbors == 'New Mexico' | neighbors == 'Texas' | neighbors == 'Arkansas' |
# neighbors == 'Colorado' | neighbors == 'Kansas') %>% group_by(dates) %>%
# mutate(RegionName = 'Oklahoma', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'Washington' | neighbors == 'California' | neighbors == 'Idaho') %>%
# group_by(dates) %>% mutate(RegionName = 'Oregon', number.neighbors = 4, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New York' |
# neighbors == 'Ohio' | neighbors == 'West Virginia' | neighbors == 'Delaware'
# | neighbors == 'Maryland' | neighbors == 'New Jersey') %>% group_by(dates)
# %>% mutate(RegionName = 'Pennsylvania', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Massachusetts' |
# neighbors == 'New York' | neighbors == 'Connecticut') %>% group_by(dates) %>%
# mutate(RegionName = 'Rhode Island', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'North Carolina' |
# neighbors == 'Georgia') %>% group_by(dates) %>% mutate(RegionName = 'South
# Carolina', number.neighbors = 2, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'North Dakota' | neighbors ==
# 'Wyoming' | neighbors == 'Iowa' | neighbors == 'Minnesota' | neighbors ==
# 'Montana') %>% group_by(dates) %>% mutate(RegionName = 'South Dakota',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Mississippi' | neighbors == 'Missouri' | neighbors == 'North
# Carolina' | neighbors == 'Virginia' | neighbors == 'Alabama' | neighbors ==
# 'Arkansas' | neighbors == 'Georgia' | neighbors == 'Kentucky') %>%
# group_by(dates) %>% mutate(RegionName = 'Tennessee', number.neighbors = 8,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Mexico' |
# neighbors == 'Oklahoma' | neighbors == 'Arkansas' | neighbors == 'Louisiana')
# %>% group_by(dates) %>% mutate(RegionName = 'Texas', number.neighbors = 4,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'New Mexico' | neighbors == 'Wyoming' | neighbors == 'Arizona' | neighbors
# == 'Colorado' | neighbors == 'Idaho') %>% group_by(dates) %>%
# mutate(RegionName = 'Utah', number.neighbors = 6, temp = ifelse(general_only
# > level, 1, 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy, flag) %>%
# rename(pol = policy, polflag = flag) %>% mutate(general_only = ifelse(polflag
# == 1, pol, 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>%
# filter(., neighbors == 'New Hampshire' | neighbors == 'New York' | neighbors
# == 'Massachusetts') %>% group_by(dates) %>% mutate(RegionName = 'Vermont',
# number.neighbors = 3, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'Tennessee' | neighbors == 'West
# Virginia' | neighbors == 'Kentucky' | neighbors == 'Maryland') %>%
# group_by(dates) %>% mutate(RegionName = 'Virginia', number.neighbors = 5,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Oregon' | neighbors
# == 'Idaho') %>% group_by(dates) %>% mutate(RegionName = 'Washington',
# number.neighbors = 2, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Virginia' | neighbors ==
# 'Kentucky' | neighbors == 'Maryland' | neighbors == 'Ohio') %>%
# group_by(dates) %>% mutate(RegionName = 'West Virginia', number.neighbors =
# 5, temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Minnesota' | neighbors == 'Illinois' | neighbors == 'Iowa') %>%
# group_by(dates) %>% mutate(RegionName = 'Wisconsin', number.neighbors = 4,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'South Dakota' | neighbors == 'Utah' | neighbors == 'Colorado' |
# neighbors == 'Idaho' | neighbors == 'Montana') %>% group_by(dates) %>%
# mutate(RegionName = 'Wyoming', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% ungroup() %>% select(dates, RegionName, number.neighbors,
# neighbor.mandates.general) %>% group_by(dates, RegionName) %>% slice_head() }
# neighbors_general <- function(policy, level, flag) { policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Mississippi' | neighbors == 'Tennessee' | neighbors ==
# 'Florida' | neighbors == 'Georgia') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Alabama', number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) %>% bind_rows( policies %>%
# select(dates = Day, RegionName) %>% filter(RegionName == 'Alaska') %>%
# mutate(RegionName = 'Alaska', number.neighbors = 0, neighbor.mandates.general
# = 0) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'New Mexico' | neighbors == 'Utah' | neighbors == 'California' | neighbors
# == 'Colorado') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Arizona', number.neighbors = 5, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Oklahoma' |
# neighbors == 'Tennessee' | neighbors == 'Texas' | neighbors == 'Louisiana' |
# neighbors == 'Mississippi' | neighbors == 'Missouri') %>% group_by(neighbors)
# %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Arkansas', number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Arizona' | neighbors == 'Nevada') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'California', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Mexico' |
# neighbors == 'Oklahoma' | neighbors == 'Utah' | neighbors == 'Wyoming' |
# neighbors == 'Arizona' | neighbors == 'Kansas' | neighbors == 'Nebraska') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Colorado', number.neighbors = 7, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New York' |
# neighbors == 'Rhode Island' | neighbors == 'Massachusetts') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Connecticut', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Jersey' |
# neighbors == 'Pennsylvania' | neighbors == 'Maryland') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Delaware', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Georgia' | neighbors
# == 'Alabama') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Florida', number.neighbors = 2, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'North Carolina' |
# neighbors == 'South Carolina' | neighbors == 'Tennessee' | neighbors ==
# 'Alabama' | neighbors == 'Florida') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Georgia', number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, RegionName) %>% filter(RegionName == 'Hawaii') %>%
# mutate(RegionName = 'Hawaii', number.neighbors = 0, neighbor.mandates.general
# = 0) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Utah' | neighbors ==
# 'Washington' | neighbors == 'Wyoming' | neighbors == 'Montana' | neighbors ==
# 'Nevada' | neighbors == 'Oregon') %>% group_by(neighbors) %>% arrange(dates)
# %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Idaho',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Kentucky' | neighbors == 'Missouri' | neighbors == 'Wisconsin'
# | neighbors == 'Indiana' | neighbors == 'Iowa' | neighbors == 'Michigan') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Illinois', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Ohio' | neighbors == 'Illinois' | neighbors == 'Kentucky') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Indiana', number.neighbors = 4, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'South Dakota' | neighbors == 'Wisconsin' | neighbors ==
# 'Illinois' | neighbors == 'Minnesota' | neighbors == 'Missouri') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Iowa', number.neighbors = 6, temp = ifelse(general_only
# > level, 1, 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy, flag) %>%
# rename(pol = policy, polflag = flag) %>% mutate(general_only = ifelse(polflag
# == 1, pol, 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>%
# filter(., neighbors == 'Nebraska' | neighbors == 'Oklahoma' | neighbors ==
# 'Colorado' | neighbors == 'Missouri') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Kansas', number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Tennessee' | neighbors == 'Virginia' | neighbors == 'West
# Virginia' | neighbors == 'Illinois' | neighbors == 'Indiana' | neighbors ==
# 'Missouri' | neighbors == 'Ohio') %>% group_by(neighbors) %>% arrange(dates)
# %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Kentucky',
# number.neighbors = 7, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Texas' | neighbors == 'Arkansas' | neighbors == 'Mississippi')
# %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates)
# %>% mutate(RegionName = 'Louisiana', number.neighbors = 3, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Hampshire') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Maine', number.neighbors = 1, temp = ifelse(general_only
# > level, 1, 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows(
# policies %>% select(dates = Day, neighbors = RegionName, policy, flag) %>%
# rename(pol = policy, polflag = flag) %>% mutate(general_only = ifelse(polflag
# == 1, pol, 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>%
# filter(., neighbors == 'Virginia' | neighbors == 'West Virginia' | neighbors
# == 'Delaware' | neighbors == 'Pennsylvania') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Maryland', number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'New York' | neighbors == 'Rhode Island' | neighbors ==
# 'Vermont' | neighbors == 'Connecticut' | neighbors == 'New Hampshire') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Massachusetts', number.neighbors = 5, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Ohio' | neighbors ==
# 'Wisconsin' | neighbors == 'Illinois' | neighbors == 'Indiana' | neighbors ==
# 'Minnesota') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Michigan', number.neighbors = 5,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'North Dakota' |
# neighbors == 'South Dakota' | neighbors == 'Wisconsin' | neighbors == 'Iowa'
# | neighbors == 'Michigan') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Minnesota',
# number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Louisiana' | neighbors == 'Tennessee' | neighbors == 'Alabama'
# | neighbors == 'Arkansas') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Mississippi',
# number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Nebraska' | neighbors == 'Oklahoma' | neighbors == 'Tennessee'
# | neighbors == 'Arkansas' | neighbors == 'Illinois' | neighbors == 'Iowa' |
# neighbors == 'Kansas' | neighbors == 'Kentucky') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Missouri', number.neighbors = 8, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'South Dakota' | neighbors == 'Wyoming' | neighbors == 'Idaho' |
# neighbors == 'North Dakota') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'Montana',
# number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Missouri' | neighbors == 'South Dakota' | neighbors ==
# 'Wyoming' | neighbors == 'Colorado' | neighbors == 'Iowa' | neighbors ==
# 'Kansas') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Nebraska', number.neighbors = 6,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Idaho' | neighbors
# == 'Oregon' | neighbors == 'Utah' | neighbors == 'Arizona' | neighbors ==
# 'California') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Nevada', number.neighbors = 5, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Vermont' | neighbors
# == 'Maine' | neighbors == 'Massachusetts') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'New
# Hampshire', number.neighbors = 3, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Delaware' | neighbors == 'New
# York') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'New Jersey', number.neighbors = 3,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Oklahoma' |
# neighbors == 'Texas' | neighbors == 'Utah' | neighbors == 'Arizona' |
# neighbors == 'Colorado') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'New Mexico',
# number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Rhode Island' | neighbors ==
# 'Vermont' | neighbors == 'Connecticut' | neighbors == 'Massachusetts' |
# neighbors == 'New Jersey') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'New York',
# number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Tennessee' | neighbors == 'Virginia' | neighbors == 'Georgia' |
# neighbors == 'South Carolina') %>% group_by(neighbors) %>% arrange(dates) %>%
# fill(pol) %>% group_by(dates) %>% mutate(RegionName = 'North Carolina',
# number.neighbors = 4, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'South Dakota' | neighbors == 'Minnesota' | neighbors ==
# 'Montana') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'North Dakota', number.neighbors = 3,
# temp = ifelse(general_only > level, 1, 0), neighbor.mandates.general =
# sum(temp)) ) %>% bind_rows( policies %>% select(dates = Day, neighbors =
# RegionName, policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Pennsylvania' | neighbors == 'West Virginia' | neighbors ==
# 'Indiana' | neighbors == 'Kentucky') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Ohio', number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Missouri' | neighbors == 'New Mexico' | neighbors == 'Texas' |
# neighbors == 'Arkansas' | neighbors == 'Colorado' | neighbors == 'Kansas')
# %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates)
# %>% mutate(RegionName = 'Oklahoma', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'Washington' | neighbors == 'California' | neighbors == 'Idaho') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Oregon', number.neighbors = 4, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New York' |
# neighbors == 'Ohio' | neighbors == 'West Virginia' | neighbors == 'Delaware'
# | neighbors == 'Maryland' | neighbors == 'New Jersey') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Pennsylvania', number.neighbors = 6, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Massachusetts' |
# neighbors == 'New York' | neighbors == 'Connecticut') %>% group_by(neighbors)
# %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Rhode Island', number.neighbors = 3, temp = ifelse(general_only > level, 1,
# 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'North Carolina' | neighbors == 'Georgia') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'South Carolina', number.neighbors = 2, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'North Dakota' | neighbors == 'Wyoming' | neighbors == 'Iowa' |
# neighbors == 'Minnesota' | neighbors == 'Montana') %>% group_by(neighbors)
# %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'South Dakota', number.neighbors = 6, temp = ifelse(general_only > level, 1,
# 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Mississippi' | neighbors == 'Missouri' | neighbors == 'North
# Carolina' | neighbors == 'Virginia' | neighbors == 'Alabama' | neighbors ==
# 'Arkansas' | neighbors == 'Georgia' | neighbors == 'Kentucky') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Tennessee', number.neighbors = 8, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'New Mexico' |
# neighbors == 'Oklahoma' | neighbors == 'Arkansas' | neighbors == 'Louisiana')
# %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates)
# %>% mutate(RegionName = 'Texas', number.neighbors = 4, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nevada' | neighbors
# == 'New Mexico' | neighbors == 'Wyoming' | neighbors == 'Arizona' | neighbors
# == 'Colorado' | neighbors == 'Idaho') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Utah', number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'New Hampshire' | neighbors == 'New York' | neighbors ==
# 'Massachusetts') %>% group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>%
# group_by(dates) %>% mutate(RegionName = 'Vermont', number.neighbors = 3, temp
# = ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp))
# ) %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'North Carolina' |
# neighbors == 'Tennessee' | neighbors == 'West Virginia' | neighbors ==
# 'Kentucky' | neighbors == 'Maryland') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Virginia', number.neighbors = 5, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Oregon' | neighbors == 'Idaho') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Washington', number.neighbors = 2, temp = ifelse(general_only > level, 1,
# 0), neighbor.mandates.general = sum(temp)) ) %>% bind_rows( policies %>%
# select(dates = Day, neighbors = RegionName, policy, flag) %>% rename(pol =
# policy, polflag = flag) %>% mutate(general_only = ifelse(polflag == 1, pol,
# 0)) %>% mutate(general_only = replace_na(general_only, 0)) %>% filter(.,
# neighbors == 'Pennsylvania' | neighbors == 'Virginia' | neighbors ==
# 'Kentucky' | neighbors == 'Maryland' | neighbors == 'Ohio') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'West Virginia', number.neighbors = 5, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Michigan' |
# neighbors == 'Minnesota' | neighbors == 'Illinois' | neighbors == 'Iowa') %>%
# group_by(neighbors) %>% arrange(dates) %>% fill(pol) %>% group_by(dates) %>%
# mutate(RegionName = 'Wisconsin', number.neighbors = 4, temp =
# ifelse(general_only > level, 1, 0), neighbor.mandates.general = sum(temp)) )
# %>% bind_rows( policies %>% select(dates = Day, neighbors = RegionName,
# policy, flag) %>% rename(pol = policy, polflag = flag) %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% filter(., neighbors == 'Nebraska' |
# neighbors == 'South Dakota' | neighbors == 'Utah' | neighbors == 'Colorado' |
# neighbors == 'Idaho' | neighbors == 'Montana') %>% group_by(neighbors) %>%
# arrange(dates) %>% fill(pol) %>% group_by(dates) %>% mutate(RegionName =
# 'Wyoming', number.neighbors = 6, temp = ifelse(general_only > level, 1, 0),
# neighbor.mandates.general = sum(temp)) ) %>% ungroup() %>% select(dates,
# RegionName, number.neighbors, neighbor.mandates.general) %>% group_by(dates,
# RegionName) %>% slice_head() } # Unemployment rate unemploymentrate <-
# evalmetrics( 'outbreaklocation', list( spec = list( ids = states_list,
# expressions = list('BLS_UnemploymentRate'),#US Bureau of Labor Statistics
# start = '2020-01-01', end = today, interval = 'MONTH' ) ), get_all = TRUE )
# unemploymentrate <- unemploymentrate %>% mutate(year = year(dates), month =
# month(dates)) %>% inner_join(name_conversions, by = 'name') hospitalbeds2019
# <- read.csv('~/Documents/RPubs/Survival Analysis/kff_hospitalbeds.csv') %>% #
# from KFF
# https://www.kff.org/other/state-indicator/total-hospital-beds/?currentTimeframe=0&sortModel=%7B%22colId%22:%22Location%22,%22sort%22:%22asc%22%7D
# rename(RegionName = Location) %>% filter(RegionName != 'United States' &
# RegionName != 'District of Columbia') physicians2021 <-
# read.csv('~/Documents/RPubs/Survival Analysis/kff_physicians.csv') %>% # from
# KFF
# https://www.kff.org/other/state-indicator/total-active-physicians/?currentTimeframe=0&sortModel=%7B%22colId%22:%22Location%22,%22sort%22:%22asc%22%7D
# rename(RegionName = Location, primary_care_physicians2021 =
# Primary.Care.Physicians) %>% filter(RegionName != 'United States' &
# RegionName != 'District of Columbia') fortify_any_speed <- function(policy,
# level) { policies %>% select(Day, RegionName, policy) %>% rename(pol =
# policy) %>% drop_na() %>% filter(Day >= '2020-01-09') %>% filter(Day <=
# '2021-07-09') %>% group_by(RegionName) %>% arrange(Day) %>% mutate(tstart =
# row_number() - 1, tstop = row_number(), temp = cumsum(pol >= level)) %>%
# group_by(temp, .add=TRUE) %>% group_by(RegionName) %>% mutate(status =
# ifelse(pol >= level, 1, 0)) %>% filter(temp <= 1) %>% mutate(endpt =
# max(status), start = min(tstart), stop = max(tstop)) %>% select(dates = Day,
# RegionName, start, stop, status, tstart, tstop, endpt) %>% filter(RegionName
# != 'USA' && RegionName != 'Washington DC') %>% # Governor data
# inner_join(governors %>% select(RegionName, governor_party,
# governor_entered_office, governor_term_end, governor_date_of_birth,
# governor_gender), by = 'RegionName') %>% mutate(governor_time_on =
# time_length(interval(governor_entered_office, dates), 'years'),
# governor_time_left = time_length(interval(dates, governor_term_end),
# 'years'), governor_age = floor(time_length(interval(governor_date_of_birth,
# dates), 'years'))) %>% filter(governor_time_on >= 0) %>%
# filter(governor_time_left > 0) %>% mutate(governor_partyrepublican =
# ifelse(governor_party == 'Republican', 1, 0), governor_gendermale =
# ifelse(governor_gender == 'Male', 1, 0)) %>% # Partisan control data
# inner_join(statecontrol, by = 'RegionName') %>% mutate(state_time_on =
# time_length(interval(state_start, dates), 'years'), state_time_left =
# time_length(interval(dates, state_end), 'years')) %>% filter(state_time_on >=
# 0) %>% filter(state_time_left > 0) %>% select(-state_time_on,
# -state_time_left, -state_start, -state_end) %>% # Population data (total pop,
# over 65, under 18) inner_join(totalpopulation %>% filter(dates ==
# '2019-01-01') %>% select(RegionName, totalpopulation = data), by =
# 'RegionName') %>% mutate(log_totalpopulation = log(totalpopulation)) %>%
# inner_join(over65population %>% select (RegionName, over65population = data),
# by = 'RegionName') %>% mutate(over65population_frac =
# over65population/totalpopulation) %>% inner_join(under18population %>% select
# (RegionName, under18population = data), by = 'RegionName') %>%
# mutate(under18population_frac = under18population/totalpopulation) %>% #
# Density inner_join(density2020, by = 'RegionName') %>% # Urban population
# inner_join(urbanrural2019 %>% select(RegionName, urbanfrac), by =
# 'RegionName') %>% # COVID Cases left_join(casecounts %>% filter(value_id ==
# 'JHU_ConfirmedCases') %>% select(dates, RegionName, covidcases = data), by =
# c('RegionName', 'dates')) %>% # COVID Case rates left_join(caseincrease %>%
# select(dates, RegionName, daily_increase_smoothed_per_100k), by =
# c('RegionName', 'dates')) %>% # COVID deaths left_join(casecounts %>%
# filter(value_id == 'JHU_ConfirmedDeaths') %>% select(dates, RegionName,
# coviddeaths = data), by = c('RegionName', 'dates')) %>% # COVID Death rates
# left_join(deathincrease %>% select(dates, RegionName,
# death_increase_smoothed_per_100k), by = c('RegionName', 'dates')) %>% #
# Airport Activity left_join(commercial_service_enplanements_cy19, by =
# 'RegionName') %>% mutate(log_totalenplanements19plus1 =
# log(totalenplanements19 + 1)) %>% # Neighbor mandates
# left_join(neighbors_any(policy, level), by = c('RegionName', 'dates')) %>% #
# Unemployment rate mutate(year = year(dates), month = month(dates)) %>%
# left_join(unemploymentrate %>% select(year, month, RegionName,
# unemploymentrate = data), by = c('RegionName', 'year', 'month')) %>%
# select(-year, -month) %>% # GDP & GDP per capita
# inner_join(nominalgdp_percapita %>% select(RegionName, nominalgdp,
# nominalgdp_percap), by = 'RegionName') %>% mutate(log_nominalgdp =
# log(nominalgdp)) %>% # GINI coefficient left_join(gini2019, by =
# 'RegionName') %>% # hospital capacity left_join(hospitalbeds2019, by =
# 'RegionName') %>% left_join(physicians2018, by = 'RegionName') %>%
# mutate(log_physicians2018 = log(primary_care_physicians2018)) %>%
# left_join(physicians2021, by = 'RegionName') %>% mutate(log_physicians2021 =
# log(primary_care_physicians2021)) } ## General policy only
# fortify_general_speed <- function(policy, flag, level) { policies %>%
# select(Day, RegionName, policy, flag) %>% rename(pol = policy, polflag =
# flag) %>% filter(Day >= '2020-01-09') %>% filter(Day <= '2021-07-09') %>%
# mutate(general_only = ifelse(polflag == 1, pol, 0)) %>% mutate(general_only =
# replace_na(general_only, 0)) %>% group_by(RegionName) %>% arrange(Day) %>%
# mutate(tstart = row_number() - 1, tstop = row_number(), temp =
# cumsum(general_only >= level)) %>% group_by(temp, .add=TRUE) %>%
# group_by(RegionName) %>% mutate(status = ifelse(general_only >= level, 1, 0))
# %>% filter(temp <= 1) %>% mutate(endpt = max(status), start = min(tstart),
# stop = max(tstop)) %>% select(dates = Day, RegionName, start, stop, status,
# tstart, tstop, endpt) %>% filter(RegionName != 'USA' && RegionName !=
# 'Washington DC') %>% # Governor data inner_join(governors %>%
# select(RegionName, governor_party, governor_entered_office,
# governor_term_end, governor_date_of_birth, governor_gender), by =
# 'RegionName') %>% mutate(governor_time_on =
# time_length(interval(governor_entered_office, dates), 'years'),
# governor_time_left = time_length(interval(dates, governor_term_end),
# 'years'), governor_age = floor(time_length(interval(governor_date_of_birth,
# dates), 'years'))) %>% filter(governor_time_on >= 0) %>%
# filter(governor_time_left > 0) %>% mutate(governor_partyrepublican =
# ifelse(governor_party == 'Republican', 1, 0), governor_gendermale =
# ifelse(governor_gender == 'Male', 1, 0)) %>% # Partisan control data
# inner_join(statecontrol, by = 'RegionName') %>% mutate(state_time_on =
# time_length(interval(state_start, dates), 'years'), state_time_left =
# time_length(interval(dates, state_end), 'years')) %>% filter(state_time_on >=
# 0) %>% filter(state_time_left > 0) %>% select(-state_time_on,
# -state_time_left, -state_start, -state_end) %>% # Population data (total pop,
# over 65, under 18) inner_join(totalpopulation %>% filter(dates ==
# '2019-01-01') %>% select(RegionName, totalpopulation = data), by =
# 'RegionName') %>% mutate(log_totalpopulation = log(totalpopulation)) %>%
# inner_join(over65population %>% select (RegionName, over65population = data),
# by = 'RegionName') %>% mutate(over65population_frac =
# over65population/totalpopulation) %>% inner_join(under18population %>% select
# (RegionName, under18population = data), by = 'RegionName') %>%
# mutate(under18population_frac = under18population/totalpopulation) %>% #
# Density inner_join(density2020, by = 'RegionName') %>% # Urban population
# inner_join(urbanrural2019 %>% select(RegionName, urbanfrac), by =
# 'RegionName') %>% # COVID Cases left_join(casecounts %>% filter(value_id ==
# 'JHU_ConfirmedCases') %>% select(dates, RegionName, covidcases = data), by =
# c('RegionName', 'dates')) %>% # COVID Case rates left_join(caseincrease %>%
# select(dates, RegionName, daily_increase_smoothed_per_100k), by =
# c('RegionName', 'dates')) %>% # COVID deaths left_join(casecounts %>%
# filter(value_id == 'JHU_ConfirmedDeaths') %>% select(dates, RegionName,
# coviddeaths = data), by = c('RegionName', 'dates')) %>% # COVID Death rates
# left_join(deathincrease %>% select(dates, RegionName,
# death_increase_smoothed_per_100k), by = c('RegionName', 'dates')) %>% #
# Airport Activity left_join(commercial_service_enplanements_cy19, by =
# 'RegionName') %>% mutate(log_totalenplanements19plus1 =
# log(totalenplanements19 + 1)) %>% # Neighbor mandates
# left_join(neighbors_any(policy, level), by = c('RegionName', 'dates')) %>%
# left_join(neighbors_general(policy, level, flag) %>%
# select(-number.neighbors), by = c('RegionName', 'dates')) %>% # Unemployment
# rate mutate(year = year(dates), month = month(dates)) %>%
# left_join(unemploymentrate %>% select(year, month, RegionName,
# unemploymentrate = data), by = c('RegionName', 'year', 'month')) %>%
# select(-year, -month) %>% # GDP & GDP per capita
# inner_join(nominalgdp_percapita %>% select(RegionName, nominalgdp,
# nominalgdp_percap), by = 'RegionName') %>% mutate(log_nominalgdp =
# log(nominalgdp)) %>% # GINI coefficient left_join(gini2019, by =
# 'RegionName') %>% # hospital capacity left_join(hospitalbeds2019, by =
# 'RegionName') %>% left_join(physicians2018, by = 'RegionName') %>%
# mutate(log_physicians2018 = log(primary_care_physicians2018)) %>%
# left_join(physicians2021, by = 'RegionName') %>% mutate(log_physicians2021 =
# log(primary_care_physicians2021)) } C1_general_speed_fort <-
# fortify_general_speed(policy = 'C1_School.closing', flag = 'C1_Flag', level =
# 2) #Binary flag for geographic scope: 0 - targeted, 1- general, Blank - no
# data C2_general_speed_fort <- fortify_general_speed(policy =
# 'C2_Workplace.closing', flag = 'C2_Flag', level = 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C3_general_speed_fort <- fortify_general_speed(policy =
# 'C3_Cancel.public.events', flag = 'C3_Flag', level = 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C4_general_speed_fort <- fortify_general_speed(policy =
# 'C4_Restrictions.on.gatherings', flag = 'C4_Flag', level = 1) #Binary flag
# for geographic scope: 0 - targeted, 1- general, Blank - no data
# C6_general_speed_fort <- fortify_general_speed(policy =
# 'C6_Stay.at.home.requirements', flag = 'C6_Flag', level = 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data
# C7_general_speed_fort <- fortify_general_speed(policy =
# 'C7_Restrictions.on.internal.movement', flag = 'C7_Flag', level = 2) #Binary
# flag for geographic scope: 0 - targeted, 1- general, Blank - no data
# C8_any_speed_fort <- fortify_any_speed(policy =
# 'C8_International.travel.controls', level = 1) #No flag E1_any_speed_fort <-
# fortify_any_speed(policy = 'E1_Income.support', level = 1) #Binary flag for
# sectoral scope: 0 - formal sector workers only or informal sector workers
# only, 1 - all workers E2_any_speed_fort <- fortify_any_speed(policy =
# 'E2_Debt.contract.relief', level = 1) #No flag H1_general_speed_fort <-
# fortify_general_speed(policy = 'H1_Public.information.campaigns', flag =
# 'H1_Flag', level = 2) #Binary flag for geographic scope: 0 - targeted, 1-
# general, Blank - no data H2_any_speed_fort <- fortify_any_speed(policy =
# 'H2_Testing.policy', level = 1) #No flag H3_any_speed_fort <-
# fortify_any_speed(policy = 'H3_Contact.tracing', level = 1) #No flag
# H6_general_speed_fort <- fortify_general_speed(policy =
# 'H6_Facial.Coverings', flag = 'H6_Flag', level = 2) #Binary flag for
# geographic scope: 0 - targeted, 1- general, Blank - no data H7_any_speed_fort
# <- fortify_any_speed(policy = 'H7_Vaccination.policy', level = 1) #Binary
# flag for cost: 0 - At cost to individual (or funded by NGO, insurance, or
# partially government funded), 1- No or minimal cost to individual (government
# funded or subsidised), Blank - no data H8_general_speed_fort <-
# fortify_general_speed(policy = 'H8_Protection.of.elderly.people', flag =
# 'H8_Flag', level = 2) #Binary flag for geographic scope: 0 - targeted, 1-
# general, Blank - no data
set_my_extra_reg_labels_general <- function(data) {
    data %>%
        set_variable_labels(governor_party = "Governor's party", governor_partyrepublican = "Republican governor",
            governor_gendermale = "Male governor", governor_time_on = "Time on as governor (Years)",
            governor_time_left = "Time left as governor (Years)", governor_age = "Governor's age (Years)",
            governor_gender = "Governor's gender", statecontrol = "Partisan control of state",
            log_totalpopulation = "Log(Population, 2019)", over65population_frac = "Population over 65, 2019 (fraction of total)",
            under18population_frac = "Population under 18, 2019 (fraction of total)",
            density2020 = "People per square mile, 2020", urbanfrac = "Urban population, 2019 (fraction of total)",
            daily_increase_smoothed_per_100k = "Case increases per 100K, 7-day avg.",
            death_increase_smoothed_per_100k = "Death increases per 100k, 7-day avg",
            log_totalenplanements19plus1 = "Log(Total enplanements + 1, 2019)", number.neighbors = "Number of neighbours",
            neighbor.mandates.any = "Neighbours with mandates", neighbor.mandates.general = "Neighours with state-wide mandates",
            unemploymentrate = "Monthly unemployment rate (%)", nominalgdp_percap = "Nominal GDP per capita, 2019",
            gini2019 = "GINI coefficient, 2019", Beds.per.1.000.Population = "Hospital beds per 1,000, 2019",
            log_physicians2018 = "Log(Physicians, 2018)", log_physicians2021 = "Log(Physicians, 2021)")
}

set_my_extra_reg_labels_any <- function(data) {
    data %>%
        set_variable_labels(governor_party = "Governor's party", governor_partyrepublican = "Republican governor",
            governor_gendermale = "Male governor", governor_time_on = "Time on as governor (Years)",
            governor_time_left = "Time left as governor (Years)", governor_age = "Governor's age (Years)",
            governor_gender = "Governor's gender", statecontrol = "Partisan control of state",
            log_totalpopulation = "Log(Population, 2019)", over65population_frac = "Population over 65, 2019 (fraction of total)",
            under18population_frac = "Population under 18, 2019 (fraction of total)",
            density2020 = "People per square mile, 2020", urbanfrac = "Urban population, 2019 (fraction of total)",
            daily_increase_smoothed_per_100k = "Case increases per 100K, 7-day avg.",
            death_increase_smoothed_per_100k = "Death increases per 100k, 7-day avg",
            log_totalenplanements19plus1 = "Log(Total enplanements + 1, 2019)", number.neighbors = "Number of neighbours",
            neighbor.mandates.any = "Neighbours with mandates", unemploymentrate = "Monthly unemployment rate (%)",
            nominalgdp_percap = "Nominal GDP per capita, 2019", gini2019 = "GINI coefficient, 2019",
            Beds.per.1.000.Population = "Hospital beds per 1,000, 2019", log_physicians2018 = "Log(Physicians, 2018)",
            log_physicians2021 = "Log(Physicians, 2021)")
}

C1_general_speed_fort <- set_my_extra_reg_labels_general(C1_general_speed_fort)
C2_general_speed_fort <- set_my_extra_reg_labels_general(C2_general_speed_fort)
C3_general_speed_fort <- set_my_extra_reg_labels_general(C3_general_speed_fort)
C4_general_speed_fort <- set_my_extra_reg_labels_general(C4_general_speed_fort)
C6_general_speed_fort <- set_my_extra_reg_labels_general(C6_general_speed_fort)
C7_general_speed_fort <- set_my_extra_reg_labels_general(C7_general_speed_fort)
C8_any_speed_fort <- set_my_extra_reg_labels_any(C8_any_speed_fort)

E1_any_speed_fort <- set_my_extra_reg_labels_any(E1_any_speed_fort)
E2_any_speed_fort <- set_my_extra_reg_labels_any(E2_any_speed_fort)

H1_general_speed_fort <- set_my_extra_reg_labels_general(H1_general_speed_fort)
H2_any_speed_fort <- set_my_extra_reg_labels_any(H2_any_speed_fort)
H3_any_speed_fort <- set_my_extra_reg_labels_any(H3_any_speed_fort)
H6_general_speed_fort <- set_my_extra_reg_labels_general(H6_general_speed_fort)
H7_any_speed_fort <- set_my_extra_reg_labels_any(H7_any_speed_fort)
H8_general_speed_fort <- set_my_extra_reg_labels_general(H8_general_speed_fort)
# # Stepwise policy by significance any.variable.list <-
# c('governor_partyrepublican', 'governor_time_on', 'governor_time_left',
# 'governor_age', 'governor_gendermale', 'statecontrol', 'log_totalpopulation',
# 'over65population_frac', 'under18population_frac', 'density2020',
# 'urbanfrac', 'daily_increase_smoothed_per_100k',
# 'death_increase_smoothed_per_100k', 'log_totalenplanements19plus1',
# 'number.neighbors', 'neighbor.mandates.any', 'unemploymentrate',
# 'nominalgdp_percap', 'gini2019',
# 'Beds.per.1.000.Population','log_physicians2018', 'log_physicians2021' )
# general.variable.list <- c('governor_partyrepublican', 'governor_time_on',
# 'governor_time_left', 'governor_age', 'governor_gendermale', 'statecontrol',
# 'log_totalpopulation', 'over65population_frac', 'under18population_frac',
# 'density2020', 'urbanfrac', 'daily_increase_smoothed_per_100k',
# 'death_increase_smoothed_per_100k', 'log_totalenplanements19plus1',
# 'number.neighbors', 'neighbor.mandates.any', 'neighbor.mandates.general',
# 'unemploymentrate', 'nominalgdp_percap', 'gini2019',
# 'Beds.per.1.000.Population','log_physicians2018', 'log_physicians2021' )
# stepwise.any.policy <- function(data) { My.stepwise.coxph(T1 = 'tstart', T2 =
# 'tstop', Status = 'status', variable.list = any.variable.list, in.variable =
# c('governor_partyrepublican'), data = data) } stepwise.general.policy <-
# function(data) { My.stepwise.coxph(T1 = 'tstart', T2 = 'tstop', Status =
# 'status', variable.list = general.variable.list, in.variable =
# c('governor_partyrepublican'), data = data) } sink(file =
# 'stepwise_C1_general_speed_fort.txt')
# stepwise.general.policy(C1_general_speed_fort) sink(file = NULL) sink(file =
# 'stepwise_C2_general_speed_fort.txt')
# stepwise.general.policy(C2_general_speed_fort) sink(file = NULL) sink(file =
# 'stepwise_C3_general_speed_fort.txt')
# stepwise.general.policy(C3_general_speed_fort) sink(file = NULL) sink(file =
# 'stepwise_C4_general_speed_fort.txt')
# stepwise.general.policy(C4_general_speed_fort) sink(file = NULL) sink(file =
# 'stepwise_C6_general_speed_fort.txt')
# stepwise.general.policy(drop_na(C6_general_speed_fort)) sink(file = NULL)
# sink(file = 'stepwise_C7_general_speed_fort.txt')
# stepwise.general.policy(drop_na(C7_general_speed_fort)) sink(file = NULL)
# sink(file = 'stepwise_C8_any_speed_fort.txt')
# stepwise.any.policy(drop_na(C8_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_E1_any_speed_fort.txt')
# stepwise.any.policy(drop_na(E1_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_E2_any_speed_fort.txt')
# stepwise.any.policy(drop_na(E2_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_H1_general_speed_fort.txt')
# stepwise.general.policy(drop_na(H1_general_speed_fort)) sink(file = NULL)
# sink(file = 'stepwise_H2_any_speed_fort.txt')
# stepwise.any.policy(drop_na(H2_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_H3_any_speed_fort.txt')
# stepwise.any.policy(drop_na(H3_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_H6_general_speed_fort.txt')
# stepwise.general.policy(drop_na(H6_general_speed_fort)) sink(file = NULL)
# sink(file = 'stepwise_H7_any_speed_fort.txt')
# stepwise.any.policy(drop_na(H7_any_speed_fort)) sink(file = NULL) sink(file =
# 'stepwise_H8_general_speed_fort.txt')
# stepwise.any.policy(drop_na(H8_general_speed_fort)) sink(file = NULL)
# C1_general_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop,
# event=status) ~ governor_party + unemploymentrate + number.neighbors, data=
# C1_general_speed_fort) C2_general_speed_coxph_maxp <- coxph(Surv(time=tstart,
# time2=tstop, event=status) ~ governor_party + nominalgdp_percap, data=
# drop_na(C2_general_speed_fort)) C3_general_speed_coxph_maxp <-
# coxph(Surv(time=tstart, time2=tstop, event=status) ~ governor_party +
# Beds.per.1.000.Population + death_increase_smoothed_per_100k +
# governor_gender + nominalgdp_percap + unemploymentrate + statecontrol, data=
# C3_general_speed_fort) C4_general_speed_coxph_maxp <- coxph(Surv(time=tstart,
# time2=tstop, event=status) ~ governor_party +
# death_increase_smoothed_per_100k, data= drop_na(C4_general_speed_fort))
# C6_general_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop,
# event=status) ~ governor_party + unemploymentrate + log_physicians2018 +
# death_increase_smoothed_per_100k + log_totalpopulation +
# neighbor.mandates.any + governor_gender + log_totalenplanements19plus1, data=
# drop_na(C6_general_speed_fort)) C7_general_speed_coxph_maxp <-
# coxph(Surv(time=tstart, time2=tstop, event=status) ~ governor_party +
# daily_increase_smoothed_per_100k + under18population_frac + urbanfrac, data=
# drop_na(C7_general_speed_fort)) C8_any_speed_coxph_maxp <-
# coxph(Surv(time=tstart, time2=tstop, event=status) ~ governor_party +
# death_increase_smoothed_per_100k + number.neighbors + nominalgdp_percap,
# data= drop_na(C8_any_speed_fort)) E1_any_speed_coxph_maxp <-
# coxph(Surv(time=tstart, time2=tstop, event=status) ~ governor_party +
# under18population_frac + over65population_frac + density2020, data=
# drop_na(drop_na(E1_any_speed_fort))) E2_any_speed_coxph_maxp <-
# coxph(Surv(time=tstart, time2=tstop, event=status) ~ governor_party +
# log_physicians2021 + log_totalpopulation, data= E2_any_speed_fort)
# H1_general_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop,
# event=status) ~ governor_party + unemploymentrate + under18population_frac +
# governor_time_left + number.neighbors + governor_age, data=
# H1_general_speed_fort) H2_any_speed_coxph_maxp <- coxph(Surv(time=tstart,
# time2=tstop, event=status) ~ governor_party + unemploymentrate, data=
# H2_any_speed_fort) H3_any_speed_coxph_maxp <- coxph(Surv(time=tstart,
# time2=tstop, event=status) ~ governor_party + governor_age + statecontrol +
# log_physicians2021 + neighbor.mandates.any, data= H3_any_speed_fort)
# H6_general_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop,
# event=status) ~ governor_party + density2020 + governor_age +
# death_increase_smoothed_per_100k, data= drop_na(H6_general_speed_fort))
# H7_any_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop, event=status)
# ~ governor_party + gini2019 + urbanfrac + neighbor.mandates.any +
# death_increase_smoothed_per_100k, data= drop_na(H7_any_speed_fort))
# H8_general_speed_coxph_maxp <- coxph(Surv(time=tstart, time2=tstop,
# event=status) ~ governor_party + density2020 + statecontrol, data=
# drop_na(H8_general_speed_fort))
C1sigt <- tbl_regression(C1_general_speed_coxph_maxp, exponentiate = TRUE)
C2sigt <- tbl_regression(C2_general_speed_coxph_maxp, exponentiate = TRUE)
C3sigt <- tbl_regression(C3_general_speed_coxph_maxp, exponentiate = TRUE)
C4sigt <- tbl_regression(C4_general_speed_coxph_maxp, exponentiate = TRUE)
C6sigt <- tbl_regression(C6_general_speed_coxph_maxp, exponentiate = TRUE)
C7sigt <- tbl_regression(C7_general_speed_coxph_maxp, exponentiate = TRUE)
C8sigt <- tbl_regression(C8_any_speed_coxph_maxp, exponentiate = TRUE)

E1sigt <- tbl_regression(E1_any_speed_coxph_maxp, exponentiate = TRUE)
E2sigt <- tbl_regression(E2_any_speed_coxph_maxp, exponentiate = TRUE)

H1sigt <- tbl_regression(H1_general_speed_coxph_maxp, exponentiate = TRUE)
H2sigt <- tbl_regression(H2_any_speed_coxph_maxp, exponentiate = TRUE)
H3sigt <- tbl_regression(H3_any_speed_coxph_maxp, exponentiate = TRUE)
H6sigt <- tbl_regression(H6_general_speed_coxph_maxp, exponentiate = TRUE)
H7sigt <- tbl_regression(H7_any_speed_coxph_maxp, exponentiate = TRUE)
H8sigt <- tbl_regression(H8_general_speed_coxph_maxp, exponentiate = TRUE)
# Coef_maxp <- c( summary(C1_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C2_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C3_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C4_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C6_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C7_general_speed_coxph_maxp)$coefficients[1,1],
# summary(C8_any_speed_coxph_maxp)$coefficients[1,1],
# summary(E1_any_speed_coxph_maxp)$coefficients[1,1],
# summary(E2_any_speed_coxph_maxp)$coefficients[1,1],
# summary(H1_general_speed_coxph_maxp)$coefficients[1,1],
# summary(H2_any_speed_coxph_maxp)$coefficients[1,1],
# summary(H3_any_speed_coxph_maxp)$coefficients[1,1],
# summary(H6_general_speed_coxph_maxp)$coefficients[1,1],
# summary(H7_any_speed_coxph_maxp)$coefficients[1,1],
# summary(H8_general_speed_coxph_maxp)$coefficients[1,1]) Std.Err_maxp <- c(
# summary(C1_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C2_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C3_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C4_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C6_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C7_general_speed_coxph_maxp)$coefficients[1,3],
# summary(C8_any_speed_coxph_maxp)$coefficients[1,3],
# summary(E1_any_speed_coxph_maxp)$coefficients[1,3],
# summary(E2_any_speed_coxph_maxp)$coefficients[1,3],
# summary(H1_general_speed_coxph_maxp)$coefficients[1,3],
# summary(H2_any_speed_coxph_maxp)$coefficients[1,3],
# summary(H3_any_speed_coxph_maxp)$coefficients[1,3],
# summary(H6_general_speed_coxph_maxp)$coefficients[1,3],
# summary(H7_any_speed_coxph_maxp)$coefficients[1,3],
# summary(H8_general_speed_coxph_maxp)$coefficients[1,3]) p_maxp <- c(
# summary(C1_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C2_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C3_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C4_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C6_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C7_general_speed_coxph_maxp)$coefficients[1,5],
# summary(C8_any_speed_coxph_maxp)$coefficients[1,5],
# summary(E1_any_speed_coxph_maxp)$coefficients[1,5],
# summary(E2_any_speed_coxph_maxp)$coefficients[1,5],
# summary(H1_general_speed_coxph_maxp)$coefficients[1,5],
# summary(H2_any_speed_coxph_maxp)$coefficients[1,5],
# summary(H3_any_speed_coxph_maxp)$coefficients[1,5],
# summary(H6_general_speed_coxph_maxp)$coefficients[1,5],
# summary(H7_any_speed_coxph_maxp)$coefficients[1,5],
# summary(H8_general_speed_coxph_maxp)$coefficients[1,5]) exp_coef_maxp <- c(
# summary(C1_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C2_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C3_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C4_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C6_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C7_general_speed_coxph_maxp)$conf.int[1,1],
# summary(C8_any_speed_coxph_maxp)$conf.int[1,1],
# summary(E1_any_speed_coxph_maxp)$conf.int[1,1],
# summary(E2_any_speed_coxph_maxp)$conf.int[1,1],
# summary(H1_general_speed_coxph_maxp)$conf.int[1,1],
# summary(H2_any_speed_coxph_maxp)$conf.int[1,1],
# summary(H3_any_speed_coxph_maxp)$conf.int[1,1],
# summary(H6_general_speed_coxph_maxp)$conf.int[1,1],
# summary(H7_any_speed_coxph_maxp)$conf.int[1,1],
# summary(H8_general_speed_coxph_maxp)$conf.int[1,1]) lower_95_maxp <- c(
# summary(C1_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C2_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C3_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C4_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C6_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C7_general_speed_coxph_maxp)$conf.int[1,3],
# summary(C8_any_speed_coxph_maxp)$conf.int[1,3],
# summary(E1_any_speed_coxph_maxp)$conf.int[1,3],
# summary(E2_any_speed_coxph_maxp)$conf.int[1,3],
# summary(H1_general_speed_coxph_maxp)$conf.int[1,3],
# summary(H2_any_speed_coxph_maxp)$conf.int[1,3],
# summary(H3_any_speed_coxph_maxp)$conf.int[1,3],
# summary(H6_general_speed_coxph_maxp)$conf.int[1,3],
# summary(H7_any_speed_coxph_maxp)$conf.int[1,3],
# summary(H8_general_speed_coxph_maxp)$conf.int[1,3]) upper_95_maxp <- c(
# summary(C1_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C2_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C3_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C4_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C6_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C7_general_speed_coxph_maxp)$conf.int[1,4],
# summary(C8_any_speed_coxph_maxp)$conf.int[1,4],
# summary(E1_any_speed_coxph_maxp)$conf.int[1,4],
# summary(E2_any_speed_coxph_maxp)$conf.int[1,4],
# summary(H1_general_speed_coxph_maxp)$conf.int[1,4],
# summary(H2_any_speed_coxph_maxp)$conf.int[1,4],
# summary(H3_any_speed_coxph_maxp)$conf.int[1,4],
# summary(H6_general_speed_coxph_maxp)$conf.int[1,4],
# summary(H7_any_speed_coxph_maxp)$conf.int[1,4],
# summary(H8_general_speed_coxph_maxp)$conf.int[1,4]) ph_maxp <- c(
# cox.zph(C1_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C2_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C3_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C4_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C6_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C7_general_speed_coxph_maxp)$table[1,3],
# cox.zph(C8_any_speed_coxph_maxp)$table[1,3],
# cox.zph(E1_any_speed_coxph_maxp)$table[1,3],
# cox.zph(E2_any_speed_coxph_maxp)$table[1,3],
# cox.zph(H1_general_speed_coxph_maxp)$table[1,3],
# cox.zph(H2_any_speed_coxph_maxp)$table[1,3],
# cox.zph(H3_any_speed_coxph_maxp)$table[1,3],
# cox.zph(H6_general_speed_coxph_maxp)$table[1,3],
# cox.zph(H7_any_speed_coxph_maxp)$table[1,3],
# cox.zph(H8_general_speed_coxph_maxp)$table[1,3]) ph_global_maxp <- c(
# cox.zph(C1_general_speed_coxph_maxp)$table[nrow(cox.zph(C1_general_speed_coxph_maxp)$table),3],
# cox.zph(C2_general_speed_coxph_maxp)$table[nrow(cox.zph(C2_general_speed_coxph_maxp)$table),3],
# cox.zph(C3_general_speed_coxph_maxp)$table[nrow(cox.zph(C3_general_speed_coxph_maxp)$table),3],
# cox.zph(C4_general_speed_coxph_maxp)$table[nrow(cox.zph(C4_general_speed_coxph_maxp)$table),3],
# cox.zph(C6_general_speed_coxph_maxp)$table[nrow(cox.zph(C6_general_speed_coxph_maxp)$table),3],
# cox.zph(C7_general_speed_coxph_maxp)$table[nrow(cox.zph(C7_general_speed_coxph_maxp)$table),3],
# cox.zph(C8_any_speed_coxph_maxp)$table[nrow(cox.zph(C8_any_speed_coxph_maxp)$table),3],
# cox.zph(E1_any_speed_coxph_maxp)$table[nrow(cox.zph(E1_any_speed_coxph_maxp)$table),3],
# cox.zph(E2_any_speed_coxph_maxp)$table[nrow(cox.zph(E2_any_speed_coxph_maxp)$table),3],
# cox.zph(H1_general_speed_coxph_maxp)$table[nrow(cox.zph(H1_general_speed_coxph_maxp)$table),3],
# cox.zph(H2_any_speed_coxph_maxp)$table[nrow(cox.zph(H2_any_speed_coxph_maxp)$table),3],
# cox.zph(H3_any_speed_coxph_maxp)$table[nrow(cox.zph(H3_any_speed_coxph_maxp)$table),3],
# cox.zph(H6_general_speed_coxph_maxp)$table[nrow(cox.zph(H6_general_speed_coxph_maxp)$table),3],
# cox.zph(H7_any_speed_coxph_maxp)$table[nrow(cox.zph(H7_any_speed_coxph_maxp)$table),3],
# cox.zph(H8_general_speed_coxph_maxp)$table[nrow(cox.zph(H8_general_speed_coxph_maxp)$table),3])
# aic_maxp <- c( AIC(C1_general_speed_coxph_maxp),
# AIC(C2_general_speed_coxph_maxp), AIC(C3_general_speed_coxph_maxp),
# AIC(C4_general_speed_coxph_maxp), AIC(C6_general_speed_coxph_maxp),
# AIC(C7_general_speed_coxph_maxp), AIC(C8_any_speed_coxph_maxp),
# AIC(E1_any_speed_coxph_maxp), AIC(E2_any_speed_coxph_maxp),
# AIC(H1_general_speed_coxph_maxp), AIC(H2_any_speed_coxph_maxp),
# AIC(H3_any_speed_coxph_maxp), AIC(H6_general_speed_coxph_maxp),
# AIC(H7_any_speed_coxph_maxp), AIC(H8_general_speed_coxph_maxp))
# model_maxp_summary <- tibble( Group, Policy, Coef_maxp, Std.Err_maxp, p_maxp,
# exp_coef_maxp, lower_95_maxp, upper_95_maxp, ph_maxp, ph_global_maxp,
# aic_maxp, events, n ) ggplot(model_maxp_summary, aes (x = Policy, y =
# exp_coef_maxp)) + geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) +
# geom_point(aes( x = Policy, y = exp_coef_maxp, color = p_maxp)) +
# geom_linerange(aes( ymin = lower_95_maxp, ymax = upper_95_maxp, color =
# p_maxp )) + scale_color_gradient2(low = 'deepskyblue', high = 'midnightblue',
# mid = 'dodgerblue3', midpoint = 0.05, guide = 'colourbar', aesthetics =
# 'color', limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name =
# 'p-values') + scale_y_continuous(name = 'Hazard Ratios', limits = c(0,6.1),
# breaks = c(0, 0.5, 1:6), sec.axis = sec_axis(trans~.*1, name = 'Relative to
# Democrat governors, enactments by Republican governors are...', breaks =
# c(0.5, 1:6), labels = c('1/2 as likely', 'As likely', '2x as likely', '3x as
# likely', '4x as likely', '5x as likely', '6x as likely'))) +
# scale_x_discrete(limits = rev(Policy)) + coord_flip() + theme_light() +
# theme(axis.text.x.top = element_text(size = 8, angle = 30))

### END ORIGINAL CODE ###
C1_general_speed_fort <- set_my_extra_reg_labels_general(C1_general_speed_fort)
C2_general_speed_fort <- set_my_extra_reg_labels_general(C2_general_speed_fort)
C3_general_speed_fort <- set_my_extra_reg_labels_general(C3_general_speed_fort)
C4_general_speed_fort <- set_my_extra_reg_labels_general(C4_general_speed_fort)
C6_general_speed_fort <- set_my_extra_reg_labels_general(C6_general_speed_fort)
C7_general_speed_fort <- set_my_extra_reg_labels_general(C7_general_speed_fort)
C8_any_speed_fort <- set_my_extra_reg_labels_any(C8_any_speed_fort)

E1_any_speed_fort <- set_my_extra_reg_labels_any(E1_any_speed_fort)
E2_any_speed_fort <- set_my_extra_reg_labels_any(E2_any_speed_fort)

H1_general_speed_fort <- set_my_extra_reg_labels_general(H1_general_speed_fort)
H2_any_speed_fort <- set_my_extra_reg_labels_any(H2_any_speed_fort)
H3_any_speed_fort <- set_my_extra_reg_labels_any(H3_any_speed_fort)
H6_general_speed_fort <- set_my_extra_reg_labels_general(H6_general_speed_fort)
H7_any_speed_fort <- set_my_extra_reg_labels_any(H7_any_speed_fort)
H8_general_speed_fort <- set_my_extra_reg_labels_general(H8_general_speed_fort)
### ORIGINAL CODE ###

# #### By AIC
step_aic_policy_any <- function(data) {
    step(coxph(Surv(time = tstart, time2 = tstop, event = status) ~ governor_party +
        governor_time_on + governor_time_left + governor_age + governor_gender +
        statecontrol + log_totalpopulation + over65population_frac + under18population_frac +
        density2020 + urbanfrac + daily_increase_smoothed_per_100k + death_increase_smoothed_per_100k +
        log_totalenplanements19plus1 + number.neighbors + neighbor.mandates.any +
        unemploymentrate + nominalgdp_percap + gini2019 + Beds.per.1.000.Population +
        log_physicians2018 + log_physicians2021, data = data), direction = "both",
        trace = 0)
}

step_aic_policy_general <- function(data) {
    step(coxph(Surv(time = tstart, time2 = tstop, event = status) ~ governor_party +
        governor_time_on + governor_time_left + governor_age + governor_gender +
        statecontrol + log_totalpopulation + over65population_frac + under18population_frac +
        density2020 + urbanfrac + daily_increase_smoothed_per_100k + death_increase_smoothed_per_100k +
        log_totalenplanements19plus1 + number.neighbors + neighbor.mandates.any +
        neighbor.mandates.general + unemploymentrate + nominalgdp_percap + gini2019 +
        Beds.per.1.000.Population + log_physicians2018 + log_physicians2021, data = data),
        direction = "both", trace = 0)
}

# C1_general_speed_coxph_maxaic <-
# step_aic_policy_general(C1_general_speed_fort)

C2_general_speed_coxph_maxaic <- step_aic_policy_general(drop_na(C2_general_speed_fort))

# C3_general_speed_coxph_maxaic <-
# step_aic_policy_general(C3_general_speed_fort)

C4_general_speed_coxph_maxaic <- step_aic_policy_general(drop_na(C4_general_speed_fort))

C6_general_speed_coxph_maxaic <- step_aic_policy_general(drop_na(C6_general_speed_fort))

# C7_general_speed_coxph_maxaic <-
# step_aic_policy_general(drop_na(C7_general_speed_fort))

# C8_any_speed_coxph_maxaic <- step_aic_policy_any(drop_na(C8_any_speed_fort))

E1_any_speed_coxph_maxaic <- step_aic_policy_any(drop_na(drop_na(E1_any_speed_fort)))

E2_any_speed_coxph_maxaic <- step_aic_policy_any(E2_any_speed_fort)

H1_general_speed_coxph_maxaic <- step_aic_policy_general(H1_general_speed_fort)

H2_any_speed_coxph_maxaic <- step_aic_policy_any(H2_any_speed_fort)

# H3_any_speed_coxph_maxaic <- step_aic_policy_any(H3_any_speed_fort)

H6_general_speed_coxph_maxaic <- step_aic_policy_general(drop_na(H6_general_speed_fort))

# H7_any_speed_coxph_maxaic <- step_aic_policy_any(drop_na(H7_any_speed_fort))

# H8_general_speed_coxph_maxaic <-
# step_aic_policy_general(drop_na(H8_general_speed_fort))


# C1aict <- tbl_regression(C1_geenera, exponentiate = TRUE)
C2aict <- tbl_regression(C2_general_speed_coxph_maxaic, exponentiate = TRUE)
# C3aict <- tbl_regression(mincox(C3_general_speed_fort), exponentiate = TRUE)
C4aict <- tbl_regression(C4_general_speed_coxph_maxaic, exponentiate = TRUE)
C6aict <- tbl_regression(C6_general_speed_coxph_maxaic, exponentiate = TRUE)
# C7aict <- tbl_regression(mincox(C7_general_speed_fort), exponentiate = TRUE)
# C8aict <- tbl_regression(mincox(C8_any_speed_fort), exponentiate = TRUE)

E1aict <- tbl_regression(E1_any_speed_coxph_maxaic, exponentiate = TRUE)
E2aict <- tbl_regression(E2_any_speed_coxph_maxaic, exponentiate = TRUE)

H1aict <- tbl_regression(H1_general_speed_coxph_maxaic, exponentiate = TRUE)
H2aict <- tbl_regression(H2_any_speed_coxph_maxaic, exponentiate = TRUE)
# H3aict <- tbl_regression(mincox(H3_any_speed_fort), exponentiate = TRUE)
H6aict <- tbl_regression(H6_general_speed_coxph_maxaic, exponentiate = TRUE)
# H7aict <- tbl_regression(mincox(H7_any_speed_fort), exponentiate = TRUE)
# H8aict <- tbl_regression(mincox(H8_general_speed_fort), exponentiate = TRUE)
# Coef_maxaic <- c( NA,
# summary(C2_general_speed_coxph_maxaic)$coefficients[1,1], NA,
# summary(C4_general_speed_coxph_maxaic)$coefficients[1,1],
# summary(C6_general_speed_coxph_maxaic)$coefficients[1,1], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$coefficients[1,1],
# summary(E2_any_speed_coxph_maxaic)$coefficients[1,1],
# summary(H1_general_speed_coxph_maxaic)$coefficients[1,1],
# summary(H2_any_speed_coxph_maxaic)$coefficients[1,1], NA,
# summary(H6_general_speed_coxph_maxaic)$coefficients[1,1], NA, NA)
# Std.Err_maxaic <- c( NA,
# summary(C2_general_speed_coxph_maxaic)$coefficients[1,3], NA,
# summary(C4_general_speed_coxph_maxaic)$coefficients[1,3],
# summary(C6_general_speed_coxph_maxaic)$coefficients[1,3], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$coefficients[1,3],
# summary(E2_any_speed_coxph_maxaic)$coefficients[1,3],
# summary(H1_general_speed_coxph_maxaic)$coefficients[1,3],
# summary(H2_any_speed_coxph_maxaic)$coefficients[1,3], NA,
# summary(H6_general_speed_coxph_maxaic)$coefficients[1,3], NA, NA) p_maxaic <-
# c( NA, summary(C2_general_speed_coxph_maxaic)$coefficients[1,5], NA,
# summary(C4_general_speed_coxph_maxaic)$coefficients[1,5],
# summary(C6_general_speed_coxph_maxaic)$coefficients[1,5], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$coefficients[1,5],
# summary(E2_any_speed_coxph_maxaic)$coefficients[1,5],
# summary(H1_general_speed_coxph_maxaic)$coefficients[1,5],
# summary(H2_any_speed_coxph_maxaic)$coefficients[1,5], NA,
# summary(H6_general_speed_coxph_maxaic)$coefficients[1,5], NA, NA)
# exp_coef_maxaic <- c( NA,
# summary(C2_general_speed_coxph_maxaic)$conf.int[1,1], NA,
# summary(C4_general_speed_coxph_maxaic)$conf.int[1,1],
# summary(C6_general_speed_coxph_maxaic)$conf.int[1,1], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$conf.int[1,1],
# summary(E2_any_speed_coxph_maxaic)$conf.int[1,1],
# summary(H1_general_speed_coxph_maxaic)$conf.int[1,1],
# summary(H2_any_speed_coxph_maxaic)$conf.int[1,1], NA,
# summary(H6_general_speed_coxph_maxaic)$conf.int[1,1], NA, NA) lower_95_maxaic
# <- c( NA, summary(C2_general_speed_coxph_maxaic)$conf.int[1,3], NA,
# summary(C4_general_speed_coxph_maxaic)$conf.int[1,3],
# summary(C6_general_speed_coxph_maxaic)$conf.int[1,3], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$conf.int[1,3],
# summary(E2_any_speed_coxph_maxaic)$conf.int[1,3],
# summary(H1_general_speed_coxph_maxaic)$conf.int[1,3],
# summary(H2_any_speed_coxph_maxaic)$conf.int[1,3], NA,
# summary(H6_general_speed_coxph_maxaic)$conf.int[1,3], NA, NA) upper_95_maxaic
# <- c( NA, summary(C2_general_speed_coxph_maxaic)$conf.int[1,4], NA,
# summary(C4_general_speed_coxph_maxaic)$conf.int[1,4],
# summary(C6_general_speed_coxph_maxaic)$conf.int[1,4], NA, NA,
# summary(E1_any_speed_coxph_maxaic)$conf.int[1,4],
# summary(E2_any_speed_coxph_maxaic)$conf.int[1,4],
# summary(H1_general_speed_coxph_maxaic)$conf.int[1,4],
# summary(H2_any_speed_coxph_maxaic)$conf.int[1,4], NA,
# summary(H6_general_speed_coxph_maxaic)$conf.int[1,4], NA, NA) ph_maxaic <- c(
# NA, cox.zph(C2_general_speed_coxph_maxaic)$table[1,3], NA,
# cox.zph(C4_general_speed_coxph_maxaic)$table[1,3],
# cox.zph(C6_general_speed_coxph_maxaic)$table[1,3], NA, NA,
# cox.zph(E1_any_speed_coxph_maxaic)$table[1,3],
# cox.zph(E2_any_speed_coxph_maxaic)$table[1,3],
# cox.zph(H1_general_speed_coxph_maxaic)$table[1,3],
# cox.zph(H2_any_speed_coxph_maxaic)$table[1,3], NA,
# cox.zph(H6_general_speed_coxph_maxaic)$table[1,3], NA, NA) ph_global_maxaic
# <- c( NA,
# cox.zph(C2_general_speed_coxph_maxaic)$table[nrow(cox.zph(C2_general_speed_coxph_maxaic)$table),3],
# NA,
# cox.zph(C4_general_speed_coxph_maxaic)$table[nrow(cox.zph(C4_general_speed_coxph_maxaic)$table),3],
# cox.zph(C6_general_speed_coxph_maxaic)$table[nrow(cox.zph(C6_general_speed_coxph_maxaic)$table),3],
# NA, NA,
# cox.zph(E1_any_speed_coxph_maxaic)$table[nrow(cox.zph(E1_any_speed_coxph_maxaic)$table),3],
# cox.zph(E2_any_speed_coxph_maxaic)$table[nrow(cox.zph(E2_any_speed_coxph_maxaic)$table),3],
# cox.zph(H1_general_speed_coxph_maxaic)$table[nrow(cox.zph(H1_general_speed_coxph_maxaic)$table),3],
# cox.zph(H2_any_speed_coxph_maxaic)$table[nrow(cox.zph(H2_any_speed_coxph_maxaic)$table),3],
# NA,
# cox.zph(H6_general_speed_coxph_maxaic)$table[nrow(cox.zph(H6_general_speed_coxph_maxaic)$table),3],
# NA, NA) aic_maxaic <- c( NA, AIC(C2_general_speed_coxph_maxaic), NA,
# AIC(C4_general_speed_coxph_maxaic), AIC(C6_general_speed_coxph_maxaic), NA,
# NA, AIC(E1_any_speed_coxph_maxaic), AIC(E2_any_speed_coxph_maxaic),
# AIC(H1_general_speed_coxph_maxaic), AIC(H2_any_speed_coxph_maxaic), NA,
# AIC(H6_general_speed_coxph_maxaic), NA, NA) model_maxaic_summary <- tibble(
# Group, Policy, Coef_maxaic, Std.Err_maxaic, p_maxaic, exp_coef_maxaic,
# lower_95_maxaic, upper_95_maxaic, ph_maxaic, ph_global_maxaic, aic_maxaic,
# events, n ) ggplot(model_maxaic_summary, aes (x = Policy, y =
# exp_coef_maxaic)) + geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) +
# geom_point(aes( x = Policy, y = exp_coef_maxaic, color = p_maxaic)) +
# geom_linerange(aes( ymin = lower_95_maxaic, ymax = upper_95_maxaic, color =
# p_maxaic )) + scale_color_gradient2(low = 'deepskyblue', high =
# 'midnightblue', mid = 'dodgerblue3', midpoint = 0.05, guide = 'colourbar',
# aesthetics = 'color', limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15),
# name = 'p-values') + scale_y_continuous(name = 'Hazard Ratios', limits =
# c(0,6.1), breaks = c(0, 0.5, 1:6), sec.axis = sec_axis(trans~.*1, name =
# 'Relative to Democrat governors, enactments by Republican governors are...',
# breaks = c(0.5, 1:6), labels = c('1/2 as likely', 'As likely', '2x as
# likely', '3x as likely', '4x as likely', '5x as likely', '6x as likely'))) +
# scale_x_discrete(limits = rev(Policy)) + coord_flip() + theme_light() +
# theme(axis.text.x.top = element_text(size = 8, angle = 30))
# model_stepwise_summary <- model_summary %>% #filter(ph > 0.05 & ph_global >
# 0.05) %>% full_join(model_maxp_summary #%>% filter(ph_maxp > 0.05 &
# ph_global_maxp > 0.05) , by = 'Policy') %>% full_join(model_maxaic_summary
# #%>% filter(ph_maxaic > 0.05 & ph_global_maxaic > 0.05) , by ='Policy') %>%
# full_join(tibble(Group, Policy), by = 'Policy') %>% arrange(Policy)

gg_stepwise <- ggplot(model_stepwise_summary, aes(x = Policy, y = exp_coef_maxp)) +
    geom_hline(yintercept = 1, colour = gray(1/2), lty = 2) + geom_point(aes(x = Policy,
    y = exp_coef_maxp, color = p_maxp, shape = "Max significance", text = paste0(Policy,
        " - Max significance model", "</br></br>Hazard ratio: ", round(exp_coef_maxp,
            3), "</br>95% CI: ", round(lower_95_maxp, 3), " - ", round(upper_95_maxp,
            3), "</br><i>p</i>-value: ", round(p_maxp, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ",
        round(ph_maxp, 3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global_maxp,
            3), "</br>AIC: ", round(aic_maxp, 3), "</br>Events: ", round(events.y,
            3), "</br>N (days): ", round(n.y, 3))), size = 2, position = position_nudge(x = -0.3)) +
    geom_linerange(aes(ymin = lower_95_maxp, ymax = upper_95_maxp, color = p_maxp),
        size = 1.01, position = position_nudge(x = -0.3)) + geom_point(aes(x = Policy,
    y = exp_coef, color = p, shape = "Primary", text = paste0(Policy, " - Primary model",
        "</br></br>Hazard ratio: ", round(exp_coef, 3), "</br>95% CI: ", round(lower_95,
            3), " - ", round(upper_95, 3), "</br><i>p</i>-value: ", round(p, 3),
        "</br>Schoenfeld test on 'party' <i>p</i>: ", round(ph, 3), "</br>Global Schoenfeld test <i>p</i>: ",
        round(ph_global, 3), "</br>AIC: ", round(aic, 3), "</br>Events: ", round(events.x,
            3), "</br>N (days): ", round(n.x, 3)))) + geom_linerange(aes(ymin = lower_95,
    ymax = upper_95, color = p), linetype = "dotdash") + geom_point(aes(x = Policy,
    y = exp_coef_maxaic, color = p_maxaic, shape = "Max AIC", text = paste0(Policy,
        " - Max AIC model", "</br></br>Hazard ratio: ", round(exp_coef_maxaic, 3),
        "</br>95% CI: ", round(lower_95_maxaic, 3), " - ", round(upper_95_maxaic,
            3), "</br><i>p</i>-value: ", round(p_maxaic, 3), "</br>Schoenfeld test on 'party' <i>p</i>: ",
        round(ph_maxaic, 3), "</br>Global Schoenfeld test <i>p</i>: ", round(ph_global_maxaic,
            3), "</br>AIC: ", round(aic_maxaic, 3), "</br>Events: ", round(events,
            3), "</br>N (days): ", round(n, 3))), size = 2, position = position_nudge(x = 0.3)) +
    geom_linerange(aes(ymin = lower_95_maxaic, ymax = upper_95_maxaic, color = p_maxaic),
        size = 1.01, position = position_nudge(x = 0.3)) + scale_color_gradient2(low = "deepskyblue",
    high = "midnightblue", mid = "dodgerblue3", midpoint = 0.05, guide = "colourbar",
    aesthetics = "color", limits = c(0, 0.15), breaks = c(0, 0.05, 0.1, 0.15), name = "p-values") +
    scale_y_continuous(name = "Hazard Ratios", limits = c(0, 8), breaks = c(0, 0.5,
        1:8), sec.axis = sec_axis(trans ~ . * 1, name = "Relative to Democrat governors, enactments by Republican governors are...",
        breaks = c(0.5, 1:8), labels = c("1/2 as likely", "As likely", "2x as likely",
            "3x as likely", "4x as likely", "5x as likely", "6x as likely", "7x as likely",
            "8x as likely"))) + scale_x_discrete(limits = rev(Policy)) + scale_shape_manual(name = "Model",
    values = c(`Max AIC` = 5, Primary = 1, `Max significance` = 4)) + labs(x = "Policy") +
    coord_flip() + theme_light() + theme(axis.text.x.top = element_text(size = 8,
    angle = 25))

ax <- list(overlaying = "x", side = "top", showticklabels = TRUE, range = c(0, 8),
    tickmode = "array", tickvals = c(0.5, 1, 2, 3, 4, 5, 6, 7, 8), ticktext = list("1/2 as likely",
        "As likely", "2x as likely", "3x as likely", "4x as likely", "5x as likely",
        "6x as likely", "7x as likely", "8x as likely"), tickfont = list(size = 8),
    scaleanchor = "x", scalerato = "1", title = list(text = "Relative to Democrat governors, enactments by Republican governors are...",
        font = list(size = 11.5)))

plotly_stepwise <- ggplotly(gg_stepwise, tooltip = "text") %>%
    add_markers(x = 0, y = "y", data = NULL, inherit = TRUE, xaxis = "x2", showlegend = F) %>%
    plotly::config(modeBarButtonsToAdd = list("drawopenpath", "eraseshape"), displaylogo = FALSE,
        modeBarButtonsToRemove = list("autoScale2d")) %>%
    layout(xaxis2 = ax, margin = list(t = 50), legend = list(traceorder = "reversed"))

for (i in 2:17) {
    plotly_stepwise$x$data[[i]]$name = "Max significance"
    plotly_stepwise$x$data[[i]]$legendgroup <- "Max significance"
}

for (i in 18:33) {
    plotly_stepwise$x$data[[i]]$name = "Primary"
    plotly_stepwise$x$data[[i]]$legendgroup <- "Primary"
}

for (i in 30:44) {
    plotly_stepwise$x$data[[i]]$name = "Max AIC"
    plotly_stepwise$x$data[[i]]$legendgroup <- "Max AIC"
}

plotly_stepwise$x$layout$annotations[[1]]$y <- 0.4
plotly_stepwise$x$layout$annotations[[1]]$x <- 1.04

plotly_stepwise

Note: Symbols represent hazard ratios and lines represent the 95% confidence interval.

Stepwise models largely support the results from the primary analysis, finding statistically significant partisan differences for C2 workplace closures, C6 stay at home requirements, E1 income support programs, E2 debt or contract relief, and H6 face covering mandates. However, counter to the results from the primary analysis and expectations, stepwise models produced some evidence for partisan differences for C3 cancellations of public events and H1 coordinated public information campaigns and a positive effect direction for Republican governors (meaning C3 and H1 enactments were more likely under Republican governors than Democratic governors).

Summary of Results

Table 3 presents a stylized summary of the variable of interest in the primary analysis and in all robustness checks except for the geography checks. As briefly discussed, results from models that counted locally targeted policies are especially interesting because they suggest no statistically significant differences between Republican-led states or Democratic-led states in the time they took to enact any of the policies at any geographic level, which may be possibly explained by the compensatory effect first presented by Brandtner et al. (2021) or strategic actions from governors to minimize potential political fallout. Given the ambiguity over enacting authorities that is unique to these checks, these models are discussed separately from the others for easier interpretation and analysis of the main variable of interest.

Average treatment effects of the governor’s party affiliation are calculated from the mean hazard ratios and 95% confidence intervals from the primary models and the stepwise models and transformed for interpretation. Results from modelling variations in intensity are excluded to preserve continuity in outcome variables (i.e., time to enact policy i with at least intensity j). Aggregated grades for the statistical significance of differences between Republican and Democratic-led states in policy enactment represent consistency in p-values across models from the primary analysis, stepwise models, intensity variation models, and Kaplan-Meier log-rank tests. Differences for policies are marked as significant only if all p-values are less than 0.05, insignificant if all p-values are above 0.1, and unclear if any p-value is below 0.1 but above 0.05 or if p-values are neither universally statistically significant nor insignificant at the 5% level. This is to accommodate potential “edge” cases, where p-values are close to but do not cross the 0.05 level of significance. Model quality is derived from testing the proportional-hazards assumption on all included Cox models (i.e., models from the primary analysis, stepwise models, and intensity testing models). Quality is denoted as good if no model violates the proportional-hazards assumption, mixed if there is at least one violation, and bad if all models violate the assumption.

C1 is the only policy analyzed that appears both unambiguously consistent in the statistical insignificance of partisan differences and wholly compliant with the proportional-hazards assumption in each applicable model. Models for C2 were similarly appropriate for proportional hazards. However, increasing the policy intensity level by 1 (from the closure of some workplaces to the closure of all-but-essential businesses) yielded the policy’s only statistically insignificant result. As noted above, this is part of a general pattern of statistical insignificance in policy enactment along partisan lines when intensity levels are raised by 1, and similarly when levels are lowered by 1. However, it is important to note that the proportional hazards assumption, which is crucial to model interpretation, was violated in the higher intensity models of E1 and H6, and the lower intensity models of H6. Another notable pattern is the disappointing performance of the primary set of covariates, which was responsible for 6 of the 12 models with proportional hazards violations: C3, C6, C8, H2, and H8. In comparison, 2 max AIC models (C3 and C4) violated the assumption, and no violations were found in max significance models at the 5% alpha level. Furthermore, there are 4 policies where the governor’s party affiliation is statistically insignificant at the 5% level under the primary set of covariates but significant in both stepwise regressions (C3, C4, E2, and H1).

Table 3. Summary of models and robustness checks.
# all_summary_graded <- tibble(Group_plusC5, Policy_plusC5) %>%
# full_join(model_summary, by = c('Policy_plusC5' = 'Policy')) %>%
# full_join(model_maxaic_summary, by = c('Policy_plusC5' = 'Policy')) %>%
# full_join(model_maxp_summary, by = c('Policy_plusC5' = 'Policy')) %>%
# mutate(avg_hr = rowMeans(select(., starts_with('exp_coef')), na.rm = TRUE),
# avg_hr_interp = (round(avg_hr, digits = 2) - 1) * 100, avg_lower_95 =
# rowMeans(select(., starts_with('lower_95')), na.rm = TRUE), avg_upper_95 =
# rowMeans(select(., starts_with('upper_95')), na.rm = TRUE)) %>%
# mutate(avg_hr_text = case_when(avg_hr_interp == 0 ~ paste0('As likely', ' (',
# round(((avg_lower_95 - 1) * 100), digits = 2), '% to ', round(((avg_upper_95
# - 1) * 100), digits = 2), '%)'), avg_hr_interp > 0 ~
# paste0(round(avg_hr_interp, digits = 0), '% more likely (',
# round(((avg_lower_95 - 1) * 100), digits = 2), '% to ', round(((avg_upper_95
# - 1) * 100), digits = 2), '%)'), avg_hr_interp < 0 ~
# paste0(abs(round(avg_hr_interp, digits = 0)), '% less likely (',
# ((round(avg_lower_95, digits = 2) - 1) * 100), '% to ', round(((avg_upper_95
# - 1) * 100), digits = 2), '%)'))) %>% full_join(model_any_summary, by =
# 'Policy_plusC5') %>% full_join(model_plus1_summary, by = 'Policy_plusC5') %>%
# full_join(model_minus1_summary, by = 'Policy_plusC5') %>%
# full_join(kmpvals_gubonly, by = c('Policy_plusC5' = 'Policy')) %>% mutate(sig
# = case_when(p < 0.05 ~ 1, p < 0.1 & p >= 0.05 ~ 0.5, p >= 0.1 ~ 0),
# sig_maxaic = case_when(p_maxaic < 0.05 ~ 1, p_maxaic < 0.1 & p >= 0.05 ~ 0.5,
# p_maxaic >= 0.1 ~ 0), sig_maxp = case_when(p_maxp < 0.05 ~ 1, p_maxp < 0.1 &
# p >= 0.05 ~ 0.5, p_maxp >= 0.1 ~ 0), sig_plus1 = case_when(p_plus1 < 0.05 ~
# 1, p_plus1 < 0.1 & p >= 0.05 ~ 0.5, p_plus1 >= 0.1 ~ 0), sig_minus1 =
# case_when(p_minus1 < 0.05 ~ 1, p_minus1 < 0.1 & p >= 0.05 ~ 0.5, p_minus1 >=
# 0.1 ~ 0), sig_km = case_when(log.rank.p < 0.05 ~ 1, log.rank.p < 0.1 & p >=
# 0.05 ~ 0.5, log.rank.p >= 0.1 ~ 0) ) %>% mutate(all_sig = rowSums(select(.,
# starts_with('sig')), na.rm = TRUE), no_sig = rowSums(is.na(select(.,
# starts_with('sig')))), yes_sig = 6 - no_sig, grade_sig = all_sig/yes_sig) %>%
# mutate(grade_sig_text = case_when(grade_sig == 0 ~ 'Insignificant', grade_sig
# > 0 & grade_sig < 1 ~ 'Unclear', grade_sig == 1 ~ 'Significant')) %>%
# mutate(quality = case_when(ph < 0.05 | ph_global < 0.05 ~ 0, ph >= 0.05 |
# ph_global >= 0.05 ~ 1), quality_maxaic = case_when(ph_maxaic < 0.05 |
# ph_global_maxaic < 0.05 ~ 0, ph_maxaic >= 0.05 | ph_global_maxaic >= 0.05 ~
# 1), quality_maxp = case_when(ph_maxp < 0.05 | ph_global_maxp < 0.05 ~ 0,
# ph_maxp >= 0.05 | ph_global_maxp >= 0.05 ~ 1), quality_plus1 =
# case_when(ph_plus1 < 0.05 | ph_global_plus1 < 0.05 ~ 0, ph_plus1 >= 0.05 |
# ph_global_plus1 >= 0.05 ~ 1), quality_minus1 = case_when(ph_minus1 < 0.05 |
# ph_global_plus1 < 0.05 ~ 0, ph_minus1 >= 0.05 | ph_global_minus1 >= 0.05 ~
# 1)) %>% mutate(all_quality = rowSums(select(., starts_with('quality')), na.rm
# = TRUE), no_quality = rowSums(is.na(select(., starts_with('quality')))),
# yes_quality = 5 - no_quality, grade_quality = all_quality/yes_quality) %>%
# mutate(grade_quality_text = case_when(grade_quality == 0 ~ 'Bad',
# grade_quality > 0 & grade_quality < 1 ~ 'Mixed', grade_quality == 1 ~
# 'Good'))

kbl(all_summary_graded %>%
    select(Group_plusC5.x, Policy_plusC5, avg_hr_text, grade_sig_text, grade_quality_text),
    col.names = c("Group", "Policy", "Average effects of Republican governors on enactment (95% CI)*",
        "Statistical significance**", "Model quality***"), digiits = 3) %>%
    kable_classic(full_width = F) %>%
    kable_styling(bootstrap_options = c("hover", "condensed", "responsive")) %>%
    column_spec(1, bold = T) %>%
    collapse_rows(columns = 1:1, valign = "top") %>%
    footnote(general = "* Average effects of Republican governors are calculated from the hazard ratios and confidence intervals of the primary and stepwise models only because they share the same outcome variable (i.e., no difference in geographic scope or intensity) and are presented for ease of interpretation. As likely = average hazard ratio of 1.
           ** Statistical significance grading is based on p-values from all robustness checks except geography checks due to uncertainties over issuing authority & tangential relevance to main research question. Insignificant = all applicable p-values are > 0.1, significant = all p-values are < 0.05, and unclear = not all p-values are > p-value is < 0.1.
           *** Model quality grading is based on violations of proportional hazards assumptions, with good = no violations for all included models, mixed = some violation, and bad = violations in all applicable models.")
Group Policy Average effects of Republican governors on enactment (95% CI)* Statistical significance** Model quality***
Containment and Closure C1 School Closing 16% less likely (-56% to 61.51%) Insignificant Good
C2 Workplace Closing 59% less likely (-79% to -19.32%) Unclear Good
C3 Cancel Public Events 104% more likely (-4.98% to 336.93%) Unclear Mixed
C4 Restrictions on Gatherings 52% less likely (-76% to -2.28%) Unclear Mixed
C5 Close Public Transport NA Insignificant Bad
C6 Stay at Home Requirements 66% less likely (-85% to -24.35%) Significant Mixed
C7 Restrictions on Internal Movement 40% less likely (-74% to 37.73%) Unclear Good
C8 International Travel Controls 1% less likely (-52% to 106.33%) Insignificant Mixed
Economic E1 Income Support 67% less likely (-83% to -35.35%) Unclear Mixed
E2 Debt/Contract Relief 49% less likely (-73% to -4.04%) Unclear Good
Health H1 Public Information Campaigns 151% more likely (19.77% to 428%) Unclear Good
H2 Testing Policy 24% less likely (-59% to 42.21%) Unclear Mixed
H3 Contact Tracing 3% less likely (-48% to 82.32%) Unclear Good
H6 Facial Coverings 75% less likely (-88% to -46.29%) Unclear Mixed
H7 Vaccination Policy 12% less likely (-58% to 83.14%) Insignificant Good
H8 Protection of Elderly People 26% more likely (-35.59% to 147.4%) Insignificant Mixed
Note:
* Average effects of Republican governors are calculated from the hazard ratios and confidence intervals of the primary and stepwise models only because they share the same outcome variable (i.e., no difference in geographic scope or intensity) and are presented for ease of interpretation. As likely = average hazard ratio of 1.
** Statistical significance grading is based on p-values from all robustness checks except geography checks due to uncertainties over issuing authority & tangential relevance to main research question. Insignificant = all applicable p-values are > 0.1, significant = all p-values are < 0.05, and unclear = not all p-values are > p-value is < 0.1.
*** Model quality grading is based on violations of proportional hazards assumptions, with good = no violations for all included models, mixed = some violation, and bad = violations in all applicable models.

Discussion

In a manual review of the coding notes for 73 additional orders under Republican governors when geographically targeted orders are also counted, at least 13 orders can be directly traced to a state office or the governor: 2 school closure orders (Missouri and Tennessee), 2 workplace closure mandates (Alabama and Nebraska), 2 cancellations of public events (Alabama and Ohio), 4 restrictions on public gatherings (Alabama, Arkansas, Florida and Nebraska), 1 face covering mandate (Georgia), and 2 orders directed towards the protection of elderly people (Alabama and Mississippi). Although most geographically targeted orders under Republican-led states were first enacted at the municipal level (thus supporting the theory of a compensatory effect), some of these policies were either early initiatives from Republican governors or the only policy they enacted in its category. These include, for example, Nebraska Governor Pete Ricketts shutting down select businesses and imposing an enforceable limit on gatherings as part of the state’s first “Directed Health Measure” on 19 March 2020, or Governor Brian Kemp of Georgia issuing a mandate on 17 August 2020 that explicitly pushed the responsibility to instate mask mandates onto counties while simultaneously defining the legal threshold that must be met before municipal governments can do so (the county must have 100 or more). Months later, the Georgia governor was the centre of harsh criticism from then outgoing President Trump after certifying the state’s federal election results, but nonetheless announced his enthusiastic support for a 2024 Trump presidential campaign in a bid to recoup right-wing support ahead of the state’s 2022 gubernatorial elections (Bluestein 2021). Given the Governor’s precarious political position and the vicious partisan climate, in which the former president and lockdown-skeptic still holds immense sway, it seems strategically sensible to maintain the deference of controversial responsibilities like mask mandates to local governments and refrain from issuing any state-wide mask orders.

Relative to blue states, states with Republican governors also have unexpectedly similar or higher rates of policy enactment when intensity parameters are changed. 14 out of 26 states with Republican governors closed all-but-essential businesses, the strictest level of recorded workplace closures, while 19 out of 24 states with Democratic governors. These enactments took place within 18 days, from the first enactment on 19 March 2020 in California under Democratic Governor Gavin Newsom to the last one on 6 April 2020 in South Carolina under Republican Governor Henry McMaster. Of these enactments, 12 were the states’ first closure order (6 Democratic and 6 Republican) and 21 states (13 Democratic and 8 Republican) were expanding closures within 11 days of their first and lower intensity order with a median of 7 days (IQR: 5, 8). As such, one explanation for why the differences in speeds to close all-but-essential workplaces are statistically insignificant, even though gaps in the time took to recommend the closing of workplaces and the closing of some businesses are significant, is that this level of policy intensity acted as a partisan filter. Given the strictness of this policy level and their accompanying unpopularity, especially among Republicans, states that did enact may have pre-committed to upsetting certain segments of their voters. If so, the timing of these policies may be informed by other considerations, such as the interests and influence of medical professionals. Indeed, the only variable that is statistically significant in the primary model is the number of physicians per 100,000 people, where each additional primary care physician may increase the likelihood of enactment by as much as 3.9% (\(\exp(\beta)\)=⁡1.039, 95% CI:1.006 to 1.073, p<0.05, \(n_{events}\)=33).

Another departure from the results of the primary analysis is the similar rates for income support that replace more than 50% of a worker’s wages or the state median salary (5 Democratic states and 6 Republican states). However, this result is likely due to the low sample size of this event that likely contributed to its violation of the proportional hazards assumption. On the other hand, there were 34 enactments of comprehensive debt or contract relief, with partisan differences in their issuing no longer statistically significant at the 5% level. While Democratic-led states saw relatively more enactments (21 versus 13 mandates in Republican states), most orders took a similar pace. Excluding outliers that took over 100 days (6 Democratic states and 5 Republican states), Democratic enactment times took a median of 72 days (IQR: 69, 78) since the start of the observation period while Republicans took a median of 71.5 days (IQR 68.75, 75), whereas the enactment of limited relief took Democratic states a median of 68 days (IQR 65, 72) and Republican states 71 days (IQR 68, 78). The weaker statistical significance of differences at the stricter level of this policy is better interpreted as a limited narrowing in the time gap for expanding contract relief, with 8 Republican states, Alaska, Florida, Georgia, Indiana, Iowa, Maryland, New Hampshire, and South Carolina, mimicking the pace of Democratic states while the rest either refused to expand coverage or did so much later.

As for the unexpected direction of the hazard ratio for contact tracing programs graded as comprehensive, a manual review of the data offers some support to the theory that the typically smaller populations and later infections in red states were advantages. For example, North Dakota, with a population of 762,000, was the first state to meet the estimated demand of 30 contact tracers per 100,000 people and the 13th state to be given this policy intensity ranking (Dura 2020; Hallas et al. 2021). Most states enacted some sort of initial tracking program during the beginning of the pandemic, with 26 Republican-led states taking a median of 59.5 days (IQR: 55.25, 83) from the start of the observation window and 24 Democratic states taking a median of 60 days (IQR: 57, 69.5), but these programs are marked as limited until a state records its first case and demonstrates that it can actually carry out comprehensive tracking. Upon escalating the intensity parameter of the outcome policy variable, the gap in timings is significantly widened as 20 blue states took a median of 120 days (IQR: 59.5, 202.25) from the date they first enacted a limited tracing program to the date that they are graded as having a comprehensive one while red states took only a median of 64 extra days (IQR: 31, 127).

Despite the noted shortcomings of the primary model, its results are largely supported by the non-parametric and stepwise analyses and are in congruence with expectations set by previous findings from Baccini and Brodeur (2021), Wang, Devine, and Molina-Sieiro (2021), Adolph et al. (2021), and Warner and Zhang (2021). Log-rank tests for differences between Kaplan-Meier survival curves support the conclusion that there are significant partisan differences in the rates at which states shut down workplaces, restrict gatherings, issue stay-at-home orders, and mandate masks, and both stepwise regression methods substantiate the expectation that Republican governors are less likely to enact these policies than their Democratic colleagues.

For C2, both stepwise models concur that the optimal model to explain the variance in enactment times consists of only the governor’s party (Republican) (\(\exp⁡(\beta)\)=0.411, 95% CI=0.214 to 0.788, p<0.01, \(n_{events}\)=50) and the nominal GDP per capita (\(\exp(\beta)\)=1.000, 95% CI=1.000 to 1.000, p=0.145), in which Republican governors are 58.9% less likely to shut down at least some workplaces per day after controlling for GDP per capita while increasing the GDP per capita by $1,000 increases the daily risk for business closures by 1.9%. This agrees with the expectation that governments in wealthier regions may be more likely to enact economically strenuous policies because they are better able to bear the costs, as noted by Adolph et al. (2021, 4).

For C4, the max AIC stepwise model is overfitted with 13 variables on 49 events and violates the proportional hazards assumption, but the max significance model contains only the party of the governor (\(\exp(\beta0\)=.417,95% CI:0.224 to 0.773,p<0.01, \(n_{events}\)=49) and the daily death rate per 100,000 people averaged over 7 days (\(\exp(\beta)\)==6.823e07, 95% CI:1.730 to 3.968e+15, p<0.05). This means that, controlling for the death rate, Republican governors are 58.4% less likely to stop gatherings of over 1,000 people or less, and every increase of 0.001 deaths per individual in the state additionally increases the baseline hazards multiplier by 68.2%.

The max significance model for C6 controls for similar variables as the primary model, with the addition of the governor’s gender and the substitution of the primary economic variable of nominal GDP per capita for the monthly unemployment rate and the COVID variable of the 7-day average case increases per 100,000 people for the identically transformed death rate. Controlling for all variables, Republican governors are 63.6% less likely to enact stay-at-home orders (\(\exp(\beta)\)=0.364, 95% CI:0.164 to 0.808, p<0.05, \(n_{events}\)=39). In comparison, the max AIC model is identical to the max significance model, but also controls for the fraction of the population over the age of 65, the rate of COVID case increases, and the nominal GDP per capita. In this model, Republican governors are 69.1% less likely to enact stay-at-home orders (\(\exp(\beta)\)=0.310, 95% CI:0.134 to 0.712, p<0.01, \(n_{events}\)=39).

The stepwise models also help illustrate the likelihood of mask mandates in states with Republican states relative to Democratic states. The max significance model controls for density, the governors’ age, and the average death rate, which then estimates that Republican governors are 71.8% less likely to enact mask requirements than Democratic governors after controlling for covariates (\(\exp(\beta)\)=0.282, 95% CI=0.140 to 0.565, p<0.001, \(n_{events}\)=39). The max AIC model, on the other hand, is likely multicollinear, as it controls for the time the governor has spent in their position, the time the governor has left before their term expires, the governor’s age, whether the governor’s party also controls the state legislature, the density of the state, and the fraction of people living in urban areas. Accounting for these variables, a Republican governor is 85.6% less likely to enact a mask mandate (\(\exp(\beta)\)=0.144, 95% CI=0.059 to 0.352, p<0.001).

Max significance and max AIC regressions also provide empirical evidence for other policies that have not been explicitly covered in past event history analyses in the American context, namely the economic policies E1 income support and E2 debt or contract relief. Stepwise results for both models support the expectation and results from the primary analysis that Republican governors enact economic assistance at lower rates than Democratic governors.

For E1, both stepwise models selected the fraction of those under the age of 18, the fraction of those over the age of 65, and the density of each state as control variables, and estimate that the probability of a Republican governor newly enacting income support on any given day is 65.2% less than Democratic governors (\(\exp(\beta)\)=0.348, 95% CI=0.181 to 0.671, p<0.01, \(n_{events}\)=46).

Again, both stepwise models for E2 are the same. They control for two variables: the log of the state population and the log of the number of primary care physicians in 2021. This model estimates that Republican governors 49.0% less likely to enact debt or contract relief than Democratic governors after controlling for the size of the state (in terms of population) and health care capacity (in terms of available doctors) (\(\exp(\beta)\)=0.510, 95% CI:0.277 to 0.937, p<0.01, \(n_{events}\)=50).

The stepwise models also present several unexpected results that are not seen in the primary models. First, the max significance model for C3, cancellation of public events, suggests that Republican governors are 125.9% more likely to cancel public events than Democratic governors (\(\exp(\beta)\)0.144, 95% CI=1.021 to 4.998, p<0.05, \(n_{events}\)=49) after accounting for the number of hospital beds per 1,000 people, the death rate, the governor’s gender, the nominal GDP per capita, the monthly unemployment rate, and single-party control over the governor’s office and the state legislature.

Second, both the max AIC model and the max significance model suggest that coordinated public information campaigns happen at a higher rate under Republican governors than Democratic governors. Controlling for the unemployment rate, the fraction of the population under the age of 18, the time left in the governor’s term, the number of neighbouring states, and the governor’s age, the max significance model finds that Republican governors are 194% more likely to start coordinated public information campaigns (\(\exp(\beta)\)=2.94, 95% CI:1.421 to 6.080, p<0.01, \(n_{events}\)=50). The max AIC model estimates that Republican governors are 250.3% more likely to start coordinated public information campaigns (\(\exp(\beta)\)=3.503, 95% CI:1.598 to 7.681, p<0.001), after controlling for the term time left, the governor’s age, the fraction of the population under the age of 18, the fraction of the population considered urban, the number of neighbouring states, the unemployment rate, and the log of the number of primary care physicians.

Most importantly, the stepwise regressions largely support a dominant trend across all models: several types of policies are enacted at rates that are not significantly different along party lines. This paper has presented consistent results that requirements to close schools, measures to control and monitor international arrivals, programs to trace COVID infections and their contacts, vaccination policies, and specific protections for the elderly are irrelevant to the party affiliation of the state governor.

These results lend support to two substantive interpretations of policy reactions to COVID-19 in the United States. First, it is possible that not all policy issues became partisan issues. Even though COVID-19 became an extremely politicized issue during a period of extreme partisan tensions, certain deployments of the tools of government remained apolitical. For example, special protections for the elderly, even when especially restrictive, were enacted at similar rates between Republican and Democratic governors. Furthermore, there is some evidence that political executives employed ways to keep certain policies apolitical, or at least enact them with minimal consequences to balance other political priorities (for example, by explicitly deferring mask mandates to municipal governments). If this interpretation is correct, then the absence of federal leadership may have squandered several crucial opportunities for interstate cooperation during the beginning of the pandemic. COVID testing and contact tracing, for example, were widely popular for governors of both parties (with Republican states possibly having had established more comprehensive tracing programs faster than Democratic states). As such, it is not difficult to imagine an early, national contact tracing and testing program that would have been appropriate given the tendency of the coronavirus to rapidly spread across cities, states, and countries.

Second, this overview of party affiliation as a variable in the decision-making of political executives may suggest that political ideology or identity may manifest in preferences in the use of the different tools of government. Using a tools of government framework, these results may suggest a Republican aversion to the use of authority (i.e., using legal powers to shut down businesses, or requiring people to stay home or wear masks) and the use of treasure (i.e., dispersing monetary assistance or temporary relief from financial obligations). Instead, Republican governors seem to prefer the use of nodality and organization (for example, mobilizing the bureaucracy to disseminate public health information, recruiting teams of contact tracers to monitor the spread of COVID, and establishing testing centres to collect and provide essential statistics). If this interpretation is accurate, these results also lend support to social constructivist theories like UET, as raised by Wang, Devine, and Molina-Sieiro (2021, 8–15), as these preferences are to be expected from political executives who believe in smaller and more passive government.

Conclusion

This paper has provided an overview of the explanatory power of a governor’s political affiliation on policy response times on a range of containment and closure, economic, and health-related mandates through several variations of event history analyses. This paper supports previous findings that state-wide lockdown orders are enacted at lower rates under Republican leadership, as well as the expectation that mask mandates are also less likely under Republican governors. Model results from this paper also support the idea of a compensatory effect from municipal governments that enact policies in response to COVID when their state governments are late or fail to do so, but they also raise the possibility that state governments may enact geographically targeted policies to avoid potential political consequences. This paper also looks at the significance of policy timings of orders in the American context that have not been modelled via event history analyses, such as economic and health policies. Most importantly, this paper finds that the governor’s political affiliation is not a robust explanatory variable for several kinds of government responses to COVID.

Although the analysis in this paper has been broad (likely overly so), it is not an exhaustive probe into its variable of interest. The intent is to hopefully instigate further investigations into the role that partisan identity plays in decision-making, especially in times of great uncertainty and urgent challenges. In the context of COVID-19, an investigation into the performance of this variable against the length of policies may prove fruitful. Second, an effort to differentiate the issuing authority of locally targeted policies may reveal interesting relationships between partisanship and the different levels of government. Lastly, the proportional hazards assumption is violated in several models, and parts of the analysis have relied on stepwise selection methods for model building to analyze many dependent and independent variables against the variable of interest. Better models are certain, but this paper may serve as a starting point.

Bibliography

2019 State Physician Workforce Data Report.” 2019. Washington, D.C.: Association of American Medical Colleges.

A Timeline of COVID-19 Developments in 2020.” 2021. AJMC. January 1, 2021. https://www.ajmc.com/view/a-timeline-of-covid19-developments-in-2020.

Adolph, Christopher, Kenya Amano, Bree Bang-Jensen, Nancy Fullman, and John Wilkerson. 2021. “Pandemic Politics: Timing State-Level Social Distancing Responses to COVID-19.” Journal of Health Politics, Policy and Law 46 (2): 211–33. https://doi.org/10.1215/03616878-8802162.

Akaike, H. 1974. “A New Look at the Statistical Model Identification.” IEEE Transactions on Automatic Control 19 (6): 716–23. https://doi.org/10.1109/TAC.1974.1100705.

Baccini, Leonardo, and Abel Brodeur. 2021. “Explaining Governors’ Response to the COVID-19 Pandemic in the United States.” American Politics Research 49 (2): 215–20. https://doi.org/10.1177/1532673X20973453.

Bluestein, Greg. 2021. “Squeezed from Both Sides, Kemp Tests 2022 Reelection Appeal.” The Atlanta Journal-Constitution, March 5, 2021, sec. Politics.

Brandtner, Christof, Luís M. A. Bettencourt, Marc G. Berman, and Andrew J. Stier. 2021. “Creatures of the State? Metropolitan Counties Compensated for State Inaction in Initial U.S. Response to COVID-19 Pandemic.” PLOS ONE 16 (2): e0246249. https://doi.org/10.1371/journal.pone.0246249.

Cole, Jared P. 2014. “Federal and State Quarantine and Isolation Authority.” CRS Report RL33201. https://fas.org/sgp/crs/misc/RL33201.pdf.

Creating a Unified COVID-19 Global Resource in Record Time.” n.d. C3.AI. Accessed August 19, 2021. https://c3.ai/customers/covid-19-data-lake/.

Dura, Jack. 2020. “North Dakota Leads Nation in COVID-19 Contact Tracing.” Governing. May 4, 2020. https://www.governing.com/now/North-Dakota-Leads-Nation-in-COVID-19-Contact-Tracing.html.

GINI Index of Income Inequality.” n.d. United States Census Bureau. Accessed July 20, 2021. https://data.census.gov/cedsci/table?q=gini&g=0100000US.04000.001&tid=ACSDT1Y2019.B19083&hidePreview=true&moe=false&tp=true.

Hallas, Laura, Ariq Hatbie, Rachelle Koch, Saptarshi Majumdar, Monika Pyarali, Andrew Wood, and Thomas Hale. 2021. “Variation in US States’ COVID-19 Policy Responses 3.0,” May.

Hood, Christopher, and Helen Margetts. 2007. The Tools of Government in the Digital Age. London, UNITED KINGDOM: Macmillan Education UK. http://ebookcentral.proquest.com/lib/londonschoolecons/detail.action?docID=4762868.

McMinn, Sean, Audrey Carlsen, Zach Levitt, and Thomas Wilburn. 2021. “Where Are Hospitals Overwhelmed By COVID-19 Patients? Look Up Your State.” NPR, May 24, 2021, sec. Shots - Health News. https://www.npr.org/sections/health-shots/2020/12/09/944379919/new-data-reveal-which-hospitals-are-dangerously-full-is-yours.

Ozga, Ann-Kathrin, Meinhard Kieser, and Geraldine Rauch. 2018. “A Systematic Comparison of Recurrent Event Models for Application to Composite Endpoints.” BMC Medical Research Methodology 18 (1): 1–12. https://doi.org/10.1186/s12874-017-0462-x.

Passenger Boarding (Enplanement) and All-Cargo Data for U.S. Airports – Airports.” n.d. Template. Accessed July 20, 2021. https://www.faa.gov/airports/planning_capacity/passenger_allcargo_stats/passenger/.

Pei, Sen, Sasikiran Kandula, and Jeffrey Shaman. 2020. “Differential Effects of Intervention Timing on COVID-19 Spread in the United States.” MedRxiv, May, 2020.05.15.20103655. https://doi.org/10.1101/2020.05.15.20103655.

Professionally Active Physicians.” 2021. KFF (blog). July 22, 2021. https://www.kff.org/other/state-indicator/total-active-physicians/.

Schmalfeldt, Peter, Nick O’Neill, and Nathan Seither. 2021. United States Governors. JavaScript. Civil Services. https://github.com/CivilServiceUSA/us-governors.

Sebhatu, Abiel, Karl Wennberg, Stefan Arora-Jonsson, and Staffan I. Lindberg. 2020. “Explaining the Homogeneous Diffusion of COVID-19 Nonpharmaceutical Interventions across Heterogeneous Countries.” Proceedings of the National Academy of Sciences 117 (35): 21201–8.

Smith, Gary. 2018. “Step Away from Stepwise.” Journal of Big Data 5 (1): 1–12. https://doi.org/10.1186/s40537-018-0143-6.

State Partisan Composition.” 2021. National Conference of State Legislatures. May 13, 2021. https://www.ncsl.org/research/about-state-legislatures/partisan-composition.aspx#.

State Quarantine and Isolation Statutes.” 2020. August 7, 2020. https://www.ncsl.org/research/health/state-quarantine-and-isolation-statutes.aspx.

The Bill of Rights: A Transcription.” 2015. National Archives. November 4, 2015. https://www.archives.gov/founding-docs/bill-of-rights-transcript.

Therneau, Terry, Thomas Lumley, Atkinson Elizabeth, and Cynthia Crowson. 2021. “Package ‘Survival.’” CRAN. https://cran.r-project.org/web/packages/survival/index.html.

Total Hospital Beds | KFF.” n.d. Accessed July 23, 2021. https://www.kff.org/other/state-indicator/total-hospital-beds/?currentTimeframe=0&sortModel=%7B%22colId%22:%22Location%22,%22sort%22:%22asc%22%7D.

US Census Bureau. n.d. “Historical Population Density Data (1910-2020).” Census.Gov. Accessed August 21, 2021. https://www.census.gov/data/tables/time-series/dec/density-data-text.html.

U.S. States And Their Border States.” n.d. The Fact File (blog). Accessed July 20, 2021. https://thefactfile.org/u-s-states-and-their-border-states/.

USDA ERS - State Fact Sheets.” n.d. Accessed August 21, 2021. https://www.ers.usda.gov/data-products/state-fact-sheets/.

Wang, Gang, Richard A. Devine, and Gonzalo Molina-Sieiro. 2021. “Democratic Governors Quicker to Issue Stay-at-Home Orders in Response to COVID-19.” The Leadership Quarterly, June, 101542. https://doi.org/10.1016/j.leaqua.2021.101542.

Warner, Mildred E., and Xue Zhang. 2021. “Social Safety Nets and COVID-19 Stay Home Orders across US States: A Comparative Policy Analysis.” Journal of Comparative Policy Analysis: Research and Practice 23 (2): 176–90. https://doi.org/10.1080/13876988.2021.1874243.

Zhang, Zhongheng, Jaakko Reinikainen, Kazeem Adedayo Adeleke, Marcel E. Pieterse, and Catharina G. M. Groothuis-Oudshoorn. 2018. “Time-Varying Covariates and Coefficients in Cox Regression Models.” Annals of Translational Medicine 6 (7): 121. https://doi.org/10.21037/atm.2018.02.12.

Annex

Annex A – Summary Statistics of All Variables

summary_allstats_data <- C1_general_speed_fort %>%
    mutate(pol = "C1") %>%
    bind_rows(C2_general_speed_fort %>%
        mutate(pol = "C2")) %>%
    bind_rows(C3_general_speed_fort %>%
        mutate(pol = "C3")) %>%
    bind_rows(C4_general_speed_fort %>%
        mutate(pol = "C4")) %>%
    bind_rows(C6_general_speed_fort %>%
        mutate(pol = "C6")) %>%
    bind_rows(C7_general_speed_fort %>%
        mutate(pol = "C7")) %>%
    bind_rows(C8_any_speed_fort %>%
        mutate(pol = "C8")) %>%
    bind_rows(E1_any_speed_fort %>%
        mutate(pol = "E1")) %>%
    bind_rows(E2_any_speed_fort %>%
        mutate(pol = "E2")) %>%
    bind_rows(H1_general_speed_fort %>%
        mutate(pol = "H1")) %>%
    bind_rows(H2_any_speed_fort %>%
        mutate(pol = "H2")) %>%
    bind_rows(H3_any_speed_fort %>%
        mutate(pol = "H3")) %>%
    bind_rows(H6_general_speed_fort %>%
        mutate(pol = "H6")) %>%
    bind_rows(H7_any_speed_fort %>%
        mutate(pol = "H7")) %>%
    bind_rows(H8_general_speed_fort %>%
        mutate(pol = "H8")) %>%
    select(pol, dates, RegionName, stop, endpt, governor_party, governor_time_on,
        governor_time_left, governor_age, governor_gender, statecontrol, log_totalpopulation,
        over65population_frac, under18population_frac, density2020, urbanfrac, daily_increase_smoothed_per_100k,
        death_increase_smoothed_per_100k, log_totalenplanements19plus1, number.neighbors,
        neighbor.mandates.any, neighbor.mandates.general, unemploymentrate, nominalgdp_percap,
        gini2019, Beds.per.1.000.Population, log_physicians2018, physicians_per_100k_2018,
        log_physicians2021) %>%
    ungroup() %>%
    mutate(governor_party = str_to_title(governor_party), governor_gender = str_to_title(governor_gender))

set_my_extra_labels <- function(data) {
    data %>%
        set_variable_labels(governor_party = "Governor's party", governor_time_on = "Time on as governor (Years)",
            governor_time_left = "Time left as governor (Years)", governor_age = "Governor's age (Years)",
            governor_gender = "Governor's gender", statecontrol = "Partisan control of state",
            log_totalpopulation = "Log(Population, 2019)", over65population_frac = "Population over 65, 2019 (fraction of total)",
            under18population_frac = "Population under 18, 2019 (fraction of total)",
            density2020 = "People per square mile, 2020", urbanfrac = "Urban population, 2019 (fraction of total)",
            daily_increase_smoothed_per_100k = "Case increases per 100K, 7-day avg.",
            death_increase_smoothed_per_100k = "Death increases per 100k, 7-day avg",
            log_totalenplanements19plus1 = "Log(Total enplanements + 1, 2019)", number.neighbors = "Number of neighbours",
            neighbor.mandates.any = "Neighbours with mandates", neighbor.mandates.general = "Neighours with state-wide mandates",
            unemploymentrate = "Monthly unemployment rate (%)", nominalgdp_percap = "Nominal GDP per capita, 2019",
            gini2019 = "GINI coefficient, 2019", Beds.per.1.000.Population = "Hospital beds per 1,000, 2019",
            log_physicians2018 = "Log(Physicians, 2018", physicians_per_100k_2018 = "Physicians per 100K, 2018",
            log_physicians2021 = "Log(Physicians, 2021)")
}

summary_allstats_data <- set_my_extra_labels(summary_allstats_data)

summary_allstats_data %>%
    select(-c(pol, dates, RegionName, stop, endpt)) %>%
    tbl_summary(by = governor_party) %>%
    modify_header(label ~ "**State characteristics**", stat_by = "**{level}**<br>N = {n}") %>%
    add_overall(col_label = "**All governors**<br>N = {N}") %>%
    modify_footnote(all_stat_cols() ~ "State-day observations. Median (IQR) or frequency (%).")
State characteristics All governors
N = 1105971
Democrat
N = 449291
Republican
N = 656681
Time on as governor (Years) 2.42 (1.32, 4.54) 2.14 (1.21, 4.95) 2.82 (1.44, 4.12)
Time left as governor (Years) 2.67 (2.08, 2.88) 2.65 (1.94, 2.87) 2.69 (2.15, 2.89)
Governor's age (Years) 61 (53, 66) 62 (54, 67) 61 (52, 64)
Governor's gender
Female 19,821 (18%) 10,745 (24%) 9,076 (14%)
Male 90,776 (82%) 34,184 (76%) 56,592 (86%)
Partisan control of state 82,928 (75%) 27,639 (62%) 55,289 (84%)
Log(Population, 2019) 15.31 (14.48, 15.78) 15.35 (14.88, 16.00) 14.98 (14.40, 15.74)
Population over 65, 2019 (fraction of total) 0.164 (0.155, 0.172) 0.164 (0.155, 0.173) 0.165 (0.156, 0.171)
Population under 18, 2019 (fraction of total) 0.225 (0.215, 0.236) 0.219 (0.209, 0.225) 0.233 (0.222, 0.242)
People per square mile, 2020 90 (40, 215) 114 (44, 254) 63 (40, 170)
Urban population, 2019 (fraction of total) 0.78 (0.63, 0.89) 0.84 (0.74, 0.91) 0.75 (0.60, 0.86)
Case increases per 100K, 7-day avg. 2 (0, 13) 0 (0, 9) 3 (0, 16)
Death increases per 100k, 7-day avg 0.02 (0.00, 0.22) 0.00 (0.00, 0.16) 0.06 (0.00, 0.26)
Log(Total enplanements + 1, 2019) 15.79 (14.62, 17.00) 16.71 (15.03, 17.17) 15.13 (14.00, 16.41)
Number of neighbours
0 3,422 (3.1%) 1,669 (3.7%) 1,753 (2.7%)
1 2,228 (2.0%) 2,228 (5.0%) 0 (0%)
2 7,146 (6.5%) 1,651 (3.7%) 5,495 (8.4%)
3 17,064 (15%) 10,565 (24%) 6,499 (9.9%)
4 21,827 (20%) 10,455 (23%) 11,372 (17%)
5 20,620 (19%) 9,184 (20%) 11,436 (17%)
6 28,622 (26%) 5,386 (12%) 23,236 (35%)
7 3,791 (3.4%) 3,791 (8.4%) 0 (0%)
8 5,877 (5.3%) 0 (0%) 5,877 (8.9%)
Neighbours with mandates
0 72,304 (65%) 32,382 (72%) 39,922 (61%)
1 14,980 (14%) 5,534 (12%) 9,446 (14%)
2 9,219 (8.3%) 3,609 (8.0%) 5,610 (8.5%)
3 4,999 (4.5%) 1,293 (2.9%) 3,706 (5.6%)
4 4,298 (3.9%) 1,232 (2.7%) 3,066 (4.7%)
5 2,805 (2.5%) 808 (1.8%) 1,997 (3.0%)
6 1,346 (1.2%) 48 (0.1%) 1,298 (2.0%)
7 181 (0.2%) 23 (<0.1%) 158 (0.2%)
8 465 (0.4%) 0 (0%) 465 (0.7%)
Neighours with state-wide mandates
0 55,068 (88%) 22,596 (94%) 32,472 (85%)
1 3,049 (4.9%) 850 (3.5%) 2,199 (5.7%)
2 1,771 (2.8%) 237 (1.0%) 1,534 (4.0%)
3 1,139 (1.8%) 196 (0.8%) 943 (2.5%)
4 804 (1.3%) 43 (0.2%) 761 (2.0%)
5 371 (0.6%) 15 (<0.1%) 356 (0.9%)
6 36 (<0.1%) 11 (<0.1%) 25 (<0.1%)
7 1 (<0.1%) 0 (0%) 1 (<0.1%)
Unknown 48,358 20,981 27,377
Monthly unemployment rate (%) 4.6 (3.7, 6.9) 4.7 (4.0, 7.6) 4.6 (3.4, 6.3)
Nominal GDP per capita, 2019 60,442 (52,409, 68,757) 60,830 (57,445, 73,452) 59,893 (51,746, 66,070)
GINI coefficient, 2019 0.463 (0.447, 0.475) 0.469 (0.450, 0.478) 0.460 (0.440, 0.475)
Hospital beds per 1,000, 2019 2.50 (2.00, 3.00) 2.10 (2.00, 2.70) 2.70 (2.20, 3.10)
Log(Physicians, 2018 8.15 (7.38, 8.84) 8.35 (7.59, 8.96) 7.81 (7.21, 8.57)
Physicians per 100K, 2018 80 (73, 88) 88 (82, 94) 78 (72, 80)
Log(Physicians, 2021) 8.72 (7.96, 9.33) 8.87 (8.04, 9.53) 8.47 (7.64, 9.19)

1 State-day observations. Median (IQR) or frequency (%).

Annex B – Summary of All Cox Proportional Hazards Models

Summary of C1 & C2 Cox models

tbl_merge(tbls = list(C1prit %>%
    add_nevent() %>%
    add_n(), C1anyt %>%
    add_nevent() %>%
    add_n(), C1plust %>%
    add_nevent() %>%
    add_n(), C1mint %>%
    add_nevent() %>%
    add_n(), C1sigt %>%
    add_nevent() %>%
    add_n(), C2prit %>%
    add_nevent() %>%
    add_n(), C2anyt %>%
    add_nevent() %>%
    add_n(), C2plust %>%
    add_nevent() %>%
    add_n(), C2mint %>%
    add_nevent() %>%
    add_n(), C2aict %>%
    add_nevent() %>%
    add_n(), C2sigt %>%
    add_nevent() %>%
    add_n()), tab_spanner = c("**C1**", "**C1, any**", "**C1 +1**", "**C1 -1**",
    "**C1, Max sig.**", "**C2**", "**C2, any**", "**C2 +1**", "**C2 -1**", "**C2, Max AIC.**",
    "**C2, Max sig.**"))
Characteristic C1 C1, any C1 +1 C1 -1 C1, Max sig. C2 C2, any C2 +1 C2 -1 C2, Max AIC. C2, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 3517 50 3417 50 3517 50 3517 50 3517 50 4152 50 3583 50 4152 50 4152 50 4152 50 4152 50
democrat
republican 0.77 0.38, 1.56 0.5 1.32 0.69, 2.49 0.4 0.77 0.38, 1.56 0.5 0.77 0.38, 1.56 0.5 0.92 0.50, 1.68 0.8 0.39 0.19, 0.81 0.011 0.59 0.31, 1.14 0.12 0.39 0.19, 0.81 0.011 0.39 0.19, 0.81 0.011 0.41 0.21, 0.79 0.007 0.41 0.21, 0.79 0.007
Log(Population, 2019) 3517 50 1.19 0.13, 11.3 0.9 3417 50 0.05 0.00, 0.63 0.020 3517 50 1.19 0.13, 11.3 0.9 3517 50 1.19 0.13, 11.3 0.9 4152 50 1.16 0.14, 9.71 0.9 3583 50 1.73 0.23, 13.2 0.6 4152 50 1.16 0.14, 9.71 0.9 4152 50 1.16 0.14, 9.71 0.9
Case increases per 100K, 7-day avg. 3517 50 1.63 0.84, 3.16 0.2 3417 50 1.68 0.41, 6.88 0.5 3517 50 1.63 0.84, 3.16 0.2 3517 50 1.63 0.84, 3.16 0.2 4152 50 1.05 0.58, 1.90 0.9 3583 50 0.62 0.17, 2.30 0.5 4152 50 1.05 0.58, 1.90 0.9 4152 50 1.05 0.58, 1.90 0.9
Log(Total enplanements + 1, 2019) 3517 50 0.93 0.80, 1.08 0.3 3417 50 0.94 0.81, 1.09 0.4 3517 50 0.93 0.80, 1.08 0.3 3517 50 0.93 0.80, 1.08 0.3 4152 50 0.94 0.82, 1.07 0.3 3583 50 0.96 0.82, 1.11 0.6 4152 50 0.94 0.82, 1.07 0.3 4152 50 0.94 0.82, 1.07 0.3
Neighbours with mandates 3517 50 0.96 0.81, 1.15 0.7 3417 50 1.11 0.91, 1.35 0.3 3517 50 0.96 0.81, 1.15 0.7 3517 50 0.96 0.81, 1.15 0.7 4152 50 1.04 0.86, 1.24 0.7 3583 50 0.96 0.78, 1.17 0.7 4152 50 1.04 0.86, 1.24 0.7 4152 50 1.04 0.86, 1.24 0.7
Nominal GDP per capita, 2019 3517 50 1.00 1.00, 1.00 0.5 3417 50 1.00 1.00, 1.00 0.8 3517 50 1.00 1.00, 1.00 0.5 3517 50 1.00 1.00, 1.00 0.5 4152 50 1.00 1.00, 1.00 0.2 3583 50 1.00 1.00, 1.00 0.2 4152 50 1.00 1.00, 1.00 0.2 4152 50 1.00 1.00, 1.00 0.2 4152 50 1.00 1.00, 1.00 0.14 4152 50 1.00 1.00, 1.00 0.14
GINI coefficient, 2019 3517 50 593 0.00, 204,801,390,490 0.5 3417 50 1,607,441,134,401 161, 16,033,306,868,197,663,703,040 0.017 3517 50 593 0.00, 204,801,390,490 0.5 3517 50 593 0.00, 204,801,390,490 0.5 4152 50 24.8 0.00, 57,695,973,338 0.8 3583 50 4.35 0.00, 2,556,495,880 0.9 4152 50 24.8 0.00, 57,695,973,338 0.8 4152 50 24.8 0.00, 57,695,973,338 0.8
Log(Physicians, 2018) 3517 50 0.85 0.08, 9.49 0.9 3417 50 21.7 1.43, 330 0.027 3517 50 0.85 0.08, 9.49 0.9 3517 50 0.85 0.08, 9.49 0.9 4152 50 0.82 0.09, 7.73 0.9 3583 50 0.68 0.08, 5.93 0.7 4152 50 0.82 0.09, 7.73 0.9 4152 50 0.82 0.09, 7.73 0.9
Monthly unemployment rate (%) 3517 50 1.46 1.08, 1.96 0.013
Number of neighbours 3517 50 0.89 0.78, 1.02 0.10

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of C3 & C4 cox models

tbl_merge(tbls = list(
                      C3prit %>% add_nevent() %>% add_n(),
                      C3anyt %>% add_nevent() %>% add_n(),
                      C3mint %>% add_nevent() %>% add_n(),
                      C3sigt %>% add_nevent() %>% add_n(),
                      
                      C4anyt %>% add_nevent() %>% add_n(),
                      C4plust %>% add_nevent() %>% add_n(),
                      C4aict %>% add_nevent() %>% add_n(),
                      C4sigt %>% add_nevent() %>% add_n()),
          tab_spanner = c(
                          "**C3**", 
                          "**C3, any**",
                          "**C3 -1**",
                          "**C3, Max sig.**",
                          
                          "**C4**", 
                          "**C4 +1**",
                          "**C4, Max AIC.**",
                          "**C4, Max sig.**"))
Characteristic C3 C3, any C3 -1 C3, Max sig. C4 C4 +1 C4, Max AIC. C4, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 4278 49 3854 50 4278 49 4278 49 3779 50 4458 49 4458 49 4458 49
democrat
republican 1.61 0.78, 3.30 0.2 1.30 0.64, 2.64 0.5 1.61 0.78, 3.30 0.2 2.26 1.02, 5.00 0.044 0.90 0.45, 1.78 0.8 0.59 0.29, 1.20 0.15 0.40 0.18, 0.90 0.028 0.42 0.22, 0.77 0.006
Log(Population, 2019) 4278 49 0.02 0.00, 0.44 0.012 3854 50 0.07 0.00, 1.14 0.062 4278 49 0.02 0.00, 0.44 0.012 3779 50 0.08 0.01, 1.01 0.051 4458 49 0.06 0.00, 0.82 0.035 4458 49 0.00 0.00, 0.02 <0.001
Case increases per 100K, 7-day avg. 4278 49 1.22 0.86, 1.72 0.3 3854 50 0.98 0.68, 1.42 >0.9 4278 49 1.22 0.86, 1.72 0.3 3779 50 2.61 0.71, 9.54 0.15 4458 49 0.97 0.88, 1.07 0.6
Log(Total enplanements + 1, 2019) 4278 49 0.85 0.73, 0.98 0.024 3854 50 0.89 0.78, 1.02 0.090 4278 49 0.85 0.73, 0.98 0.024 3779 50 0.94 0.83, 1.06 0.3 4458 49 0.95 0.84, 1.07 0.4 4458 49 0.84 0.70, 1.01 0.070
Neighbours with mandates 4278 49 1.08 0.86, 1.36 0.5 3854 50 1.08 0.85, 1.38 0.5 4278 49 1.08 0.86, 1.36 0.5 3779 50 1.08 0.85, 1.36 0.5 4458 49 1.18 0.97, 1.44 0.091
Nominal GDP per capita, 2019 4278 49 1.00 1.00, 1.00 >0.9 3854 50 1.00 1.00, 1.00 0.8 4278 49 1.00 1.00, 1.00 >0.9 4278 49 1.00 1.00, 1.00 0.009 3779 50 1.00 1.00, 1.00 0.9 4458 49 1.00 1.00, 1.00 >0.9
GINI coefficient, 2019 4278 49 0.00 0.00, 10,214 0.2 3854 50 157 0.00, 10,416,994,703,633 0.7 4278 49 0.00 0.00, 10,214 0.2 3779 50 1.02 0.00, 9,750,561,407 >0.9 4458 49 433,730 0.00, 7,999,473,807,714,418 0.3 4458 49 6,471,819,633,130,683 1,207, 34,688,759,885,605,286,166,654,877,696 0.015
Log(Physicians, 2018) 4278 49 80.4 3.74, 1,728 0.005 3854 50 23.4 1.30, 419 0.032 4278 49 80.4 3.74, 1,728 0.005 3779 50 17.6 1.35, 229 0.029 4458 49 16.1 1.19, 218 0.037 4458 49 2,614 56.9, 120,119 <0.001
Hospital beds per 1,000, 2019 4278 49 0.52 0.31, 0.85 0.009 4458 49 0.23 0.10, 0.51 <0.001
Death increases per 100k, 7-day avg 4278 49 3,986,451,154 26.7, 594,189,436,488,105,600 0.021 4458 49 1,109,662 0.01, 86,780,384,491,531 0.13 4458 49 68,227,799 1.17, 3,968,325,783,112,709 0.048
Governor's gender 4278 49 4458 49
female
male 0.29 0.12, 0.70 0.006 0.46 0.19, 1.09 0.077
Monthly unemployment rate (%) 4278 49 1.22 0.97, 1.53 0.082
Partisan control of state 4278 49 0.51 0.24, 1.10 0.087
Time left as governor (Years) 4458 49 2.14 0.80, 5.77 0.13
Population under 18, 2019 (fraction of total) 4458 49 5,873,266,677,953,389,265,944,576 29,127,495,334, 1,184,285,194,254,981,689,097,583,565,464,680,792,064 <0.001
People per square mile, 2020 4458 49 1.00 1.00, 1.00 0.009
Urban population, 2019 (fraction of total) 4458 49 0.00 0.00, 0.16 0.006
Number of neighbours 4458 49 1.20 0.98, 1.46 0.071

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of C5 & C6 cox models

tbl_merge(tbls = list(C5anyt %>%
    add_nevent() %>%
    add_n(), C5mint %>%
    add_nevent() %>%
    add_n(), C6prit %>%
    add_nevent() %>%
    add_n(), C6anyt %>%
    add_nevent() %>%
    add_n(), C6mint %>%
    add_nevent() %>%
    add_n(), C6aict %>%
    add_nevent() %>%
    add_n(), C6sigt %>%
    add_nevent() %>%
    add_n()), tab_spanner = c("**C5, any**", "**C5 -1**", "**C6**", "**C6, any**",
    "**C6 -1**", "**C6, Max AIC.**", "**C6, Max sig.**"))
Characteristic C5, any C5 -1 C6 C6, any C6 -1 C6, Max AIC. C6, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 23228 8 20272 18 9133 39 8290 41 9133 39 9133 39 9133 39
democrat
republican 0.81 0.17, 3.96 0.8 0.81 0.29, 2.27 0.7 0.36 0.17, 0.77 0.009 0.84 0.43, 1.64 0.6 0.36 0.17, 0.77 0.009 0.31 0.13, 0.71 0.006 0.36 0.16, 0.81 0.013
Log(Population, 2019) 23228 8 0.04 0.00, 3.86 0.2 20272 18 0.17 0.00, 6.31 0.3 9133 39 0.45 0.04, 4.68 0.5 8290 41 0.21 0.02, 2.44 0.2 9133 39 0.45 0.04, 4.68 0.5 9133 39 0.00 0.00, 0.06 <0.001 9133 39 0.07 0.01, 0.69 0.023
Case increases per 100K, 7-day avg. 23228 8 0.95 0.78, 1.16 0.6 20272 18 1.01 0.98, 1.04 0.4 9133 39 0.96 0.80, 1.16 0.7 8290 41 1.04 0.96, 1.14 0.3 9133 39 0.96 0.80, 1.16 0.7 9133 39 1.34 1.01, 1.79 0.046
Log(Total enplanements + 1, 2019) 23228 8 1.08 0.71, 1.62 0.7 20272 18 0.84 0.70, 1.01 0.064 9133 39 0.85 0.73, 1.00 0.048 8290 41 0.81 0.67, 0.98 0.034 9133 39 0.85 0.73, 1.00 0.048 9133 39 0.73 0.60, 0.89 0.002 9133 39 0.86 0.76, 0.98 0.026
Neighbours with mandates 23228 8 0.81 0.16, 4.05 0.8 20272 18 0.83 0.54, 1.28 0.4 9133 39 0.80 0.60, 1.05 0.11 8290 41 0.71 0.50, 1.00 0.049 9133 39 0.80 0.60, 1.05 0.11 9133 39 0.74 0.57, 0.95 0.020 9133 39 0.74 0.56, 0.97 0.028
Nominal GDP per capita, 2019 23228 8 1.00 1.00, 1.00 0.8 20272 18 1.00 1.00, 1.00 0.6 9133 39 1.00 1.00, 1.00 0.6 8290 41 1.00 1.00, 1.00 0.013 9133 39 1.00 1.00, 1.00 0.6 9133 39 1.00 1.00, 1.00 0.009
GINI coefficient, 2019 23228 8 4.81 0.00, 298,846,260,372,325,418,653,450,240 >0.9 20272 18 6,681 0.00, 2,204,113,043,927,273,472 0.6 9133 39 0.00 0.00, 10,549,386 0.5 8290 41 2.06 0.00, 405,711,031 >0.9 9133 39 0.00 0.00, 10,549,386 0.5
Log(Physicians, 2018) 23228 8 15.3 0.10, 2,347 0.3 20272 18 7.70 0.17, 355 0.3 9133 39 5.58 0.49, 64.0 0.2 8290 41 20.0 1.44, 276 0.026 9133 39 5.58 0.49, 64.0 0.2 9133 39 2,966 32.7, 268,952 <0.001 9133 39 31.4 2.76, 358 0.005
Governor's gender 9133 39 9133 39
female
male 5.18 1.39, 19.3 0.014 2.64 0.93, 7.50 0.068
Population over 65, 2019 (fraction of total) 9133 39 0.00 0.00, 0.00 0.019
Death increases per 100k, 7-day avg 9133 39 0.00 0.00, 0.00 0.008 9133 39 0.00 0.00, 0.36 0.032
Monthly unemployment rate (%) 9133 39 1.40 1.16, 1.70 <0.001 9133 39 1.36 1.13, 1.64 0.001

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of C7 & C8 cox models

tbl_merge(tbls = list(C7prit, C7anyt, C7mint, C7sigt, C8anyt, C8plust, C8sigt), tab_spanner = c("**C7**",
    "**C7, any**", "**C7 -1**", "**C7, Max sig.**", "**C8**", "**C8 +1**", "**C8, Max sig.**"))
Characteristic C7 C7, any C7 -1 C7, Max sig. C8 C8 +1 C8, Max sig.
HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value
Governor's party
democrat
republican 0.61 0.27, 1.36 0.2 0.72 0.35, 1.50 0.4 0.61 0.27, 1.36 0.2 0.65 0.31, 1.38 0.3 0.95 0.44, 2.03 0.9 0.95 0.44, 2.03 0.9 1.01 0.49, 2.06 >0.9
Log(Population, 2019) 0.01 0.00, 0.20 0.002 0.03 0.00, 0.33 0.005 0.01 0.00, 0.20 0.002 0.41 0.04, 4.53 0.5 0.41 0.04, 4.53 0.5
Case increases per 100K, 7-day avg. 0.77 0.64, 0.92 0.005 0.93 0.88, 1.00 0.037 0.77 0.64, 0.92 0.005 0.78 0.65, 0.94 0.009 0.94 0.88, 1.00 0.047 0.94 0.88, 1.00 0.047
Log(Total enplanements + 1, 2019) 0.94 0.77, 1.13 0.5 0.96 0.80, 1.16 0.7 0.94 0.77, 1.13 0.5 0.88 0.75, 1.03 0.12 0.88 0.75, 1.03 0.12
Neighbours with mandates 1.04 0.70, 1.55 0.9 1.11 0.73, 1.69 0.6 1.04 0.70, 1.55 0.9 0.98 0.68, 1.41 >0.9 0.98 0.68, 1.41 >0.9
Nominal GDP per capita, 2019 1.00 1.00, 1.00 0.6 1.00 1.00, 1.00 0.5 1.00 1.00, 1.00 0.6 1.00 1.00, 1.00 0.2 1.00 1.00, 1.00 0.2 1.00 1.00, 1.00 0.035
GINI coefficient, 2019 4,197,706,632 0.02, 1,077,944,178,948,910,219,264 0.10 75.5 0.00, 817,577,212,634 0.7 4,197,706,632 0.02, 1,077,944,178,948,910,219,264 0.10 20.9 0.00, 260,389,736,087 0.8 20.9 0.00, 260,389,736,087 0.8
Log(Physicians, 2018) 110 5.60, 2,179 0.002 47.7 3.09, 736 0.006 110 5.60, 2,179 0.002 2.95 0.22, 38.7 0.4 2.95 0.22, 38.7 0.4
Population under 18, 2019 (fraction of total) 0.00 0.00, 0.04 0.027
Urban population, 2019 (fraction of total) 9.88 0.80, 122 0.074
Death increases per 100k, 7-day avg 0.01 0.00, 0.33 0.013
Number of neighbours 0.80 0.66, 0.97 0.024

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of E1 & E2 cox models

tbl_merge(tbls = list(E1anyt, E1plust, E1aict, E1sigt, E2anyt, E2plust, E2aict, E2sigt),
    tab_spanner = c("**E1, any**", "**E1 +1**", "**E1, Max AIC.**", "**E1, Max sig.**",
        "**E2, any**", "**E2 +1**", "**E2, Max AIC.**", "**E2, Max sig.**"))
Characteristic E1, any E1 +1 E1, Max AIC. E1, Max sig. E2, any E2 +1 E2, Max AIC. E2, Max sig.
HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value HR1 95% CI1 p-value
Governor's party
democrat
republican 0.37 0.19, 0.73 0.004 0.37 0.19, 0.73 0.004 0.27 0.13, 0.53 <0.001 0.35 0.18, 0.67 0.002 0.54 0.27, 1.04 0.066 0.54 0.27, 1.04 0.066 0.51 0.28, 0.94 0.030 0.51 0.28, 0.94 0.030
Log(Population, 2019) 0.16 0.02, 1.20 0.075 0.16 0.02, 1.20 0.075 0.27 0.03, 2.27 0.2 0.27 0.03, 2.27 0.2 0.25 0.06, 1.01 0.052 0.25 0.06, 1.01 0.052
Case increases per 100K, 7-day avg. 1.01 0.94, 1.08 0.9 1.01 0.94, 1.08 0.9 0.88 0.40, 1.93 0.7 0.88 0.40, 1.93 0.7
Log(Total enplanements + 1, 2019) 0.92 0.80, 1.05 0.2 0.92 0.80, 1.05 0.2 1.00 0.89, 1.13 >0.9 1.00 0.89, 1.13 >0.9
Neighbours with mandates 1.01 0.80, 1.29 >0.9 1.01 0.80, 1.29 >0.9 0.68 0.46, 1.01 0.053 1.08 0.84, 1.39 0.5 1.08 0.84, 1.39 0.5
Nominal GDP per capita, 2019 1.00 1.00, 1.00 0.3 1.00 1.00, 1.00 0.3 1.00 1.00, 1.00 0.026 1.00 1.00, 1.00 0.6 1.00 1.00, 1.00 0.6
GINI coefficient, 2019 0.06 0.00, 17,849,484 0.8 0.06 0.00, 17,849,484 0.8 0.00 0.00, 0.06 0.029 623 0.00, 387,563,034,687 0.5 623 0.00, 387,563,034,687 0.5
Log(Physicians, 2018) 8.45 1.00, 71.1 0.050 8.45 1.00, 71.1 0.050 0.07 0.00, 1.94 0.12 4.55 0.49, 42.1 0.2 4.55 0.49, 42.1 0.2
Population over 65, 2019 (fraction of total) 0.00 0.00, 0.00 0.002 0.00 0.00, 0.00 0.018
Population under 18, 2019 (fraction of total) 0.00 0.00, 0.00 <0.001 0.00 0.00, 0.00 0.003
Number of neighbours 1.25 0.97, 1.62 0.087
Log(Physicians, 2021) 14.1 0.56, 358 0.11 4.78 1.33, 17.1 0.016 4.78 1.33, 17.1 0.016
People per square mile, 2020 1.00 1.00, 1.00 0.087

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of H1 & H2 cox models

tbl_merge(tbls = list(H1prit %>%
    add_nevent() %>%
    add_n(), H1anyt %>%
    add_nevent() %>%
    add_n(), H1mint %>%
    add_nevent() %>%
    add_n(), H1aict %>%
    add_nevent() %>%
    add_n(), H1sigt %>%
    add_nevent() %>%
    add_n(), H2anyt %>%
    add_nevent() %>%
    add_n(), H2plust %>%
    add_nevent() %>%
    add_n(), H2aict %>%
    add_nevent() %>%
    add_n(), H2sigt %>%
    add_nevent() %>%
    add_n()), tab_spanner = c("**H1**", "**H1, any**", "**H1 -1**", "**H1, Max AIC.**",
    "**H1, Max sig.**", "**H2, any**", "**H2 +1**", "**H2, Max AIC.**", "**H2, Max sig.**"))
Characteristic H1 H1, any H1 -1 H1, Max AIC. H1, Max sig. H2, any H2 +1 H2, Max AIC. H2, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 3364 50 3292 50 3364 50 3364 50 3364 50 2484 50 2484 50 2484 50 2484 50
democrat
republican 1.06 0.56, 2.02 0.9 0.99 0.52, 1.88 >0.9 1.06 0.56, 2.02 0.9 3.50 1.60, 7.68 0.002 2.94 1.42, 6.08 0.004 0.78 0.42, 1.45 0.4 0.78 0.42, 1.45 0.4 0.54 0.27, 1.10 0.091 0.91 0.51, 1.62 0.7
Log(Population, 2019) 3364 50 0.39 0.04, 3.60 0.4 3292 50 0.38 0.04, 3.34 0.4 3364 50 0.39 0.04, 3.60 0.4 2484 50 0.52 0.05, 5.26 0.6 2484 50 0.52 0.05, 5.26 0.6
Case increases per 100K, 7-day avg. 3364 50 1.24 0.92, 1.67 0.2 3292 50 1.32 0.96, 1.81 0.086 3364 50 1.24 0.92, 1.67 0.2 2484 50 4.95 0.27, 91.6 0.3 2484 50 4.95 0.27, 91.6 0.3 2484 50 11.2 0.55, 230 0.12
Log(Total enplanements + 1, 2019) 3364 50 1.00 0.80, 1.25 >0.9 3292 50 1.01 0.81, 1.25 >0.9 3364 50 1.00 0.80, 1.25 >0.9 2484 50 0.86 0.73, 1.01 0.065 2484 50 0.86 0.73, 1.01 0.065
Neighbours with mandates 3364 50 0.80 0.58, 1.11 0.2 3292 50 0.81 0.59, 1.12 0.2 3364 50 0.80 0.58, 1.11 0.2 2484 50 0.93 0.70, 1.24 0.6 2484 50 0.93 0.70, 1.24 0.6
Nominal GDP per capita, 2019 3364 50 1.00 1.00, 1.00 0.9 3292 50 1.00 1.00, 1.00 >0.9 3364 50 1.00 1.00, 1.00 0.9 2484 50 1.00 1.00, 1.00 0.2 2484 50 1.00 1.00, 1.00 0.2
GINI coefficient, 2019 3364 50 438,238,700 0.06, 3,027,107,788,121,331,200 0.085 3292 50 496,625,607 0.12, 1,984,068,824,170,577,152 0.076 3364 50 438,238,700 0.06, 3,027,107,788,121,331,200 0.085 2484 50 0.01 0.00, 37,174,865 0.7 2484 50 0.01 0.00, 37,174,865 0.7 2484 50 0.00 0.00, 454 0.2
Log(Physicians, 2018) 3364 50 1.81 0.16, 20.1 0.6 3292 50 1.82 0.17, 19.0 0.6 3364 50 1.81 0.16, 20.1 0.6 3364 50 0.52 0.32, 0.86 0.011 2484 50 3.29 0.28, 38.6 0.3 2484 50 3.29 0.28, 38.6 0.3
Time left as governor (Years) 3364 50 0.44 0.24, 0.81 0.008 3364 50 0.44 0.25, 0.80 0.007 2484 50 1.80 0.90, 3.58 0.10
Governor's age (Years) 3364 50 0.96 0.92, 1.00 0.049 3364 50 0.97 0.94, 1.01 0.15
Population under 18, 2019 (fraction of total) 3364 50 0.00 0.00, 5.33 0.077 3364 50 0.00 0.00, 8.00 0.085
Urban population, 2019 (fraction of total) 3364 50 31.3 2.13, 460 0.012 2484 50 0.08 0.00, 1.39 0.083
Number of neighbours 3364 50 0.80 0.64, 1.00 0.051 3364 50 0.80 0.64, 0.99 0.039
Monthly unemployment rate (%) 3364 50 1.95 1.47, 2.60 <0.001 3364 50 1.86 1.41, 2.47 <0.001 2484 50 1.50 1.05, 2.16 0.028 2484 50 1.30 1.00, 1.68 0.050
Time on as governor (Years) 2484 50 1.23 1.04, 1.46 0.014
Log(Physicians, 2021) 2484 50 1.76 0.99, 3.12 0.054

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of H3 & H6 cox models

tbl_merge(tbls = list(H3anyt %>%
    add_nevent() %>%
    add_n(), H3plust %>%
    add_nevent() %>%
    add_n(), H3sigt %>%
    add_nevent() %>%
    add_n(), H6prit %>%
    add_nevent() %>%
    add_n(), H6anyt %>%
    add_nevent() %>%
    add_n(), H6plust %>%
    add_nevent() %>%
    add_n(), H6mint %>%
    add_nevent() %>%
    add_n(), H6aict %>%
    add_nevent() %>%
    add_n(), H6sigt %>%
    add_nevent() %>%
    add_n()), tab_spanner = c("**H3, any**", "**H3 +1**", "**H3, Max sig.**", "**H6**",
    "**H6, any**", "**H6 +1**", "**H6 -1**", "**H6, Max AIC.**", "**H6, Max sig.**"))
Characteristic H3, any H3 +1 H3, Max sig. H6 H6, any H6 +1 H6 -1 H6, Max AIC. H6, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 3304 50 3304 50 3304 50 12762 39 6797 49 12762 39 12762 39 12762 39 12762 39
democrat
republican 1.13 0.61, 2.11 0.7 1.13 0.61, 2.11 0.7 0.77 0.41, 1.43 0.4 0.33 0.15, 0.71 0.004 1.02 0.51, 2.03 >0.9 0.33 0.15, 0.71 0.004 0.33 0.15, 0.71 0.004 0.14 0.06, 0.35 <0.001 0.28 0.14, 0.56 <0.001
Log(Population, 2019) 3304 50 0.78 0.07, 8.53 0.8 3304 50 0.78 0.07, 8.53 0.8 12762 39 0.09 0.00, 2.28 0.14 6797 49 0.04 0.00, 0.63 0.022 12762 39 0.09 0.00, 2.28 0.14 12762 39 0.09 0.00, 2.28 0.14
Case increases per 100K, 7-day avg. 3304 50 0.96 0.83, 1.12 0.6 3304 50 0.96 0.83, 1.12 0.6 12762 39 1.03 1.00, 1.06 0.073 6797 49 1.08 1.04, 1.13 <0.001 12762 39 1.03 1.00, 1.06 0.073 12762 39 1.03 1.00, 1.06 0.073
Log(Total enplanements + 1, 2019) 3304 50 0.95 0.83, 1.08 0.4 3304 50 0.95 0.83, 1.08 0.4 12762 39 0.93 0.80, 1.09 0.4 6797 49 0.92 0.77, 1.10 0.4 12762 39 0.93 0.80, 1.09 0.4 12762 39 0.93 0.80, 1.09 0.4
Neighbours with mandates 3304 50 0.76 0.58, 1.00 0.049 3304 50 0.76 0.58, 1.00 0.049 3304 50 0.76 0.60, 0.98 0.035 12762 39 1.11 0.89, 1.40 0.3 6797 49 0.80 0.59, 1.08 0.15 12762 39 1.11 0.89, 1.40 0.3 12762 39 1.11 0.89, 1.40 0.3
Nominal GDP per capita, 2019 3304 50 1.00 1.00, 1.00 0.8 3304 50 1.00 1.00, 1.00 0.8 12762 39 1.00 1.00, 1.00 0.2 6797 49 1.00 1.00, 1.00 0.2 12762 39 1.00 1.00, 1.00 0.2 12762 39 1.00 1.00, 1.00 0.2
GINI coefficient, 2019 3304 50 90,875 0.00, 26,145,703,004,847 0.3 3304 50 90,875 0.00, 26,145,703,004,847 0.3 12762 39 5,295,495 0.00, 52,203,205,715,325,288 0.2 6797 49 77.9 0.00, 282,479,966,920 0.7 12762 39 5,295,495 0.00, 52,203,205,715,325,288 0.2 12762 39 5,295,495 0.00, 52,203,205,715,325,288 0.2
Log(Physicians, 2018) 3304 50 1.95 0.17, 22.9 0.6 3304 50 1.95 0.17, 22.9 0.6 12762 39 10.6 0.35, 324 0.2 6797 49 29.7 1.85, 477 0.017 12762 39 10.6 0.35, 324 0.2 12762 39 10.6 0.35, 324 0.2
Governor's age (Years) 3304 50 0.96 0.92, 0.99 0.026 12762 39 1.04 1.00, 1.08 0.054 12762 39 1.04 1.00, 1.08 0.045
Partisan control of state 3304 50 2.30 1.12, 4.69 0.023 12762 39 2.19 0.93, 5.16 0.072
Log(Physicians, 2021) 3304 50 1.74 1.23, 2.46 0.002
Time on as governor (Years) 12762 39 1.18 1.01, 1.38 0.040
Time left as governor (Years) 12762 39 1.77 1.04, 3.02 0.035
People per square mile, 2020 12762 39 1.00 1.00, 1.01 <0.001 12762 39 1.00 1.00, 1.00 <0.001
Urban population, 2019 (fraction of total) 12762 39 0.08 0.00, 1.27 0.073
Death increases per 100k, 7-day avg 12762 39 1.50 0.99, 2.27 0.054

1 HR = Hazard Ratio, CI = Confidence Interval

Summary of H7 & H8 cox models

tbl_merge(tbls = list(H7anyt %>%
    add_nevent() %>%
    add_n(), H7plust %>%
    add_nevent() %>%
    add_n(), H7sigt %>%
    add_nevent() %>%
    add_n(), H8prit %>%
    add_nevent() %>%
    add_n(), H8anyt %>%
    add_nevent() %>%
    add_n(), H8plust %>%
    add_nevent() %>%
    add_n(), H8mint %>%
    add_nevent() %>%
    add_n(), H8sigt %>%
    add_nevent() %>%
    add_n()), tab_spanner = c("**H7, any**", "**H7 +1**", "**H7, Max sig.**", "**H8**",
    "**H8, any**", "**H8 +1**", "**H8 -1**", "**H8, Max sig.**"))
Characteristic H7, any H7 +1 H7, Max sig. H8 H8, any H8 +1 H8 -1 H8, Max sig.
N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value N Event N HR1 95% CI1 p-value
Governor's party 17120 50 17120 50 17120 50 5946 48 5408 48 5946 48 5946 48 5946 48
democrat
republican 1.06 0.52, 2.16 0.9 1.06 0.52, 2.16 0.9 0.94 0.47, 1.87 0.9 1.26 0.61, 2.57 0.5 1.30 0.64, 2.65 0.5 1.26 0.61, 2.57 0.5 1.26 0.61, 2.57 0.5 1.16 0.64, 2.13 0.6
Log(Population, 2019) 17120 50 0.69 0.07, 6.91 0.8 17120 50 0.69 0.07, 6.91 0.8 5946 48 0.81 0.10, 6.63 0.8 5408 48 0.88 0.11, 7.26 >0.9 5946 48 0.81 0.10, 6.63 0.8 5946 48 0.81 0.10, 6.63 0.8
Case increases per 100K, 7-day avg. 17120 50 1.00 0.98, 1.02 >0.9 17120 50 1.00 0.98, 1.02 >0.9 5946 48 1.00 0.96, 1.04 >0.9 5408 48 1.01 0.98, 1.04 0.6 5946 48 1.00 0.96, 1.04 >0.9 5946 48 1.00 0.96, 1.04 >0.9
Log(Total enplanements + 1, 2019) 17120 50 1.04 0.93, 1.17 0.5 17120 50 1.04 0.93, 1.17 0.5 5946 48 1.00 0.88, 1.14 >0.9 5408 48 0.99 0.87, 1.13 >0.9 5946 48 1.00 0.88, 1.14 >0.9 5946 48 1.00 0.88, 1.14 >0.9
Neighbours with mandates 17120 50 0.86 0.69, 1.07 0.2 17120 50 0.86 0.69, 1.07 0.2 17120 50 0.76 0.62, 0.95 0.015 5946 48 0.83 0.63, 1.08 0.2 5408 48 0.91 0.70, 1.20 0.5 5946 48 0.83 0.63, 1.08 0.2 5946 48 0.83 0.63, 1.08 0.2
Nominal GDP per capita, 2019 17120 50 1.00 1.00, 1.00 0.6 17120 50 1.00 1.00, 1.00 0.6 5946 48 1.00 1.00, 1.00 0.15 5408 48 1.00 1.00, 1.00 0.4 5946 48 1.00 1.00, 1.00 0.15 5946 48 1.00 1.00, 1.00 0.15
GINI coefficient, 2019 17120 50 14,624,871,709,808,728 610,029, 350,617,819,821,577,661,774,299,136 0.002 17120 50 14,624,871,709,808,728 610,029, 350,617,819,821,577,661,774,299,136 0.002 17120 50 194,770,395,103,221 683,622, 55,491,927,143,831,878,762,496 <0.001 5946 48 9,034,887 0.00, 22,917,465,758,068,644 0.15 5408 48 20,689,971,878 0.78, 550,757,674,276,049,846,272 0.052 5946 48 9,034,887 0.00, 22,917,465,758,068,644 0.15 5946 48 9,034,887 0.00, 22,917,465,758,068,644 0.15
Log(Physicians, 2018) 17120 50 0.89 0.08, 9.39 >0.9 17120 50 0.89 0.08, 9.39 >0.9 5946 48 1.11 0.13, 9.42 >0.9 5408 48 0.95 0.11, 8.18 >0.9 5946 48 1.11 0.13, 9.42 >0.9 5946 48 1.11 0.13, 9.42 >0.9
Urban population, 2019 (fraction of total) 17120 50 0.09 0.01, 0.67 0.019
Death increases per 100k, 7-day avg 17120 50 1.65 0.94, 2.92 0.083
People per square mile, 2020 5946 48 1.00 1.00, 1.00 0.009
Partisan control of state 5946 48 0.54 0.28, 1.05 0.068

1 HR = Hazard Ratio, CI = Confidence Interval

RPubs RPubs


  1. The London School of Economics and Political Science, School of Government | MSc. in Public Administration and Government, 2020/21 Joint Winner of the MSc Public Administration and Government Prize for Best Overall Performance↩︎

  2. “…to avoid an infinity error from logging one…” in the submitted version changed to “…to avoid an infinity error from logging zero…” in this version.↩︎