当前位置:网站首页>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.

边栏推荐
- 状态(State)模式
- Plus SBOM: assembly line BOM pbom
- AtCoder Beginner Contest 261E // 按位思考 + dp
- Seven lines of code made station B crash for three hours, but "a scheming 0"
- Interviewer: "classmate, have you ever done a real landing project?"
- Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
- [rust] reference and borrowing, string slice type (& STR) - rust language foundation 12
- Force deduction 83 biweekly T4 6131. The shortest dice sequence impossible to get, 303 weeks T4 6127. The number of high-quality pairs
- Shell常用脚本:判断远程主机的文件是否存在
- Intval MD5 bypass [wustctf2020] plain
猜你喜欢

Zero basic learning canoe panel (14) -- led control and LCD control
What does the software testing process include? What are the test methods?

如何用因果推断和实验驱动用户增长? | 7月28日TF67

零基础学习CANoe Panel(16)—— Clock Control/Panel Control/Start Stop Control/Tab Control

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

massCode 一款优秀的开源代码片段管理器

程序的内存布局

2022 年中回顾 | 大模型技术最新进展 澜舟科技
![SSTI template injection vulnerability summary [bjdctf2020]cookie is so stable](/img/19/0b943019fe1c959c4b79035a814410.png)
SSTI template injection vulnerability summary [bjdctf2020]cookie is so stable

卷积核越大性能越强?一文解读RepLKNet模型
随机推荐
[rust] reference and borrowing, string slice type (& STR) - rust language foundation 12
"Wei Lai Cup" 2022 Niuke summer multi school training camp 2 supplementary problem solution (g, J, K, l)
Can flinkcdc import multiple tables in mongodb database together?
基于JEECG制作一个通用的级联字典选择控件-DictCascadeUniversal
[problem solving] org.apache.ibatis.exceptions PersistenceException: Error building SqlSession. 1-byte word of UTF-8 sequence
Interviewer: "classmate, have you ever done a real landing project?"
零基础学习CANoe Panel(15)—— 文本输出(CAPL Output View )
485 communication (detailed explanation)
Microsoft proposed CodeT: a new SOTA for code generation, with 20 points of performance improvement
Kyligence was selected into Gartner 2022 data management technology maturity curve report
【重温SSM框架系列】15 - SSM系列博文总结【SSM杀青篇】
Use of hystrix
Make a general cascade dictionary selection control based on jeecg -dictcascadeuniversal
The programmer's father made his own AI breast feeding detector to predict that the baby is hungry and not let the crying affect his wife's sleep
零基础学习CANoe Panel(16)—— Clock Control/Panel Control/Start Stop Control/Tab Control
Substance Designer 2021软件安装包下载及安装教程
MySQL remote connection permission error 1045 problem
[operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
[problem solving] ibatis.binding BindingException: Type interface xxDao is not known to the MapperRegistry.
如何理解Keras中的指标Metrics