-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_create_gsynth_objects.R
More file actions
116 lines (90 loc) · 3.89 KB
/
08_create_gsynth_objects.R
File metadata and controls
116 lines (90 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
## ==========================================================================##
# Project: GIRFT Elective Hubs Evaluation
# Team: Improvement Analytics Unit (IAU) at the Health Foundation
# Script: 08_create_gsynth_objects.R
# Corresponding author: Tatjana Marks (tatjana.marks@health.org.uk)
# Description:
# Apply gsynth function and export model objects
# Dependencies:
# '07_gsynth_preamble.R'
# Inputs:
# Takes inputs created in '07_gsynth_preamble.R'
# Outputs:
# exports final datasets externally
# exports gsynth model objects externally
# Notes: To use, need to adjust locations of R scripts and csv files
# E.g. replace 'gsynth results/gsynth input datasets/lm_dat_new.csv' with location of where you saved 'lm_dat_new.csv'
## ==========================================================================##
# Source relevant scripts -------------------------------------------------
source("~/iaelecthubs1/hes_did/pipeline/07_gsynth_preamble.R")
# Export final datasets ----------------------------------------
s3write_using(lm_dat_new,
FUN = write.csv,
object = paste0(output_bucket, "gsynth results/gsynth input datasets/lm_dat_new.csv"),
bucket = output_bucket
)
s3write_using(lm_dat_old,
FUN = write.csv,
object = paste0(output_bucket, "gsynth results/gsynth input datasets/lm_dat_old.csv"),
bucket = output_bucket
)
# Apply function for main analyses ----------------------------------------
### Differences between "_rates" and "_los_dc" models
## 1. Different "weights" column
## 2. Different covariates
## New hubs ----------------------------------------------------------------
# Elect rate
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "elect_rate", subfolder_name = "pooled",
covariates_type = covariates_rates, weight_type = weight_rates
)
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "hvlc_rate", subfolder_name = "pooled",
covariates_type = covariates_rates, weight_type = weight_rates
)
# Dc
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "elect_los.dc_ratio", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "hvlc_los.dc_ratio", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
# Los
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "elect_los.ip_avg", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
gsynth_custom(
dat_name = lm_dat_new, hub_type = "new", output_name = "hvlc_los.ip_avg", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
## Old hubs ----------------------------------------------------------------
# Elect rate
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "elect_rate", subfolder_name = "pooled",
covariates_type = covariates_rates, weight_type = weight_rates
)
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "hvlc_rate", subfolder_name = "pooled",
covariates_type = covariates_rates, weight_type = weight_rates
)
# Dc
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "elect_los.dc_ratio", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "hvlc_los.dc_ratio", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
# Los
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "elect_los.ip_avg", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)
gsynth_custom(
dat_name = lm_dat_old, hub_type = "old", output_name = "hvlc_los.ip_avg", subfolder_name = "pooled",
covariates_type = covariates_los_dc, weight_type = weight_los_dc
)