gpt4 book ai didi

r - 从Survreg解释Weibull参数

转载 作者:行者123 更新时间:2023-12-04 03:30:06 25 4
gpt4 key购买 nike

我正在尝试使用从R中survreg估计的参数生成逆Weibull分布。这意味着我想针对给定的概率(在MS Excel中实现的小型仿真模型中为随机数)返回使用我的参数的预期故障时间。我理解逆Weibull分布的一般形式为:

X=b[-ln(1-rand())]^(1/a)

其中a和b分别是形状和比例参数,X是我想要的失效时间。我的问题是来自survreg的intercept和协变量参数的解释。我有以下参数,时间单位是天:
             Value   Std. Error    z    p
(Intercept) 7.79 0.2288 34.051 0.000
Group 2 -0.139 0.2335 -0.596 0.551
Log(scale) 0.415 0.0279 14.88 0.000
Scale= 1.51

Weibull distribution
Loglik(model)= -8356.7 Loglik(intercept only)= -8356.9
Chisq = 0.37 on 1 degrees of freedom, p= 0.55
Number of Newton-Raphson Iterations: 4
n=1682 (3 observations deleted due to missing values)

我已经在帮助文件中阅读到R的系数来自“极值分布”,但是我不确定这的真正含义以及我如何“回到”公式中直接使用的标准比例参数。使用b = 7.79和a = 1.51会给出无意义的答案。我真的希望能够为基础组和“组2”生成时间。我还应注意,我自己没有执行分析,也无法进一步查询数据。

最佳答案

手册页?survreg(在“示例”部分中)对此进行了说明。

library(survival)
y <- rweibull(1000, shape=2, scale=5)
r <- survreg(Surv(y)~1, dist="weibull")
a <- 1/r$scale # Approximately 2
b <- exp( coef(r) ) # Approximately 5
y2 <- b * ( -ln( 1-runif(1000) ) ) ^(1/a)
y3 <- rweibull(1000, shape=a, scale=5)
# Check graphically that the distributions are the same
plot(sort(y), sort(y2))
abline(0,1)

关于r - 从Survreg解释Weibull参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9113872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com