RiskPremium

Measuring the market risk premium
Log | Files | Refs

Makefile (2023B)


      1 #
      2 # Makefile for PREDICTING THE EQUITY RISK PREMIUM
      3 #
      4 # Created       on June  04th 2019
      5 # Last modified on March 23rd 2020
      6 ## --------------------------------------------------------------------------------------------------------
      7 
      8 
      9 
     10 ## --------------------------------------------------------------------------------------------------------
     11 ## LOAD A FEW OPTIONS
     12 -include ./rules.mk
     13 ## --------------------------------------------------------------------------------------------------------
     14 
     15 # --------------------------------------------------------------------------------------------------------
     16 ## ALL
     17 all: output/predict.csv readme.md
     18 
     19 ##
     20 ## DOWNLOAD THE DATA FROM WRDS
     21 ## Edit rules.mk to change your user name under WRDS_USERNAME
     22 input/msi.sas7bdat: 
     23 	$(call colorecho,"Download stock market index from crsp ...")
     24 	rsync -aPvzh --stats --human-readable  ${WRDS_USERNAME}@wrds-cloud.wharton.upenn.edu:/wrds/crsp/sasdata/a_stock/msi.sas7bdat ./input/
     25 	@echo
     26 
     27 ## GENERATE PREDICTORS
     28 tmp/predict.csv: src/import_predictors.R input/cay_current.csv input/msi.sas7bdat
     29 	$(call colorecho,"Import and merge all return predictors ...")
     30 	mkdir -p tmp
     31 	R CMD BATCH $(R_OPTS) src/import_predictors.R log/import_predictors.log.R
     32 	@echo
     33 
     34 ## RUN REGRESSIONS
     35 output/predict.csv: src/rp_measure.R tmp/predict.csv
     36 	$(call colorecho,"Estimate predictive regression ...")
     37 	R CMD BATCH $(R_OPTS) src/rp_measure.R log/rp_measure.log.R
     38 	@echo
     39 
     40 ## OUTPUT RESULTS
     41 readme.md: src/readme_in.md output/predict.png tmp/reg_update.txt
     42 	$(call colorecho,"Update readme file ...")
     43 	cat src/readme_in.md tmp/reg_update.txt > readme.md
     44 	@echo
     45 
     46 ##
     47 ## --------------------------------------------------------------------------------------------------------
     48 ## help (this call)
     49 .PHONY : help
     50 help : Makefile
     51 	@sed -n 's/^##//p' $<
     52 
     53 ## clean
     54 .PHONY : clean
     55 clean:
     56 	rm -rf ./output/*
     57 	rm -rf ./log/*.log*
     58 	rm -rf ./tmp/*	
     59 	rm -rf readme.md
     60 
     61 ##
     62 # --------------------------------------------------------------------------------------------------------
     63 
     64 
     65