Con trăn ecotools
Ngày đăng:
06/01/2023
Trả lời:
0
Lượt xem:
161
ecotools là gói Python chứa các hàm kinh tế lượng và các phím tắt thuận tiện để dữ liệu hoạt động với pandas và numpy. Tài liệu đầy đủ tại đây Show Cài đặtBạn có thể cài đặt trực tiếp từ PYPI $ pip install econtools Hoặc bạn có thể sao chép từ Github và cài đặt trực tiếp $ git clone http://github.com/dmsul/econtools $ cd econtools $ python setup.py install kinh tế lượng
import econtools import econtools.metrics as mt # Read Stata DTA file df = econtools.read('my_data.dta') # Estimate OLS regression with fixed-effects and clustered s.e.'s result = mt.reg(df, # DataFrame to use 'y', # Outcome ['x1', 'x2'], # Indep. Variables fe_name='person_id', # Fixed-effects using variable 'person_id' cluster='state' # Cluster by state ) # Results print(result.summary) # Print regression results beta_x1 = result.beta['x1'] # Get coefficient by variable name r_squared = result.r2a # Get adjusted R-squared joint_F = result.Ftest(['x1', 'x2']) # Test for joint significance equality_F = result.Ftest(['x1', 'x2'], equal=True) # Test for coeff. equality Bảng thống kê hồi quy và tóm tắt
linh tinh. Công cụ thao tác dữ liệu
Dữ liệu vào/ra
|