Linear regression and plotting functions for RCT Analysis.
Requires utilities package for data processing functions.
Download this project to a location on your computer.
Create a virtual environment for rct_analysis where python packages will be installed.
Use command python -m venv . in rct_analysis directory.
- Save the utilities directory, note the filepath to its location (absolute or relative to this directory).
- Use the command
pip install {path/to/utilities}
Use the command pip install -e {path/to/rct_analysis}
If running in the rct_analysis directory, this will be pip install -e .
. signals the current directory, -e makes it editable in case changes are needed.
Create the file config.json by copying and renaming example_config.json, then edit the file to contain the relevant data.
Once setup is done, run the analysis using the command python analysis.py
This assumes the data is in a directory with the same name as the code directory, in this case lmi_rct_pilot_analysis.
This will produce aggregate and by tasks plots showing the percentage change in outcomes between the control and treatment groups.
It also produces the results of the model used to create these plots, and a file detailing the percentage effect each covariate and fixed effect has on the model.
- Errors
- By default, uses normal standard error calculations.
- Setting robust_SEs to true or clusters to the variable(s) to cluster over will implement these error methods.
- Wald test
- Setting this to true and specifying the parameters to check the interaction terms of runs Wald tests for all tasks and outcomes.
- The parameters are the outputs of the model fit results, not columns, so for "Sex" it is "Sex_Male" due to encoding categorical variables.