Description Usage Arguments Value Author(s) Examples
View source: R/lrs.multistate.R
This function computes a Likelihood Ratio Statistic to compare two embedded multistate models.
1 | lrs.multistate(model1, model0)
|
model1 |
A list containing the results after using a function included in the |
model0 |
A list containing the results after using a function included in the |
statistic |
The value of the statistic. |
ddl |
Degrees of freedom. |
pvalue |
p-value. |
Yohann Foucher <Yohann.Foucher@univ-nantes.fr> and
Florence Gillaizeau <Florence.Gillaizeau@univ-nantes.fr>
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 | data(dataDIVAT)
# A subgroup analysis to reduce the time needed for this example
dataDIVAT$id<-c(1:nrow(dataDIVAT))
set.seed(2)
d3<-dataDIVAT[dataDIVAT$id %in% sample(dataDIVAT$id, 250, replace = FALSE),]
# To illustrate the use of a 3-state model, individuals with trajectory 13 and 123 are
# censored at the time of transition into state X=3
d3$trajectory[d3$trajectory==13]<-1
d3$trajectory[d3$trajectory==123]<-12
d3$trajectory[d3$trajectory==14]<-13
d3$trajectory[d3$trajectory==124]<-123
# 3-state parametric semi-Markov model : does 'z' influence both the
# transition 1->3 ? We only reduced the precision and the number of iteration
# to save time in this example, prefere the default values.
m1 <- sm3(t1=d3$time1, t2=d3$time2, sequence=d3$trajectory, dist=c("E","E","E"),
ini.dist.12=c(9.93), ini.dist.13=c(11.54), ini.dist.23=c(10.21),
cov.12=d3$z, init.cov.12=c(-0.13), names.12=c("beta12_z"),
cov.13=d3$z, init.cov.13=c(1.61), names.13=c("beta13_z"),
conf.int=TRUE, silent=FALSE, precision=0.001)
m1
m0 <- sm3(t1=d3$time1, t2=d3$time2, sequence=d3$trajectory, dist=c("E","E","E"),
ini.dist.12=c(9.93), ini.dist.13=c(11.54), ini.dist.23=c(10.21),
cov.12=d3$z, init.cov.12=c(-0.13), names.12=c("beta12_z"),
conf.int=TRUE, silent=FALSE, precision=0.001)
m0
lrs.multistate(model1=m1, model0=m0)
|
Loading required package: survival
Loading required package: statmod
Loading required package: date
Loading required package: relsurv
****** 3-state semi-Markov model ******
-747.7689
-747.7689
-747.7689
Number of data rows: 250Number of data rows with missing values (deleted): 0
$object
[1] "sm3 (3-state semi-markov model)"
$dist
[1] "E" "E" "E"
$cuts.12
NULL
$cuts.13
NULL
$cuts.23
NULL
$covariates
[1] 1 1 0
$table
Estimate Std.Error t.value Pr(>|t|)
1 log(sigma) on trans. 12 8.3683 0.1543 54.2339 0.0000
2 log(sigma) on trans. 13 10.4961 0.4471 23.4750 0.0000
3 log(sigma) on trans. 23 10.2164 0.5770 17.7052 0.0000
4 beta12_z 0.2253 0.2559 0.8805 0.3786
5 beta13_z 0.5611 0.6708 0.8364 0.4029
$cov.matrix
[,1] [,2] [,3] [,4] [,5]
[1,] 2.380828e-02 3.381919e-10 1.126534e-10 2.380828e-02 8.459337e-10
[2,] 3.381919e-10 1.999148e-01 4.729675e-09 8.117579e-10 1.999148e-01
[3,] 1.126534e-10 4.729675e-09 3.329631e-01 -2.817145e-10 8.280105e-09
[4,] 2.380828e-02 8.117579e-10 -2.817145e-10 6.548133e-02 1.615743e-09
[5,] 8.459337e-10 1.999148e-01 8.280105e-09 1.615743e-09 4.500320e-01
$LogLik
[1] -747.7689
$AIC
[1] 1505.538
****** 3-state semi-Markov model ******
-748.1084
-748.1084
-748.1084
Number of data rows: 250Number of data rows with missing values (deleted): 0
$object
[1] "sm3 (3-state semi-markov model)"
$dist
[1] "E" "E" "E"
$cuts.12
NULL
$cuts.13
NULL
$cuts.23
NULL
$covariates
[1] 1 0 0
$table
Estimate Std.Error t.value Pr(>|t|)
1 log(sigma) on trans. 12 8.3682 0.1543 54.2355 0.0000
2 log(sigma) on trans. 13 10.2844 0.3333 30.8546 0.0000
3 log(sigma) on trans. 23 10.2179 0.5775 17.6946 0.0000
4 beta12_z 0.2255 0.2559 0.8812 0.3782
$cov.matrix
[,1] [,2] [,3] [,4]
[1,] 2.380646e-02 -7.517282e-11 -1.128125e-10 2.380646e-02
[2,] -7.517282e-11 1.111004e-01 -2.672008e-19 -2.067322e-10
[3,] -1.128125e-10 -2.672008e-19 3.334589e-01 8.461978e-11
[4,] 2.380646e-02 -2.067322e-10 8.461978e-11 6.546997e-02
$LogLik
[1] -748.1084
$AIC
[1] 1504.217
statistic ddl pvalue
0.6789791 1.0000000 0.4099385
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.