Association between BMD and mortality risk: A multistate approach

Analysis plan

Rationales: - Previous studies have shown a significantly positive association betwen BMD and mortality risk. Nevertheless, the occurance of incident fractures was not accounted for in the previous studies. Given a proven mortality risk following fragility fractures, it is critical to control for the occurence of incident fractures in any assessment of the association between BMD and mortality risk. - Evidence of “off-label” treatment of osteoporosis on mortality has been found, though there is no accepted biomechanisms. - Robust evidence of beneficial contribution of BMD (i.e., ~ possible benefits of osteoporosis treatments) would widen the treatment indications, ultimately reducing the risk of mortality. Analysis approach: - Multistate regression to differentiate the contribution of BMD to (i) incident fracture (which is well established), (ii) death without fractures, and (iii) post-fracture deaths.

Data management

bmd.0 = read.csv("C:\\Thach\\Research projects\\BMD and mortality\\Data\\SOF_MrOS_Dubbo_CaMos_Nick_28mar24.csv")

bmd = subset(bmd.0, select = c("ID", "gender", "age", "race", "education", "weight", "height", "BMI", "smoke", "drink", "fall", "fx50", "physical", "hypertension", "copd", "parkinson", "cancer", "rheumatoid", "cvd", "renal", "depression", "diabetes", "fnbmd", "anyfx", "death", "Tscore", "event", "state", "time2event", "ageBase", "fnbmdBase", "TscoreBase", "time2end"), data == "MrOS" | data == "SOF")
dim(bmd)
## [1] 30553    33
head(bmd)
##   ID gender   age    race education weight height     BMI smoke drink fall fx50
## 1  1      F 69.00 1:WHITE         9   67.3  150.5 29.7127     1     1    2    1
## 2  1      F 86.01 1:WHITE         9   59.5  148.8 26.8727     1     1    2    1
## 3  2      F 84.00 1:WHITE        10   68.4  151.8 29.6833     0     0    1    1
## 4  2      F 90.53 1:WHITE        10   68.4  151.8 29.6833     0     0    1    1
## 5  3      F 75.00 1:WHITE        12   72.7  151.0 31.8846     1     1    3    0
## 6  3      F 93.46 1:WHITE        12   61.7  147.2 28.4754     1     1    3    0
##   physical hypertension copd parkinson cancer rheumatoid cvd renal depression
## 1        0            0    0         0      0          0   0     0          0
## 2        0            0    0         0      0          0   0     0          0
## 3        0            1    0         0      0          0   1     0          0
## 4        0            1    0         0      0          0   1     0          0
## 5        1            0    1         0      1          0   0     0          0
## 6        1            0    1         0      1          0   0     0          0
##   diabetes  fnbmd anyfx death  Tscore event state time2event ageBase fnbmdBase
## 1        0 0.6560     0     0 -2.1077  Well     1     0.0000      69     0.656
## 2        0 0.6349     0     0 -2.2700  Well     1    17.2238      69     0.656
## 3        2 0.5850     0     1 -2.6538  Well     1     0.0000      84     0.585
## 4        2 0.5850     0     1 -2.6538 Death     3     6.5325      84     0.585
## 5        0 0.6540     0     0 -2.1231  Well     1     0.0000      75     0.654
## 6        0 0.5537     0     0 -2.8946  Well     1    18.6366      75     0.654
##   TscoreBase time2end
## 1    -2.1077  17.2238
## 2    -2.1077   5.0103
## 3    -2.6538   6.5325
## 4    -2.6538   6.5325
## 5    -2.1231  18.6366
## 6    -2.1231   6.4586
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
bmd = bmd %>% mutate(fx_death = case_when(anyfx == 0 & death == 0 ~ "Event-free",
                                          anyfx == 1 & death == 0 ~ "Fractured, Alive",
                                          anyfx == 0 & death == 1 ~ "No Fractured, Dead",
                                          anyfx == 1 & death == 1 ~ "Fractured, Dead"))
bmd = bmd %>% mutate(fall.no = case_when(fall == 0 ~ "0",
                                         fall == 1 ~ "1",
                                         fall == 2 ~ "2",
                                         fall >= 3 ~ "3+"))
bmd = bmd %>% mutate(fall.yesno = case_when(fall == 0 ~ "No",
                                            fall >= 1 ~ "Yes"))
bmd$Tscore.2 = bmd$Tscore*(-1)
bmd$TscoreBase.2 = bmd$TscoreBase*(-1)
bmd = bmd %>% mutate(cvd.n = case_when(cvd == 0 ~ "No",
                                       cvd >= 1 ~ "Yes"))
bmd = bmd %>% mutate(diabetes.n = case_when(diabetes == 0 ~ "No",
                                            diabetes >= 1 ~ "Yes"))
bmd = bmd %>% mutate(drink.n = case_when(drink == 0 ~ "No",
                                         drink >= 1 ~ "Yes"))

1. MEN

1.1 Description of study sample

men = subset(bmd, gender == "M" & race == "1:WHITE")
baseline.m = subset(men, state == 1 & time2event == 0)
library(table1)
## 
## Attaching package: 'table1'
## The following objects are masked from 'package:base':
## 
##     units, units<-
table1(~ ageBase + fnbmdBase + TscoreBase + as.factor(fall.no) + fall.yesno + as.factor(fx50) + race + weight + 
         height + BMI + as.factor(smoke) + as.factor(drink.n) + as.factor(physical) + as.factor(cvd.n) +
         as.factor(hypertension) + as.factor(copd) + as.factor(diabetes.n) + as.factor(cancer) + as.factor(parkinson) +
         as.factor(rheumatoid) + as.factor(renal) + as.factor(depression) + as.factor(anyfx) + as.factor(death) |
         fx_death, data = baseline.m)
Event-free
(N=1723)
Fractured, Alive
(N=361)
Fractured, Dead
(N=655)
No Fractured, Dead
(N=2642)
Overall
(N=5381)
ageBase
Mean (SD) 70.8 (4.66) 71.7 (4.87) 76.2 (5.83) 75.6 (5.87) 73.8 (5.92)
Median [Min, Max] 70.0 [64.0, 89.0] 71.0 [65.0, 91.0] 76.0 [65.0, 94.0] 75.0 [65.0, 100] 73.0 [64.0, 100]
fnbmdBase
Mean (SD) 0.803 (0.123) 0.754 (0.115) 0.727 (0.121) 0.783 (0.123) 0.780 (0.124)
Median [Min, Max] 0.794 [0.404, 1.38] 0.744 [0.499, 1.27] 0.719 [0.273, 1.15] 0.773 [0.475, 1.35] 0.772 [0.273, 1.38]
TscoreBase
Mean (SD) -1.51 (0.856) -1.85 (0.802) -2.04 (0.840) -1.65 (0.853) -1.66 (0.865)
Median [Min, Max] -1.57 [-4.28, 2.51] -1.92 [-3.62, 1.75] -2.09 [-5.19, 0.892] -1.72 [-3.78, 2.28] -1.72 [-5.19, 2.51]
as.factor(fall.no)
0 1344 (78.0%) 248 (68.7%) 389 (59.4%) 1966 (74.4%) 3947 (73.4%)
1 379 (22.0%) 113 (31.3%) 266 (40.6%) 676 (25.6%) 1434 (26.6%)
fall.yesno
No 1344 (78.0%) 248 (68.7%) 389 (59.4%) 1966 (74.4%) 3947 (73.4%)
Yes 379 (22.0%) 113 (31.3%) 266 (40.6%) 676 (25.6%) 1434 (26.6%)
as.factor(fx50)
0 1476 (85.7%) 280 (77.6%) 492 (75.1%) 2187 (82.8%) 4435 (82.4%)
1 247 (14.3%) 81 (22.4%) 163 (24.9%) 455 (17.2%) 946 (17.6%)
race
1:WHITE 1723 (100%) 361 (100%) 655 (100%) 2642 (100%) 5381 (100%)
weight
Mean (SD) 84.4 (12.2) 83.9 (12.7) 82.3 (13.3) 83.2 (13.5) 83.5 (13.0)
Median [Min, Max] 83.3 [52.7, 129] 82.6 [58.0, 142] 80.8 [52.6, 142] 81.5 [50.8, 144] 82.1 [50.8, 144]
height
Mean (SD) 175 (6.41) 176 (6.90) 174 (6.69) 174 (6.67) 174 (6.63)
Median [Min, Max] 175 [154, 198] 175 [158, 199] 174 [153, 193] 174 [147, 198] 174 [147, 199]
Missing 1 (0.1%) 1 (0.3%) 0 (0%) 4 (0.2%) 6 (0.1%)
BMI
Mean (SD) 27.5 (3.56) 27.2 (3.56) 27.1 (3.87) 27.4 (3.96) 27.4 (3.80)
Median [Min, Max] 27.1 [17.5, 50.7] 26.6 [19.2, 41.9] 26.6 [18.3, 41.5] 26.8 [17.2, 48.5] 26.9 [17.2, 50.7]
Missing 1 (0.1%) 1 (0.3%) 0 (0%) 4 (0.2%) 6 (0.1%)
as.factor(smoke)
0 709 (41.1%) 143 (39.6%) 245 (37.4%) 919 (34.8%) 2016 (37.5%)
1 1014 (58.9%) 218 (60.4%) 410 (62.6%) 1723 (65.2%) 3365 (62.5%)
as.factor(drink.n)
No 547 (31.7%) 111 (30.7%) 238 (36.3%) 945 (35.8%) 1841 (34.2%)
Yes 1176 (68.3%) 250 (69.3%) 417 (63.7%) 1697 (64.2%) 3540 (65.8%)
as.factor(physical)
0 458 (26.6%) 96 (26.6%) 255 (38.9%) 976 (36.9%) 1785 (33.2%)
1 1265 (73.4%) 265 (73.4%) 400 (61.1%) 1666 (63.1%) 3596 (66.8%)
as.factor(cvd.n)
No 1508 (87.5%) 304 (84.2%) 497 (75.9%) 1946 (73.7%) 4255 (79.1%)
Yes 215 (12.5%) 57 (15.8%) 158 (24.1%) 696 (26.3%) 1126 (20.9%)
as.factor(hypertension)
0 1114 (64.7%) 231 (64.0%) 344 (52.5%) 1436 (54.4%) 3125 (58.1%)
1 609 (35.3%) 130 (36.0%) 311 (47.5%) 1206 (45.6%) 2256 (41.9%)
as.factor(copd)
0 1584 (91.9%) 334 (92.5%) 562 (85.8%) 2322 (87.9%) 4802 (89.2%)
1 139 (8.1%) 27 (7.5%) 93 (14.2%) 320 (12.1%) 579 (10.8%)
as.factor(diabetes.n)
No 1612 (93.6%) 338 (93.6%) 582 (88.9%) 2314 (87.6%) 4846 (90.1%)
Yes 111 (6.4%) 23 (6.4%) 73 (11.1%) 328 (12.4%) 535 (9.9%)
as.factor(cancer)
0 1482 (86.0%) 305 (84.5%) 529 (80.8%) 2077 (78.6%) 4393 (81.6%)
1 241 (14.0%) 56 (15.5%) 126 (19.2%) 565 (21.4%) 988 (18.4%)
as.factor(parkinson)
0 1506 (87.4%) 311 (86.1%) 579 (88.4%) 2255 (85.4%) 4651 (86.4%)
1 217 (12.6%) 50 (13.9%) 76 (11.6%) 387 (14.6%) 730 (13.6%)
as.factor(rheumatoid)
0 983 (57.1%) 201 (55.7%) 335 (51.1%) 1314 (49.7%) 2833 (52.6%)
1 740 (42.9%) 160 (44.3%) 320 (48.9%) 1328 (50.3%) 2548 (47.4%)
as.factor(renal)
0 1513 (87.8%) 307 (85.0%) 599 (91.5%) 2447 (92.6%) 4866 (90.4%)
1 210 (12.2%) 54 (15.0%) 56 (8.5%) 195 (7.4%) 515 (9.6%)
as.factor(depression)
0 1659 (96.3%) 345 (95.6%) 622 (95.0%) 2552 (96.6%) 5178 (96.2%)
1 64 (3.7%) 16 (4.4%) 33 (5.0%) 90 (3.4%) 203 (3.8%)
as.factor(anyfx)
0 1723 (100%) 0 (0%) 0 (0%) 2642 (100%) 4365 (81.1%)
1 0 (0%) 361 (100%) 655 (100%) 0 (0%) 1016 (18.9%)
as.factor(death)
0 1723 (100%) 361 (100%) 0 (0%) 0 (0%) 2084 (38.7%)
1 0 (0%) 0 (0%) 655 (100%) 2642 (100%) 3297 (61.3%)
#library(compareGroups)
#createTable(compareGroups(fx_death ~ ageBase + fnbmdBase + TscoreBase + fall.no + fall.yesno + fx50 + weight + height + BMI + smoke + drink.n + physical + cvd.n + hypertension + copd + diabetes.n + cancer + parkinson + rheumatoid + renal + depression + anyfx + death, data = baseline.m))

1.2 Conventional Cox’s PH model

1.2.1 Age-adjusted model
library(survival)
cox.m = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2, data = baseline.m)
summary(cox.m)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2, 
##     data = baseline.m)
## 
##   n= 5381, number of events= 3297 
## 
##                  coef exp(coef) se(coef)      z Pr(>|z|)    
## ageBase      0.119424  1.126848 0.003121 38.261   <2e-16 ***
## TscoreBase.2 0.047200  1.048331 0.020694  2.281   0.0226 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##              exp(coef) exp(-coef) lower .95 upper .95
## ageBase          1.127     0.8874     1.120     1.134
## TscoreBase.2     1.048     0.9539     1.007     1.092
## 
## Concordance= 0.684  (se = 0.005 )
## Likelihood ratio test= 1467  on 2 df,   p=<2e-16
## Wald test            = 1546  on 2 df,   p=<2e-16
## Score (logrank) test = 1626  on 2 df,   p=<2e-16
1.2.3 Adjusted for essential covariates (~ JBMR paper)
cox.m2 = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2 + fall.yesno + fx50 + cvd.n + copd + diabetes.n + cancer, data = baseline.m)
summary(cox.m2)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2 + 
##     fall.yesno + fx50 + cvd.n + copd + diabetes.n + cancer, data = baseline.m)
## 
##   n= 5381, number of events= 3297 
## 
##                    coef exp(coef)  se(coef)      z Pr(>|z|)    
## ageBase        0.116141  1.123154  0.003213 36.146  < 2e-16 ***
## TscoreBase.2   0.060915  1.062808  0.020854  2.921 0.003489 ** 
## fall.yesnoYes -0.052394  0.948955  0.039084 -1.341 0.180071    
## fx50           0.061556  1.063490  0.045092  1.365 0.172216    
## cvd.nYes       0.411120  1.508506  0.040618 10.122  < 2e-16 ***
## copd           0.344799  1.411706  0.052878  6.521    7e-11 ***
## diabetes.nYes  0.482317  1.619823  0.054167  8.904  < 2e-16 ***
## cancer         0.154026  1.166522  0.043308  3.557 0.000376 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##               exp(coef) exp(-coef) lower .95 upper .95
## ageBase           1.123     0.8903    1.1161     1.130
## TscoreBase.2      1.063     0.9409    1.0202     1.107
## fall.yesnoYes     0.949     1.0538    0.8790     1.025
## fx50              1.063     0.9403    0.9735     1.162
## cvd.nYes          1.509     0.6629    1.3931     1.634
## copd              1.412     0.7084    1.2727     1.566
## diabetes.nYes     1.620     0.6174    1.4567     1.801
## cancer            1.167     0.8572    1.0716     1.270
## 
## Concordance= 0.7  (se = 0.005 )
## Likelihood ratio test= 1707  on 8 df,   p=<2e-16
## Wald test            = 1777  on 8 df,   p=<2e-16
## Score (logrank) test = 1885  on 8 df,   p=<2e-16
1.2.3 Multivariable-adjusted model
cox.m3 = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2 + fall.yesno + fx50 + BMI + smoke + drink.n + 
                 physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson + 
                 depression, data = baseline.m)
summary(cox.m3)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2 + 
##     fall.yesno + fx50 + BMI + smoke + drink.n + physical + cvd.n + 
##     hypertension + copd + diabetes.n + cancer + renal + parkinson + 
##     depression, data = baseline.m)
## 
##   n= 5375, number of events= 3293 
##    (6 observations deleted due to missingness)
## 
##                    coef exp(coef)  se(coef)       z Pr(>|z|)    
## ageBase        0.114056  1.120815  0.003318  34.378  < 2e-16 ***
## TscoreBase.2   0.080642  1.083983  0.022022   3.662  0.00025 ***
## fall.yesnoYes -0.053736  0.947682  0.039240  -1.369  0.17087    
## fx50           0.067626  1.069965  0.045137   1.498  0.13407    
## BMI            0.013457  1.013548  0.005303   2.538  0.01116 *  
## smoke          0.244277  1.276698  0.037225   6.562 5.31e-11 ***
## drink.nYes    -0.097682  0.906937  0.037265  -2.621  0.00876 ** 
## physical      -0.162773  0.849784  0.036896  -4.412 1.03e-05 ***
## cvd.nYes       0.385533  1.470398  0.040894   9.428  < 2e-16 ***
## hypertension   0.180792  1.198165  0.036076   5.011 5.40e-07 ***
## copd           0.276893  1.319025  0.053336   5.191 2.09e-07 ***
## diabetes.nYes  0.398043  1.488908  0.055419   7.182 6.85e-13 ***
## cancer         0.130736  1.139667  0.043538   3.003  0.00267 ** 
## renal         -0.877874  0.415666  0.080457 -10.911  < 2e-16 ***
## parkinson      0.532403  1.703019  0.061545   8.651  < 2e-16 ***
## depression    -0.112416  0.893673  0.092731  -1.212  0.22541    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##               exp(coef) exp(-coef) lower .95 upper .95
## ageBase          1.1208     0.8922    1.1136    1.1281
## TscoreBase.2     1.0840     0.9225    1.0382    1.1318
## fall.yesnoYes    0.9477     1.0552    0.8775    1.0234
## fx50             1.0700     0.9346    0.9794    1.1689
## BMI              1.0135     0.9866    1.0031    1.0241
## smoke            1.2767     0.7833    1.1869    1.3733
## drink.nYes       0.9069     1.1026    0.8431    0.9757
## physical         0.8498     1.1768    0.7905    0.9135
## cvd.nYes         1.4704     0.6801    1.3571    1.5931
## hypertension     1.1982     0.8346    1.1164    1.2860
## copd             1.3190     0.7581    1.1881    1.4644
## diabetes.nYes    1.4889     0.6716    1.3357    1.6597
## cancer           1.1397     0.8774    1.0465    1.2412
## renal            0.4157     2.4058    0.3550    0.4867
## parkinson        1.7030     0.5872    1.5095    1.9214
## depression       0.8937     1.1190    0.7452    1.0718
## 
## Concordance= 0.718  (se = 0.004 )
## Likelihood ratio test= 1958  on 16 df,   p=<2e-16
## Wald test            = 2018  on 16 df,   p=<2e-16
## Score (logrank) test = 2133  on 16 df,   p=<2e-16

1.3 Multistate regression

1.3.1 Data preparation

reorder_array <- function(Qx3) {
  new_row_order <- c("Well", "Fracture", "Death")
  new_col_order <- c("Well", "Fracture")
  Qx3_reordered <- Qx3[new_col_order, new_row_order]
  Death <- c(0, 0, 0)
  Qx3_reordered <- rbind(Qx3_reordered, Death)
  return(Qx3_reordered)
}
library(msm)
## Warning: package 'msm' was built under R version 4.3.3
Q.m = statetable.msm(event, subject = ID, data = bmd)
Q.m2 = reorder_array(Q.m)
qmatrix.n = crudeinits.msm(state ~ time2event, subject = ID, data = men, qmatrix = Q.m2)
qmatrix.n
##                 Well    Fracture      Death
## Well     -0.05499161  0.01527378 0.03971784
## Fracture  0.00000000 -0.10331884 0.10331884
## Death     0.00000000  0.00000000 0.00000000
statetable.msm(state, ID, data = men)
##     to
## from    1    2    3
##    1 1723 1016 2642
##    2    0  361  655

1.3.2 Age-adjusted model:

Age and FNBMD at baseline:
age.m1= msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2)  
age.m1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~ageBase + TscoreBase.2, exacttimes = TRUE,     pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.04264 (-0.04450,-0.04087)                    
## Well - Fracture      0.01364 ( 0.01270, 0.01465) 1.061 (1.049,1.072)
## Well - Death         0.02900 ( 0.02752, 0.03057) 1.117 (1.109,1.124)
## Fracture - Fracture -0.07333 (-0.08546,-0.06292)                    
## Fracture - Death     0.07333 ( 0.06292, 0.08546) 1.103 (1.088,1.119)
##                     TscoreBase.2         timeperiod[5,Inf)  
## Well - Well                                                 
## Well - Fracture     1.6729 (1.543,1.814) 1.541 (1.347,1.763)
## Well - Death        0.9819 (0.939,1.027) 3.309 (2.998,3.653)
## Fracture - Fracture                                         
## Fracture - Death    1.1461 (1.041,1.262) 1.658 (1.259,2.183)
## 
## -2 * log-likelihood:  35090.96
hazard.msm(age.m1)
## $ageBase
##                        HR        L        U
## Well - Fracture  1.060677 1.049396 1.072079
## Well - Death     1.116706 1.109450 1.124010
## Fracture - Death 1.103441 1.088480 1.118608
## 
## $TscoreBase.2
##                         HR         L        U
## Well - Fracture  1.6728647 1.5425823 1.814151
## Well - Death     0.9818919 0.9390253 1.026715
## Fracture - Death 1.1461358 1.0410791 1.261794
## 
## $`timeperiod[5,Inf)`
##                        HR        L        U
## Well - Fracture  1.541029 1.347086 1.762894
## Well - Death     3.309001 2.997627 3.652720
## Fracture - Death 1.657590 1.258728 2.182841
Age and FNBMD at fracture time:
age.m2= msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2)  
age.m2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~age + Tscore.2, exacttimes = TRUE,     pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.04602 (-0.04797,-0.04415)                    
## Well - Fracture      0.01431 ( 0.01333, 0.01536) 1.061 (1.049,1.072)
## Well - Death         0.03171 ( 0.03013, 0.03337) 1.117 (1.109,1.124)
## Fracture - Fracture -0.05318 (-0.06310,-0.04481)                    
## Fracture - Death     0.05318 ( 0.04481, 0.06310) 1.094 (1.081,1.108)
##                     Tscore.2             timeperiod[5,Inf)    
## Well - Well                                                   
## Well - Fracture     1.6731 (1.543,1.814) 1.5407 (1.3469,1.763)
## Well - Death        0.9819 (0.939,1.027) 3.3084 (2.9971,3.652)
## Fracture - Fracture                                           
## Fracture - Death    1.1641 (1.056,1.283) 0.9587 (0.7298,1.259)
## 
## -2 * log-likelihood:  35077.96
hazard.msm(age.m2)
## $age
##                        HR        L        U
## Well - Fracture  1.060668 1.049389 1.072068
## Well - Death     1.116670 1.109414 1.123974
## Fracture - Death 1.094131 1.080748 1.107680
## 
## $Tscore.2
##                         HR         L        U
## Well - Fracture  1.6730828 1.5428031 1.814364
## Well - Death     0.9819034 0.9390353 1.026729
## Fracture - Death 1.1641039 1.0564348 1.282746
## 
## $`timeperiod[5,Inf)`
##                         HR         L        U
## Well - Fracture  1.5407403 1.3468723 1.762514
## Well - Death     3.3084328 2.9971142 3.652089
## Fracture - Death 0.9586784 0.7298231 1.259297

1.3.3 Adjusted for essential covariates:

Age and FNBMD at baseline:
multi.me1= msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2 +
             fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)  
multi.me1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~ageBase + TscoreBase.2 +         fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n +         cancer, exacttimes = TRUE, pci = 5, method = "BFGS",     control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.04166 (-0.04350,-0.03990)                    
## Well - Fracture      0.01336 ( 0.01242, 0.01437) 1.055 (1.043,1.067)
## Well - Death         0.02830 ( 0.02683, 0.02986) 1.112 (1.104,1.119)
## Fracture - Fracture -0.07161 (-0.08370,-0.06127)                    
## Fracture - Death     0.07161 ( 0.06127, 0.08370) 1.102 (1.087,1.118)
##                     TscoreBase.2         fall.yesnoYes         
## Well - Well                                                    
## Well - Fracture     1.676 (1.5440,1.820) 1.6032 (1.4100,1.8229)
## Well - Death        1.003 (0.9591,1.050) 0.8740 (0.8001,0.9547)
## Fracture - Fracture                                            
## Fracture - Death    1.162 (1.0541,1.281) 0.9154 (0.7798,1.0746)
##                     fx50                  cvd.nYes            
## Well - Well                                                   
## Well - Fracture     1.3744 (1.1883,1.590) 1.145 (0.9815,1.335)
## Well - Death        1.0309 (0.9309,1.142) 1.511 (1.3828,1.651)
## Fracture - Fracture                                           
## Fracture - Death    0.9981 (0.8335,1.195) 1.173 (0.9758,1.409)
##                     hypertension        copd                
## Well - Well                                                 
## Well - Fracture     1.198 (1.056,1.358) 1.143 (0.9438,1.384)
## Well - Death        1.187 (1.098,1.283) 1.333 (1.1857,1.500)
## Fracture - Fracture                                         
## Fracture - Death    1.320 (1.127,1.545) 1.478 (1.1839,1.844)
##                     diabetes.nYes       cancer               
## Well - Well                                                  
## Well - Fracture     1.273 (1.028,1.575) 0.9567 (0.8132,1.125)
## Well - Death        1.566 (1.392,1.762) 1.1804 (1.0742,1.297)
## Fracture - Fracture                                          
## Fracture - Death    1.293 (1.002,1.668) 1.0146 (0.8332,1.236)
##                     timeperiod[5,Inf)  
## Well - Well                            
## Well - Fracture     1.593 (1.392,1.824)
## Well - Death        3.458 (3.132,3.819)
## Fracture - Fracture                    
## Fracture - Death    1.724 (1.307,2.274)
## 
## -2 * log-likelihood:  34744.9
hazard.msm(multi.me1)
## $ageBase
##                        HR        L        U
## Well - Fracture  1.054893 1.043383 1.066529
## Well - Death     1.111739 1.104262 1.119266
## Fracture - Death 1.102465 1.087112 1.118035
## 
## $TscoreBase.2
##                        HR         L        U
## Well - Fracture  1.676388 1.5439838 1.820147
## Well - Death     1.003356 0.9591305 1.049620
## Fracture - Death 1.161975 1.0541115 1.280875
## 
## $fall.yesnoYes
##                         HR         L         U
## Well - Fracture  1.6031880 1.4099895 1.8228589
## Well - Death     0.8740106 0.8001366 0.9547051
## Fracture - Death 0.9154343 0.7798266 1.0746235
## 
## $fx50
##                         HR         L        U
## Well - Fracture  1.3743945 1.1882655 1.589679
## Well - Death     1.0308641 0.9309001 1.141563
## Fracture - Death 0.9980506 0.8334572 1.195148
## 
## $cvd.nYes
##                        HR         L        U
## Well - Fracture  1.144834 0.9814826 1.335372
## Well - Death     1.510965 1.3828041 1.651004
## Fracture - Death 1.172581 0.9758481 1.408975
## 
## $hypertension
##                        HR        L        U
## Well - Fracture  1.197515 1.055659 1.358432
## Well - Death     1.186812 1.098014 1.282791
## Fracture - Death 1.319750 1.127106 1.545320
## 
## $copd
##                        HR         L        U
## Well - Fracture  1.142991 0.9438275 1.384182
## Well - Death     1.333414 1.1856837 1.499550
## Fracture - Death 1.477535 1.1838938 1.844007
## 
## $diabetes.nYes
##                        HR        L        U
## Well - Fracture  1.272761 1.028335 1.575284
## Well - Death     1.566059 1.391904 1.762004
## Fracture - Death 1.292961 1.002401 1.667743
## 
## $cancer
##                         HR         L        U
## Well - Fracture  0.9566555 0.8131619 1.125471
## Well - Death     1.1803967 1.0741758 1.297121
## Fracture - Death 1.0146369 0.8331869 1.235603
## 
## $`timeperiod[5,Inf)`
##                        HR        L        U
## Well - Fracture  1.593472 1.392327 1.823675
## Well - Death     3.458493 3.132276 3.818685
## Fracture - Death 1.723856 1.306865 2.273901
Age and FNBMD at fracture time:
multi.me2= msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2 +
             fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)  
multi.me2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~age + Tscore.2 + fall.yesno +         fx50 + cvd.n + hypertension + copd + diabetes.n + cancer,     exacttimes = TRUE, pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.04478 (-0.04671,-0.04293)                    
## Well - Fracture      0.01395 ( 0.01297, 0.01500) 1.055 (1.043,1.067)
## Well - Death         0.03083 ( 0.02927, 0.03247) 1.112 (1.104,1.119)
## Fracture - Fracture -0.04901 (-0.05857,-0.04101)                    
## Fracture - Death     0.04901 ( 0.04101, 0.05857) 1.097 (1.083,1.110)
##                     Tscore.2             fall.yesnoYes        
## Well - Well                                                   
## Well - Fracture     1.676 (1.5440,1.820) 1.603 (1.4097,1.8225)
## Well - Death        1.003 (0.9591,1.050) 0.874 (0.8001,0.9547)
## Fracture - Fracture                                           
## Fracture - Death    1.181 (1.0707,1.303) 1.056 (0.8995,1.2397)
##                     fx50                 cvd.nYes            
## Well - Well                                                  
## Well - Fracture     1.374 (1.1883,1.590) 1.145 (0.9815,1.335)
## Well - Death        1.031 (0.9309,1.142) 1.511 (1.3828,1.651)
## Fracture - Fracture                                          
## Fracture - Death    1.097 (0.9149,1.315) 1.266 (1.0546,1.520)
##                     hypertension        copd                
## Well - Well                                                 
## Well - Fracture     1.197 (1.056,1.358) 1.143 (0.9439,1.384)
## Well - Death        1.187 (1.098,1.283) 1.334 (1.1858,1.500)
## Fracture - Fracture                                         
## Fracture - Death    1.315 (1.122,1.541) 1.578 (1.2637,1.970)
##                     diabetes.nYes       cancer              
## Well - Well                                                 
## Well - Fracture     1.273 (1.028,1.575) 0.9565 (0.813,1.125)
## Well - Death        1.566 (1.392,1.762) 1.1805 (1.074,1.297)
## Fracture - Fracture                                         
## Fracture - Death    1.361 (1.055,1.756) 1.0482 (0.861,1.276)
##                     timeperiod[5,Inf)   
## Well - Well                             
## Well - Fracture     1.593 (1.3922,1.824)
## Well - Death        3.459 (3.1323,3.819)
## Fracture - Fracture                     
## Fracture - Death    1.035 (0.7858,1.362)
## 
## -2 * log-likelihood:  34718
hazard.msm(multi.me2)
## $age
##                        HR        L        U
## Well - Fracture  1.054893 1.043382 1.066530
## Well - Death     1.111736 1.104259 1.119264
## Fracture - Death 1.096603 1.082896 1.110485
## 
## $Tscore.2
##                        HR         L        U
## Well - Fracture  1.676407 1.5439937 1.820177
## Well - Death     1.003344 0.9591196 1.049608
## Fracture - Death 1.181165 1.0707167 1.303007
## 
## $fall.yesnoYes
##                         HR         L         U
## Well - Fracture  1.6028547 1.4096812 1.8224994
## Well - Death     0.8739604 0.8000898 0.9546513
## Fracture - Death 1.0560219 0.8995404 1.2397244
## 
## $fx50
##                        HR         L        U
## Well - Fracture  1.374483 1.1883343 1.589790
## Well - Death     1.030870 0.9309054 1.141569
## Fracture - Death 1.096912 0.9148719 1.315175
## 
## $cvd.nYes
##                        HR         L        U
## Well - Fracture  1.144918 0.9815492 1.335479
## Well - Death     1.510998 1.3828338 1.651040
## Fracture - Death 1.266295 1.0546447 1.520420
## 
## $hypertension
##                        HR        L        U
## Well - Fracture  1.197487 1.055627 1.358411
## Well - Death     1.186690 1.097900 1.282660
## Fracture - Death 1.314632 1.121583 1.540907
## 
## $copd
##                        HR        L        U
## Well - Fracture  1.143115 0.943925 1.384338
## Well - Death     1.333526 1.185788 1.499672
## Fracture - Death 1.577629 1.263723 1.969510
## 
## $diabetes.nYes
##                        HR        L        U
## Well - Fracture  1.272735 1.028300 1.575275
## Well - Death     1.566080 1.391923 1.762028
## Fracture - Death 1.360714 1.054603 1.755677
## 
## $cancer
##                        HR         L        U
## Well - Fracture  0.956539 0.8130495 1.125352
## Well - Death     1.180495 1.0742670 1.297227
## Fracture - Death 1.048199 0.8610391 1.276042
## 
## $`timeperiod[5,Inf)`
##                        HR        L        U
## Well - Fracture  1.593385 1.392242 1.823587
## Well - Death     3.458543 3.132319 3.818742
## Fracture - Death 1.034724 0.785842 1.362429

1.3.4 Multivariable-adjusted model:

All covariates at baseline:
multi.m1 = msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2 +
             fall.yesno + fx50 + BMI + smoke + drink.n + physical + cvd.n + hypertension + copd + diabetes.n + cancer + 
             renal + parkinson + depression)  
multi.m1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~ageBase + TscoreBase.2 +         fall.yesno + fx50 + BMI + smoke + drink.n + physical +         cvd.n + hypertension + copd + diabetes.n + cancer + renal +         parkinson + depression, exacttimes = TRUE, pci = 5, method = "BFGS",     control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.04106 (-0.04289,-0.03931)                    
## Well - Fracture      0.01333 ( 0.01239, 0.01435) 1.057 (1.045,1.069)
## Well - Death         0.02773 ( 0.02627, 0.02927) 1.108 (1.100,1.116)
## Fracture - Fracture -0.06968 (-0.08163,-0.05948)                    
## Fracture - Death     0.06968 ( 0.05948, 0.08163) 1.105 (1.089,1.121)
##                     TscoreBase.2         fall.yesnoYes        
## Well - Well                                                   
## Well - Fracture     1.721 (1.5785,1.877) 1.5985 (1.4052,1.818)
## Well - Death        1.012 (0.9652,1.061) 0.8758 (0.8015,0.957)
## Fracture - Fracture                                           
## Fracture - Death    1.193 (1.0765,1.322) 0.8715 (0.7405,1.026)
##                     fx50                  BMI                
## Well - Well                                                  
## Well - Fracture     1.3651 (1.1798,1.580) 1.020 (1.002,1.039)
## Well - Death        1.0261 (0.9265,1.136) 1.013 (1.001,1.025)
## Fracture - Fracture                                          
## Fracture - Death    0.9874 (0.8242,1.183) 1.007 (0.984,1.031)
##                     smoke                drink.nYes            
## Well - Well                                                    
## Well - Fracture     1.068 (0.9385,1.215) 0.9768 (0.8559,1.1148)
## Well - Death        1.276 (1.1761,1.384) 0.9081 (0.8370,0.9853)
## Fracture - Fracture                                            
## Fracture - Death    1.183 (1.0034,1.394) 0.9249 (0.7826,1.0930)
##                     physical               cvd.nYes            
## Well - Well                                                    
## Well - Fracture     0.9271 (0.8123,1.0580) 1.133 (0.9702,1.322)
## Well - Death        0.8604 (0.7935,0.9328) 1.492 (1.3649,1.631)
## Fracture - Fracture                                            
## Fracture - Death    0.9167 (0.7778,1.0805) 1.156 (0.9614,1.389)
##                     hypertension        copd                
## Well - Well                                                 
## Well - Fracture     1.166 (1.026,1.325) 1.123 (0.9258,1.361)
## Well - Death        1.142 (1.056,1.236) 1.254 (1.1143,1.412)
## Fracture - Fracture                                         
## Fracture - Death    1.309 (1.115,1.538) 1.489 (1.1893,1.865)
##                     diabetes.nYes        cancer               
## Well - Well                                                   
## Well - Fracture     1.233 (0.9938,1.529) 0.9543 (0.8108,1.123)
## Well - Death        1.492 (1.3240,1.682) 1.1789 (1.0725,1.296)
## Fracture - Fracture                                           
## Fracture - Death    1.281 (0.9880,1.661) 0.9775 (0.8005,1.194)
##                     renal                  parkinson            
## Well - Well                                                     
## Well - Fracture     1.0165 (0.7850,1.3163) 0.8601 (0.6750,1.096)
## Well - Death        0.4330 (0.3626,0.5171) 1.7169 (1.5057,1.958)
## Fracture - Fracture                                             
## Fracture - Death    0.4588 (0.3314,0.6353) 1.1816 (0.8889,1.571)
##                     depression            timeperiod[5,Inf)  
## Well - Well                                                  
## Well - Fracture     1.0618 (0.7944,1.419) 1.606 (1.403,1.839)
## Well - Death        0.8306 (0.6721,1.027) 3.621 (3.278,4.000)
## Fracture - Fracture                                          
## Fracture - Death    1.2171 (0.8498,1.743) 1.856 (1.403,2.456)
## 
## -2 * log-likelihood:  34491.05
hazard.msm(multi.m1)
## $ageBase
##                        HR        L        U
## Well - Fracture  1.056532 1.044627 1.068573
## Well - Death     1.108127 1.100434 1.115874
## Fracture - Death 1.104515 1.088557 1.120706
## 
## $TscoreBase.2
##                        HR         L        U
## Well - Fracture  1.721052 1.5784643 1.876519
## Well - Death     1.012130 0.9652314 1.061308
## Fracture - Death 1.193110 1.0765397 1.322303
## 
## $fall.yesnoYes
##                         HR         L         U
## Well - Fracture  1.5985235 1.4052214 1.8184162
## Well - Death     0.8758376 0.8015349 0.9570282
## Fracture - Death 0.8715066 0.7405168 1.0256671
## 
## $fx50
##                         HR         L        U
## Well - Fracture  1.3651281 1.1798251 1.579535
## Well - Death     1.0260681 0.9265258 1.136305
## Fracture - Death 0.9873639 0.8241734 1.182867
## 
## $BMI
##                        HR         L        U
## Well - Fracture  1.020475 1.0018068 1.039491
## Well - Death     1.012850 1.0012874 1.024547
## Fracture - Death 1.006997 0.9839584 1.030574
## 
## $smoke
##                        HR         L        U
## Well - Fracture  1.067754 0.9384658 1.214854
## Well - Death     1.276023 1.1760566 1.384487
## Fracture - Death 1.182703 1.0034209 1.394017
## 
## $drink.nYes
##                         HR         L        U
## Well - Fracture  0.9767765 0.8558774 1.114753
## Well - Death     0.9080883 0.8369526 0.985270
## Fracture - Death 0.9248804 0.7826158 1.093006
## 
## $physical
##                         HR         L         U
## Well - Fracture  0.9270604 0.8123462 1.0579738
## Well - Death     0.8603537 0.7935042 0.9328351
## Fracture - Death 0.9167199 0.7777671 1.0804975
## 
## $cvd.nYes
##                        HR         L        U
## Well - Fracture  1.132618 0.9701617 1.322277
## Well - Death     1.492011 1.3649366 1.630917
## Fracture - Death 1.155622 0.9614487 1.389011
## 
## $hypertension
##                        HR        L        U
## Well - Fracture  1.166131 1.026127 1.325238
## Well - Death     1.142403 1.055792 1.236119
## Fracture - Death 1.309470 1.115126 1.537684
## 
## $copd
##                        HR         L        U
## Well - Fracture  1.122635 0.9257888 1.361335
## Well - Death     1.254417 1.1143020 1.412150
## Fracture - Death 1.489421 1.1893413 1.865213
## 
## $diabetes.nYes
##                        HR         L        U
## Well - Fracture  1.232859 0.9937647 1.529478
## Well - Death     1.492432 1.3239788 1.682317
## Fracture - Death 1.280957 0.9879886 1.660800
## 
## $cancer
##                        HR         L        U
## Well - Fracture  0.954256 0.8108125 1.123077
## Well - Death     1.178874 1.0725265 1.295767
## Fracture - Death 0.977499 0.8005035 1.193629
## 
## $renal
##                         HR         L         U
## Well - Fracture  1.0165166 0.7849800 1.3163471
## Well - Death     0.4330191 0.3626234 0.5170807
## Fracture - Death 0.4588461 0.3314259 0.6352544
## 
## $parkinson
##                         HR         L        U
## Well - Fracture  0.8600922 0.6749731 1.095982
## Well - Death     1.7169247 1.5056692 1.957821
## Fracture - Death 1.1816255 0.8888873 1.570771
## 
## $depression
##                         HR         L        U
## Well - Fracture  1.0617969 0.7944134 1.419176
## Well - Death     0.8306316 0.6720585 1.026620
## Fracture - Death 1.2171307 0.8498407 1.743159
## 
## $`timeperiod[5,Inf)`
##                        HR        L        U
## Well - Fracture  1.606226 1.402850 1.839085
## Well - Death     3.620799 3.277774 3.999722
## Fracture - Death 1.856101 1.402940 2.455636
Age and FNBMD at fracture time (other covariates at baseline):
multi.m2= msm(state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2 + fall.yesno
           + fx50 + BMI + smoke + drink + physical + cvd + hypertension + copd + diabetes + cancer + renal + parkinson 
           + depression)  
multi.m2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = men, qmatrix = qmatrix.n,     gen.inits = TRUE, covariates = ~age + Tscore.2 + fall.yesno +         fx50 + BMI + smoke + drink + physical + cvd + hypertension +         copd + diabetes + cancer + renal + parkinson + depression,     exacttimes = TRUE, pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.04408 (-0.04600,-0.04224)                    
## Well - Fracture      0.01394 ( 0.01296, 0.01499) 1.057 (1.045,1.069)
## Well - Death         0.03014 ( 0.02859, 0.03177) 1.108 (1.101,1.116)
## Fracture - Fracture -0.04795 (-0.05740,-0.04006)                    
## Fracture - Death     0.04795 ( 0.04006, 0.05740) 1.096 (1.082,1.110)
##                     Tscore.2             fall.yesnoYes         
## Well - Well                                                    
## Well - Fracture     1.721 (1.5777,1.876) 1.5989 (1.4054,1.8190)
## Well - Death        1.014 (0.9672,1.064) 0.8736 (0.7995,0.9547)
## Fracture - Fracture                                            
## Fracture - Death    1.216 (1.0951,1.351) 1.0174 (0.8650,1.1966)
##                     fx50                 BMI                 
## Well - Well                                                  
## Well - Fracture     1.365 (1.1799,1.580) 1.020 (1.0017,1.039)
## Well - Death        1.027 (0.9270,1.137) 1.013 (1.0018,1.025)
## Fracture - Fracture                                          
## Fracture - Death    1.085 (0.9047,1.302) 1.010 (0.9861,1.034)
##                     smoke                drink                
## Well - Well                                                   
## Well - Fracture     1.069 (0.9385,1.217) 0.9930 (0.9509,1.037)
## Well - Death        1.268 (1.1683,1.377) 0.9888 (0.9625,1.016)
## Fracture - Fracture                                           
## Fracture - Death    1.135 (0.9626,1.339) 0.9953 (0.9406,1.053)
##                     physical              cvd                 
## Well - Well                                                   
## Well - Fracture     0.927 (0.8123,1.0578) 1.133 (0.9706,1.323)
## Well - Death        0.859 (0.7922,0.9313) 1.499 (1.3714,1.639)
## Fracture - Fracture                                           
## Fracture - Death    0.856 (0.7280,1.0066) 1.247 (1.0371,1.499)
##                     hypertension        copd                
## Well - Well                                                 
## Well - Fracture     1.167 (1.027,1.326) 1.123 (0.9261,1.362)
## Well - Death        1.143 (1.056,1.237) 1.260 (1.1196,1.419)
## Fracture - Fracture                                         
## Fracture - Death    1.302 (1.109,1.530) 1.554 (1.2414,1.945)
##                     diabetes             cancer               
## Well - Well                                                   
## Well - Fracture     1.234 (0.9945,1.530) 0.9537 (0.8104,1.122)
## Well - Death        1.506 (1.3359,1.697) 1.1763 (1.0702,1.293)
## Fracture - Fracture                                           
## Fracture - Death    1.341 (1.0343,1.739) 1.0075 (0.8254,1.230)
##                     renal                  parkinson            
## Well - Well                                                     
## Well - Fracture     1.0167 (0.7851,1.3166) 0.8598 (0.6747,1.096)
## Well - Death        0.4318 (0.3616,0.5156) 1.7243 (1.5120,1.966)
## Fracture - Fracture                                             
## Fracture - Death    0.4687 (0.3350,0.6557) 1.2108 (0.9024,1.625)
##                     depression            timeperiod[5,Inf)   
## Well - Well                                                   
## Well - Fracture     1.0600 (0.7932,1.417) 1.606 (1.4027,1.839)
## Well - Death        0.8281 (0.6700,1.023) 3.616 (3.2731,3.994)
## Fracture - Fracture                                           
## Fracture - Death    1.2069 (0.8445,1.725) 1.110 (0.8403,1.467)
## 
## -2 * log-likelihood:  34470.73
hazard.msm(multi.m2)
## $age
##                        HR        L        U
## Well - Fracture  1.056557 1.044652 1.068598
## Well - Death     1.108332 1.100632 1.116086
## Fracture - Death 1.096287 1.082381 1.110371
## 
## $Tscore.2
##                        HR         L        U
## Well - Fracture  1.720524 1.5777383 1.876232
## Well - Death     1.014341 0.9672201 1.063757
## Fracture - Death 1.216304 1.0951054 1.350916
## 
## $fall.yesnoYes
##                         HR         L         U
## Well - Fracture  1.5989006 1.4054221 1.8190145
## Well - Death     0.8736494 0.7995108 0.9546629
## Fracture - Death 1.0174197 0.8650423 1.1966383
## 
## $fx50
##                        HR         L        U
## Well - Fracture  1.365187 1.1798854 1.579590
## Well - Death     1.026617 0.9270134 1.136923
## Fracture - Death 1.085141 0.9046731 1.301610
## 
## $BMI
##                        HR         L        U
## Well - Fracture  1.020414 1.0017261 1.039451
## Well - Death     1.013435 1.0018398 1.025164
## Fracture - Death 1.009768 0.9860617 1.034044
## 
## $smoke
##                        HR         L        U
## Well - Fracture  1.068799 0.9385241 1.217157
## Well - Death     1.268305 1.1683139 1.376853
## Fracture - Death 1.135351 0.9626285 1.339065
## 
## $drink
##                         HR         L        U
## Well - Fracture  0.9930187 0.9508768 1.037028
## Well - Death     0.9888032 0.9625315 1.015792
## Fracture - Death 0.9952847 0.9405634 1.053190
## 
## $physical
##                         HR         L         U
## Well - Fracture  0.9269554 0.8122600 1.0578464
## Well - Death     0.8589759 0.7922314 0.9313435
## Fracture - Death 0.8560163 0.7279584 1.0066013
## 
## $cvd
##                        HR         L        U
## Well - Fracture  1.133023 0.9705892 1.322642
## Well - Death     1.499006 1.3713565 1.638538
## Fracture - Death 1.246936 1.0371028 1.499224
## 
## $hypertension
##                        HR        L        U
## Well - Fracture  1.166554 1.026518 1.325694
## Well - Death     1.143080 1.056413 1.236856
## Fracture - Death 1.302362 1.108775 1.529748
## 
## $copd
##                        HR         L        U
## Well - Fracture  1.122966 0.9261099 1.361667
## Well - Death     1.260384 1.1196275 1.418836
## Fracture - Death 1.554060 1.2414050 1.945460
## 
## $diabetes
##                        HR         L        U
## Well - Fracture  1.233613 0.9945055 1.530209
## Well - Death     1.505779 1.3358999 1.697262
## Fracture - Death 1.341307 1.0342839 1.739469
## 
## $cancer
##                         HR         L        U
## Well - Fracture  0.9537327 0.8103887 1.122432
## Well - Death     1.1762833 1.0701796 1.292907
## Fracture - Death 1.0075191 0.8253600 1.229881
## 
## $renal
##                         HR         L         U
## Well - Fracture  1.0166769 0.7850960 1.3165676
## Well - Death     0.4317897 0.3615690 0.5156481
## Fracture - Death 0.4687098 0.3350274 0.6557341
## 
## $parkinson
##                         HR         L        U
## Well - Fracture  0.8597611 0.6746954 1.095589
## Well - Death     1.7243383 1.5120242 1.966465
## Fracture - Death 1.2108287 0.9023629 1.624741
## 
## $depression
##                         HR         L        U
## Well - Fracture  1.0600160 0.7931910 1.416599
## Well - Death     0.8280899 0.6700044 1.023475
## Fracture - Death 1.2068968 0.8445388 1.724728
## 
## $`timeperiod[5,Inf)`
##                        HR         L        U
## Well - Fracture  1.605983 1.4026624 1.838777
## Well - Death     3.615570 3.2730570 3.993925
## Fracture - Death 1.110399 0.8403278 1.467269

1.3.4 Transition risks

# Osteopenia:
options(digits = 5)
pmatrix.msm(multi.m2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well   Fracture     Death
## Well     0.99765 0.00038895 0.0019646
## Fracture 0.00000 0.99584765 0.0041524
## Death    0.00000 0.00000000 1.0000000
  pmatrix.msm(multi.m2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well  Fracture    Death
## Well     0.97771 0.0023779 0.019910
## Fracture 0.00000 0.9785105 0.021489
## Death    0.00000 0.0000000 1.000000
  pmatrix.msm(multi.m2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well Fracture    Death
## Well     0.94062 0.005294 0.054087
## Fracture 0.00000 0.956164 0.043836
## Death    0.00000 0.000000 1.000000
# Osteoporosis:
pmatrix.msm(multi.m2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well   Fracture     Death
## Well     0.99784 0.00022617 0.0019366
## Fracture 0.00000 0.99658483 0.0034152
## Death    0.00000 0.00000000 1.0000000
  pmatrix.msm(multi.m2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well  Fracture    Death
## Well     0.97898 0.0013853 0.019631
## Fracture 0.00000 0.9822981 0.017702
## Death    0.00000 0.0000000 1.000000
  pmatrix.msm(multi.m2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well  Fracture    Death
## Well     0.94355 0.0030931 0.053354
## Fracture 0.00000 0.9638169 0.036183
## Death    0.00000 0.0000000 1.000000
# Osteoporosis + comorbidities:
pmatrix.msm(multi.m2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
##             Well   Fracture     Death
## Well     0.99457 0.00030065 0.0051333
## Fracture 0.00000 0.99425183 0.0057482
## Death    0.00000 0.00000000 1.0000000
  pmatrix.msm(multi.m2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
##             Well  Fracture    Death
## Well     0.94693 0.0018119 0.051260
## Fracture 0.00000 0.9703517 0.029648
## Death    0.00000 0.0000000 1.000000
  pmatrix.msm(multi.m2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
##             Well  Fracture    Death
## Well     0.86071 0.0039121 0.135377
## Fracture 0.00000 0.9397865 0.060214
## Death    0.00000 0.0000000 1.000000

1.3.5 Check the model goodness-of-fit

Model validation
prevalence.msm(multi.m2, times = seq(0,20,1), covariates = "mean", ci = "normal")
## $Observed
##    State 1 State 2 State 3 Total
## 0     5375       0       0  5375
## 1     5270      49      53  5372
## 2     5120     101     148  5369
## 3     4923     159     262  5344
## 4     4733     198     394  5325
## 5     4477     257     559  5293
## 6     4252     290     726  5268
## 7     4022     323     905  5250
## 8     3755     371    1102  5228
## 9     3497     392    1322  5211
## 10    3244     413    1533  5190
## 11    2986     419    1764  5169
## 12    2750     418    1978  5146
## 13    2482     414    2226  5122
## 14    2222     413    2455  5090
## 15    1963     399    2673  5035
## 16    1746     365    2871  4982
## 17    1530     346    3066  4942
## 18    1338     310    3231  4879
## 19    1182     265    3292  4739
## 20    1019     212    3293  4524
## 
## $Expected
## $Expected$estimates
##      Well Fracture   Death Total
## 0  5375.0    0.000    0.00  5375
## 1  5228.0   57.308   86.65  5372
## 2  5085.1  110.466  173.43  5369
## 3  4925.8  159.049  259.16  5344
## 4  4776.7  203.785  344.47  5325
## 5  4620.8  244.190  428.01  5293
## 6  4262.5  307.745  697.76  5268
## 7  3937.1  362.408  950.46  5250
## 8  3633.8  408.471 1185.75  5228
## 9  3357.0  447.461 1406.58  5211
## 10 3098.8  479.431 1611.76  5190
## 11 2860.5  505.405 1803.13  5169
## 12 2639.4  525.826 1980.79  5146
## 13 2434.9  541.365 2145.77  5122
## 14 2242.6  551.795 2295.59  5090
## 15 2056.1  555.900 2423.02  5035
## 16 1885.6  556.841 2539.57  4982
## 17 1733.6  556.312 2652.09  4942
## 18 1586.3  550.668 2742.06  4879
## 19 1428.0  534.174 2776.80  4739
## 20 1263.5  507.517 2752.98  4524
## 
## $Expected$ci
## , , 2.5%
## 
##         [,1]    [,2]     [,3] [,4]
##  [1,] 5375.0   0.000    0.000 5375
##  [2,] 5217.3  51.314   79.152 5372
##  [3,] 5064.2  98.982  158.422 5369
##  [4,] 4895.4 142.408  237.155 5344
##  [5,] 4737.6 182.398  316.426 5325
##  [6,] 4573.5 218.024  393.777 5293
##  [7,] 4215.3 282.478  662.813 5268
##  [8,] 3889.1 336.418  912.472 5250
##  [9,] 3584.3 380.843 1144.791 5228
## [10,] 3304.7 416.011 1360.904 5211
## [11,] 3043.4 447.141 1560.867 5190
## [12,] 2802.4 471.783 1747.564 5169
## [13,] 2579.1 490.337 1921.759 5146
## [14,] 2372.6 503.378 2084.077 5122
## [15,] 2179.3 512.004 2231.992 5090
## [16,] 1993.6 514.227 2358.605 5035
## [17,] 1824.3 513.772 2472.185 4982
## [18,] 1672.2 511.668 2580.438 4942
## [19,] 1525.5 505.216 2670.427 4879
## [20,] 1369.1 488.196 2707.607 4739
## [21,] 1207.7 461.874 2686.791 4524
## 
## , , 97.5%
## 
##         [,1]    [,2]     [,3] [,4]
##  [1,] 5375.0   0.000    0.000 5375
##  [2,] 5237.8  64.119   94.832 5372
##  [3,] 5104.1 123.731  189.528 5369
##  [4,] 4953.5 178.281  283.000 5344
##  [5,] 4812.6 228.360  375.720 5325
##  [6,] 4664.2 274.452  467.100 5293
##  [7,] 4303.9 337.180  735.765 5268
##  [8,] 3981.4 392.110  990.494 5250
##  [9,] 3681.6 438.563 1230.042 5228
## [10,] 3407.1 479.720 1455.976 5211
## [11,] 3153.0 513.262 1664.678 5190
## [12,] 2917.3 541.107 1857.979 5169
## [13,] 2698.1 562.924 2039.696 5146
## [14,] 2496.6 580.507 2206.831 5122
## [15,] 2304.9 593.344 2360.294 5090
## [16,] 2118.6 600.434 2489.107 5035
## [17,] 1947.9 602.994 2605.932 4982
## [18,] 1795.4 603.624 2718.921 4942
## [19,] 1647.0 599.477 2807.753 4879
## [20,] 1486.2 583.247 2842.825 4739
## [21,] 1318.0 556.208 2816.547 4524
## 
## 
## 
## $`Observed percentages`
##    State 1 State 2 State 3
## 0  100.000 0.00000  0.0000
## 1   98.101 0.91214  0.9866
## 2   95.362 1.88117  2.7566
## 3   92.122 2.97530  4.9027
## 4   88.883 3.71831  7.3991
## 5   84.583 4.85547 10.5611
## 6   80.714 5.50494 13.7813
## 7   76.610 6.15238 17.2381
## 8   71.825 7.09640 21.0788
## 9   67.108 7.52255 25.3694
## 10  62.505 7.95761 29.5376
## 11  57.767 8.10602 34.1265
## 12  53.440 8.12281 38.4376
## 13  48.458 8.08278 43.4596
## 14  43.654 8.11395 48.2318
## 15  38.987 7.92453 53.0884
## 16  35.046 7.32637 57.6275
## 17  30.959 7.00121 62.0397
## 18  27.424 6.35376 66.2226
## 19  24.942 5.59190 69.4661
## 20  22.524 4.68612 72.7896
## 
## $`Expected percentages`
## $`Expected percentages`$estimates
##       Well Fracture   Death
## 0  100.000   0.0000  0.0000
## 1   97.320   1.0668  1.6130
## 2   94.712   2.0575  3.2303
## 3   92.174   2.9762  4.8496
## 4   89.704   3.8269  6.4690
## 5   87.300   4.6134  8.0863
## 6   80.913   5.8418 13.2453
## 7   74.993   6.9030 18.1041
## 8   69.506   7.8131 22.6808
## 9   64.421   8.5869 26.9925
## 10  59.707   9.2376 31.0551
## 11  55.339   9.7776 34.8835
## 12  51.290  10.2181 38.4919
## 13  47.537  10.5694 41.8932
## 14  44.059  10.8408 45.1000
## 15  40.836  11.0407 48.1236
## 16  37.848  11.1770 50.9750
## 17  35.079  11.2568 53.6644
## 18  32.512  11.2865 56.2012
## 19  30.134  11.2719 58.5946
## 20  27.929  11.2183 60.8529
## 
## $`Expected percentages`$ci
## , , 2.5%
## 
##          [,1]     [,2]    [,3]
##  [1,] 100.000  0.00000  0.0000
##  [2,]  97.120  0.95521  1.4734
##  [3,]  94.323  1.84358  2.9507
##  [4,]  91.606  2.66481  4.4378
##  [5,]  88.968  3.42532  5.9423
##  [6,]  86.406  4.11910  7.4396
##  [7,]  80.017  5.36215 12.5819
##  [8,]  74.078  6.40796 17.3804
##  [9,]  68.560  7.28467 21.8973
## [10,]  63.418  7.98332 26.1160
## [11,]  58.640  8.61543 30.0745
## [12,]  54.215  9.12717 33.8085
## [13,]  50.119  9.52850 37.3447
## [14,]  46.322  9.82776 40.6887
## [15,]  42.816 10.05902 43.8505
## [16,]  39.595 10.21305 46.8442
## [17,]  36.617 10.31256 49.6223
## [18,]  33.836 10.35346 52.2144
## [19,]  31.266 10.35490 54.7331
## [20,]  28.891 10.30167 57.1346
## [21,]  26.695 10.20942 59.3897
## 
## , , 97.5%
## 
##          [,1]    [,2]    [,3]
##  [1,] 100.000  0.0000  0.0000
##  [2,]  97.502  1.1936  1.7653
##  [3,]  95.067  2.3045  3.5300
##  [4,]  92.692  3.3361  5.2957
##  [5,]  90.377  4.2885  7.0558
##  [6,]  88.119  5.1852  8.8249
##  [7,]  81.699  6.4005 13.9667
##  [8,]  75.836  7.4688 18.8665
##  [9,]  70.421  8.3887 23.5280
## [10,]  65.382  9.2059 27.9404
## [11,]  60.751  9.8894 32.0747
## [12,]  56.438 10.4683 35.9447
## [13,]  52.430 10.9391 39.6365
## [14,]  48.743 11.3336 43.0853
## [15,]  45.284 11.6571 46.3712
## [16,]  42.078 11.9252 49.4361
## [17,]  39.099 12.1035 52.3069
## [18,]  36.330 12.2142 55.0166
## [19,]  33.757 12.2869 57.5477
## [20,]  31.361 12.3074 59.9879
## [21,]  29.133 12.2946 62.2579
plot.prevalence.msm(multi.m2, mintime = 0, maxtime = 20, legend.pos = c(10, 80), col.obs = "gray", 
                    col.exp = "black")

Diagnostic plots for survival
par(mfrow= c(1,2))
plot.survfit.msm(multi.m2, from = 1, main = "No fracture", range = c(0,20), 
                 ci = "normal", col = "black", col.ci = "black", lty = 2, lwd = 2, 
                 col.surv ="grey", lty.surv = 2, lwd.surv = 1, xlab = "Time (years)")
legend(0.4,0.35, legend = c("Expected", "Expected (95% CI)", "Observed", "Observed (95% CI)"), 
       col = c("black", "black", "grey", "gray"), lty = c(2, 2, 1, 2), lwd = c(2, 1, 2, 1))
plot.survfit.msm(multi.m2, from = 2, main = "Initial fracture", range = c(0,20), 
                 ci = "normal", col = "black", col.ci = "black", lty = 2, lwd = 2, 
                 col.surv ="grey", lty.surv = 2, lwd.surv = 1, xlab = "Time (years)")

2. WOMEN

2.1 Description of study sample

women = subset(bmd, gender == "F" & race == "1:WHITE")
baseline.w = subset(women, state == 1 & time2event == 0)

table1(~ ageBase + fnbmdBase + TscoreBase + as.factor(fall.no) + fall.yesno + as.factor(fx50) + race + weight + height + BMI + as.factor(smoke) + as.factor(drink.n) + as.factor(physical) + as.factor(cvd.n) + as.factor(hypertension) + as.factor(copd) + as.factor(diabetes.n) + as.factor(cancer) + as.factor(parkinson) + as.factor(rheumatoid) + as.factor(renal) + as.factor(depression) + as.factor(anyfx) + as.factor(death) | fx_death, data = baseline.w)
Event-free
(N=1888)
Fractured, Alive
(N=1211)
Fractured, Dead
(N=1487)
No Fractured, Dead
(N=2781)
Overall
(N=7367)
ageBase
Mean (SD) 71.6 (3.99) 72.0 (4.20) 75.4 (5.29) 74.7 (5.33) 73.6 (5.08)
Median [Min, Max] 71.0 [67.0, 88.0] 71.0 [67.0, 90.0] 75.0 [67.0, 91.0] 74.0 [67.0, 90.0] 73.0 [67.0, 91.0]
fnbmdBase
Mean (SD) 0.676 (0.107) 0.639 (0.106) 0.605 (0.102) 0.658 (0.115) 0.649 (0.112)
Median [Min, Max] 0.666 [0.387, 1.15] 0.630 [0.302, 1.21] 0.597 [0.297, 1.21] 0.648 [0.277, 1.30] 0.639 [0.277, 1.30]
TscoreBase
Mean (SD) -1.96 (0.824) -2.24 (0.812) -2.50 (0.788) -2.09 (0.883) -2.16 (0.860)
Median [Min, Max] -2.03 [-4.18, 1.67] -2.31 [-4.83, 2.18] -2.56 [-4.87, 2.18] -2.17 [-5.02, 2.83] -2.24 [-5.02, 2.83]
as.factor(fall.no)
0 1418 (75.1%) 854 (70.5%) 1034 (69.5%) 2038 (73.3%) 5344 (72.5%)
1 333 (17.6%) 257 (21.2%) 287 (19.3%) 474 (17.0%) 1351 (18.3%)
2 97 (5.1%) 71 (5.9%) 107 (7.2%) 176 (6.3%) 451 (6.1%)
3+ 40 (2.1%) 29 (2.4%) 59 (4.0%) 93 (3.3%) 221 (3.0%)
fall.yesno
No 1418 (75.1%) 854 (70.5%) 1034 (69.5%) 2038 (73.3%) 5344 (72.5%)
Yes 470 (24.9%) 357 (29.5%) 453 (30.5%) 743 (26.7%) 2023 (27.5%)
as.factor(fx50)
0 1297 (68.7%) 655 (54.1%) 709 (47.7%) 1702 (61.2%) 4363 (59.2%)
1 591 (31.3%) 556 (45.9%) 778 (52.3%) 1079 (38.8%) 3004 (40.8%)
race
1:WHITE 1888 (100%) 1211 (100%) 1487 (100%) 2781 (100%) 7367 (100%)
weight
Mean (SD) 67.3 (11.8) 66.3 (11.7) 64.7 (11.6) 66.7 (12.8) 66.4 (12.2)
Median [Min, Max] 65.8 [41.7, 112] 65.0 [40.8, 112] 63.3 [40.2, 112] 65.3 [40.0, 112] 65.0 [40.0, 112]
Missing 11 (0.6%) 11 (0.9%) 20 (1.3%) 24 (0.9%) 66 (0.9%)
height
Mean (SD) 160 (5.66) 160 (5.65) 159 (6.01) 159 (5.94) 159 (5.85)
Median [Min, Max] 160 [142, 175] 160 [143, 176] 159 [142, 175] 159 [141, 175] 159 [141, 176]
Missing 8 (0.4%) 7 (0.6%) 16 (1.1%) 13 (0.5%) 44 (0.6%)
BMI
Mean (SD) 26.4 (4.36) 26.0 (4.37) 25.7 (4.37) 26.5 (4.69) 26.2 (4.50)
Median [Min, Max] 25.8 [16.0, 44.1] 25.4 [16.2, 48.8] 25.3 [16.9, 48.3] 25.9 [15.3, 44.7] 25.7 [15.3, 48.8]
Missing 11 (0.6%) 11 (0.9%) 20 (1.3%) 25 (0.9%) 67 (0.9%)
as.factor(smoke)
0 1182 (62.6%) 771 (63.7%) 916 (61.6%) 1615 (58.1%) 4484 (60.9%)
1 706 (37.4%) 440 (36.3%) 571 (38.4%) 1166 (41.9%) 2883 (39.1%)
as.factor(drink.n)
No 723 (38.3%) 481 (39.7%) 724 (48.7%) 1337 (48.1%) 3265 (44.3%)
Yes 1165 (61.7%) 730 (60.3%) 763 (51.3%) 1444 (51.9%) 4102 (55.7%)
as.factor(physical)
0 567 (30.0%) 355 (29.3%) 734 (49.4%) 1400 (50.3%) 3056 (41.5%)
1 1321 (70.0%) 856 (70.7%) 753 (50.6%) 1381 (49.7%) 4311 (58.5%)
as.factor(cvd.n)
No 1554 (82.3%) 1003 (82.8%) 1080 (72.6%) 1958 (70.4%) 5595 (75.9%)
Yes 334 (17.7%) 208 (17.2%) 407 (27.4%) 823 (29.6%) 1772 (24.1%)
as.factor(hypertension)
0 1326 (70.2%) 865 (71.4%) 847 (57.0%) 1557 (56.0%) 4595 (62.4%)
1 562 (29.8%) 346 (28.6%) 640 (43.0%) 1224 (44.0%) 2772 (37.6%)
as.factor(copd)
0 1628 (86.2%) 1008 (83.2%) 1191 (80.1%) 2291 (82.4%) 6118 (83.0%)
1 260 (13.8%) 203 (16.8%) 296 (19.9%) 490 (17.6%) 1249 (17.0%)
as.factor(diabetes.n)
No 1821 (96.5%) 1154 (95.3%) 1358 (91.3%) 2545 (91.5%) 6878 (93.4%)
Yes 67 (3.5%) 57 (4.7%) 129 (8.7%) 236 (8.5%) 489 (6.6%)
as.factor(cancer)
0 1546 (81.9%) 978 (80.8%) 1182 (79.5%) 2234 (80.3%) 5940 (80.6%)
1 342 (18.1%) 233 (19.2%) 305 (20.5%) 547 (19.7%) 1427 (19.4%)
as.factor(parkinson)
0 1882 (99.7%) 1205 (99.5%) 1471 (98.9%) 2766 (99.5%) 7324 (99.4%)
1 6 (0.3%) 6 (0.5%) 16 (1.1%) 15 (0.5%) 43 (0.6%)
as.factor(rheumatoid)
0 1804 (95.6%) 1147 (94.7%) 1393 (93.7%) 2630 (94.6%) 6974 (94.7%)
1 84 (4.4%) 64 (5.3%) 94 (6.3%) 151 (5.4%) 393 (5.3%)
as.factor(renal)
0 1867 (98.9%) 1204 (99.4%) 1464 (98.5%) 2743 (98.6%) 7278 (98.8%)
1 21 (1.1%) 7 (0.6%) 23 (1.5%) 38 (1.4%) 89 (1.2%)
as.factor(depression)
0 1765 (93.5%) 1117 (92.2%) 1352 (90.9%) 2564 (92.2%) 6798 (92.3%)
1 123 (6.5%) 94 (7.8%) 135 (9.1%) 217 (7.8%) 569 (7.7%)
as.factor(anyfx)
0 1888 (100%) 0 (0%) 0 (0%) 2781 (100%) 4669 (63.4%)
1 0 (0%) 1211 (100%) 1487 (100%) 0 (0%) 2698 (36.6%)
as.factor(death)
0 1888 (100%) 1211 (100%) 0 (0%) 0 (0%) 3099 (42.1%)
1 0 (0%) 0 (0%) 1487 (100%) 2781 (100%) 4268 (57.9%)
#createTable(compareGroups(fx_death ~ ageBase + fnbmdBase + TscoreBase + fall.no + fall.yesno + fx50 + race + weight + height + BMI + smoke + drink.n + physical + cvd.n + hypertension + copd + diabetes.n + cancer + parkinson + rheumatoid + renal + depression + anyfx + death, data = baseline.w))

2.2 Conventional Cox’s PH model

2.2.1 Age-adjusted model:
cox.w1 = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2, data = baseline.w)
summary(cox.w1)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2, 
##     data = baseline.w)
## 
##   n= 7367, number of events= 4268 
## 
##                 coef exp(coef) se(coef)     z Pr(>|z|)    
## ageBase      0.11971   1.12717  0.00308 38.90  < 2e-16 ***
## TscoreBase.2 0.07819   1.08132  0.01925  4.06  4.9e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##              exp(coef) exp(-coef) lower .95 upper .95
## ageBase           1.13      0.887      1.12      1.13
## TscoreBase.2      1.08      0.925      1.04      1.12
## 
## Concordance= 0.664  (se = 0.004 )
## Likelihood ratio test= 1546  on 2 df,   p=<2e-16
## Wald test            = 1720  on 2 df,   p=<2e-16
## Score (logrank) test = 1812  on 2 df,   p=<2e-16
2.2.2 Essential covariates
cox.w2 = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2 + fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + cancer, data = baseline.w)
summary(cox.w2)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2 + 
##     fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + 
##     cancer, data = baseline.w)
## 
##   n= 7367, number of events= 4268 
## 
##                   coef exp(coef) se(coef)     z Pr(>|z|)    
## ageBase        0.11294   1.11956  0.00315 35.80  < 2e-16 ***
## TscoreBase.2   0.09890   1.10395  0.01973  5.01  5.4e-07 ***
## fall.yesnoYes -0.02540   0.97492  0.03423 -0.74   0.4580    
## fx50           0.09498   1.09964  0.03183  2.98   0.0028 ** 
## cvd.nYes       0.31972   1.37674  0.03433  9.31  < 2e-16 ***
## hypertension   0.31536   1.37075  0.03136 10.06  < 2e-16 ***
## copd           0.12368   1.13166  0.03964  3.12   0.0018 ** 
## diabetes.nYes  0.58033   1.78662  0.05539 10.48  < 2e-16 ***
## cancer         0.02340   1.02368  0.03837  0.61   0.5419    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##               exp(coef) exp(-coef) lower .95 upper .95
## ageBase           1.120      0.893     1.113      1.13
## TscoreBase.2      1.104      0.906     1.062      1.15
## fall.yesnoYes     0.975      1.026     0.912      1.04
## fx50              1.100      0.909     1.033      1.17
## cvd.nYes          1.377      0.726     1.287      1.47
## hypertension      1.371      0.730     1.289      1.46
## copd              1.132      0.884     1.047      1.22
## diabetes.nYes     1.787      0.560     1.603      1.99
## cancer            1.024      0.977     0.950      1.10
## 
## Concordance= 0.686  (se = 0.004 )
## Likelihood ratio test= 1876  on 9 df,   p=<2e-16
## Wald test            = 2064  on 9 df,   p=<2e-16
## Score (logrank) test = 2167  on 9 df,   p=<2e-16
2.2.3 Multivariable-adjusted model
cox.w3 = coxph(Surv(time2end, death) ~ ageBase + TscoreBase.2 + fall.yesno + fx50 + BMI + smoke + drink.n + 
                 physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson + 
                 depression, data = baseline.w)
summary(cox.w3)
## Call:
## coxph(formula = Surv(time2end, death) ~ ageBase + TscoreBase.2 + 
##     fall.yesno + fx50 + BMI + smoke + drink.n + physical + cvd.n + 
##     hypertension + copd + diabetes.n + cancer + renal + parkinson + 
##     depression, data = baseline.w)
## 
##   n= 7300, number of events= 4223 
##    (67 observations deleted due to missingness)
## 
##                    coef exp(coef)  se(coef)      z Pr(>|z|)    
## ageBase        0.106438  1.112309  0.003268  32.57  < 2e-16 ***
## TscoreBase.2   0.067567  1.069902  0.021052   3.21  0.00133 ** 
## fall.yesnoYes  0.000279  1.000279  0.034449   0.01  0.99355    
## fx50           0.080579  1.083914  0.032173   2.50  0.01226 *  
## BMI           -0.013499  0.986592  0.003955  -3.41  0.00064 ***
## smoke          0.302597  1.353368  0.032631   9.27  < 2e-16 ***
## drink.nYes    -0.166401  0.846707  0.032366  -5.14  2.7e-07 ***
## physical      -0.598213  0.549793  0.032871 -18.20  < 2e-16 ***
## cvd.nYes       0.284623  1.329261  0.034618   8.22  < 2e-16 ***
## hypertension   0.292155  1.339310  0.031722   9.21  < 2e-16 ***
## copd           0.028812  1.029231  0.040449   0.71  0.47628    
## diabetes.nYes  0.469461  1.599133  0.056721   8.28  < 2e-16 ***
## cancer         0.067294  1.069610  0.038688   1.74  0.08197 .  
## renal          0.360623  1.434222  0.130476   2.76  0.00571 ** 
## parkinson      0.203365  1.225520  0.186795   1.09  0.27628    
## depression     0.083361  1.086934  0.056561   1.47  0.14053    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##               exp(coef) exp(-coef) lower .95 upper .95
## ageBase           1.112      0.899     1.105     1.119
## TscoreBase.2      1.070      0.935     1.027     1.115
## fall.yesnoYes     1.000      1.000     0.935     1.070
## fx50              1.084      0.923     1.018     1.154
## BMI               0.987      1.014     0.979     0.994
## smoke             1.353      0.739     1.270     1.443
## drink.nYes        0.847      1.181     0.795     0.902
## physical          0.550      1.819     0.515     0.586
## cvd.nYes          1.329      0.752     1.242     1.423
## hypertension      1.339      0.747     1.259     1.425
## copd              1.029      0.972     0.951     1.114
## diabetes.nYes     1.599      0.625     1.431     1.787
## cancer            1.070      0.935     0.992     1.154
## renal             1.434      0.697     1.111     1.852
## parkinson         1.226      0.816     0.850     1.767
## depression        1.087      0.920     0.973     1.214
## 
## Concordance= 0.716  (se = 0.004 )
## Likelihood ratio test= 2326  on 16 df,   p=<2e-16
## Wald test            = 2499  on 16 df,   p=<2e-16
## Score (logrank) test = 2650  on 16 df,   p=<2e-16

2.3 Multistate regression

2.3.1 Data preparation

qmatrix.n = crudeinits.msm(state ~ time2event, subject = ID, data = women, qmatrix = Q.m2)
qmatrix.n
##               Well  Fracture    Death
## Well     -0.069633  0.034289 0.035344
## Fracture  0.000000 -0.081958 0.081958
## Death     0.000000  0.000000 0.000000
statetable.msm(state, ID, data = women)
##     to
## from    1    2    3
##    1 1889 2698 2781
##    2    0 1211 1487

2.3.2 Age-adjusted model:

Age and FNBMD at baseline:
age.w1= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2)  
age.w1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~ageBase +         TscoreBase.2, exacttimes = TRUE, pci = 5, method = "BFGS",     control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.06129 (-0.06321,-0.05942)                    
## Well - Fracture      0.03322 ( 0.03191, 0.03459) 1.040 (1.032,1.048)
## Well - Death         0.02806 ( 0.02676, 0.02943) 1.105 (1.097,1.113)
## Fracture - Fracture -0.05903 (-0.06487,-0.05371)                    
## Fracture - Death     0.05903 ( 0.05371, 0.06487) 1.096 (1.086,1.107)
##                     TscoreBase.2         timeperiod[5,Inf)  
## Well - Well                                                 
## Well - Fracture     1.632 (1.5504,1.717) 1.307 (1.208,1.415)
## Well - Death        0.983 (0.9396,1.028) 3.095 (2.824,3.394)
## Fracture - Fracture                                         
## Fracture - Death    1.087 (1.0131,1.166) 1.899 (1.592,2.264)
## 
## -2 * log-likelihood:  55963
hazard.msm(age.w1)
## $ageBase
##                      HR      L      U
## Well - Fracture  1.0404 1.0324 1.0484
## Well - Death     1.1053 1.0973 1.1132
## Fracture - Death 1.0962 1.0855 1.1070
## 
## $TscoreBase.2
##                       HR       L      U
## Well - Fracture  1.63155 1.55040 1.7169
## Well - Death     0.98304 0.93961 1.0285
## Fracture - Death 1.08691 1.01308 1.1661
## 
## $`timeperiod[5,Inf)`
##                      HR      L      U
## Well - Fracture  1.3072 1.2079 1.4146
## Well - Death     3.0955 2.8236 3.3935
## Fracture - Death 1.8985 1.5920 2.2641
Age and FNBMD at baseline and at fracture time:
age.w2= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2)  
age.w2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age +         Tscore.2, exacttimes = TRUE, pci = 5, method = "BFGS",     control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.06685 (-0.06894,-0.06482)                    
## Well - Fracture      0.03497 ( 0.03355, 0.03645) 1.041 (1.033,1.049)
## Well - Death         0.03188 ( 0.03044, 0.03338) 1.106 (1.098,1.114)
## Fracture - Fracture -0.04282 (-0.04753,-0.03858)                    
## Fracture - Death     0.04282 ( 0.03858, 0.04753) 1.105 (1.096,1.114)
##                     Tscore.2              timeperiod[5,Inf)   
## Well - Well                                                   
## Well - Fracture     1.6272 (1.5461,1.712) 1.310 (1.2104,1.418)
## Well - Death        0.9781 (0.9348,1.023) 3.134 (2.8573,3.438)
## Fracture - Fracture                                           
## Fracture - Death    1.1294 (1.0544,1.210) 1.195 (0.9996,1.428)
## 
## -2 * log-likelihood:  55458
hazard.msm(age.w2)
## $age
##                      HR      L      U
## Well - Fracture  1.0406 1.0326 1.0486
## Well - Death     1.1062 1.0983 1.1142
## Fracture - Death 1.1048 1.0957 1.1140
## 
## $Tscore.2
##                       HR       L      U
## Well - Fracture  1.62719 1.54614 1.7125
## Well - Death     0.97808 0.93479 1.0234
## Fracture - Death 1.12936 1.05439 1.2097
## 
## $`timeperiod[5,Inf)`
##                      HR       L      U
## Well - Fracture  1.3101 1.21038 1.4180
## Well - Death     3.1345 2.85734 3.4385
## Fracture - Death 1.1947 0.99965 1.4278

2.3.3 Essential covariates:

Age and FNBMD at baseline:
multi.we1= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2 +
             fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)  
multi.we1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~ageBase +         TscoreBase.2 + fall.yesno + fx50 + cvd.n + hypertension +         copd + diabetes.n + cancer, exacttimes = TRUE, pci = 5,     method = "BFGS", control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.06070 (-0.06263,-0.05884)                    
## Well - Fracture      0.03308 ( 0.03176, 0.03445) 1.036 (1.028,1.045)
## Well - Death         0.02762 ( 0.02633, 0.02899) 1.098 (1.089,1.106)
## Fracture - Fracture -0.05823 (-0.06406,-0.05293)                    
## Fracture - Death     0.05823 ( 0.05293, 0.06406) 1.090 (1.079,1.101)
##                     TscoreBase.2         fall.yesnoYes        
## Well - Well                                                   
## Well - Fracture     1.587 (1.5069,1.672) 1.1534 (1.0618,1.253)
## Well - Death        1.006 (0.9608,1.054) 0.9709 (0.8923,1.056)
## Fracture - Fracture                                           
## Fracture - Death    1.113 (1.0366,1.196) 0.9426 (0.8434,1.053)
##                     fx50                  cvd.nYes             
## Well - Well                                                    
## Well - Fracture     1.4807 (1.3703,1.600) 0.9934 (0.9069,1.088)
## Well - Death        1.0776 (0.9965,1.165) 1.3761 (1.2671,1.494)
## Fracture - Fracture                                            
## Fracture - Death    0.9458 (0.8517,1.050) 1.2494 (1.1117,1.404)
##                     hypertension         copd                
## Well - Well                                                  
## Well - Fracture     1.070 (0.9879,1.158) 1.133 (1.0274,1.249)
## Well - Death        1.328 (1.2314,1.433) 1.132 (1.0262,1.248)
## Fracture - Fracture                                          
## Fracture - Death    1.309 (1.1777,1.455) 1.096 (0.9635,1.247)
##                     diabetes.nYes       cancer               
## Well - Well                                                  
## Well - Fracture     1.470 (1.265,1.708) 1.0458 (0.9514,1.150)
## Well - Death        1.599 (1.398,1.830) 1.0068 (0.9168,1.106)
## Fracture - Fracture                                          
## Fracture - Death    1.701 (1.416,2.042) 0.9849 (0.8681,1.117)
##                     timeperiod[5,Inf)  
## Well - Well                            
## Well - Fracture     1.342 (1.240,1.453)
## Well - Death        3.200 (2.918,3.509)
## Fracture - Fracture                    
## Fracture - Death    1.952 (1.636,2.328)
## 
## -2 * log-likelihood:  55552
hazard.msm(multi.we1)
## $ageBase
##                      HR      L      U
## Well - Fracture  1.0364 1.0282 1.0446
## Well - Death     1.0975 1.0895 1.1057
## Fracture - Death 1.0901 1.0791 1.1013
## 
## $TscoreBase.2
##                      HR       L      U
## Well - Fracture  1.5873 1.50689 1.6719
## Well - Death     1.0064 0.96078 1.0541
## Fracture - Death 1.1133 1.03661 1.1958
## 
## $fall.yesnoYes
##                       HR       L      U
## Well - Fracture  1.15343 1.06183 1.2529
## Well - Death     0.97090 0.89234 1.0564
## Fracture - Death 0.94255 0.84338 1.0534
## 
## $fx50
##                       HR       L      U
## Well - Fracture  1.48065 1.37034 1.5998
## Well - Death     1.07757 0.99648 1.1653
## Fracture - Death 0.94577 0.85165 1.0503
## 
## $cvd.nYes
##                       HR       L      U
## Well - Fracture  0.99336 0.90693 1.0880
## Well - Death     1.37608 1.26706 1.4945
## Fracture - Death 1.24937 1.11175 1.4040
## 
## $hypertension
##                      HR       L      U
## Well - Fracture  1.0697 0.98792 1.1582
## Well - Death     1.3285 1.23144 1.4332
## Fracture - Death 1.3089 1.17767 1.4548
## 
## $copd
##                      HR       L      U
## Well - Fracture  1.1328 1.02745 1.2489
## Well - Death     1.1317 1.02616 1.2480
## Fracture - Death 1.0959 0.96346 1.2465
## 
## $diabetes.nYes
##                      HR      L      U
## Well - Fracture  1.4698 1.2646 1.7082
## Well - Death     1.5994 1.3977 1.8302
## Fracture - Death 1.7008 1.4163 2.0424
## 
## $cancer
##                       HR       L      U
## Well - Fracture  1.04584 0.95145 1.1496
## Well - Death     1.00679 0.91676 1.1057
## Fracture - Death 0.98493 0.86814 1.1174
## 
## $`timeperiod[5,Inf)`
##                      HR      L      U
## Well - Fracture  1.3420 1.2399 1.4526
## Well - Death     3.1998 2.9181 3.5088
## Fracture - Death 1.9515 1.6358 2.3281
Age and FNBMD at fracture time:
multi.we2= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2 +
             fall.yesno + fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)  
multi.we2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age +         Tscore.2 + fall.yesno + fx50 + cvd.n + hypertension +         copd + diabetes.n + cancer, exacttimes = TRUE, pci = 5,     method = "BFGS", control = list(fnscale = 4000, maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.06572 (-0.06781,-0.06369)                    
## Well - Fracture      0.03463 ( 0.03321, 0.03611) 1.037 (1.028,1.045)
## Well - Death         0.03109 ( 0.02966, 0.03258) 1.099 (1.091,1.107)
## Fracture - Fracture -0.04162 (-0.04628,-0.03743)                    
## Fracture - Death     0.04162 ( 0.03743, 0.04628) 1.103 (1.093,1.112)
##                     Tscore.2             fall.yesnoYes        
## Well - Well                                                   
## Well - Fracture     1.583 (1.5029,1.668) 1.1468 (1.0554,1.246)
## Well - Death        1.002 (0.9561,1.049) 0.9721 (0.8932,1.058)
## Fracture - Fracture                                           
## Fracture - Death    1.136 (1.0596,1.218) 0.9524 (0.8517,1.065)
##                     fx50                 cvd.nYes             
## Well - Well                                                   
## Well - Fracture     1.481 (1.3709,1.601) 0.9922 (0.9056,1.087)
## Well - Death        1.074 (0.9932,1.162) 1.3755 (1.2662,1.494)
## Fracture - Fracture                                           
## Fracture - Death    1.038 (0.9349,1.153) 1.2833 (1.1426,1.441)
##                     hypertension         copd                
## Well - Well                                                  
## Well - Fracture     1.070 (0.9881,1.159) 1.131 (1.0257,1.247)
## Well - Death        1.319 (1.2220,1.423) 1.140 (1.0332,1.257)
## Fracture - Fracture                                          
## Fracture - Death    1.330 (1.1974,1.478) 1.103 (0.9692,1.254)
##                     diabetes.nYes       cancer              
## Well - Well                                                 
## Well - Fracture     1.464 (1.260,1.703) 1.047 (0.9524,1.151)
## Well - Death        1.609 (1.406,1.841) 1.013 (0.9221,1.112)
## Fracture - Fracture                                         
## Fracture - Death    1.771 (1.474,2.128) 1.051 (0.9260,1.194)
##                     timeperiod[5,Inf)  
## Well - Well                            
## Well - Fracture     1.345 (1.242,1.456)
## Well - Death        3.240 (2.953,3.555)
## Fracture - Fracture                    
## Fracture - Death    1.276 (1.066,1.526)
## 
## -2 * log-likelihood:  55039
hazard.msm(multi.we2)
## $age
##                      HR      L      U
## Well - Fracture  1.0366 1.0284 1.0448
## Well - Death     1.0986 1.0905 1.1068
## Fracture - Death 1.1026 1.0934 1.1119
## 
## $Tscore.2
##                      HR       L      U
## Well - Fracture  1.5832 1.50291 1.6678
## Well - Death     1.0016 0.95611 1.0492
## Fracture - Death 1.1361 1.05956 1.2183
## 
## $fall.yesnoYes
##                       HR       L      U
## Well - Fracture  1.14677 1.05541 1.2460
## Well - Death     0.97207 0.89320 1.0579
## Fracture - Death 0.95240 0.85165 1.0651
## 
## $fx50
##                      HR       L      U
## Well - Fracture  1.4815 1.37087 1.6010
## Well - Death     1.0743 0.99321 1.1621
## Fracture - Death 1.0384 0.93492 1.1533
## 
## $cvd.nYes
##                       HR       L      U
## Well - Fracture  0.99219 0.90561 1.0870
## Well - Death     1.37548 1.26618 1.4942
## Fracture - Death 1.28329 1.14265 1.4412
## 
## $hypertension
##                      HR       L      U
## Well - Fracture  1.0700 0.98806 1.1588
## Well - Death     1.3187 1.22199 1.4230
## Fracture - Death 1.3301 1.19736 1.4775
## 
## $copd
##                      HR       L      U
## Well - Fracture  1.1310 1.02566 1.2472
## Well - Death     1.1395 1.03324 1.2568
## Fracture - Death 1.1025 0.96917 1.2542
## 
## $diabetes.nYes
##                      HR      L      U
## Well - Fracture  1.4644 1.2595 1.7026
## Well - Death     1.6088 1.4059 1.8411
## Fracture - Death 1.7713 1.4741 2.1285
## 
## $cancer
##                      HR       L      U
## Well - Fracture  1.0471 0.95242 1.1512
## Well - Death     1.0128 0.92207 1.1124
## Fracture - Death 1.0513 0.92598 1.1935
## 
## $`timeperiod[5,Inf)`
##                      HR      L      U
## Well - Fracture  1.3451 1.2425 1.4562
## Well - Death     3.2399 2.9528 3.5550
## Fracture - Death 1.2756 1.0663 1.5261

2.3.4 Multivariable-adjusted model:

All covariates at baseline:
multi.w1= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ ageBase + TscoreBase.2 +
             fall.yesno + fx50 + BMI + smoke + drink.n + physical + cvd.n + hypertension + copd + diabetes.n + cancer + 
             renal + parkinson + depression)  
multi.w1
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~ageBase +         TscoreBase.2 + fall.yesno + fx50 + BMI + smoke + drink.n +         physical + cvd.n + hypertension + copd + diabetes.n +         cancer + renal + parkinson + depression, exacttimes = TRUE,     pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     ageBase            
## Well - Well         -0.05974 (-0.06165,-0.05788)                    
## Well - Fracture      0.03297 ( 0.03164, 0.03435) 1.032 (1.024,1.041)
## Well - Death         0.02677 ( 0.02548, 0.02812) 1.088 (1.080,1.097)
## Fracture - Fracture -0.05639 (-0.06215,-0.05116)                    
## Fracture - Death     0.05639 ( 0.05116, 0.06215) 1.087 (1.076,1.099)
##                     TscoreBase.2          fall.yesnoYes        
## Well - Well                                                    
## Well - Fracture     1.5746 (1.4889,1.665) 1.1479 (1.0559,1.248)
## Well - Death        0.9837 (0.9361,1.034) 1.0005 (0.9192,1.089)
## Fracture - Fracture                                            
## Fracture - Death    1.0594 (0.9808,1.144) 0.9537 (0.8524,1.067)
##                     fx50                  BMI                   
## Well - Well                                                     
## Well - Fracture     1.4770 (1.3657,1.597) 0.9956 (0.9859,1.0053)
## Well - Death        1.0617 (0.9811,1.149) 0.9875 (0.9783,0.9968)
## Fracture - Fracture                                             
## Fracture - Death    0.9278 (0.8341,1.032) 0.9906 (0.9773,1.0041)
##                     smoke                 drink.nYes            
## Well - Well                                                     
## Well - Fracture     0.9919 (0.9143,1.076) 0.9724 (0.8978,1.0532)
## Well - Death        1.3379 (1.2367,1.447) 0.8721 (0.8064,0.9430)
## Fracture - Fracture                                             
## Fracture - Death    1.2315 (1.1025,1.376) 0.8287 (0.7429,0.9245)
##                     physical               cvd.nYes             
## Well - Well                                                     
## Well - Fracture     0.8314 (0.7660,0.9025) 0.9815 (0.8954,1.076)
## Well - Death        0.5636 (0.5207,0.6102) 1.3224 (1.2169,1.437)
## Fracture - Fracture                                             
## Fracture - Death    0.6515 (0.5840,0.7267) 1.2122 (1.0770,1.364)
##                     hypertension         copd                
## Well - Well                                                  
## Well - Fracture     1.055 (0.9736,1.144) 1.107 (1.0023,1.223)
## Well - Death        1.315 (1.2176,1.420) 1.043 (0.9437,1.152)
## Fracture - Fracture                                          
## Fracture - Death    1.250 (1.1230,1.391) 1.028 (0.9015,1.173)
##                     diabetes.nYes       cancer              
## Well - Well                                                 
## Well - Fracture     1.427 (1.224,1.663) 1.062 (0.9653,1.168)
## Well - Death        1.426 (1.242,1.637) 1.056 (0.9613,1.161)
## Fracture - Fracture                                         
## Fracture - Death    1.537 (1.273,1.856) 1.008 (0.8871,1.145)
##                     renal                parkinson            
## Well - Well                                                   
## Well - Fracture     1.047 (0.7294,1.502) 2.0855 (1.3558,3.208)
## Well - Death        1.222 (0.8821,1.693) 1.2954 (0.7626,2.200)
## Fracture - Fracture                                           
## Fracture - Death    1.553 (1.0252,2.352) 0.9511 (0.5702,1.586)
##                     depression           timeperiod[5,Inf)  
## Well - Well                                                 
## Well - Fracture     1.125 (0.9799,1.291) 1.369 (1.264,1.483)
## Well - Death        1.029 (0.8938,1.184) 3.370 (3.071,3.698)
## Fracture - Fracture                                         
## Fracture - Death    1.029 (0.8583,1.233) 2.108 (1.762,2.522)
## 
## -2 * log-likelihood:  54586
hazard.msm(multi.w1)
## $ageBase
##                      HR      L      U
## Well - Fracture  1.0323 1.0240 1.0407
## Well - Death     1.0881 1.0798 1.0965
## Fracture - Death 1.0875 1.0761 1.0989
## 
## $TscoreBase.2
##                       HR       L      U
## Well - Fracture  1.57461 1.48892 1.6652
## Well - Death     0.98371 0.93612 1.0337
## Fracture - Death 1.05936 0.98085 1.1442
## 
## $fall.yesnoYes
##                       HR       L      U
## Well - Fracture  1.14787 1.05594 1.2478
## Well - Death     1.00053 0.91920 1.0891
## Fracture - Death 0.95368 0.85236 1.0670
## 
## $fx50
##                       HR       L      U
## Well - Fracture  1.47695 1.36574 1.5972
## Well - Death     1.06175 0.98110 1.1490
## Fracture - Death 0.92777 0.83409 1.0320
## 
## $BMI
##                       HR       L      U
## Well - Fracture  0.99557 0.98593 1.0053
## Well - Death     0.98749 0.97828 0.9968
## Fracture - Death 0.99061 0.97725 1.0041
## 
## $smoke
##                       HR       L      U
## Well - Fracture  0.99187 0.91435 1.0760
## Well - Death     1.33793 1.23674 1.4474
## Fracture - Death 1.23152 1.10253 1.3756
## 
## $drink.nYes
##                       HR       L       U
## Well - Fracture  0.97240 0.89778 1.05323
## Well - Death     0.87206 0.80642 0.94304
## Fracture - Death 0.82871 0.74289 0.92445
## 
## $physical
##                       HR       L       U
## Well - Fracture  0.83145 0.76596 0.90254
## Well - Death     0.56364 0.52067 0.61016
## Fracture - Death 0.65146 0.58400 0.72672
## 
## $cvd.nYes
##                       HR       L      U
## Well - Fracture  0.98154 0.89544 1.0759
## Well - Death     1.32238 1.21687 1.4370
## Fracture - Death 1.21217 1.07704 1.3643
## 
## $hypertension
##                      HR       L      U
## Well - Fracture  1.0552 0.97355 1.1437
## Well - Death     1.3147 1.21761 1.4196
## Fracture - Death 1.2500 1.12304 1.3912
## 
## $copd
##                      HR       L      U
## Well - Fracture  1.1073 1.00229 1.2234
## Well - Death     1.0425 0.94370 1.1517
## Fracture - Death 1.0283 0.90147 1.1730
## 
## $diabetes.nYes
##                      HR      L      U
## Well - Fracture  1.4267 1.2238 1.6632
## Well - Death     1.4256 1.2416 1.6368
## Fracture - Death 1.5372 1.2734 1.8556
## 
## $cancer
##                      HR       L      U
## Well - Fracture  1.0620 0.96527 1.1683
## Well - Death     1.0565 0.96133 1.1611
## Fracture - Death 1.0078 0.88706 1.1449
## 
## $renal
##                      HR       L      U
## Well - Fracture  1.0466 0.72943 1.5018
## Well - Death     1.2222 0.88213 1.6934
## Fracture - Death 1.5527 1.02521 2.3516
## 
## $parkinson
##                      HR       L      U
## Well - Fracture  2.0855 1.35584 3.2077
## Well - Death     1.2954 0.76264 2.2004
## Fracture - Death 0.9511 0.57025 1.5863
## 
## $depression
##                      HR       L      U
## Well - Fracture  1.1248 0.97986 1.2911
## Well - Death     1.0286 0.89381 1.1838
## Fracture - Death 1.0289 0.85827 1.2335
## 
## $`timeperiod[5,Inf)`
##                      HR      L      U
## Well - Fracture  1.3693 1.2641 1.4833
## Well - Death     3.3697 3.0707 3.6978
## Fracture - Death 2.1078 1.7618 2.5218
Age and FNBMD at fracture time (other covariates at baseline):
multi.w2= msm(state ~ time2event, subject = ID, data = women, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE, 
           method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + Tscore.2 + fall.yesno
           + fx50 + BMI + smoke + drink.n + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson 
           + depression)  
multi.w2
## 
## Call:
## msm(formula = state ~ time2event, subject = ID, data = women,     qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age +         Tscore.2 + fall.yesno + fx50 + BMI + smoke + drink.n +         physical + cvd.n + hypertension + copd + diabetes.n +         cancer + renal + parkinson + depression, exacttimes = TRUE,     pci = 5, method = "BFGS", control = list(fnscale = 4000,         maxit = 10000))
## 
## Maximum likelihood estimates
## Baselines are with covariates set to their means
## 
## Transition intensities with hazard ratios for each covariate
##                     Baseline                     age                
## Well - Well         -0.06418 (-0.06626,-0.06217)                    
## Well - Fracture      0.03433 ( 0.03291, 0.03581) 1.033 (1.024,1.041)
## Well - Death         0.02985 ( 0.02844, 0.03133) 1.089 (1.081,1.098)
## Fracture - Fracture -0.03961 (-0.04417,-0.03553)                    
## Fracture - Death     0.03961 ( 0.03553, 0.04417) 1.104 (1.094,1.113)
##                     Tscore.2              fall.yesnoYes        
## Well - Well                                                    
## Well - Fracture     1.5688 (1.4833,1.659) 1.1416 (1.0499,1.241)
## Well - Death        0.9819 (0.9343,1.032) 1.0007 (0.9192,1.090)
## Fracture - Fracture                                            
## Fracture - Death    1.0671 (0.9895,1.151) 0.9603 (0.8576,1.075)
##                     fx50                 BMI                   
## Well - Well                                                    
## Well - Fracture     1.479 (1.3670,1.599) 0.9952 (0.9856,1.0050)
## Well - Death        1.058 (0.9774,1.145) 0.9882 (0.9789,0.9975)
## Fracture - Fracture                                            
## Fracture - Death    1.021 (0.9176,1.136) 0.9868 (0.9735,1.0003)
##                     smoke                 drink.nYes            
## Well - Well                                                     
## Well - Fracture     0.9957 (0.9178,1.080) 0.9716 (0.8969,1.0525)
## Well - Death        1.3477 (1.2456,1.458) 0.8734 (0.8075,0.9447)
## Fracture - Fracture                                             
## Fracture - Death    1.2864 (1.1512,1.438) 0.8076 (0.7236,0.9014)
##                     physical               cvd.nYes             
## Well - Well                                                     
## Well - Fracture     0.8326 (0.7668,0.9039) 0.9804 (0.8941,1.075)
## Well - Death        0.5689 (0.5255,0.6160) 1.3206 (1.2150,1.436)
## Fracture - Fracture                                             
## Fracture - Death    0.6357 (0.5702,0.7087) 1.2400 (1.1022,1.395)
##                     hypertension         copd                
## Well - Well                                                  
## Well - Fracture     1.056 (0.9743,1.145) 1.105 (1.0000,1.221)
## Well - Death        1.306 (1.2093,1.411) 1.048 (0.9484,1.158)
## Fracture - Fracture                                          
## Fracture - Death    1.267 (1.1385,1.409) 1.030 (0.9033,1.175)
##                     diabetes.nYes       cancer              
## Well - Well                                                 
## Well - Fracture     1.422 (1.220,1.659) 1.063 (0.9661,1.170)
## Well - Death        1.433 (1.248,1.646) 1.061 (0.9655,1.166)
## Fracture - Fracture                                         
## Fracture - Death    1.570 (1.299,1.897) 1.079 (0.9492,1.227)
##                     renal                parkinson           
## Well - Well                                                  
## Well - Fracture     1.050 (0.7314,1.506) 2.092 (1.3600,3.218)
## Well - Death        1.229 (0.8876,1.703) 1.305 (0.7692,2.214)
## Fracture - Fracture                                          
## Fracture - Death    1.760 (1.1605,2.668) 1.098 (0.6580,1.833)
##                     depression           timeperiod[5,Inf)  
## Well - Well                                                 
## Well - Fracture     1.122 (0.9774,1.289) 1.373 (1.267,1.487)
## Well - Death        1.033 (0.8978,1.189) 3.397 (3.094,3.730)
## Fracture - Fracture                                         
## Fracture - Death    1.077 (0.8972,1.292) 1.399 (1.166,1.680)
## 
## -2 * log-likelihood:  54080
hazard.msm(multi.w2)
## $age
##                      HR      L      U
## Well - Fracture  1.0326 1.0242 1.0410
## Well - Death     1.0894 1.0810 1.0979
## Fracture - Death 1.1038 1.0943 1.1133
## 
## $Tscore.2
##                       HR       L      U
## Well - Fracture  1.56884 1.48333 1.6593
## Well - Death     0.98191 0.93431 1.0319
## Fracture - Death 1.06713 0.98952 1.1508
## 
## $fall.yesnoYes
##                      HR       L      U
## Well - Fracture  1.1416 1.04986 1.2413
## Well - Death     1.0007 0.91917 1.0895
## Fracture - Death 0.9603 0.85759 1.0753
## 
## $fx50
##                      HR       L      U
## Well - Fracture  1.4786 1.36704 1.5993
## Well - Death     1.0580 0.97738 1.1452
## Fracture - Death 1.0209 0.91760 1.1359
## 
## $BMI
##                       HR       L       U
## Well - Fracture  0.99522 0.98556 1.00497
## Well - Death     0.98818 0.97894 0.99752
## Fracture - Death 0.98678 0.97345 1.00029
## 
## $smoke
##                      HR       L      U
## Well - Fracture  0.9957 0.91777 1.0802
## Well - Death     1.3477 1.24555 1.4583
## Fracture - Death 1.2864 1.15120 1.4376
## 
## $drink.nYes
##                       HR       L       U
## Well - Fracture  0.97158 0.89687 1.05251
## Well - Death     0.87344 0.80751 0.94474
## Fracture - Death 0.80762 0.72357 0.90143
## 
## $physical
##                       HR       L       U
## Well - Fracture  0.83255 0.76682 0.90392
## Well - Death     0.56894 0.52546 0.61602
## Fracture - Death 0.63574 0.57025 0.70875
## 
## $cvd.nYes
##                       HR       L      U
## Well - Fracture  0.98036 0.89412 1.0749
## Well - Death     1.32065 1.21497 1.4355
## Fracture - Death 1.23997 1.10224 1.3949
## 
## $hypertension
##                      HR       L      U
## Well - Fracture  1.0562 0.97428 1.1451
## Well - Death     1.3061 1.20933 1.4107
## Fracture - Death 1.2667 1.13851 1.4094
## 
## $copd
##                      HR       L      U
## Well - Fracture  1.1050 1.00001 1.2211
## Well - Death     1.0477 0.94835 1.1575
## Fracture - Death 1.0304 0.90329 1.1754
## 
## $diabetes.nYes
##                      HR      L      U
## Well - Fracture  1.4224 1.2197 1.6589
## Well - Death     1.4335 1.2484 1.6460
## Fracture - Death 1.5700 1.2990 1.8975
## 
## $cancer
##                      HR       L      U
## Well - Fracture  1.0630 0.96608 1.1697
## Well - Death     1.0612 0.96550 1.1664
## Fracture - Death 1.0792 0.94918 1.2270
## 
## $renal
##                      HR       L      U
## Well - Fracture  1.0496 0.73143 1.5061
## Well - Death     1.2295 0.88761 1.7030
## Fracture - Death 1.7597 1.16055 2.6682
## 
## $parkinson
##                      HR      L      U
## Well - Fracture  2.0919 1.3600 3.2176
## Well - Death     1.3051 0.7692 2.2145
## Fracture - Death 1.0983 0.6580 1.8331
## 
## $depression
##                      HR       L      U
## Well - Fracture  1.1223 0.97743 1.2887
## Well - Death     1.0333 0.89783 1.1892
## Fracture - Death 1.0766 0.89716 1.2920
## 
## $`timeperiod[5,Inf)`
##                      HR      L      U
## Well - Fracture  1.3726 1.2669 1.4872
## Well - Death     3.3973 3.0942 3.7300
## Fracture - Death 1.3992 1.1656 1.6796

2.3.4 Transition risks

# Osteopenia:
options(digits = 5)
pmatrix.msm(multi.w2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well  Fracture     Death
## Well     0.98955 0.0033404 0.0071075
## Fracture 0.00000 0.9905056 0.0094944
## Death    0.00000 0.0000000 1.0000000
  pmatrix.msm(multi.w2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well Fracture    Death
## Well     0.91466 0.018168 0.067176
## Fracture 0.00000 0.946187 0.053813
## Death    0.00000 0.000000 1.000000
  pmatrix.msm(multi.w2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -1.5), 2)
##             Well Fracture   Death
## Well     0.79179  0.03606 0.17215
## Fracture 0.00000  0.88510 0.11490
## Death    0.00000  0.00000 1.00000
# Osteoporosis:
pmatrix.msm(multi.w2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well Fracture     Death
## Well     0.99063 0.002131 0.0072356
## Fracture 0.00000 0.991100 0.0088998
## Death    0.00000 0.000000 1.0000000
  pmatrix.msm(multi.w2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well Fracture    Death
## Well     0.91992 0.011636 0.068442
## Fracture 0.00000 0.949485 0.050515
## Death    0.00000 0.000000 1.000000
  pmatrix.msm(multi.w2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5), 2)
##             Well Fracture   Death
## Well     0.80128 0.023216 0.17551
## Fracture 0.00000 0.891921 0.10808
## Death    0.00000 0.000000 1.00000
# Osteoporosis + comorbidities:
pmatrix.msm(multi.w2, t = 1, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
## Warning in factorcov2numeric.msm(covariates, x, mod): Covariates "cvd,
## diabetes" unknown, ignoring
## Warning in msm.fill.pci.covs(x, covariates): Covariate cvd unknown
## Warning in msm.fill.pci.covs(x, covariates): Covariate diabetes unknown
##             Well  Fracture     Death
## Well     0.99006 0.0022639 0.0076772
## Fracture 0.00000 0.9903988 0.0096012
## Death    0.00000 0.0000000 1.0000000
  pmatrix.msm(multi.w2, t = 5, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
## Warning in factorcov2numeric.msm(covariates, x, mod): Covariates "cvd,
## diabetes" unknown, ignoring
## Warning in msm.fill.pci.covs(x, covariates): Covariate cvd unknown
## Warning in msm.fill.pci.covs(x, covariates): Covariate diabetes unknown
##             Well Fracture    Death
## Well     0.91521 0.012318 0.072469
## Fracture 0.00000 0.945595 0.054405
## Death    0.00000 0.000000 1.000000
  pmatrix.msm(multi.w2, t = 10, ci = "none", covariates = list(age = 60, Tscore.2 = -2.5, cvd = 1, diabetes = 1, cancer = 1), 2)
## Warning in factorcov2numeric.msm(covariates, x, mod): Covariates "cvd,
## diabetes" unknown, ignoring
## Warning in msm.fill.pci.covs(x, covariates): Covariate cvd unknown
## Warning in msm.fill.pci.covs(x, covariates): Covariate diabetes unknown
##             Well Fracture   Death
## Well     0.79044  0.02442 0.18514
## Fracture 0.00000  0.88388 0.11612
## Death    0.00000  0.00000 1.00000

2.3.5 Check the model goodness-of-fit

Model validation
prevalence.msm(multi.w2, times = seq(0,20,1), covariates = "mean", ci = "normal")
## $Observed
##    State 1 State 2 State 3 Total
## 0     7273       0       0  7273
## 1     6950     246      74  7270
## 2     6623     428     205  7256
## 3     6349     558     342  7249
## 4     5969     729     529  7227
## 5     5616     867     713  7196
## 6     5245     983     934  7162
## 7     4914    1079    1134  7127
## 8     4576    1155    1359  7090
## 9     4216    1216    1591  7023
## 10    3867    1205    1862  6934
## 11    3501    1227    2109  6837
## 12    3137    1202    2422  6761
## 13    2824    1176    2663  6663
## 14    2468    1123    2956  6547
## 15    2171    1086    3206  6463
## 16    1901    1030    3459  6390
## 17    1603     917    3661  6181
## 18    1163     738    3840  5741
## 19     909     626    4034  5569
## 20     381     300    4156  4837
## 
## $Expected
## $Expected$estimates
##       Well Fracture   Death Total
## 0  7273.00     0.00    0.00  7273
## 1  6945.66   205.08  119.26  7270
## 2  6623.01   393.48  239.51  7256
## 3  6321.43   566.78  360.79  7249
## 4  6021.08   724.20  481.72  7227
## 5  5727.78   866.42  601.79  7196
## 6  5180.81  1036.66  944.53  7162
## 7  4685.31  1177.70 1263.98  7127
## 8  4235.90  1292.73 1561.36  7090
## 9  3813.21  1379.22 1830.58  7023
## 10 3421.53  1440.54 2071.93  6934
## 11 3065.98  1481.83 2289.18  6837
## 12 2755.39  1511.92 2493.69  6761
## 13 2467.80  1523.56 2671.64  6663
## 14 2203.69  1519.36 2823.95  6547
## 15 1977.02  1512.71 2973.27  6463
## 16 1776.42  1500.38 3113.20  6390
## 17 1561.61  1449.23 3170.16  6181
## 18 1318.16  1338.76 3084.08  5741
## 19 1162.05  1287.08 3119.87  5569
## 20  917.26  1104.51 2815.23  4837
## 
## $Expected$ci
## , , 2.5%
## 
##          [,1]    [,2]    [,3] [,4]
##  [1,] 7273.00    0.00    0.00 7273
##  [2,] 6928.94  192.25  109.61 7270
##  [3,] 6591.17  369.35  220.61 7256
##  [4,] 6275.90  532.29  332.15 7249
##  [5,] 5963.32  680.90  444.46 7227
##  [6,] 5659.19  816.01  555.44 7196
##  [7,] 5113.85  987.61  898.16 7162
##  [8,] 4615.29 1130.26 1216.63 7127
##  [9,] 4163.40 1244.31 1508.69 7090
## [10,] 3737.50 1328.71 1773.28 7023
## [11,] 3345.69 1388.04 2010.09 6934
## [12,] 2989.76 1426.29 2223.92 6837
## [13,] 2679.19 1453.71 2425.07 6761
## [14,] 2393.17 1462.67 2600.01 6663
## [15,] 2131.18 1457.53 2747.92 6547
## [16,] 1907.06 1449.58 2894.37 6463
## [17,] 1708.07 1435.61 3031.12 6390
## [18,] 1496.99 1384.22 3088.05 6181
## [19,] 1260.18 1276.64 3006.39 5741
## [20,] 1107.82 1223.27 3042.51 5569
## [21,]  871.95 1047.83 2747.15 4837
## 
## , , 97.5%
## 
##         [,1]    [,2]    [,3] [,4]
##  [1,] 7273.0    0.00    0.00 7273
##  [2,] 6961.4  218.90  129.11 7270
##  [3,] 6653.1  419.69  258.83 7256
##  [4,] 6364.5  604.03  389.47 7249
##  [5,] 6075.9  772.41  519.87 7227
##  [6,] 5793.0  925.18  648.23 7196
##  [7,] 5244.8 1092.43  990.63 7162
##  [8,] 4748.5 1232.04 1315.91 7127
##  [9,] 4299.9 1347.08 1617.73 7090
## [10,] 3880.2 1434.09 1890.07 7023
## [11,] 3490.8 1498.22 2135.43 6934
## [12,] 3136.3 1541.32 2355.93 6837
## [13,] 2827.3 1573.26 2562.88 6761
## [14,] 2540.9 1586.96 2742.93 6663
## [15,] 2275.6 1584.32 2897.67 6547
## [16,] 2047.3 1581.88 3049.20 6463
## [17,] 1844.5 1572.38 3191.17 6390
## [18,] 1626.8 1521.33 3248.38 6181
## [19,] 1377.7 1407.92 3158.97 5741
## [20,] 1218.0 1355.69 3193.20 5569
## [21,]  964.4 1165.93 2880.80 4837
## 
## 
## 
## $`Observed percentages`
##     State 1 State 2 State 3
## 0  100.0000  0.0000  0.0000
## 1   95.5983  3.3838  1.0179
## 2   91.2762  5.8986  2.8252
## 3   87.5845  7.6976  4.7179
## 4   82.5931 10.0872  7.3198
## 5   78.0434 12.0484  9.9083
## 6   73.2337 13.7252 13.0410
## 7   68.9491 15.1396 15.9113
## 8   64.5416 16.2906 19.1678
## 9   60.0313 17.3145 22.6541
## 10  55.7687 17.3781 26.8532
## 11  51.2067 17.9465 30.8469
## 12  46.3985 17.7784 35.8231
## 13  42.3833 17.6497 39.9670
## 14  37.6967 17.1529 45.1505
## 15  33.5912 16.8033 49.6054
## 16  29.7496 16.1189 54.1315
## 17  25.9343 14.8358 59.2299
## 18  20.2578 12.8549 66.8873
## 19  16.3225 11.2408 72.4367
## 20   7.8768  6.2022 85.9210
## 
## $`Expected percentages`
## $`Expected percentages`$estimates
##       Well Fracture   Death
## 0  100.000   0.0000  0.0000
## 1   95.539   2.8209  1.6405
## 2   91.276   5.4228  3.3008
## 3   87.204   7.8187  4.9771
## 4   83.314  10.0207  6.6656
## 5   79.597  12.0403  8.3629
## 6   72.338  14.4744 13.1881
## 7   65.740  16.5245 17.7351
## 8   59.745  18.2332 22.0221
## 9   54.296  19.6385 26.0654
## 10  49.344  20.7751 29.8807
## 11  44.844  21.6737 33.4823
## 12  40.754  22.3623 36.8835
## 13  37.037  22.8659 40.0967
## 14  33.660  23.2070 43.1334
## 15  30.590  23.4057 46.0045
## 16  27.800  23.4801 48.7198
## 17  25.265  23.4465 51.2888
## 18  22.960  23.3193 53.7202
## 19  20.866  23.1115 56.0220
## 20  18.963  22.8346 58.2019
## 
## $`Expected percentages`$ci
## , , 2.5%
## 
##          [,1]    [,2]    [,3]
##  [1,] 100.000  0.0000  0.0000
##  [2,]  95.309  2.6444  1.5077
##  [3,]  90.837  5.0903  3.0404
##  [4,]  86.576  7.3430  4.5820
##  [5,]  82.514  9.4216  6.1500
##  [6,]  78.643 11.3397  7.7188
##  [7,]  71.402 13.7896 12.5407
##  [8,]  64.758 15.8588 17.0707
##  [9,]  58.722 17.5502 21.2792
## [10,]  53.218 18.9194 25.2495
## [11,]  48.251 20.0179 28.9890
## [12,]  43.729 20.8613 32.5278
## [13,]  39.627 21.5014 35.8685
## [14,]  35.917 21.9521 39.0216
## [15,]  32.552 22.2625 41.9722
## [16,]  29.507 22.4288 44.7837
## [17,]  26.730 22.4666 47.4353
## [18,]  24.219 22.3947 49.9604
## [19,]  21.950 22.2372 52.3669
## [20,]  19.893 21.9657 54.6329
## [21,]  18.027 21.6628 56.7944
## 
## , , 97.5%
## 
##          [,1]    [,2]    [,3]
##  [1,] 100.000  0.0000  0.0000
##  [2,]  95.755  3.0110  1.7759
##  [3,]  91.691  5.7840  3.5671
##  [4,]  87.799  8.3325  5.3727
##  [5,]  84.072 10.6878  7.1934
##  [6,]  80.504 12.8569  9.0082
##  [7,]  73.231 15.2532 13.8318
##  [8,]  66.626 17.2869 18.4637
##  [9,]  60.647 18.9998 22.8170
## [10,]  55.250 20.4200 26.9126
## [11,]  50.344 21.6068 30.7965
## [12,]  45.872 22.5438 34.4586
## [13,]  41.818 23.2696 37.9068
## [14,]  38.135 23.8175 41.1667
## [15,]  34.758 24.1992 44.2595
## [16,]  31.677 24.4760 47.1794
## [17,]  28.865 24.6068 49.9401
## [18,]  26.319 24.6130 52.5543
## [19,]  23.997 24.5240 55.0247
## [20,]  21.871 24.3435 57.3389
## [21,]  19.938 24.1044 59.5575
plot.prevalence.msm(multi.w2, mintime = 0, maxtime = 20, legend.pos = c(10, 80), col.obs = "gray", 
                    col.exp = "black")

Diagnostic plots for survival
par(mfrow= c(1,2))
plot.survfit.msm(multi.w2, from = 1, main = "No fracture", range = c(0,20), 
                 ci = "normal", col = "black", col.ci = "black", lty = 2, lwd = 2, 
                 col.surv ="grey", lty.surv = 2, lwd.surv = 1, xlab = "Time (years)")
legend(0.4,0.35, legend = c("Expected", "Expected (95% CI)", "Observed", "Observed (95% CI)"), 
       col = c("black", "black", "grey", "gray"), lty = c(2, 2, 1, 2), lwd = c(2, 1, 2, 1))
plot.survfit.msm(multi.w2, from = 2, main = "Initial fracture", range = c(0,20), 
                 ci = "normal", col = "black", col.ci = "black", lty = 2, lwd = 2, 
                 col.surv ="grey", lty.surv = 2, lwd.surv = 1, xlab = "Time (years)")