generated from trr266/trer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
156 lines (95 loc) · 4.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# If you are new to Makefiles: https://makefiletutorial.com
# Commands
RSCRIPT := Rscript --encoding=UTF-8
# Data locations
DISH_PLAN := data/experiment/dish_plan.csv
TMENT_DATA := data/experiment/tment_data.rds
DISH_CHOICES := data/experiment/dish_choices.rds
SURVEY_DATA := data/survey/survey_data.RData
# Targets for pre-registered simulated power analysis
POWER_SIM_DATA := data/generated/power_runs.rds \
data/generated/power_differential_effects.rds
POWER_SIM_OUTPUT := output/power_sim_output.zip
POWER_SIM := output/power_analysis.html
# Targets for experimental analysis
EXP_DATA := $(DISH_PLAN) $(TMENT_DATA) $(DISH_CHOICES)
EXP_SAMPLES := data/generated/exp_sample_dish.rds \
data/generated/exp_sample_taction.rds \
output/exp_samples_desc_output.zip
EXP_DEBRIEFING_FIGURES := output/debriefing_res_exp.svg \
output/debriefing_res_exp.pdf
EXP_PREREG_OUTPUT := output/exp_prereg_output_dish.zip \
output/exp_prereg_output_taction.zip
EXP_ADD_OUTPUT := output/exp_additional_output_dish.zip \
output/exp_additional_output_taction.zip
EXP_RESULTS := $(EXP_DEBRIEFING_FIGURES) $(EXP_PREREG_OUTPUT) $(EXP_ADD_OUTPUT)
# Targets for survey analysis
SURVEY_OUTPUT := output/survey_output.zip
# Targets for RDF analysis
RDF_OUTCOMES := output/rdf_code_doc.pdf output/rdf_flowchart.pdf \
data/generated/rdf_outcomes.rds
RDF_SPEC_CURVES := output/rdf_spec_curves.zip
RDF_RESULTS := $(RDF_OUTCOMES) $(RDF_SPEC_CURVES)
# Static targets
STATIC_POWER_SIM_DATA := static/power_runs.rds \
static/power_differential_effects.rds
STATIC_DEBRIEFING_FIGURE := static/debriefing_res_exp.svg
STATIC_RDF_OUTCOMES := static/rdf_code_doc.pdf static/rdf_flowchart.pdf \
static/rdf_outcomes.rds
STATIC_TARGETS := $(STATIC_POWER_SIM_DATA) $(STATIC_DEBRIEFING_FIGURE) \
$(STATIC_RDF_OUTCOMES)
# All targets combined
TARGETS := $(STATIC_TARGETS) $(POWER_SIM) $(EXP_RESULTS) $(SURVEY_OUTPUT) \
$(RDF_RESULTS)
# Phony targets
.phony: all power findings rdf clean dist-clean
all: $(TARGETS)
static: $(STATIC_TARGETS)
power: $(POWER_SIM)
findings: $(EXP_RESULTS) $(SURVEY_OUTPUT)
rdf: $(RDF_RESULTS)
clean:
rm -f $(POWER_SIM) $(POWER_SIM_OUTPUT) $(EXP_SAMPLES) $(EXP_RESULTS) \
$(SURVEY_OUTPUT) $(RDF_SPEC_CURVES) $(POWER_SIM_DATA) $(RDF_OUTCOMES)
dist-clean: clean
rm -f $(STATIC_TARGETS)
# Recipes for targets
$(STATIC_POWER_SIM_DATA): doc/power_analysis.Rmd \
code/R/linear_hypothesis_testing_fixest.R
$(RSCRIPT) -e 'library(rmarkdown); render("doc/power_analysis.Rmd")'
mv data/generated/power_runs.rds static/
mv data/generated/power_differential_effects.rds static/
mv doc/power_analysis.html output
$(POWER_SIM): doc/power_analysis.Rmd code/R/linear_hypothesis_testing_fixest.R \
$(STATIC_POWER_SIM_DATA)
cp -f static/power_runs.rds data/generated
cp -f static/power_differential_effects.rds data/generated
$(RSCRIPT) -e 'library(rmarkdown); render("doc/power_analysis.Rmd")'
mv doc/power_analysis.html output
$(EXP_SAMPLES): code/R/prepare_exp_samples.R $(EXP_DATA)
$(RSCRIPT) code/R/prepare_exp_samples.R
$(STATIC_DEBRIEFING_FIGURE): code/R/exp_debriefing_figures.R $(EXP_SAMPLES)
$(RSCRIPT) code/R/exp_debriefing_figures.R
cp output/debriefing_res_exp.svg static/
$(EXP_DEBRIEFING_FIGURES): code/R/exp_debriefing_figures.R $(EXP_SAMPLES)
$(RSCRIPT) code/R/exp_debriefing_figures.R
$(EXP_PREREG_OUTPUT) $(EXP_PREREG_RESULTS): \
code/R/exp_preregistered_analyses.R code/R/exp_utils.R $(EXP_SAMPLES)
$(RSCRIPT) code/R/exp_preregistered_analyses.R
$(EXP_ADD_OUTPUT) $(EXP_ADD_RESULTS): \
code/R/exp_additional_analyses.R code/R/exp_utils.R $(EXP_SAMPLES)
$(RSCRIPT) code/R/exp_additional_analyses.R
$(SURVEY_OUTPUT): code/R/survey_results.R $(SURVEY_DATA)
$(RSCRIPT) code/R/survey_results.R
$(STATIC_RDF_OUTCOMES): code/R/rdf_exhaust_design.R \
code/R/rdf_design.R code/R/exp_utils.R $(EXP_DATA)
$(RSCRIPT) code/R/rdf_exhaust_design.R
cp data/generated/rdf_outcomes.rds static/
cp -f output/rdf_* static/
$(RDF_OUTCOMES): $(STATIC_RDF_OUTCOMES)
cp -f static/rdf_code_doc.pdf output/
cp -f static/rdf_flowchart.pdf output/
cp -f static/rdf_outcomes.rds data/generated/
$(RDF_SPEC_CURVES): code/R/rdf_create_spec_curves.R $(RDF_OUTCOMES)
$(RSCRIPT) code/R/rdf_create_spec_curves.R
rm -f Rplots.pdf