Description Usage Arguments Details Value Author(s) Examples
Function to generate an illness-death model for simulation.
1 2 3 4 | idmModel(scale.illtime = 1/100, shape.illtime = 1, scale.lifetime = 1/100,
shape.lifetime = 1, scale.waittime = 1/100, shape.waittime = 1,
scale.censtime = 1/100, shape.censtime = 1, n.inspections = 5,
schedule = 10, punctuality = 5)
|
scale.illtime |
Weilbull scale for latent illness time |
shape.illtime |
Weilbull shape for latent illness time |
scale.lifetime |
Weilbull scale for latent life time |
shape.lifetime |
Weilbull shape for latent life time |
scale.waittime |
Weilbull scale for latent life time |
shape.waittime |
Weilbull shape for latent life time |
scale.censtime |
Weilbull scale for censoring time |
shape.censtime |
Weilbull shape for censoring time |
n.inspections |
Number of inspection times |
schedule |
Mean of the waiting time between adjacent inspections. |
punctuality |
Standard deviation of waiting time between inspections. |
Based on the functionality of the lava PACKAGE the function generates a latent variable model (latent illtime, waittime and lifetime) and censoring mechanism (censtime, inspection1,inspection2,...,inspectionK).
The function sim.idmModel
then simulates
right censored lifetimes and interval censored illness times.
A latent variable model object lvm
Thomas Alexander Gerds
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | ## Not run:
library(lava)
library(prodlim)
# generate illness-death model based on exponentially
# distributed times
m <- idmModel(scale.illtime=1/70,
shape.illtime=1.8,
scale.lifetime=1/50,
shape.lifetime=0.7,
scale.waittime=1/30,
shape.waittime=0.7)
round(sim(m,6),1)
# Estimate the parameters of the Weibull models
# based on the uncensored exact event times
# and the uncensored illstatus.
set.seed(18)
d <- sim(m,100,latent=FALSE)
d$uncensored.status <- 1
f <- idm(formula01=Hist(time=illtime,event=illstatus)~1,
formula02=Hist(time=lifetime,event=uncensored.status)~1,
data=d,
conf.int=FALSE)
print(f)
# Change the rate of the 0->2 and 0->1 transitions
# also the rate of the 1->2 transition
# and also lower the censoring rate
m <- idmModel(scale.lifetime=1/2000,
scale.waittime=1/30,
scale.illtime=1/1000,
scale.censtime=1/1000)
set.seed(18)
d <- sim(m,50,latent=TRUE)
d$uncensored.status <- 1
f <- idm(formula01=Hist(time=observed.illtime,event=illstatus)~1,
formula02=Hist(time=observed.lifetime,event=uncensored.status)~1,
data=d,
conf.int=FALSE)
print(f)
# Estimate based on the right censored observations
fc <- idm(formula01=Hist(time=illtime,event=seen.ill)~1,
formula02=Hist(time=observed.lifetime,event=seen.exit)~1,
data=d,
conf.int=FALSE)
print(fc)
# Estimate based on interval censored and right censored observations
fi <- idm(formula01=Hist(time=list(L,R),event=seen.ill)~1,
formula02=Hist(time=observed.lifetime,event=seen.exit)~1,
data=d,
conf.int=FALSE)
print(fi)
# Estimation of covariate effects:
# X1, X2, X3
m <- idmModel(shape.waittime=2,
scale.lifetime=1/2000,
scale.waittime=1/300,
scale.illtime=1/10000,
scale.censtime=1/10000)
distribution(m,"X1") <- binomial.lvm(p=0.3)
distribution(m,"X2") <- normal.lvm(mean=120,sd=20)
distribution(m,"X3") <- normal.lvm(mean=50,sd=20)
regression(m,to="latent.illtime",from="X1") <- 1.7
regression(m,to="latent.illtime",from="X2") <- 0.07
regression(m,to="latent.illtime",from="X3") <- -0.1
regression(m,to="latent.waittime",from="X1") <- 1.8
regression(m,to="latent.lifetime",from="X1") <- 0.7
set.seed(28)
d <- sim(m,100,latent=TRUE)
head(d)
table(ill=d$seen.ill,death=d$seen.exit)
# Estimation based on uncensored data
d$uncensored.status <- 1
# uncensored data
F1 <- idm(formula01=Hist(time=illtime,event=illstatus)~X1+X2+X3,
formula02=Hist(time=lifetime,event=uncensored.status)~X1+X2+X3,
data=d,conf.int=FALSE)
print(F1)
# Estimation based on right censored data
F2 <- idm(formula01=Hist(time=illtime,event=seen.ill)~X1+X2+X3,
formula02=Hist(time=observed.lifetime,event=seen.exit)~X1+X2+X3,
data=d,conf.int=FALSE)
print(F2)
# Estimation based on interval censored and right censored data
F3 <- idm(formula01=Hist(time=list(L,R),event=seen.ill)~X1+X2+X3,
formula02=Hist(time=observed.lifetime,event=seen.exit)~X1+X2+X3,
data=d,conf.int=FALSE)
print(F3)
cbind(uncensored=F1$coef,right.censored=F2$coef,interval.censored=F3$coef)
## End(Not run)
|
Loading required package: prodlim
censtime illtime illstatus lifetime L R seen.ill seen.exit
1 87.3 9.8 1 21.5 6.9 19.1 1 1
2 116.2 12.4 1 114.9 0.0 13.2 1 1
3 68.8 6.6 1 84.6 0.0 13.4 1 0
4 34.1 14.4 1 38.7 13.5 18.4 1 0
5 37.2 8.4 1 121.7 0.0 10.8 1 0
6 73.0 4.6 1 67.3 0.0 5.4 1 1
observed.lifetime observed.illtime
1 21.5 9.8
2 114.9 12.4
3 68.8 6.6
4 34.1 14.4
5 37.2 8.4
6 67.3 4.6
Call:
idm(formula01 = Hist(time = illtime, event = illstatus) ~ 1,
formula02 = Hist(time = lifetime, event = uncensored.status) ~
1, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 100
number of events '0 -> 1': 94
number of events '0 -> 2' or '0 -> 1 -> 2': 100
number of covariates: 0 0 0
----
Model converged.
number of iterations: 7
convergence criteria: parameters= 4.5e-11
: likelihood= 8.9e-09
: second derivatives= 6.2e-16
Without covariates With covariates
log-likelihood -876.4219 0
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.8852734 0.819140818 0.5239669
scale (b) 0.1026855 0.004036428 0.0126208
Call:
idm(formula01 = Hist(time = observed.illtime, event = illstatus) ~
1, formula02 = Hist(time = observed.lifetime, event = uncensored.status) ~
1, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 50
number of events '0 -> 1': 34
number of events '0 -> 2' or '0 -> 1 -> 2': 50
number of covariates: 0 0 0
----
Model converged.
number of iterations: 11
convergence criteria: parameters= 1.2e-11
: likelihood= 2e-09
: second derivatives= 2.5e-14
Without covariates With covariates
log-likelihood -500.183 0
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.324300827 1.241391811 1.17527272
scale (b) 0.001928705 0.001052337 0.03612296
Call:
idm(formula01 = Hist(time = illtime, event = seen.ill) ~ 1, formula02 = Hist(time = observed.lifetime,
event = seen.exit) ~ 1, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 50
number of events '0 -> 1': 18
number of events '0 -> 2' or '0 -> 1 -> 2': 24
number of covariates: 0 0 0
----
Model converged.
number of iterations: 11
convergence criteria: parameters= 1.2e-09
: likelihood= 4.7e-08
: second derivatives= 5.6e-13
Without covariates With covariates
log-likelihood -274.9932 0
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.07423525 1.2515356328 0.95656563
scale (b) 0.00106407 0.0004829543 0.03842021
Warning message:
In idm(formula01 = Hist(time = list(L, R), event = seen.ill) ~ 1, :
Model did not converge. You could try to increase the 'maxit' parameter and set 'CV=1'.
Call:
idm(formula01 = Hist(time = list(L, R), event = seen.ill) ~ 1,
formula02 = Hist(time = observed.lifetime, event = seen.exit) ~
1, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 50
number of events '0 -> 1': 18
number of events '0 -> 2' or '0 -> 1 -> 2': 24
number of covariates: 0 0 0
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.000000000 1.000000000 1.000000000
scale (b) 0.000982495 0.001309993 0.001309993
Warning messages:
1: In print.idm(fi) : The model did not converge.
2: Maximum number of iterations reached.
latent.illtime latent.lifetime latent.waittime censtime X1 X2 X3
1 1.217973 2804.9085 14.518521 33713.559 0 134.6338 11.95686
2 280.525594 748.9620 7.263955 3508.494 0 132.2453 48.71410
3 1.162656 592.3499 23.795270 8732.422 0 128.7554 23.37666
4 2.341798 5638.3843 9.969513 17502.474 1 110.3836 13.60017
5 245.194273 781.3930 6.962619 19363.433 1 109.8695 53.25339
6 510.382597 955.4774 12.837700 1265.768 0 121.8592 60.62793
illtime illstatus lifetime L R seen.ill seen.exit
1 1.217973 1 15.73649 0.00000 9.574974 1 1
2 280.525594 1 287.78955 49.81715 287.789549 1 1
3 1.162656 1 24.95793 0.00000 17.479958 1 1
4 2.341798 1 12.31131 0.00000 3.979647 1 1
5 245.194273 1 252.15689 43.89710 252.156891 1 1
6 510.382597 1 523.22030 44.38116 523.220297 1 1
observed.lifetime observed.illtime
1 15.73649 1.217973
2 287.78955 280.525594
3 24.95793 1.162656
4 12.31131 2.341798
5 252.15689 245.194273
6 523.22030 510.382597
death
ill 0 1
0 4 22
1 0 74
Call:
idm(formula01 = Hist(time = illtime, event = illstatus) ~ X1 +
X2 + X3, formula02 = Hist(time = lifetime, event = uncensored.status) ~
X1 + X2 + X3, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 100
number of events '0 -> 1': 77
number of events '0 -> 2' or '0 -> 1 -> 2': 100
number of covariates: 3 3 3
----
Model converged.
number of iterations: 12
convergence criteria: parameters= 9.2e-10
: likelihood= 1.7e-09
: second derivatives= 3.3e-14
Without covariates With covariates
log-likelihood -986.0347 -890.4222
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.0871865355 1.481407274 1.25719831
scale (b) 0.0002190188 0.000168841 0.01308373
Regression coefficients:
$`transition 0 -> 1`
Factor coef SE coef exp(coef) CI p-value
1 X1 1.5978 0.3099 4.9421 [2.69; 9.07] < 1e-04
2 X2 0.0743 0.0086 1.0771 [1.06; 1.10] < 1e-04
3 X3 -0.1199 0.0124 0.8870 [0.87; 0.91] < 1e-04
$`transition 0 -> 2`
Factor coef SE coef exp(coef) CI p-value
4 X1 1.4709 0.5353 4.3530 [1.52;12.43] 0.005997
5 X2 0.0127 0.0120 1.0128 [0.99; 1.04] 0.290496
6 X3 0.0003 0.0170 1.0003 [0.97; 1.03] 0.985167
$`transition 1 -> 2`
Factor coef SE coef exp(coef) CI p-value
7 X1 1.2514 0.3150 3.4951 [1.89; 6.48] < 1e-04
8 X2 0.0150 0.0081 1.0151 [1.00; 1.03] 0.063200
9 X3 -0.0118 0.0107 0.9883 [0.97; 1.01] 0.269752
Call:
idm(formula01 = Hist(time = illtime, event = seen.ill) ~ X1 +
X2 + X3, formula02 = Hist(time = observed.lifetime, event = seen.exit) ~
X1 + X2 + X3, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 100
number of events '0 -> 1': 74
number of events '0 -> 2' or '0 -> 1 -> 2': 96
number of covariates: 3 3 3
----
Model converged.
number of iterations: 13
convergence criteria: parameters= 3.3e-09
: likelihood= 1.1e-07
: second derivatives= 1.6e-13
Without covariates With covariates
log-likelihood -942.8116 -847.0686
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.0959001727 1.4474687373 1.25941541
scale (b) 0.0001848469 0.0001183147 0.01132937
Regression coefficients:
$`transition 0 -> 1`
Factor coef SE coef exp(coef) CI p-value
1 X1 1.6380 0.3125 5.1448 [2.79; 9.49] < 1e-04
2 X2 0.0767 0.0089 1.0797 [1.06; 1.10] < 1e-04
3 X3 -0.1221 0.0128 0.8850 [0.86; 0.91] < 1e-04
$`transition 0 -> 2`
Factor coef SE coef exp(coef) CI p-value
4 X1 1.2724 0.5566 3.5695 [1.20;10.63] 0.02224
5 X2 0.0154 0.0119 1.0155 [0.99; 1.04] 0.19701
6 X3 0.0043 0.0175 1.0043 [0.97; 1.04] 0.80739
$`transition 1 -> 2`
Factor coef SE coef exp(coef) CI p-value
7 X1 1.2607 0.3188 3.5277 [1.89; 6.59] < 1e-04
8 X2 0.0156 0.0086 1.0157 [1.00; 1.03] 0.06895
9 X3 -0.0090 0.0111 0.9910 [0.97; 1.01] 0.41700
Call:
idm(formula01 = Hist(time = list(L, R), event = seen.ill) ~ X1 +
X2 + X3, formula02 = Hist(time = observed.lifetime, event = seen.exit) ~
X1 + X2 + X3, data = d, conf.int = FALSE)
Illness-death regression model using Weibull parametrization
to estimate the baseline transition intensities.
number of subjects: 100
number of events '0 -> 1': 74
number of events '0 -> 2' or '0 -> 1 -> 2': 96
number of covariates: 3 3 3
----
Model converged.
number of iterations: 15
convergence criteria: parameters= 1.1e-09
: likelihood= 1.8e-08
: second derivatives= 1.8e-13
Without covariates With covariates
log-likelihood -729.9178 -645.8426
Parameters of the Weibull distributions: 'S(t) = exp(-(b*t)^a)'
transition 0 -> 1 transition 0 -> 2 transition 1 -> 2
shape (a) 1.0967495268 1.4480228688 1.28707317
scale (b) 0.0002480193 0.0001182723 0.00872902
Regression coefficients:
$`transition 0 -> 1`
Factor coef SE coef exp(coef) CI p-value
1 X1 1.6195 0.3391 5.0504 [2.60; 9.82] < 1e-04
2 X2 0.0713 0.0097 1.0739 [1.05; 1.09] < 1e-04
3 X3 -0.1166 0.0139 0.8899 [0.87; 0.91] < 1e-04
$`transition 0 -> 2`
Factor coef SE coef exp(coef) CI p-value
4 X1 1.2717 0.5565 3.5668 [1.20;10.62] 0.022306
5 X2 0.0153 0.0119 1.0154 [0.99; 1.04] 0.196893
6 X3 0.0044 0.0174 1.0044 [0.97; 1.04] 0.802736
$`transition 1 -> 2`
Factor coef SE coef exp(coef) CI p-value
7 X1 1.3730 0.4669 3.9471 [1.58; 9.86] 0.003273
8 X2 0.0194 0.0109 1.0196 [1.00; 1.04] 0.075078
9 X3 -0.0108 0.0149 0.9893 [0.96; 1.02] 0.468960
uncensored right.censored interval.censored
X1 1.5977853755 1.637979393 1.619471967
X2 0.0742504069 0.076655201 0.071275469
X3 -0.1199068963 -0.122127934 -0.116631554
X1 1.4708637246 1.272435012 1.271655708
X2 0.0126847580 0.015367886 0.015314126
X3 0.0003152041 0.004260136 0.004354287
X1 1.2513711588 1.260652896 1.372976038
X2 0.0150219691 0.015624757 0.019446165
X3 -0.0117993289 -0.009032945 -0.010769769
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.