怎么利用r语言做em算法估计混合双参数指数分布的数值模拟

Python05

怎么利用r语言做em算法估计混合双参数指数分布的数值模拟,第1张

建议你先看一下这本书:

Modeling Survival Data Using Frailty Models

chap 2. Some Parametric Methods

2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.2 Exponential Distribution . . . . . . . . . . . . . . . . . . . 20

2.3 Weibull Distribution . . . . . . . . . . . . . . . . . . . . . 21

2.4 Extreme Value Distributions . . . . . . . . . . . . . . . . 23

2.5 Lognormal . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2.6 Gamma . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2.7 Loglogistic . . . . . . . . . . . . . . . . . . . . . . . . . 29

2.8 Maximum Likelihood Estimation . . . . . . . . . . . . . 30

2.9 Parametric Regression Models

chap 6. Estimation Methods for Shared Frailty Models

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . .105

6.2 Inference for the Shared Frailty Model . . . . . . . . . . 106

6.3 The EM Algorithm . . . . . . . . . . . . . . . . . . . . . . .108

6.4 The Gamma Frailty Model . . . . . . . . . . . . . . . . . . . 110

6.5 The Positive Stable Frailty Model . . . . . . . . . . . . . . 111

6.6 The Lognormal Frailty Model . . . . . . . . . . . . . . . . . 113

6.6.1 Application to Seizure Data . . . . . . . . . . . . . . . 113

6.7 Modified EM (MEM) Algorithm for Gamma Frailty Models 114

6.8 Application

然后用最基本的package "survival"

并参考你的模型可能用到的一些functions:

survreg(formula, data, weights, subset,na.action, dist="weibull",....)

survreg.distributions include "weibull", "exponential", "gaussian",

"logistic","lognormal" and "loglogistic"

frailty(x, distribution="gamma", ...)

distribution: either the gamma, gaussian or t distribution may be specified.

frailty.gamma(x, sparse = (nclass >5), theta, df, eps = 1e-05,

method = c("em","aic", "df", "fixed"),...)

布。 例如有个人的身高是 1.75 米,显然它更可能属于男性身高这个分布。据此,我们为每条数据都划 定了一个归属。接下来就可以根据最大似然法,通过这些被大概认为是 男性的若干条数据来重新估计男性身高正态分布的参数, 女性的那个分 布同样方法重新估计。然后,当更新了这两个分布的时候,每一个属于 这两个分布的概率又发生了改变,那么就再需要调整参数。如此迭代,

1.EM算法的大概流程主要三部分:需要的预备知识、EM算法详解和对EM算法的改进。

2.EM这个问题感觉真的不太好用通俗的语言去说明白,因为它很简单,又很复杂。简单在于它的思想,简单在于其仅包含了两个步骤就能完成强大的功能,复杂在于它的数学推理涉及到比较繁杂的概率公式等。如果只讲简单的,就丢失了EM算法的精髓,如果只讲数学推理,又过于枯燥和生涩。

3.EM算法基本思想:假设我们想估计的参数为A,B。 开始的时候A和B都未知, 但是如果我们知道了A,就能得到B。 我们得到了B就可以得到A。 EM会给A一个初始值,然后得到B,再由B得到A, 再得到B,一直迭代到收敛为止。