This tool enables the automatic screening of control variables to adjust the significance of specific variables, similar to Stata's 'oneclick' command, while offering enhanced functionality.
Project description
pyoneclick
This Python tool can automatically screen control variables to adjust the significance of specific variables, similar to Stata's oneclick command but with more powerful features.
- 中文:README_zh.md
Introduction
Insights
The development of this research is based on the following insights:
-
A trade-off between time and optimal solutions needs to be made. During the process of filtering control variables, when there are too many control variables, finding the optimal solution becomes time-consuming and unacceptable. In many cases, we only need a quick result that works, that is, an approximate optimal solution rather than all possible usable results.
-
Addressing the issue of "solve one problem only to find another cropping up." Oftentimes, when a variable becomes significant in a specific command, another variable or the same variable in another command may no longer be significant. Therefore, the command used for screening must address such issues where simultaneous significance is required.
Command Features
Compared to the oneclick command in Stata, this command incorporates several new features. It has the following characteristics:
-
More efficient filtering. This command is based on the simulated annealing algorithm rather than enumeration, resulting in lower time complexity during the search for usable control variables.
-
Clearer logic. The original Stata code can be directly passed into the command during execution, without needing to change coding habits, making the command more readable.
-
Broader functionality. Supports joint estimation across multiple commands and adjusts the significance of multiple variables or multiple commands at the same time.
Usage
Requirements
Before formal use, we need to meet the following conditions:
-
Licensed Stata software. The version must be Stata 17 or above.
-
An appropriate Python 3 environment. Python 3.8 or higher is recommended.
Installation
- First, set a global system variable named
STATA_PATHin the Windows Control Panel. The value of the variable should be the installation path of Stata plus the version number. For example, for the MP version of Stata 18 on a 64-bit computer, the default installation path would look like this:
STATA_PATH=C:\Program Files\Stata18\StataMP-64.exe
- Install the
pyoneclickcommand:
pip install pyoneclick
Quick Start
- Specify the data. Before executing the statistical estimation command for the first time, use the
-dparameter to specify the.dtadata file to be used:
pyoneclick -d "examples/example.dta"
- Simplest estimation. Use
-cto specify the Stata command to run; the model will automatically parse the dependent and independent variables and adjust the significance of covariates by computing an optimal list of control variables:
pyoneclick -c "reghdfe y1 x1 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31, absorb( stkcd year )"
The full functionality of the pyoneclick command is relatively complex, and mastering it fully may take some time.
- We provide detailed instructions to help users get started quickly: View detailed usage instructions
Acknowledgments
The development of this project was inspired by the StataOneClick project, and we sincerely thank the author of that project. Their excellent work provided valuable insights and became a crucial foundation for our project’s development.
Third-Party Libraries
This project uses the following open-source libraries:
- stata-setup: Licensed under Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyoneclick-0.2.0.tar.gz.
File metadata
- Download URL: pyoneclick-0.2.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0da16feea8426149932d8c9eca09d5b53747eb2b960d86a930d4edf8962e59ff
|
|
| MD5 |
ed2c10a0d4879006a925c9a37ecf2505
|
|
| BLAKE2b-256 |
681e8e9e5a5b37f448e473cb5b5f438d83b817de4768f896bdd15c0d463edac5
|
File details
Details for the file pyoneclick-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyoneclick-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dedc3a1872c4beffc2b1cd812929d8494b09129820b1a0403c83af147df389fa
|
|
| MD5 |
5830774281dd8c4cc522b299572191ea
|
|
| BLAKE2b-256 |
336e798ac1af5db4a66dee5bf437ae4f70a2f8c0c52341e9e14f78e82724ae7c
|