<commit_before># Time-stamp: <2017-05-02 12:11:42 (slane)>
.PHONY: all models input-data output-data clean-models clean-manuscripts clobber

all: manuscripts/censored-mle.html manuscripts/censored-mle.pdf \
	manuscripts/model-interrogation.html

.INTERMEDIATES: manuscripts/censored-mle.tex

models: stan/censored-mle-m0.rds \
	stan/censored-mle-m0-robust.rds \
	stan/censored-mle-m1.rds \
	stan/censored-mle-m2.rds \
	stan/censored-mle-m3.rds \
	stan/censored-mle-m4.rds

input-data: data/biofouling.rds data/imputations.rds

output-data: data/censored-mle-m0.rds \
	data/censored-mle-m0-robust.rds \
	data/censored-mle-m1.rds \
	data/censored-mle-m2.rds \
	data/censored-mle-m3.rds \
	data/censored-mle-m4.rds

# Defaults for number of multiply imputed datasets and HMC iterations if not
# passed via cmdline.
NUMMI?=50
MCITER?=2000

################################################################################
# Make data for feeding into models and manuscript
data/imputations.rds data/biofouling.rds: scripts/data-cleaning.R \
	data-raw/samples.csv data-raw/vessel.csv
	cd $(<D); \
	Rscript $(<F) --no-save --no-restore numMI=$(NUMMI)

################################################################################
# Rules for making stan models
stan/censored-mle-m0.rds: scripts/compile-model.R stan/censored-mle-m0.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m0-robust.rds: scripts/compile-model.R \
	stan/censored-mle-m0-robust.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m1.rds: scripts/compile-model.R stan/censored-mle-m1.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m2.rds: scripts/compile-model.R stan/censored-mle-m2.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m3.rds: scripts/compile-model.R stan/censored-mle-m3.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m4.rds: scripts/compile-model.R stan/censored-mle-m4.stan
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds)

################################################################################
# Rules to fit models with data
data/censored-mle-m0.rds: scripts/fit-model.R \
	stan/censored-mle-m0.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=737 iter=$(MCITER)

data/censored-mle-m0-robust.rds: scripts/fit-model.R \
	stan/censored-mle-m0-robust.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=737 iter=$(MCITER)

data/censored-mle-m1.rds: scripts/fit-model.R \
	stan/censored-mle-m1.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=666 iter=$(MCITER)

data/censored-mle-m2.rds: scripts/fit-model.R \
	stan/censored-mle-m2.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=42 iter=$(MCITER)

data/censored-mle-m3.rds: scripts/fit-model.R \
	stan/censored-mle-m3.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=13 iter=$(MCITER)

data/censored-mle-m4.rds: scripts/fit-model.R \
	stan/censored-mle-m4.rds data/imputations.rds
	cd $(<D); \
	Rscript $(<F) mname=$(basename $(@F) .rds) myseed=987 iter=$(MCITER)

################################################################################
# Rules to make manuscripts
manuscripts/censored-mle.html: manuscripts/censored-mle.Rmd \
	data-raw/samples.csv
	cd $(<D); \
	Rscript -e "rmarkdown::render('$(<F)')" --no-save --no-restore

manuscripts/model-interrogation.html: manuscripts/model-interrogation.Rmd \
	data/censored-mle-m0.rds data/censored-mle-m1.rds \
	data/censored-mle-m3.rds data/censored-mle-m4.rds
	cd $(<D); \
	Rscript -e "rmarkdown::render('$(<F)')" --no-save --no-restore

%.tex: %.Rnw data/biofouling.rds
	cd $(<D); \
	Rscript -e "knitr::knit('$(<F)')" --no-save --no-restore

%.pdf: %.tex
	cd $(<D); \
	latexmk -pdf $(<F)

################################################################################
# Cleaning targets
clean-models:
	cd stan/; \
	rm -f *.rds

clean-manuscripts:
	cd manuscripts/; \
	rm -rf *.aux *.bbl *.bcf *.blg *.fdb_latexmk *.fls *.lof *.log *.lot \
		*.code *.loe *.toc *.rec *.out *.run.xml *~ *.prv \<commit_msg>Correct order of Rscript options<commit_after># Time-stamp: <2017-05-02 12:21:59 (slane)>
.PHONY: all models input-data output-data clean-models clean-manuscripts clobber

all: manuscripts/censored-mle.html manuscripts/censored-mle.pdf \
	manuscripts/model-interrogation.html

.INTERMEDIATES: manuscripts/censored-mle.tex

models: stan/censored-mle-m0.rds \
	stan/censored-mle-m0-robust.rds \
	stan/censored-mle-m1.rds \
	stan/censored-mle-m2.rds \
	stan/censored-mle-m3.rds \
	stan/censored-mle-m4.rds

input-data: data/biofouling.rds data/imputations.rds

output-data: data/censored-mle-m0.rds \
	data/censored-mle-m0-robust.rds \
	data/censored-mle-m1.rds \
	data/censored-mle-m2.rds \
	data/censored-mle-m3.rds \
	data/censored-mle-m4.rds

# Defaults for number of multiply imputed datasets and HMC iterations if not
# passed via cmdline.
NUMMI?=50
MCITER?=2000

################################################################################
# Make data for feeding into models and manuscript
data/imputations.rds data/biofouling.rds: scripts/data-cleaning.R \
	data-raw/samples.csv data-raw/vessel.csv
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) numMI=$(NUMMI)

################################################################################
# Rules for making stan models
stan/censored-mle-m0.rds: scripts/compile-model.R stan/censored-mle-m0.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m0-robust.rds: scripts/compile-model.R \
	stan/censored-mle-m0-robust.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m1.rds: scripts/compile-model.R stan/censored-mle-m1.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m2.rds: scripts/compile-model.R stan/censored-mle-m2.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m3.rds: scripts/compile-model.R stan/censored-mle-m3.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

stan/censored-mle-m4.rds: scripts/compile-model.R stan/censored-mle-m4.stan
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds)

################################################################################
# Rules to fit models with data
data/censored-mle-m0.rds: scripts/fit-model.R \
	stan/censored-mle-m0.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=737 iter=$(MCITER)

data/censored-mle-m0-robust.rds: scripts/fit-model.R \
	stan/censored-mle-m0-robust.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=737 iter=$(MCITER)

data/censored-mle-m1.rds: scripts/fit-model.R \
	stan/censored-mle-m1.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=666 iter=$(MCITER)

data/censored-mle-m2.rds: scripts/fit-model.R \
	stan/censored-mle-m2.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=42 iter=$(MCITER)

data/censored-mle-m3.rds: scripts/fit-model.R \
	stan/censored-mle-m3.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=13 iter=$(MCITER)

data/censored-mle-m4.rds: scripts/fit-model.R \
	stan/censored-mle-m4.rds data/imputations.rds
	cd $(<D); \
	Rscript --no-save --no-restore $(<F) mname=$(basename $(@F) .rds) \
		myseed=987 iter=$(MCITER)

################################################################################
# Rules to make manuscripts
manuscripts/censored-mle.html: manuscripts/censored-mle.Rmd \
	data-raw/samples.csv
	cd $(<D); \
	Rscript --no-save --no-restore -e "rmarkdown::render('$(<F)')"

manuscripts/model-interrogation.html: manuscripts/model-interrogation.Rmd \
	data/censored-mle-m0.rds data/censored-mle-m1.rds \
	data/censored-mle-m3.rds data/censored-mle-m4.rds
	cd $(<D); \
	Rscript --no-save --no-restore -e "rmarkdown::render('$(<F)')"

%.tex: %.Rnw data/biofouling.rds
	cd $(<D); \
	Rscript --no-save --no-restore -e "knitr::knit('$(<F)')"

%.pdf: %.tex
	cd $(<D); \
	latexmk -pdf $(<F)

################################################################################
# Cleaning targets
clean-models:
	cd stan/; \
	rm -f *.rds

clean-manuscripts:
	cd manuscripts/; \
	rm -rf *.aux *.bbl *.bcf *.blg *.fdb_latexmk *.fls *.lof *.log *.lot \
		*.code *.loe *.toc *.rec *.out *.run.xml *~ *.prv \
{'fraction_non_alphanumeric': 0.27083098432743263, 'fraction_numerical': 0.017138347051527794, 'mean_word_length': 4.025495750708215, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1382267', 'n_tokens_mistral': 3885, 'n_tokens_neox': 3668, 'n_words': 618}