首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >作为乳胶的输出线性模型回归总结

作为乳胶的输出线性模型回归总结
EN

Stack Overflow用户
提问于 2021-11-04 23:59:57
回答 1查看 508关注 0票数 1

如何打印拟合的线性模型对象的汇总表作为胶乳?

例如,如何打印res作为乳胶码?

代码语言:javascript
复制
# 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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-04 23:59:57

您可以使用summary属性来完成这一任务。请注意,您必须在Latex中使用booktabs包。

代码语言:javascript
复制
print(res.summary.as_latex())

其中的指纹:

\begin{center} \begin{tabular}{lclc} \toprule \textbf{Dep。变量:}& \textbf{ R-平方:}& 0.0933 \ \textbf{估计:}& PanelOLS &\textbf{R-平方(介于):}& 0.7056 \textbf{No.观察:}& 4360 & \textbf{ R-平方(在):}

& 0.0373 \ \textbf{日期:}和清华,11月04 2021和\textbf{ R-平方(总体):}和0.6764 \textbf{时间:}& 23:50:24和\textbf{Log-可能}& -3055.6 \ \textbf{Cov。估计量:}&未调整& \textbf{ }&

\ \textbf{}和& \textbf{ F-统计量:}& 149.14 \\textbf{实体:}

& 545 & \textbf{ P}和0.0000 \ \textbf{Avg:}和8.0000 & \textbf{分发:}& F(3,4349) \textbf{Min Obs:}

& 8.0000 & \textbf{ }&

\ \textbf{Max Obs:} & 8.0000 & \textbf{ F-统计量(稳健):}& 149.14 \ \textbf{}

& \textbf{ P-值}& 0.0000 \ \textbf{时间段:}&8&\textbf{分发:}& F(3,4349) \ \textbf{Avg Obs:}

& 545.00 & \textbf{ }&

\ \textbf{Min Obs:} & 545.00 & \textbf{

}&\ \textbf{Max Obs:} & 545.00

& \textbf{}和\ \textbf{ }

&& \textbf{ }&

\\底规则\结束{tabular} \begin{tabular}{lcccccc} &\textbf{textbf}和\textbf{Std。Err.}和textbf{textbf}和\textbf{P-值}和\textbf{低CI}和\textbf{上CI} \ \midrule \textbf{小时}& -7.571e-05和1.357e-05 & -5.5805和0.0000 &0.0001&

-4.911e-05 \\textbf{已往}& 0.1573 & 0.0157和10.017 & 0.0000 & 0.1265 &

0.1881 \ \textbf{educ} & 0.0765 & 0.0042和18.048 & 0.0000 & 0.0682 &

0.0848 \\底规则\结束{表格}%\标题{PanelOLS估计摘要}\\end{中心}

Poolability测试: 41.795 \newline P-值: 0.0000 \newline分布: F(7,4349) \newline \newline包含的效果: Time

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69847202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档