[R-sig-Epi] Simulating a Weibull regression model
duo wan
duo_w@n @end|ng |rom y@hoo@com
Tue Oct 11 20:05:08 CEST 2022
HI All,I am trying to simulate a AFT Weibull model in R using a log-linear mod
log(Y)=β0+β1X1+β2X2+cW
Where W is a extreme value distribution. My R code is below. I can not understand why the intercept estimate is 2.94, not lose to 1? Thanks,
Vincent
install.packages("extRemes")
library(extRemes)
n<-500000
x1<-rnorm(n,0,1)
x2<-rnorm(n,0,1)
error<-revd(n, loc = 0, scale = 1)
b0<- 1
b1<-0.5
b2<--1.2
c<-1
time<-exp(b0+b1*x1+b2*x2+c*error)
status<-rep(1,n)
survreg(Surv(time, status==1) ~ x1+x2,dist="exponential")
####output
Coefficients:
(Intercept) x1 x2
2.9390956 0.4931199 -1.2061369
Scale fixed at 1
#####
[[alternative HTML version deleted]]
More information about the R-sig-Epi
mailing list