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
num.killed sex dose
1 1 male 1
2 4 male 2
3 9 male 4
4 13 male 8
5 18 male 16
6 20 male 32
7 0 female 1
8 2 female 2
9 6 female 4
10 10 female 8
11 12 female 16
12 16 female 32
Type the data into R as follows. Press Enter at the end of each line including blank lines.
num.killed <- scan()
1 4 9 13 18 20 0 2 6 10 12 16
sex <- scan()
0 0 0 0 0 0 1 1 1 1 1 1
dose <- scan()
1 2 4 8 16 32 1 2 4 8 16 32
Fit two models by doing the following.
ldose <- log(dose)/log(2) #convert to base-2 log dose
ldose #have a look
| y <- cbind(num.killed, 20-num.killed) | #add number survived |
| ---------------------------------------------------------- | -------------------- |
| fit1 <- glm(y ~ ldose * sex, family=binomial(link=probit)) | |
| fit2 <- glm(y ~ sex + ldose, family=binomial(link=probit))
You may also run the following lines and refer to the chi-square distribution table. |
---|
anova(fit1,test="Chisq") |
| ------------------------ |
| summary(fit2)
No other R commands are allowed. |
---|
Hand in your answers to the following for assessment. 1. What model is fitted in fit1? Write it formally and define all the terms. | [4] |
---|---|
2. How is the model in fit2 differ from that in fit1? | [2] |
3. Does the model in fit1 fit the data adequately? Use deviance to answer this question. | [2] |
(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. All the answers should be obtained by hand. Calculators may be used. Some intermediate steps should be included. You may check your answers using R, but do not hand in any R output
1
Fit1模型使用的是logistic回归模型。
yi = π + ε∼ B (1, πi ) independent,
log(π)= β0 sex+ β1ldose+β2sexldose
2
模型1中将sex 和ldose的乘积作为一个自变量,考虑到sex,lodose以及他们的交叉影响,而模型2将sex 和ldose分别作为两个自变量来对y进行回归预测模型。
3
从方差分析结果来看,可以看到ldose sex 以及ldose和sex的乘积三个变量的偏差值值的p值都远远小于0.05,也就是这三个变量对budworm moths killed这个变量都有显著的影响。但是他们的deviance resid 偏差残差值较大,即模型的预测值与实验结果有较大偏差,因此可以认为模型拟合度较差。
4
从偏差残差值来看拟合模型1可以简化成模型2,因为他们的deviance residuals相差很大,模型2的偏差残差值要明显低于模型1.,说明模型2的拟合效果要好于模型1,从而可以删去性别*ldose这个变量。
5
从模型2的结果来看,性别这个变量的相关系数的p值远小于0.001,即性别对死亡率由明显的影响,因此不能从模型中去除。
6
模型的极大似然估计参数为-0.93285 -0.95和0.42948.他们的标准差为0.19043,0.19120和0.05992。
从显著性p值和预测的系数和标准差的关系来看,p值越小,如ldoese这个变量,那么他的标准差越小,而估计的参数就越大,对死亡率的影响也越大。
7
因此,根据变量的p值来看,当sex和ldose改变的时候,有99%以上的把握可以拒绝原假设即性别与ldose对死亡率没有影响,即引起死亡率的变化。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。