当前位置:网站首页>Correction method and code of medical gender, age and years of Education
Correction method and code of medical gender, age and years of Education
2022-07-20 23:59:00 【Conditional stroll】
@ Founded in :2022.07.17
@ Modified to :2022.07.17
List of articles
1、 Parameter Introduction
statsmodels.regression.linear_model.OLS(endog, exog=None, missing='none', hasconst=None, **kwargs)
Parameters
endog: array_like
A 1-d endogenous response variable. The dependent variable.
exog: array_like
A nobs x k array where nobs is the number of observations and k is the number of regressors. An intercept is not included by default and should be added by the user. See statsmodels.tools.add_constant.
missing: str
Available options are ‘none’, ‘drop’, and ‘raise’. If ‘none’, no nan checking is done. If ‘drop’, any observations with nans are dropped. If ‘raise’, an error is raised. Default is ‘none’.
hasconst: None or bool
Indicates whether the RHS includes a user-supplied constant. If True, a constant is not checked for and k_constant is set to 1 and all result statistics are calculated as if a constant is present. If False, a constant is not checked for and k_constant is set to 0.
instructions RHS Whether to include constants provided by users .
If True, Then the constant is not checked and k_constant Set to 1, And all the result statistics are calculated in the way that there are constants .
If False, Then the constant is not checked and k_constant Set to 0.
statsmodels.regression.linear_model.OLS
2、 Official website code
>>> import statsmodels.api as sm
>>> import numpy as np
>>> duncan_prestige = sm.datasets.get_rdataset("Duncan", "carData")
>>> Y = duncan_prestige.data['income']
>>> X = duncan_prestige.data['education']
>>> X = sm.add_constant(X)
>>> model = sm.OLS(Y,X)
>>> results = model.fit()
>>> results.params
const 10.603498
education 0.594859
dtype: float64
>>> results.tvalues
const 2.039813
education 6.892802
dtype: float64
>>> print(results.t_test([1, 0]))
Test for Constraints
==============================================================================
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------
c0 10.6035 5.198 2.040 0.048 0.120 21.087
==============================================================================
>>> print(results.f_test(np.identity(2)))
<F test: F=array([[159.63031026]]), p=1.2607168903696672e-20, df_denom=43, df_num=2>
3、 Reference material
python in statsmodels Modular API Interface
python statsmodel Regression result extraction ( Regression coefficient 、t value 、pvalue、R Fang )
python statsmodel Regression result extraction (R Fang T value P-value)
stay scikit Study LinearRegression Find p value ( Importance )
python Linear regression Statistical tests p value _Python New choice of Statistics :pingouin
边栏推荐
- Postgetsql set ID auto increment primary key
- js截取字符串(3种方法)
- 多地市监部门展开冷饮抽检,钟薛高等产品均合格
- IDEA版Postman面世了,功能真心强大
- GIS技术在医疗行业的应用:利用切片地图发布技术解决dmetrix数字病理切片在线浏览
- Advantages and disadvantages of several popular cross end technology solutions in 2022
- continue语句
- 几种2022年流行的跨端技术方案的优缺点
- RuntimeError: CUDA error: an illegal memory access was encountered
- VLAN再见,我选择用QinQ!1000字带你详细了解QinQ技术
猜你喜欢
Siemens low code customer case | overcome communication barriers and solve the bottleneck of application development efficiency
字節一面掛了,面試官問DDD,我卻不知道
RuntimeError: CUDA error: an illegal memory access was encountered
关于我写书这件事
Maintainability of data intensive application of reading notes
【Postman】使用Tests进行环境变量设置
nextTick那些事儿
Prometheus has released the long-term supported version of LTS
ES6 —— Promise VS 函数“回调地狱”
MySQL 5.7 is about to stop and only maintain. It's time to learn a wave of MySQL 8
随机推荐
print-is网页打印
为什么大家说mysql数据库单表最大两千万?依据是啥?
在哪个平台买股票最好,最安全?
「架构师合集」
My creation anniversary
for语句 range函数
According to the middle order and subsequent traversal of binary tree
【SwinTransformer源码阅读一】build_loader部分代码
openGauss社区理事长江大勇:openGauss联合产业界创新,共建开源数据库根社区
Revit(21)Document-常见的API封装
惊!储户近200万存款被“刷脸”盗走,快看看你的银行卡有这三类风险吗?
洛谷P1955 程序自动分析
iptables防止nmap扫描以及binlog备份
continue语句
JS intercept string (3 methods)
基于短期的风力发电概率预测(Matlab代码实现)
Introduction to open source tools SAP ui5 tools
[postman] use tests to set environment variables
【汇总】百宝囊
Traditional architecture of enterprise digital transformation to medium platform micro service architecture