如何将拟合的线性模型对象的汇总表打印为乳胶?
例如,如何打印res
为乳胶代码?
# Libraries
import pandas as pd
from linearmodels.panel import PanelOLS
from linearmodels.datasets import wage_panel
# Load silly data
df = wage_panel.load()
# Set indexes
df = df.set_index(['nr','year'])
# Fit silly model
mod = PanelOLS(dependent=df['lwage'], exog=df[['hours','married','educ']], time_effects=True)
res = mod.fit()
# Print results
print(res)
PanelOLS Estimation Summary
================================================================================
Dep. Variable: lwage R-squared: 0.0933
Estimator: PanelOLS R-squared (Between): 0.7056
No. Observations: 4360 R-squared (Within): 0.0373
Date: Thu, Nov 04 2021 R-squared (Overall): 0.6764
Time: 23:48:11 Log-likelihood -3055.6
Cov. Estimator: Unadjusted
F-statistic: 149.14
Entities: 545 P-value 0.0000
Avg Obs: 8.0000 Distribution: F(3,4349)
Min Obs: 8.0000
Max Obs: 8.0000 F-statistic (robust): 149.14
P-value 0.0000
Time periods: 8 Distribution: F(3,4349)
Avg Obs: 545.00
Min Obs: 545.00
Max Obs: 545.00
Parameter Estimates
==============================================================================
Parameter Std. Err. T-stat P-value Lower CI Upper CI
------------------------------------------------------------------------------
hours -7.571e-05 1.357e-05 -5.5805 0.0000 -0.0001 -4.911e-05
married 0.1573 0.0157 10.017 0.0000 0.1265 0.1881
educ 0.0765 0.0042 18.048 0.0000 0.0682 0.0848
==============================================================================
F-test for Poolability: 41.795
P-value: 0.0000
Distribution: F(7,4349)
Included effects: Time