天天看点

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

Logistic回归思维导图:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

原数据部分截图:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

先看一下是否低出生体重,与是否吸烟之间的关系,使用卡方检验:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

接下来看一下,相同的单变量,使用Logistic回归应该如何去做:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

看一下具体的预测概率值:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

下面,把案例中的连续性自变量和二分类自变量纳入:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

Wals检验可以作为变量筛选的参考,但不能用于最终决定。

那应该使用何种检验的结果才是准确的呢?

就是使用上面的-2对数似然值

通过比较多次建模,比较剔除该自变量前后的-2对数似然值,数值变小说明模型效果变好。

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

发现:

           -2对数似然值变化了,由211.072到221.076,增长了0.004,模型效果稍微变差。

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

==============================================================

这样太麻烦了,比较来比较去的,如何让它自动筛选呢?

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

我们使用向后:LR来自动筛选一下:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

我们使用向前:LR来自动筛选一下:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

所以,在实际操作中,最最稳妥的方式:

  • 先进行数据描述
  • 再进行单变量分析——每个自变量都与因变量进行一次交叉表-卡方检验
  • 手动或自动进行单变量的筛选,多做几次,找区别(找模型中有变化的          自变量)
  • 利用专业知识进行判断某自变量是否该剔除

上述方法是最最稳妥的方法,当然,可在数据设置好以后直接进行二元Logistic回归,但最好也要各种方法(向前LR、向后LR)多试一下,找出各模型中最终输出有差异的变量,再利用专业知识判断该变量是否该剔除。

当然,在进行二元Logistic回归之前,进行单变量分析——每个自变量都与因变量进行一次交叉表-卡方检验,也可尽早删除与因变量无关的自变量(注意:不要随意剔除变量,即使其P值稍大,可适当放宽条件)。

==============================================================

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

在我们的上述案例中有这样一个自变量:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

选入“种族”这个多分类自变量:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

定义了分类变量以后,在该自变量后面就会多一个括号(Cat),即:该自变量已经定义了分类变量

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

虽然,race(2)的P值=0.531,不具有统计学意义,但也不可随意删除,因为哑变量“同出同进”原则。如下图,若删除了race(2),参照水平就会变为:黑人和其他种族。即:白人和非白人相比,情况如何...(此时,哑变量的含义已经发生了改变。)

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

如何使白人作为参照水平呢?

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

如果使用向前:LR

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

==============================================================

考虑两变量间的交互作用:

     比如,想看一下年龄和是否高血压的交互

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

==============================================================

功能模块截图:

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

Logistic回归,在本质上仍然是一个回归模型,只不过基于因变量是分类变量的特征进行了很多变化,拟合方法是迭代,结果展示主要看OR值(比数比)。但是其背后的模型诊断、残差分析的思路和线性回归是完全一样的。

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

微信公众号 : 小芒果学Python

● 长按二维码,关注回复“python”获取免费视频教程

logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)
logistic回归分析优点_SPSS统计分析全解析Logistic回归(逻辑回归)

点「在看」的人都变好看了哦

继续阅读