当前位置:网站首页>R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
2022-07-25 12:43:00 【51CTO】
在拟合 GLM(并检查残差)之后,可以使用 z 检验一一检验估计参数的显着性,即将估计值与其标准误差进行比较。
GLM 模型拟合和分析示例
示例 1. 小鼠数据的 GLM 建模(剂量和反应)
a) 我们输入数据并拟合逻辑回归模型。





模型:

可以与完整模型进行比较。与偏差值 17.639 相关的 P 值 0.82(> 0.10)意味着没有显着证据拒绝拟合模型。



空模型不包含预测变量,在 25 个自由度 (df) 上的偏差为 35.89。当协变量 x 添加到空模型时,偏差的变化是 35.890-17.639=18.25。与自由度为 25-24=1 的卡方分布相比,其 P 值为 1.93 × 10 -5 非常显着。
因此模型不能通过删除 x 来简化。x 的系数的 t 检验也很重要(P 值 0.0065<0.01)。
截距呢?可以删掉吗?

图 1:逻辑回归的小鼠数据和拟合值。
b)我们拟合一个带有概率链接的模型。



配套模型:

同样,这两个参数都很重要(P 值<0.01)


添加 x 时偏差的变化是显着的(P 值 =

)。
模型不能通过删除 x 来简化。

图 2:小鼠数据和拟合值(虚线:概率链接)。
使用 probit 链接的模型略好于使用 logit 链接的模型,因为偏差更小。在两个模型中,x 的系数都很显着(P 值<0.01),这意味着效果随着剂量的增加而增加。
示例 2. 临床试验数据(剂量和反应)的 GLM 建模。
a) 我们输入数据,然后拟合逻辑回归模型





与偏差值 13.633 相关的 P 值为 0.034<0.05。5% 的水平拒绝拟合模型。
针对 x 绘制残差揭示了一种依赖模式。

图 3:仅带有 x 的拟合模型的残差图。
所以我们将 x2 添加到模型中。



偏差从 13.633 减少到 5.107,不显着(P 值=0.403>0.05)。
因此,我们不能通过偏差的证据来拒绝这个模型。

图 4:带有 x2 的拟合模型的残差图。
残差现在看起来是随机的。
拟合模型为

并且所有参数估计值都很显着(5%)。对数几率

以二次方式依赖于 x。
示例 3. 艾滋病数据,泊松
a) 我们输入数据并使用默认对数链接拟合泊松回归模型。




偏差 29.654 的 P 值为 0.005<0.01 ⇒ 模型被拒绝。

图 5:拟合模型 3
的残差图 b) 针对年份指数 x 的残差图显示了依赖模式。所以我们添加

.

16.371 的偏差(P 值为 0.1279>0.10)并不显着。拟合模型

不能以偏差为由拒绝。但残差图只显示了比以前稍微随机的模式。

图 6:拟合模型 3 与 x2 的残差图
该模型可以通过使用非规范链接进行改进。

拟合模型的残差 y = (-0.27571 +0.49277x)2 + e 显示出更加随机的模式。12 df 上的偏差 16.905 略高于之前模型的 16.371(df=11),但仍然不显着(P 值=0.1532>0.10)。AIC 较小,为 73.833<75.298。因此,具有平方根链接的模型是首选。
可以删除常数项(“截距”)吗?
还可以使用哪些其他链接功能?

自测题:
Twenty tobacco budworm moths of each sex were exposed to different doses of the insecticide trans-cypermethrin. The numbers of budworm moths killed during a 3-day exposure were as follows for each sex (male, female) and dose level in mg’s.

Type the data into R as follows. Press Enter at the end of each line including blank lines.
Fit two models by doing the following.
You may also run the following lines and refer to the chi-square distribution table
1. What model is fitted in fit1? Write it formally and define all the terms.
2. How is the model in fit2 differ from that in fit1?
3. Does the model in fit1 fit the data adequately? Use deviance to answer this question.
4. Can the model in fit1 be simplified to the model in fit2? Use change in deviance to answer
this question.
5. Can sex be removed from the model in fit2? Use change in deviance to answer this ques
tion.
6. What are the maximum likelihood estimates of the parameters of the additive model? What
are their standard errors? Test the significance of each parameter using its estimate and
standard error.
7. How does the probability of a kill change with log dose and sex of the budworm moth accord
ing to the additive model?
(a) Derive the survival function S(t) of a lifetime T » E xp(‚). Find ¡logS(t) and comment on it.
(b) Calculate the Kaplan-Meier estimate for each group in the following.
Treatment Group:
6,6,6,6*,7,9*,10,10*,11*,13,16,17*,19*,20*,22,23,25*,32*,32*,34*,35
Control Group (no treatment):
1,1,2,2,3,4,5,5,8,8,8,8,11,11,12,15,17,22,23
Note that * indicates right censored data.
(c) Use the log rank test to compare the two groups of lifetimes.

边栏推荐
- The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
- I register the absolutely deleted data in the source sqlserver, send it to maxcomputer, and write the absolute data when cleaning the data
- Lu MENGZHENG's "Fu of broken kiln"
- 程序员奶爸自制AI喂奶检测仪,预判宝宝饿点,不让哭声影响老婆睡眠
- Detailed explanation of flex box
- What is ci/cd?
- LeetCode 0133. 克隆图
- 使用vsftpd服务传输文件(匿名用户认证、本地用户认证、虚拟用户认证)
- 深度学习的训练、预测过程详解【以LeNet模型和CIFAR10数据集为例】
- 【AI4Code】《GraphCodeBERT: Pre-Training Code Representations With DataFlow》 ICLR 2021
猜你喜欢

ECCV2022 | TransGrasp类级别抓取姿态迁移

Shell常用脚本:获取网卡IP地址

2022.07.24 (lc_6125_equal row and column pairs)

Shell常用脚本:判断远程主机的文件是否存在

2022 年中回顾 | 大模型技术最新进展 澜舟科技

LeetCode 1184. 公交站间的距离

【C语言进阶】动态内存管理

Atcoder beginer contest 261e / / bitwise thinking + DP
Software testing interview question: Please list the testing methods of several items?

Use of hystrix
随机推荐
Does MySQL have flush privileges
【AI4Code】《CoSQA: 20,000+ Web Queries for Code Search and Question Answering》 ACL 2021
【运维、实施精品】月薪10k+的技术岗位面试技巧
R language uses wilcox The test function performs Wilcox signed rank test to obtain the confidence interval of the population median (the default output result includes the confidence interval of 95%
Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
Vim技巧:永远显示行号
工业互联网的内涵及其应用
Detailed explanation of flex box
需求规格说明书模板
pytorch创建自己的Dataset加载数据集
How to understand metrics in keras
跌荡的人生
迁移PaloAlto HA高可用防火墙到Panorama
【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
Eccv2022 | transclassp class level grab posture migration
Leetcode 1184. distance between bus stops
cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘
Zero basic learning canoe panel (13) -- trackbar
Masscode is an excellent open source code fragment manager
Interviewer: "classmate, have you ever done a real landing project?"