MATH39512 Survival Analysis for Actuarial Science: example sheet 5Processing

Java Python MATH39512 Survival Analysis for Actuarial Science: example sheet 5

*=easy, **=intermediate, ***=difficult

* Exercise 5.1

Consider again Exercise 2.4

(a) Use R to produce a plot of the Kaplan-Meier estimate of the data set in Exercise 2.4.

(b) Use R to compute the estimate in part (c) of Exercise 2.4 in an efficient way.  (Hint:  use the survfit() command to create suitable vectors and then use the diff() and sum() commands.)

* Exercise 5.2

Consider again Exercise 3.4.

(a) Use R to produce a plot of the Nelson-Aalen estimate of the data set in Exercise 3.4.

(b) Use R to produce a plot of the estimate of the variance of the N-A estimator as defined in Exercise 3.4.  (Hint: use the last piece of code in Section A.1 for inspiration.)

*** Exercise 5.3

In R, install and load the KMsurv package containing datasets from the book of Klein and Moeschberger (1997) Survival Analysis Techniques for Censored and truncated data, Springer. This can be done

via the commands

1    install . packages ( " KM surv " )

2 library (KM surv)

Load the data set channing by using the command data(channing).  This produces a data frame called channing which consists of data on the death times of 462 elderly residents of Channing House, a retirement centre in California.  Use help(channing)  to get further information on this data set.

(a) Work with time since entry into the retirement centre as the time scale.

(i) Produce  a suitable plot containing both the Kaplan-Meier estimate of the survival function of a male as well as of a female resident.

(ii) What is the estimated median number of months that a resident spends in the retirement centre.

(iii) Perform the log-rank test at the 5% significance level to test whether there is a difference in the survival time distribution between male and female residents and report your conclusions.

(iv) Perform the log-rank test at the 5% significance level to test whether there is a difference in the survival time distribution between a female resident with age at entry less than 75 years exact and a female resident with age at entry more than or equal to 75 years

exact. Report your conclusions. (b) Work with age as the time scale.

(i) Produce a suitable plot containing the Kaplan-Meier estimate of the survival function of a female resident.

(ii) Produce a suitable plot containing the Kaplan-Meier estimate of the survival function of a male resident.  (Hint: there is problem with the male data&nb MATH39512 Survival Analysis for Actuarial Science: example sheet 5Processing sp;which prevents one from getting a sensible K-M estimate.  Find out what the problem is and come up with an appropriate workaround.)

(iii) Why is it not a good idea to provide the plots in one graph as in part (a)(i)?

(iv) Estimate the probability that a male resident dies between the ages 80 exact and 85 exact.

(v) Estimate the conditional expectation of the age at death in years of a female resident given that she dies before age 90 exact.

** Exercise 5.4

Consider the following survival data corresponding to a homogeneous group of 20 individuals where + denotes a censored value:

6.7    12.8    5.5+    4.9+    4.3+    5.6       7.6    4.8      3.7+     15.6+

3.3    7.4      6.0        2.6       11.0     4.2+     6.9    15.9     8.4       7.5+

Check graphically if a Weibull distribution of the survival times corresponding to the data is appropriate. Do the same with an exponential distribution. Report your conclusions.

*** Exercise 5.5

Let Ti  be the survival time and Ci  the censoring time of individual i = 1, . . . ,n. Assume the pairs (T1, C1 ), (T2, C2 ), ...,(Tn, Cn) are i.i.d. and the common joint survival function of (Ti, Ci) is given by

e(Ti  > t, Ci  > y) = e−µt−βy−θty,    t,y ≥ 0,

where the parameters µ , β and θ satisfy µ > 0, β > 0 and θ ∈ [0,µβ].  (Note that in the literature, (Ti, Ci) is said to have a Gumbel’s bivariate exponential distribution.)  For this exercise you should make use of the R script simbivarexp .r which generates outcomes of (Ti, Ci).  This script can be

found on the course materials webpage.

(a) What is the hazard function of T1?

(b) Assume µ = 1, β = 1.5 and θ = 0.  Simulate outcomes of (Ti, Ci) for two groups consisting of 1000 (independent) individuals each.  Assume that for one group you observe the exact surivival times Ti  for each individual (i.e.  there is no censoring) whereas for the other group you only observe the minimum of Ti  and Ci  for each individual (i.e. there is censoring).  Plot the Kaplan-Meier estimates for both groups and perform the log-rank test by using R.

(c) Do the same as in part (a) but now assume θ = 1.5 instead of θ = 0.

(d) Report your conclusions regarding whether or not the censoring is independent for each of the two cases considered (i.e. the case in part (a) and the case in part (b))         

  • 8
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断路器保护灵敏度校验整改及剩余电流监测试点应用站用交流系统断
生存分析是一种用于研究个体或群体生存时间的统计方法。生存分析可以用来分析各种领域的数据,如医学、生物学和社会科学。而R是一种流行的编程语言和统计软件,提供了丰富的统计分析和数据可视化功能,包括生存分析。 在R中进行生存分析,常用的包括survival、survminer和rms等。其中,survival包提供了进行生存分析所需的核心函数和方法,如Kaplan-Meier曲线、Cox比例风险模型和Cox-Snell残差等。survminer包则提供了生存分析结果的可视化函数,如生存曲线的绘制、风险分组的比较和生存曲线的注释等。而rms包则提供了更高级的生存分析和建模功能。 进行生存分析的基本步骤包括:导入数据、定义生存时间和事件变量、构建生存函数对象、绘制生存曲线、进行生存分析模型拟合、进行风险因素分析和模型验证等。在R中,可以使用相应包中的函数和方法来实现这些步骤,从而进行全面的生存分析。 生存分析在许多领域中都非常重要,例如医学中研究疾病存活时间、药物疗效评估和预后判断;生物学中研究个体寿命和遗传因素对生存的影响;社会科学中研究人口统计学数据和社会事件对生存的影响等。通过使用R进行生存分析,可以更方便地进行数据处理、模型拟合和结果可视化,从而为研究者提供更多有关生存时间的有用信息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值