You can see the research paper resulting from this work here.
Here is how to generate the result files:
- Download the zip file from current repository.
- Open Average Growth Rate Comparison.ipynb, click Cell -> Run All on the menu bar. Then, a group of histograms showing the general trend of difference between control and treatment group will be generated.
- Open Linear Regression .ipynb, click Cell -> Run All on the menu bar. Then, separate linear models for each outcome variable will be created and fitted. Their corresponding coefficients and p values will show up and be exported to Linear Regression Results.csv. In the same notebook, a group of scatter plots showing how outcome variable changes vs. different cumulative store months (outliers removed) can also be seen.
If you'd additionally like to recreate our data gathering processes, the original CO state license information can be found here. The get_data.py file includes basic instructions and all of our code used to manipulate these original manually-collected records, make API calls for Google Maps address matching and geocoding, and transform and save the resulting data. The get_census_data.ipynb notebook can be run in full to collect and save relevant tract-level Census variables.
tract_similarity_match.ipynb
- Divide control and treatment groups, and apply propensity score matching.
Data_Prep_DID.ipynb
- Prepare data needed for later Difference-in-Difference analysis.
Average Growth Rate Comparison.ipynb
- Compare control and treatment groups.
Linear Regression.ipynb
- Linear regression model to explore the relationships and p-values, also check the validity of the results got from 'Average Growth Rate Comparison'.
Linear Regression Results.csv
- P values and coefficients from the linear regression model.
get_census_data.ipynb
- Use [Cenpy] (https://github.com/cenpy-devs/cenpy) to get relevant Census economic variables for relevant years
get_data.py
- Wrangle existing data from co_cannabis_stores.csv, add addresses from Google Maps API, add census tract and county numbers, output both tract-level and store-level data
Growth Rate Comparison.png
- Histogram (result image) generated from 'Average Growth Rate Comparison'.
Scatter Plot.png
- Scatter plots of how outcome variable changes vs. different cumulative store months, outliers removed.
visualizations/Tableau_images_screenshots folder
- Screenshots of all visualizations that created using
Tableau files folder
- Proof dispensary datasets and the imported spatial data and graphs generated by Tableau