搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  allvar.xlsx
资料下载链接地址: https://bbs.pinggu.org/a-2003395.html
附件大小:
70.14 KB   举报本内容
一套数据出的三套题目,一点头绪都没有,目前只做出了第一大题第一小题……部分原因是英语太差……求高手指导……至少给点,思路,谢谢。数据已经附件上传

第一大题我试着写了下, 可是后两个小题一直报错……
####################Chapter11 exercise4(1)###################
allvar <- read.csv("H:/software/RStudio/files/allvar.csv")
HIV<-na.omit(allvar);
HIV;
time<-HIV$visage-HIV$baseage
HIV<-cbind(HIV,time);
for (i in 1:4) {plot(time[HIV$newpid==i],HIV$CD4PCT[HIV$newpid==i],xlab="time",ylab="CD4 percentage",type ="b")
}

####################Chapter11 exercise4(2)###################
child<-0
MAX<-max(HIV$newpid);
for (i in 1:MAX){child<-lm(HIV$CD4PCT[HIV$newpid==i]~HIV$time[HIV$newpid==i])
}
child1<-lm(HIV$CD4PCT[HIV$newpid==1]~HIV$time[HIV$newpid==1]);
child2<-lm(HIV$CD4PCT[HIV$newpid==2]~HIV$time[HIV$newpid==2]);
child1
####################Chapter11 exercise4(3)###################
#step1
treatment<-0
for (i in 1:MAX) {treatment<-lm(HIV$CD4PCT[HIV$newpid==i]~HIV$treatmnt[HIV$newpid==i]+HIV$visage[HIV$newpid==i]}

11.7
The folder cd4 has CD4 percentages for a set of young children with HIV who
were measured several times over a period of two years. The dataset also includes
the ages of the children at each measurement.
(a) Graph the outcome (the CD4 percentage, on the square root scale) for each
child as a function of time.
(b) Each child’s data has a time course that can be summarized by a linear fit.
Estimate these lines and plot them for all the children.
(c) Set up a model for the children’s slopes and intercepts as a function of
the treatment and age at baseline. Estimate this model using the two-step
procedure–first estimate the intercept and slope separately for each child, then
fit the between-child models using the point estimates from the first step.
12.2
(a) Write a model predicting CD4 percentage as a function of time with varying
intercepts across children. Fit using lmer() and interpret the coefficient for
time.
(b) Extend the model in (a) to include child-level predictors (that is, group-level
predictors) for treatment and age at baseline. Fit using lmer() and interpret
the coefficients on time, treatment, and age at baseline.
(c) Investigate the change in partial pooling from (a) to (b) both graphically and
numerically.
(d) Compare results in (b) to those obtained in part (c).
13.4
(a) Extend the model in Exercise 12.2 to allow for varying slopes for the time
predictor.
(b) Next fit a model that does not allow for varying slopes but does allow for
different coefficients for each time point (rather than fitting the linear trend).
(c) Compare the results of these models both numerically and graphically.




    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-25 05:05