#Low BMD and Mortality Risk- Sub-group analysis for Any Fractures
bmd.0 = read.csv("C:\\Users\\nickt\\OneDrive\\Documents\\Work Stuff\\Projects\\Multi-State Approach between BMD and Mortality\\R Markdown knit + Codes\\SOF_MrOS_Nick_ANYFX_11jul24.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] 32106 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 -1.6833 Well 1 0.0000 69 0.656
## 2 0 0.6349 0 0 -1.8592 Well 1 17.2238 69 0.656
## 3 2 0.5850 0 1 -2.2750 Well 1 0.0000 84 0.585
## 4 2 0.5850 0 1 -2.2750 Death 3 6.5325 84 0.585
## 5 0 0.6540 0 0 -1.7000 Well 1 0.0000 75 0.654
## 6 0 0.5537 0 0 -2.5358 Well 1 18.6366 75 0.654
## TscoreBase time2end
## 1 -1.6833 17.2238
## 2 -1.6833 5.0103
## 3 -2.2750 6.5325
## 4 -2.2750 6.5325
## 5 -1.7000 18.6366
## 6 -1.7000 6.4586
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
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"))
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)
}
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 + Tscore + 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=1722) |
Fractured, Alive (N=361) |
Fractured, Dead (N=655) |
No Fractured, Dead (N=2641) |
Overall (N=5379) |
|
|---|---|---|---|---|---|
| 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.122) | 0.754 (0.115) | 0.727 (0.121) | 0.782 (0.122) | 0.780 (0.124) |
| Median [Min, Max] | 0.794 [0.404, 1.32] | 0.744 [0.499, 1.27] | 0.719 [0.273, 1.15] | 0.773 [0.475, 1.33] | 0.772 [0.273, 1.33] |
| TscoreBase | |||||
| Mean (SD) | -0.959 (0.894) | -1.31 (0.843) | -1.51 (0.883) | -1.11 (0.893) | -1.12 (0.905) |
| Median [Min, Max] | -1.02 [-3.87, 2.81] | -1.39 [-3.18, 2.47] | -1.57 [-4.83, 1.57] | -1.18 [-3.35, 2.86] | -1.19 [-4.83, 2.86] |
| Tscore | |||||
| Mean (SD) | -0.959 (0.894) | -1.31 (0.843) | -1.51 (0.883) | -1.11 (0.893) | -1.12 (0.905) |
| Median [Min, Max] | -1.02 [-3.87, 2.81] | -1.39 [-3.18, 2.47] | -1.57 [-4.83, 1.57] | -1.18 [-3.35, 2.86] | -1.19 [-4.83, 2.86] |
| as.factor(fall.no) | |||||
| 0 | 1344 (78.0%) | 248 (68.7%) | 389 (59.4%) | 1966 (74.4%) | 3947 (73.4%) |
| 1 | 378 (22.0%) | 113 (31.3%) | 266 (40.6%) | 675 (25.6%) | 1432 (26.6%) |
| fall.yesno | |||||
| No | 1344 (78.0%) | 248 (68.7%) | 389 (59.4%) | 1966 (74.4%) | 3947 (73.4%) |
| Yes | 378 (22.0%) | 113 (31.3%) | 266 (40.6%) | 675 (25.6%) | 1432 (26.6%) |
| as.factor(fx50) | |||||
| 0 | 1475 (85.7%) | 280 (77.6%) | 492 (75.1%) | 2186 (82.8%) | 4433 (82.4%) |
| 1 | 247 (14.3%) | 81 (22.4%) | 163 (24.9%) | 455 (17.2%) | 946 (17.6%) |
| race | |||||
| 1:WHITE | 1722 (100%) | 361 (100%) | 655 (100%) | 2641 (100%) | 5379 (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.66) | 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 | 708 (41.1%) | 143 (39.6%) | 245 (37.4%) | 918 (34.8%) | 2014 (37.4%) |
| 1 | 1014 (58.9%) | 218 (60.4%) | 410 (62.6%) | 1723 (65.2%) | 3365 (62.6%) |
| as.factor(drink.n) | |||||
| No | 547 (31.8%) | 111 (30.7%) | 238 (36.3%) | 945 (35.8%) | 1841 (34.2%) |
| Yes | 1175 (68.2%) | 250 (69.3%) | 417 (63.7%) | 1696 (64.2%) | 3538 (65.8%) |
| as.factor(physical) | |||||
| 0 | 458 (26.6%) | 96 (26.6%) | 255 (38.9%) | 976 (37.0%) | 1785 (33.2%) |
| 1 | 1264 (73.4%) | 265 (73.4%) | 400 (61.1%) | 1665 (63.0%) | 3594 (66.8%) |
| as.factor(cvd.n) | |||||
| No | 1507 (87.5%) | 304 (84.2%) | 497 (75.9%) | 1946 (73.7%) | 4254 (79.1%) |
| Yes | 215 (12.5%) | 57 (15.8%) | 158 (24.1%) | 695 (26.3%) | 1125 (20.9%) |
| as.factor(hypertension) | |||||
| 0 | 1113 (64.6%) | 231 (64.0%) | 344 (52.5%) | 1436 (54.4%) | 3124 (58.1%) |
| 1 | 609 (35.4%) | 130 (36.0%) | 311 (47.5%) | 1205 (45.6%) | 2255 (41.9%) |
| as.factor(copd) | |||||
| 0 | 1583 (91.9%) | 334 (92.5%) | 562 (85.8%) | 2321 (87.9%) | 4800 (89.2%) |
| 1 | 139 (8.1%) | 27 (7.5%) | 93 (14.2%) | 320 (12.1%) | 579 (10.8%) |
| as.factor(diabetes.n) | |||||
| No | 1611 (93.6%) | 338 (93.6%) | 582 (88.9%) | 2313 (87.6%) | 4844 (90.1%) |
| Yes | 111 (6.4%) | 23 (6.4%) | 73 (11.1%) | 328 (12.4%) | 535 (9.9%) |
| as.factor(cancer) | |||||
| 0 | 1481 (86.0%) | 305 (84.5%) | 529 (80.8%) | 2077 (78.6%) | 4392 (81.7%) |
| 1 | 241 (14.0%) | 56 (15.5%) | 126 (19.2%) | 564 (21.4%) | 987 (18.3%) |
| as.factor(parkinson) | |||||
| 0 | 1505 (87.4%) | 311 (86.1%) | 579 (88.4%) | 2254 (85.3%) | 4649 (86.4%) |
| 1 | 217 (12.6%) | 50 (13.9%) | 76 (11.6%) | 387 (14.7%) | 730 (13.6%) |
| as.factor(rheumatoid) | |||||
| 0 | 982 (57.0%) | 201 (55.7%) | 335 (51.1%) | 1314 (49.8%) | 2832 (52.6%) |
| 1 | 740 (43.0%) | 160 (44.3%) | 320 (48.9%) | 1327 (50.2%) | 2547 (47.4%) |
| as.factor(renal) | |||||
| 0 | 1512 (87.8%) | 307 (85.0%) | 599 (91.5%) | 2446 (92.6%) | 4864 (90.4%) |
| 1 | 210 (12.2%) | 54 (15.0%) | 56 (8.5%) | 195 (7.4%) | 515 (9.6%) |
| as.factor(depression) | |||||
| 0 | 1658 (96.3%) | 345 (95.6%) | 622 (95.0%) | 2551 (96.6%) | 5176 (96.2%) |
| 1 | 64 (3.7%) | 16 (4.4%) | 33 (5.0%) | 90 (3.4%) | 203 (3.8%) |
| as.factor(anyfx) | |||||
| 0 | 1722 (100%) | 0 (0%) | 0 (0%) | 2641 (100%) | 4363 (81.1%) |
| 1 | 0 (0%) | 361 (100%) | 655 (100%) | 0 (0%) | 1016 (18.9%) |
| as.factor(death) | |||||
| 0 | 1722 (100%) | 361 (100%) | 0 (0%) | 0 (0%) | 2083 (38.7%) |
| 1 | 0 (0%) | 0 (0%) | 655 (100%) | 2641 (100%) | 3296 (61.3%) |
library(msm)
## Warning: package 'msm' was built under R version 4.2.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.05500799 0.0152825 0.03972549
## Fracture 0.00000000 -0.1033188 0.10331884
## Death 0.00000000 0.0000000 0.00000000
statetable.msm(state, ID, data = men)
## to
## from 1 2 3
## 1 1722 1016 2641
## 2 0 361 655
m.normal = subset(men, TscoreBase > -1)
m.osteopenia = subset(men, TscoreBase > -2.5 & TscoreBase <=-1)
m.osteoporosis = subset(men, TscoreBase <= -2.5)
age.m1= msm(state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
age.m1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.037017 (-0.039722,-0.03450)
## Well - Fracture 0.009531 ( 0.008385, 0.01083) 1.067 (1.045,1.090)
## Well - Death 0.027487 ( 0.025274, 0.02989) 1.119 (1.108,1.131)
## Fracture - Fracture -0.047366 (-0.068370,-0.03282)
## Fracture - Death 0.047366 ( 0.032815, 0.06837) 1.072 (1.045,1.100)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.08315 (0.01782,0.3879) 1.430 (1.1094,1.842)
## Well - Death 0.93100 (0.47347,1.8307) 3.547 (3.0186,4.168)
## Fracture - Fracture
## Fracture - Death 0.40567 (0.06179,2.6634) 1.170 (0.6307,2.170)
##
## -2 * log-likelihood: 13303.54
hazard.msm(age.m1)
## $age
## HR L U
## Well - Fracture 1.067209 1.045101 1.089785
## Well - Death 1.119112 1.107571 1.130773
## Fracture - Death 1.072059 1.045295 1.099508
##
## $fnbmd
## HR L U
## Well - Fracture 0.08314878 0.01782247 0.3879215
## Well - Death 0.93100213 0.47346997 1.8306652
## Fracture - Death 0.40567184 0.06178989 2.6633748
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.429555 1.1094395 1.842036
## Well - Death 3.546945 3.0186374 4.167713
## Fracture - Death 1.169914 0.6306707 2.170226
multi.me1= msm(state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
multi.me1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.035709 (-0.038377,-0.03323)
## Well - Fracture 0.009056 ( 0.007925, 0.01035) 1.059 (1.037,1.082)
## Well - Death 0.026653 ( 0.024475, 0.02903) 1.115 (1.103,1.127)
## Fracture - Fracture -0.042648 (-0.062066,-0.02931)
## Fracture - Death 0.042648 ( 0.029305, 0.06207) 1.071 (1.044,1.098)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.06834 (0.01442,0.324) 1.859 (1.4640,2.360)
## Well - Death 0.67850 (0.34373,1.339) 0.954 (0.8330,1.093)
## Fracture - Fracture
## Fracture - Death 0.31981 (0.04855,2.107) 1.099 (0.8108,1.491)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.5200 (1.1324,2.040) 1.049 (0.7803,1.410)
## Well - Death 0.9241 (0.7703,1.109) 1.553 (1.3520,1.783)
## Fracture - Fracture
## Fracture - Death 1.4174 (0.9786,2.053) 1.091 (0.7461,1.595)
## hypertension copd
## Well - Well
## Well - Fracture 1.447 (1.145,1.828) 1.018 (0.6909,1.500)
## Well - Death 1.312 (1.164,1.478) 1.327 (1.1042,1.595)
## Fracture - Fracture
## Fracture - Death 1.416 (1.043,1.921) 1.561 (0.9906,2.460)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.166 (0.8173,1.665) 1.1961 (0.8905,1.607)
## Well - Death 1.525 (1.2900,1.803) 1.1295 (0.9705,1.314)
## Fracture - Fracture
## Fracture - Death 1.575 (1.0323,2.404) 0.8861 (0.6042,1.300)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.487 (1.1534,1.917)
## Well - Death 3.712 (3.1587,4.362)
## Fracture - Fracture
## Fracture - Death 1.307 (0.7028,2.432)
##
## -2 * log-likelihood: 13125.19
hazard.msm(multi.me1)
## $age
## HR L U
## Well - Fracture 1.058986 1.036614 1.081840
## Well - Death 1.114959 1.103032 1.127015
## Fracture - Death 1.070527 1.043939 1.097793
##
## $fnbmd
## HR L U
## Well - Fracture 0.06834041 0.01441674 0.3239575
## Well - Death 0.67850303 0.34373284 1.3393145
## Fracture - Death 0.31981405 0.04855425 2.1065306
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.8587001 1.4640207 2.359780
## Well - Death 0.9540372 0.8330164 1.092640
## Fracture - Death 1.0994865 0.8108069 1.490947
##
## $fx50
## HR L U
## Well - Fracture 1.5200486 1.1323799 2.040435
## Well - Death 0.9241295 0.7702920 1.108691
## Fracture - Death 1.4174440 0.9786249 2.053031
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.048872 0.7802747 1.409930
## Well - Death 1.552748 1.3519950 1.783310
## Fracture - Death 1.090738 0.7461294 1.594508
##
## $hypertension
## HR L U
## Well - Fracture 1.446937 1.145281 1.828045
## Well - Death 1.311510 1.163575 1.478252
## Fracture - Death 1.415549 1.043127 1.920935
##
## $copd
## HR L U
## Well - Fracture 1.017989 0.6909430 1.499837
## Well - Death 1.326960 1.1042057 1.594650
## Fracture - Death 1.561197 0.9905945 2.460478
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.166369 0.8172877 1.664551
## Well - Death 1.525238 1.2900453 1.803309
## Fracture - Death 1.575329 1.0322722 2.404076
##
## $cancer
## HR L U
## Well - Fracture 1.1961079 0.8904627 1.606664
## Well - Death 1.1294654 0.9704866 1.314487
## Fracture - Death 0.8861476 0.6041728 1.299724
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.486987 1.1533823 1.917082
## Well - Death 3.712082 3.1586914 4.362425
## Fracture - Death 1.307490 0.7028187 2.432392
multi.ma1= msm(state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
multi.ma1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.035081 (-0.037736,-0.03261)
## Well - Fracture 0.008919 ( 0.007791, 0.01021) 1.063 (1.040,1.087)
## Well - Death 0.026163 ( 0.024000, 0.02852) 1.110 (1.098,1.123)
## Fracture - Fracture -0.042176 (-0.061491,-0.02893)
## Fracture - Death 0.042176 ( 0.028928, 0.06149) 1.065 (1.038,1.093)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.05022 (0.01029,0.2451) 1.8234 (1.4347,2.317)
## Well - Death 0.67008 (0.33493,1.3406) 0.9451 (0.8246,1.083)
## Fracture - Fracture
## Fracture - Death 0.15809 (0.02132,1.1724) 1.0464 (0.7706,1.421)
## fx50 BMI
## Well - Well
## Well - Fracture 1.4359 (1.0665,1.933) 1.048 (1.0157,1.081)
## Well - Death 0.8975 (0.7477,1.077) 1.012 (0.9947,1.029)
## Fracture - Fracture
## Fracture - Death 1.4873 (1.0220,2.164) 1.006 (0.9666,1.048)
## smoke drink
## Well - Well
## Well - Fracture 1.2166 (0.9439,1.568) 1.0646 (0.9838,1.152)
## Well - Death 1.2972 (1.1393,1.477) 0.9915 (0.9513,1.033)
## Fracture - Fracture
## Fracture - Death 0.9464 (0.6789,1.319) 1.0938 (0.9838,1.216)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.8142 (0.6379,1.0391) 1.024 (0.7605,1.378)
## Well - Death 0.8620 (0.7600,0.9776) 1.579 (1.3747,1.813)
## Fracture - Fracture
## Fracture - Death 0.8631 (0.6317,1.1794) 1.260 (0.8562,1.854)
## hypertension copd
## Well - Well
## Well - Fracture 1.345 (1.061,1.707) 0.974 (0.6588,1.440)
## Well - Death 1.269 (1.124,1.433) 1.305 (1.0843,1.570)
## Fracture - Fracture
## Fracture - Death 1.370 (1.002,1.871) 1.555 (0.9849,2.454)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.098 (0.7645,1.577) 1.1987 (0.8920,1.611)
## Well - Death 1.496 (1.2603,1.775) 1.1545 (0.9915,1.344)
## Fracture - Fracture
## Fracture - Death 1.456 (0.9374,2.263) 0.8459 (0.5680,1.260)
## renal parkinson
## Well - Well
## Well - Fracture 1.0506 (0.6539,1.6881) 0.9241 (0.5869,1.455)
## Well - Death 0.4400 (0.3328,0.5817) 1.6428 (1.3230,2.040)
## Fracture - Fracture
## Fracture - Death 0.4112 (0.1918,0.8817) 1.1041 (0.5582,2.184)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.2823 (0.7576,2.170) 1.505 (1.1668,1.941)
## Well - Death 0.7799 (0.5499,1.106) 3.859 (3.2824,4.538)
## Fracture - Fracture
## Fracture - Death 1.7150 (0.8780,3.350) 1.337 (0.7145,2.503)
##
## -2 * log-likelihood: 13010.52
hazard.msm(multi.ma1)
## $age
## HR L U
## Well - Fracture 1.063440 1.040136 1.087267
## Well - Death 1.110348 1.098183 1.122647
## Fracture - Death 1.064921 1.037668 1.092891
##
## $fnbmd
## HR L U
## Well - Fracture 0.05022417 0.01029177 0.2450956
## Well - Death 0.67008085 0.33492537 1.3406221
## Fracture - Death 0.15809408 0.02131915 1.1723612
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.8234150 1.4347301 2.317399
## Well - Death 0.9450891 0.8246035 1.083179
## Fracture - Death 1.0463735 0.7705730 1.420887
##
## $fx50
## HR L U
## Well - Fracture 1.4359139 1.0665172 1.933254
## Well - Death 0.8975349 0.7476683 1.077442
## Fracture - Death 1.4873123 1.0220003 2.164479
##
## $BMI
## HR L U
## Well - Fracture 1.047963 1.0156577 1.081297
## Well - Death 1.011766 0.9946789 1.029146
## Fracture - Death 1.006231 0.9665715 1.047518
##
## $smoke
## HR L U
## Well - Fracture 1.2165873 0.9439039 1.568046
## Well - Death 1.2971810 1.1393267 1.476906
## Fracture - Death 0.9464089 0.6788895 1.319346
##
## $drink
## HR L U
## Well - Fracture 1.0645594 0.9837669 1.151987
## Well - Death 0.9914731 0.9512842 1.033360
## Fracture - Death 1.0937501 0.9838101 1.215976
##
## $physical
## HR L U
## Well - Fracture 0.8141569 0.6379169 1.0390875
## Well - Death 0.8619568 0.7600275 0.9775561
## Fracture - Death 0.8631462 0.6316945 1.1794014
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.023653 0.7605361 1.377798
## Well - Death 1.578689 1.3747451 1.812888
## Fracture - Death 1.259798 0.8561683 1.853713
##
## $hypertension
## HR L U
## Well - Fracture 1.345327 1.060583 1.706519
## Well - Death 1.269416 1.124223 1.433359
## Fracture - Death 1.369617 1.002449 1.871267
##
## $copd
## HR L U
## Well - Fracture 0.9740471 0.6588069 1.440130
## Well - Death 1.3047607 1.0843419 1.569985
## Fracture - Death 1.5547462 0.9848979 2.454301
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.098097 0.7645151 1.577230
## Well - Death 1.495721 1.2602505 1.775189
## Fracture - Death 1.456433 0.9374222 2.262797
##
## $cancer
## HR L U
## Well - Fracture 1.1986803 0.8919774 1.610842
## Well - Death 1.1544820 0.9915352 1.344207
## Fracture - Death 0.8459017 0.5680331 1.259697
##
## $renal
## HR L U
## Well - Fracture 1.0506125 0.6538672 1.6880900
## Well - Death 0.4399567 0.3327536 0.5816972
## Fracture - Death 0.4112122 0.1917811 0.8817110
##
## $parkinson
## HR L U
## Well - Fracture 0.9241456 0.5868641 1.455269
## Well - Death 1.6428406 1.3230450 2.039935
## Fracture - Death 1.1040904 0.5582391 2.183680
##
## $depression
## HR L U
## Well - Fracture 1.2822901 0.7576395 2.170251
## Well - Death 0.7799312 0.5499102 1.106167
## Fracture - Death 1.7150268 0.8779871 3.350068
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.504971 1.1667711 1.941201
## Well - Death 3.859308 3.2823555 4.537673
## Fracture - Death 1.337339 0.7144826 2.503175
age.m2= msm(state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
age.m2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.05153 (-0.05437,-0.04884)
## Well - Fracture 0.01768 ( 0.01620, 0.01930) 1.057 (1.043,1.071)
## Well - Death 0.03385 ( 0.03164, 0.03622) 1.115 (1.105,1.125)
## Fracture - Fracture -0.05371 (-0.06672,-0.04323)
## Fracture - Death 0.05371 ( 0.04323, 0.06672) 1.104 (1.086,1.122)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.01885 (0.004483,0.07927) 1.7177 (1.442,2.046)
## Well - Death 1.24252 (0.470940,3.27826) 3.1787 (2.786,3.626)
## Fracture - Fracture
## Fracture - Death 0.29374 (0.064015,1.34783) 0.9156 (0.636,1.318)
##
## -2 * log-likelihood: 19592.59
hazard.msm(age.m2)
## $age
## HR L U
## Well - Fracture 1.056876 1.042731 1.071214
## Well - Death 1.114979 1.105260 1.124782
## Fracture - Death 1.104016 1.086469 1.121845
##
## $fnbmd
## HR L U
## Well - Fracture 0.01885266 0.004483437 0.0792746
## Well - Death 1.24252322 0.470939522 3.2782637
## Fracture - Death 0.29373565 0.064014623 1.3478270
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.7177166 1.4419551 2.046215
## Well - Death 3.1786580 2.7863484 3.626204
## Fracture - Death 0.9155802 0.6359509 1.318163
multi.me2= msm(state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
multi.me2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.05036 (-0.05318,-0.04769)
## Well - Fracture 0.01732 ( 0.01585, 0.01894) 1.053 (1.038,1.067)
## Well - Death 0.03303 ( 0.03084, 0.03539) 1.110 (1.100,1.120)
## Fracture - Fracture -0.05145 (-0.06435,-0.04114)
## Fracture - Death 0.05145 ( 0.04114, 0.06435) 1.105 (1.087,1.124)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.01461 (0.00348,0.06131) 1.5124 (1.2825,1.7837)
## Well - Death 1.02311 (0.38605,2.71146) 0.8421 (0.7460,0.9505)
## Fracture - Fracture
## Fracture - Death 0.35679 (0.07774,1.63751) 1.1055 (0.8965,1.3632)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.254 (1.0421,1.510) 1.240 (1.024,1.502)
## Well - Death 1.110 (0.9755,1.264) 1.462 (1.296,1.650)
## Fracture - Fracture
## Fracture - Death 1.010 (0.7948,1.284) 1.353 (1.076,1.701)
## hypertension copd
## Well - Well
## Well - Fracture 1.105 (0.9391,1.299) 1.182 (0.9274,1.506)
## Well - Death 1.087 (0.9762,1.210) 1.336 (1.1365,1.571)
## Fracture - Fracture
## Fracture - Death 1.254 (1.0195,1.543) 1.530 (1.1473,2.040)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.322 (0.9949,1.758) 0.8257 (0.6655,1.024)
## Well - Death 1.581 (1.3295,1.881) 1.2189 (1.0742,1.383)
## Fracture - Fracture
## Fracture - Death 1.163 (0.8172,1.654) 1.1268 (0.8694,1.461)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.7634 (1.4797,2.101)
## Well - Death 3.3202 (2.9092,3.789)
## Fracture - Fracture
## Fracture - Death 0.9604 (0.6677,1.381)
##
## -2 * log-likelihood: 19418.24
hazard.msm(multi.me2)
## $age
## HR L U
## Well - Fracture 1.052757 1.038254 1.067462
## Well - Death 1.109751 1.099739 1.119854
## Fracture - Death 1.105161 1.087012 1.123613
##
## $fnbmd
## HR L U
## Well - Fracture 0.01460545 0.003479617 0.06130532
## Well - Death 1.02310690 0.386046384 2.71145587
## Fracture - Death 0.35679321 0.077740626 1.63751442
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.5124480 1.2824769 1.7836570
## Well - Death 0.8420579 0.7460173 0.9504626
## Fracture - Death 1.1054933 0.8965291 1.3631631
##
## $fx50
## HR L U
## Well - Fracture 1.254344 1.0420849 1.509837
## Well - Death 1.110351 0.9755240 1.263813
## Fracture - Death 1.010033 0.7947563 1.283623
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.240086 1.023784 1.502086
## Well - Death 1.462345 1.295944 1.650111
## Fracture - Death 1.352941 1.076172 1.700889
##
## $hypertension
## HR L U
## Well - Fracture 1.104637 0.9390573 1.299413
## Well - Death 1.086816 0.9761986 1.209967
## Fracture - Death 1.254362 1.0195126 1.543309
##
## $copd
## HR L U
## Well - Fracture 1.181975 0.9273725 1.506476
## Well - Death 1.336019 1.1365284 1.570526
## Fracture - Death 1.529977 1.1472657 2.040354
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.322351 0.9949215 1.757539
## Well - Death 1.581395 1.3295259 1.880980
## Fracture - Death 1.162766 0.8171899 1.654481
##
## $cancer
## HR L U
## Well - Fracture 0.8257314 0.6655286 1.024497
## Well - Death 1.2189089 1.0742090 1.383100
## Fracture - Death 1.1268296 0.8693590 1.460553
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.7634098 1.4797325 2.101470
## Well - Death 3.3202333 2.9092304 3.789301
## Fracture - Death 0.9604101 0.6676844 1.381472
multi.ma2= msm(state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
multi.ma2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.04947 (-0.05228,-0.04681)
## Well - Fracture 0.01726 ( 0.01578, 0.01888) 1.053 (1.038,1.068)
## Well - Death 0.03221 ( 0.03003, 0.03454) 1.106 (1.096,1.117)
## Fracture - Fracture -0.05022 (-0.06294,-0.04007)
## Fracture - Death 0.05022 ( 0.04007, 0.06294) 1.107 (1.088,1.125)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.01446 (0.003355,0.06233) 1.5240 (1.2908,1.7992)
## Well - Death 0.98876 (0.367217,2.66233) 0.8399 (0.7436,0.9486)
## Fracture - Fracture
## Fracture - Death 0.33887 (0.072234,1.58970) 1.0908 (0.8811,1.3503)
## fx50 BMI
## Well - Well
## Well - Fracture 1.2583 (1.0447,1.516) 1.004 (0.9799,1.029)
## Well - Death 1.1231 (0.9865,1.279) 1.016 (0.9996,1.033)
## Fracture - Fracture
## Fracture - Death 0.9954 (0.7834,1.265) 1.022 (0.9892,1.056)
## smoke drink
## Well - Well
## Well - Fracture 0.9886 (0.8395,1.164) 0.9618 (0.9091,1.018)
## Well - Death 1.2579 (1.1256,1.406) 0.9824 (0.9467,1.020)
## Fracture - Fracture
## Fracture - Death 1.1631 (0.9432,1.434) 0.9756 (0.9064,1.050)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.9822 (0.8275,1.1657) 1.230 (1.014,1.492)
## Well - Death 0.8239 (0.7376,0.9203) 1.413 (1.251,1.597)
## Fracture - Fracture
## Fracture - Death 0.8527 (0.6899,1.0540) 1.291 (1.022,1.632)
## hypertension copd
## Well - Well
## Well - Fracture 1.107 (0.9387,1.306) 1.182 (0.9262,1.509)
## Well - Death 1.034 (0.9272,1.153) 1.236 (1.0494,1.455)
## Fracture - Fracture
## Fracture - Death 1.189 (0.9615,1.471) 1.552 (1.1558,2.083)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.294 (0.9712,1.724) 0.8247 (0.6644,1.024)
## Well - Death 1.482 (1.2438,1.767) 1.1989 (1.0562,1.361)
## Fracture - Fracture
## Fracture - Death 1.148 (0.7995,1.650) 1.0607 (0.8146,1.381)
## renal parkinson
## Well - Well
## Well - Fracture 0.9660 (0.6911,1.3503) 0.853 (0.6233,1.167)
## Well - Death 0.4360 (0.3434,0.5538) 1.752 (1.4703,2.089)
## Fracture - Fracture
## Fracture - Death 0.5118 (0.3292,0.7955) 1.166 (0.7960,1.707)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.0132 (0.6903,1.487) 1.780 (1.4921,2.122)
## Well - Death 0.9283 (0.7034,1.225) 3.484 (3.0507,3.979)
## Fracture - Fracture
## Fracture - Death 1.0947 (0.6621,1.810) 1.027 (0.7115,1.483)
##
## -2 * log-likelihood: 19276.02
hazard.msm(multi.ma2)
## $age
## HR L U
## Well - Fracture 1.052697 1.037783 1.067825
## Well - Death 1.106493 1.096139 1.116945
## Fracture - Death 1.106671 1.088158 1.125499
##
## $fnbmd
## HR L U
## Well - Fracture 0.01446135 0.003355156 0.0623311
## Well - Death 0.98876458 0.367217310 2.6623347
## Fracture - Death 0.33886613 0.072233733 1.5897040
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.5239899 1.2908448 1.7992443
## Well - Death 0.8398517 0.7435754 0.9485936
## Fracture - Death 1.0907511 0.8810875 1.3503062
##
## $fx50
## HR L U
## Well - Fracture 1.2583151 1.0447432 1.515546
## Well - Death 1.1230693 0.9865039 1.278540
## Fracture - Death 0.9954045 0.7833892 1.264799
##
## $BMI
## HR L U
## Well - Fracture 1.004331 0.9798898 1.029381
## Well - Death 1.015989 0.9996069 1.032639
## Fracture - Death 1.022215 0.9891676 1.056367
##
## $smoke
## HR L U
## Well - Fracture 0.988639 0.8395216 1.164243
## Well - Death 1.257923 1.1256129 1.405784
## Fracture - Death 1.163131 0.9431775 1.434379
##
## $drink
## HR L U
## Well - Fracture 0.9618369 0.9091359 1.017593
## Well - Death 0.9824450 0.9466803 1.019561
## Fracture - Death 0.9755835 0.9064323 1.050010
##
## $physical
## HR L U
## Well - Fracture 0.9821603 0.8275080 1.1657154
## Well - Death 0.8238622 0.7375562 0.9202674
## Fracture - Death 0.8527191 0.6898999 1.0539642
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.230154 1.014312 1.491927
## Well - Death 1.413461 1.251080 1.596917
## Fracture - Death 1.291187 1.021573 1.631958
##
## $hypertension
## HR L U
## Well - Fracture 1.107306 0.9387430 1.306137
## Well - Death 1.034028 0.9271580 1.153216
## Fracture - Death 1.189359 0.9614988 1.471219
##
## $copd
## HR L U
## Well - Fracture 1.182404 0.926191 1.509495
## Well - Death 1.235785 1.049431 1.455232
## Fracture - Death 1.551548 1.155807 2.082787
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.294028 0.9711774 1.724205
## Well - Death 1.482450 1.2438218 1.766860
## Fracture - Death 1.148398 0.7995168 1.649518
##
## $cancer
## HR L U
## Well - Fracture 0.8246976 0.6643632 1.023726
## Well - Death 1.1989324 1.0561657 1.360997
## Fracture - Death 1.0606650 0.8146251 1.381016
##
## $renal
## HR L U
## Well - Fracture 0.9660178 0.6910991 1.3502990
## Well - Death 0.4360491 0.3433539 0.5537694
## Fracture - Death 0.5117646 0.3292458 0.7954634
##
## $parkinson
## HR L U
## Well - Fracture 0.8529902 0.6233155 1.167294
## Well - Death 1.7524990 1.4703098 2.088847
## Fracture - Death 1.1657129 0.7960191 1.707103
##
## $depression
## HR L U
## Well - Fracture 1.013174 0.6902611 1.487149
## Well - Death 0.928325 0.7034431 1.225099
## Fracture - Death 1.094668 0.6621127 1.809811
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.779536 1.4921149 2.122323
## Well - Death 3.484215 3.0506861 3.979353
## Fracture - Death 1.027324 0.7114955 1.483347
age.m3= msm(state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
age.m3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.09380 (-0.10878,-0.08088)
## Well - Fracture 0.04845 ( 0.03980, 0.05899) 1.064 (1.029,1.100)
## Well - Death 0.04535 ( 0.03628, 0.05668) 1.124 (1.088,1.162)
## Fracture - Fracture -0.11434 (-0.16432,-0.07956)
## Fracture - Death 0.11434 ( 0.07956, 0.16432) 1.071 (1.033,1.110)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 2.364e-03 (2.562e-05,2.182e-01) 1.108 (0.7467,1.645)
## Well - Death 3.869e+02 (5.829e-01,2.568e+05) 3.148 (2.0919,4.737)
## Fracture - Fracture
## Fracture - Death 9.291e-02 (1.711e-03,5.044e+00) 0.937 (0.5280,1.663)
##
## -2 * log-likelihood: 2141.196
hazard.msm(age.m3)
## $age
## HR L U
## Well - Fracture 1.063995 1.029403 1.099751
## Well - Death 1.124453 1.088322 1.161782
## Fracture - Death 1.070891 1.033292 1.109857
##
## $fnbmd
## HR L U
## Well - Fracture 2.364483e-03 2.562085e-05 2.182122e-01
## Well - Death 3.869130e+02 5.828600e-01 2.568398e+05
## Fracture - Death 9.290820e-02 1.711181e-03 5.044432e+00
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.1084219 0.7466671 1.645444
## Well - Death 3.1479281 2.0918690 4.737128
## Fracture - Death 0.9369976 0.5280006 1.662810
multi.me3= msm(state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
multi.me3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.08697 (-0.10191,-0.07423)
## Well - Fracture 0.04704 ( 0.03836, 0.05768) 1.051 (1.015,1.089)
## Well - Death 0.03994 ( 0.03117, 0.05117) 1.125 (1.087,1.165)
## Fracture - Fracture -0.10756 (-0.15899,-0.07276)
## Fracture - Death 0.10756 ( 0.07276, 0.15899) 1.081 (1.040,1.122)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 1.311e-03 (0.0000134,1.283e-01) 1.7079 (1.1202,2.6041)
## Well - Death 2.916e+03 (2.3658550,3.593e+06) 0.5141 (0.3154,0.8378)
## Fracture - Fracture
## Fracture - Death 6.499e-02 (0.0009992,4.227e+00) 0.7669 (0.4679,1.2570)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.7268 (1.1442,2.606) 0.862 (0.4967,1.496)
## Well - Death 0.8623 (0.5593,1.329) 1.701 (1.1165,2.593)
## Fracture - Fracture
## Fracture - Death 1.0362 (0.6343,1.693) 1.402 (0.7451,2.637)
## hypertension copd
## Well - Well
## Well - Fracture 1.172 (0.7741,1.776) 1.122 (0.6398,1.967)
## Well - Death 1.439 (0.9829,2.107) 1.395 (0.8370,2.325)
## Fracture - Fracture
## Fracture - Death 1.583 (0.9993,2.509) 1.797 (0.9527,3.391)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.294 (0.5895,2.840) 1.2207 (0.7651,1.948)
## Well - Death 2.083 (1.0944,3.963) 1.2557 (0.8144,1.936)
## Fracture - Fracture
## Fracture - Death 1.657 (0.6588,4.166) 0.9516 (0.5478,1.653)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.189 (0.796,1.775)
## Well - Death 3.439 (2.270,5.209)
## Fracture - Fracture
## Fracture - Death 1.091 (0.600,1.984)
##
## -2 * log-likelihood: 2089.667
hazard.msm(multi.me3)
## $age
## HR L U
## Well - Fracture 1.051388 1.014894 1.089194
## Well - Death 1.125046 1.086625 1.164825
## Fracture - Death 1.080604 1.040340 1.122426
##
## $fnbmd
## HR L U
## Well - Fracture 1.310815e-03 0.0000133961 1.282639e-01
## Well - Death 2.915591e+03 2.3658550475 3.593065e+06
## Fracture - Death 6.498770e-02 0.0009992045 4.226763e+00
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.7079491 1.1201745 2.6041391
## Well - Death 0.5140669 0.3154292 0.8377944
## Fracture - Death 0.7669210 0.4679109 1.2570080
##
## $fx50
## HR L U
## Well - Fracture 1.7267516 1.1441758 2.605955
## Well - Death 0.8622689 0.5592805 1.329400
## Fracture - Death 1.0361931 0.6342751 1.692793
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.8620246 0.4967049 1.496032
## Well - Death 1.7013948 1.1165087 2.592675
## Fracture - Death 1.4015982 0.7450569 2.636681
##
## $hypertension
## HR L U
## Well - Fracture 1.172476 0.7740542 1.775974
## Well - Death 1.439061 0.9829295 2.106861
## Fracture - Death 1.583270 0.9992752 2.508563
##
## $copd
## HR L U
## Well - Fracture 1.121784 0.6398355 1.966756
## Well - Death 1.395072 0.8370456 2.325114
## Fracture - Death 1.797397 0.9527145 3.390980
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.293784 0.5894640 2.839661
## Well - Death 2.082633 1.0944484 3.963054
## Fracture - Death 1.656675 0.6587568 4.166289
##
## $cancer
## HR L U
## Well - Fracture 1.2206924 0.7651092 1.947552
## Well - Death 1.2556914 0.8143993 1.936103
## Fracture - Death 0.9516475 0.5478310 1.653125
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.188655 0.7959580 1.775093
## Well - Death 3.438657 2.2701637 5.208593
## Fracture - Death 1.091167 0.6000304 1.984309
multi.ma3= msm(state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
multi.ma3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = m.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.08358 (-0.09853,-0.07091)
## Well - Fracture 0.04716 ( 0.03838, 0.05796) 1.063 (1.023,1.104)
## Well - Death 0.03642 ( 0.02789, 0.04757) 1.135 (1.093,1.178)
## Fracture - Fracture -0.10312 (-0.15521,-0.06851)
## Fracture - Death 0.10312 ( 0.06851, 0.15521) 1.085 (1.043,1.128)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 7.301e-04 (6.453e-06,8.261e-02) 1.7986 (1.1660,2.7745)
## Well - Death 3.955e+03 (2.102e+00,7.441e+06) 0.5292 (0.3259,0.8593)
## Fracture - Fracture
## Fracture - Death 1.114e-01 (1.373e-03,9.038e+00) 0.7186 (0.4296,1.2020)
## fx50 BMI
## Well - Well
## Well - Fracture 1.6806 (1.0911,2.589) 1.0320 (0.9660,1.102)
## Well - Death 0.8058 (0.5122,1.268) 0.9715 (0.9125,1.034)
## Fracture - Fracture
## Fracture - Death 1.0893 (0.6338,1.872) 0.9458 (0.8622,1.038)
## smoke drink
## Well - Well
## Well - Fracture 1.374 (0.8822,2.141) 0.9565 (0.8236,1.111)
## Well - Death 1.199 (0.7935,1.812) 1.0782 (0.9379,1.239)
## Fracture - Fracture
## Fracture - Death 1.500 (0.8631,2.607) 0.8282 (0.6804,1.008)
## physical cvd.nYes
## Well - Well
## Well - Fracture 1.116 (0.7267,1.713) 0.7844 (0.4436,1.387)
## Well - Death 1.256 (0.8479,1.861) 2.0241 (1.2976,3.157)
## Fracture - Fracture
## Fracture - Death 0.763 (0.4649,1.252) 1.8390 (0.9294,3.639)
## hypertension copd
## Well - Well
## Well - Fracture 1.092 (0.709,1.681) 1.140 (0.6396,2.030)
## Well - Death 1.585 (1.066,2.356) 1.269 (0.7456,2.158)
## Fracture - Fracture
## Fracture - Death 1.758 (1.095,2.822) 1.992 (1.0267,3.867)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.300 (0.5815,2.907) 1.328 (0.8143,2.164)
## Well - Death 2.158 (1.0993,4.235) 1.154 (0.7404,1.799)
## Fracture - Fracture
## Fracture - Death 1.986 (0.7580,5.202) 1.085 (0.6083,1.934)
## renal parkinson
## Well - Well
## Well - Fracture 1.4366 (0.65533,3.1493) 0.9775 (0.4876,1.960)
## Well - Death 0.2399 (0.08757,0.6571) 1.9656 (1.1455,3.373)
## Fracture - Fracture
## Fracture - Death 0.4065 (0.17769,0.9297) 1.3746 (0.6512,2.902)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.1310 (0.4851,2.637) 1.210 (0.8080,1.812)
## Well - Death 0.3999 (0.1359,1.176) 3.955 (2.5846,6.052)
## Fracture - Fracture
## Fracture - Death 1.1164 (0.4476,2.785) 1.421 (0.7436,2.714)
##
## -2 * log-likelihood: 2053.792
hazard.msm(multi.ma3)
## $age
## HR L U
## Well - Fracture 1.062907 1.023181 1.104175
## Well - Death 1.135010 1.093429 1.178173
## Fracture - Death 1.084527 1.042837 1.127883
##
## $fnbmd
## HR L U
## Well - Fracture 7.301295e-04 6.453218e-06 8.260826e-02
## Well - Death 3.954985e+03 2.102138e+00 7.440951e+06
## Fracture - Death 1.114124e-01 1.373382e-03 9.038069e+00
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.7986134 1.1659707 2.7745211
## Well - Death 0.5291810 0.3258906 0.8592836
## Fracture - Death 0.7186041 0.4296272 1.2019534
##
## $fx50
## HR L U
## Well - Fracture 1.680606 1.0910861 2.588646
## Well - Death 0.805801 0.5122066 1.267682
## Fracture - Death 1.089347 0.6337817 1.872376
##
## $BMI
## HR L U
## Well - Fracture 1.0319625 0.9659643 1.102470
## Well - Death 0.9715010 0.9124994 1.034318
## Fracture - Death 0.9457968 0.8621519 1.037557
##
## $smoke
## HR L U
## Well - Fracture 1.374287 0.8821995 2.140858
## Well - Death 1.198989 0.7934794 1.811736
## Fracture - Death 1.499938 0.8631263 2.606587
##
## $drink
## HR L U
## Well - Fracture 0.9565338 0.8236460 1.110862
## Well - Death 1.0782000 0.9378921 1.239498
## Fracture - Death 0.8282269 0.6804083 1.008159
##
## $physical
## HR L U
## Well - Fracture 1.1158633 0.7267484 1.713318
## Well - Death 1.2560116 0.8478837 1.860591
## Fracture - Death 0.7630427 0.4648653 1.252479
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.7843564 0.4435519 1.387019
## Well - Death 2.0240799 1.2976379 3.157198
## Fracture - Death 1.8389797 0.9293696 3.638861
##
## $hypertension
## HR L U
## Well - Fracture 1.091722 0.7089765 1.681096
## Well - Death 1.584774 1.0661154 2.355756
## Fracture - Death 1.757742 1.0947901 2.822145
##
## $copd
## HR L U
## Well - Fracture 1.139503 0.6395809 2.030185
## Well - Death 1.268554 0.7456011 2.158297
## Fracture - Death 1.992446 1.0267191 3.866530
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.300159 0.5815302 2.906836
## Well - Death 2.157716 1.0993497 4.234994
## Fracture - Death 1.985769 0.7580128 5.202128
##
## $cancer
## HR L U
## Well - Fracture 1.327563 0.8142790 2.164397
## Well - Death 1.154196 0.7403625 1.799347
## Fracture - Death 1.084734 0.6083401 1.934194
##
## $renal
## HR L U
## Well - Fracture 1.4366111 0.65533021 3.1493305
## Well - Death 0.2398722 0.08756641 0.6570863
## Fracture - Death 0.4064519 0.17768574 0.9297491
##
## $parkinson
## HR L U
## Well - Fracture 0.9774965 0.4876092 1.959560
## Well - Death 1.9656143 1.1455465 3.372748
## Fracture - Death 1.3745817 0.6512020 2.901519
##
## $depression
## HR L U
## Well - Fracture 1.1309896 0.4850832 2.636945
## Well - Death 0.3998776 0.1359444 1.176232
## Fracture - Death 1.1163817 0.4475811 2.784541
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.209831 0.8079641 1.811578
## Well - Death 3.954911 2.5845502 6.051854
## Fracture - Death 1.420715 0.7436036 2.714392
#2a. create subset for women
women = subset(bmd, gender == "F" & race == "1:WHITE")
baseline.w = subset(women, state == 1 & time2event == 0)
library(table1)
table1(~ ageBase + fnbmdBase + TscoreBase + Tscore + 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=1722) |
Fractured, Alive (N=361) |
Fractured, Dead (N=655) |
No Fractured, Dead (N=2641) |
Overall (N=5379) |
|
|---|---|---|---|---|---|
| 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.122) | 0.754 (0.115) | 0.727 (0.121) | 0.782 (0.122) | 0.780 (0.124) |
| Median [Min, Max] | 0.794 [0.404, 1.32] | 0.744 [0.499, 1.27] | 0.719 [0.273, 1.15] | 0.773 [0.475, 1.33] | 0.772 [0.273, 1.33] |
| TscoreBase | |||||
| Mean (SD) | -0.959 (0.894) | -1.31 (0.843) | -1.51 (0.883) | -1.11 (0.893) | -1.12 (0.905) |
| Median [Min, Max] | -1.02 [-3.87, 2.81] | -1.39 [-3.18, 2.47] | -1.57 [-4.83, 1.57] | -1.18 [-3.35, 2.86] | -1.19 [-4.83, 2.86] |
| Tscore | |||||
| Mean (SD) | -0.959 (0.894) | -1.31 (0.843) | -1.51 (0.883) | -1.11 (0.893) | -1.12 (0.905) |
| Median [Min, Max] | -1.02 [-3.87, 2.81] | -1.39 [-3.18, 2.47] | -1.57 [-4.83, 1.57] | -1.18 [-3.35, 2.86] | -1.19 [-4.83, 2.86] |
| as.factor(fall.no) | |||||
| 0 | 1344 (78.0%) | 248 (68.7%) | 389 (59.4%) | 1966 (74.4%) | 3947 (73.4%) |
| 1 | 378 (22.0%) | 113 (31.3%) | 266 (40.6%) | 675 (25.6%) | 1432 (26.6%) |
| fall.yesno | |||||
| No | 1344 (78.0%) | 248 (68.7%) | 389 (59.4%) | 1966 (74.4%) | 3947 (73.4%) |
| Yes | 378 (22.0%) | 113 (31.3%) | 266 (40.6%) | 675 (25.6%) | 1432 (26.6%) |
| as.factor(fx50) | |||||
| 0 | 1475 (85.7%) | 280 (77.6%) | 492 (75.1%) | 2186 (82.8%) | 4433 (82.4%) |
| 1 | 247 (14.3%) | 81 (22.4%) | 163 (24.9%) | 455 (17.2%) | 946 (17.6%) |
| race | |||||
| 1:WHITE | 1722 (100%) | 361 (100%) | 655 (100%) | 2641 (100%) | 5379 (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.66) | 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 | 708 (41.1%) | 143 (39.6%) | 245 (37.4%) | 918 (34.8%) | 2014 (37.4%) |
| 1 | 1014 (58.9%) | 218 (60.4%) | 410 (62.6%) | 1723 (65.2%) | 3365 (62.6%) |
| as.factor(drink.n) | |||||
| No | 547 (31.8%) | 111 (30.7%) | 238 (36.3%) | 945 (35.8%) | 1841 (34.2%) |
| Yes | 1175 (68.2%) | 250 (69.3%) | 417 (63.7%) | 1696 (64.2%) | 3538 (65.8%) |
| as.factor(physical) | |||||
| 0 | 458 (26.6%) | 96 (26.6%) | 255 (38.9%) | 976 (37.0%) | 1785 (33.2%) |
| 1 | 1264 (73.4%) | 265 (73.4%) | 400 (61.1%) | 1665 (63.0%) | 3594 (66.8%) |
| as.factor(cvd.n) | |||||
| No | 1507 (87.5%) | 304 (84.2%) | 497 (75.9%) | 1946 (73.7%) | 4254 (79.1%) |
| Yes | 215 (12.5%) | 57 (15.8%) | 158 (24.1%) | 695 (26.3%) | 1125 (20.9%) |
| as.factor(hypertension) | |||||
| 0 | 1113 (64.6%) | 231 (64.0%) | 344 (52.5%) | 1436 (54.4%) | 3124 (58.1%) |
| 1 | 609 (35.4%) | 130 (36.0%) | 311 (47.5%) | 1205 (45.6%) | 2255 (41.9%) |
| as.factor(copd) | |||||
| 0 | 1583 (91.9%) | 334 (92.5%) | 562 (85.8%) | 2321 (87.9%) | 4800 (89.2%) |
| 1 | 139 (8.1%) | 27 (7.5%) | 93 (14.2%) | 320 (12.1%) | 579 (10.8%) |
| as.factor(diabetes.n) | |||||
| No | 1611 (93.6%) | 338 (93.6%) | 582 (88.9%) | 2313 (87.6%) | 4844 (90.1%) |
| Yes | 111 (6.4%) | 23 (6.4%) | 73 (11.1%) | 328 (12.4%) | 535 (9.9%) |
| as.factor(cancer) | |||||
| 0 | 1481 (86.0%) | 305 (84.5%) | 529 (80.8%) | 2077 (78.6%) | 4392 (81.7%) |
| 1 | 241 (14.0%) | 56 (15.5%) | 126 (19.2%) | 564 (21.4%) | 987 (18.3%) |
| as.factor(parkinson) | |||||
| 0 | 1505 (87.4%) | 311 (86.1%) | 579 (88.4%) | 2254 (85.3%) | 4649 (86.4%) |
| 1 | 217 (12.6%) | 50 (13.9%) | 76 (11.6%) | 387 (14.7%) | 730 (13.6%) |
| as.factor(rheumatoid) | |||||
| 0 | 982 (57.0%) | 201 (55.7%) | 335 (51.1%) | 1314 (49.8%) | 2832 (52.6%) |
| 1 | 740 (43.0%) | 160 (44.3%) | 320 (48.9%) | 1327 (50.2%) | 2547 (47.4%) |
| as.factor(renal) | |||||
| 0 | 1512 (87.8%) | 307 (85.0%) | 599 (91.5%) | 2446 (92.6%) | 4864 (90.4%) |
| 1 | 210 (12.2%) | 54 (15.0%) | 56 (8.5%) | 195 (7.4%) | 515 (9.6%) |
| as.factor(depression) | |||||
| 0 | 1658 (96.3%) | 345 (95.6%) | 622 (95.0%) | 2551 (96.6%) | 5176 (96.2%) |
| 1 | 64 (3.7%) | 16 (4.4%) | 33 (5.0%) | 90 (3.4%) | 203 (3.8%) |
| as.factor(anyfx) | |||||
| 0 | 1722 (100%) | 0 (0%) | 0 (0%) | 2641 (100%) | 4363 (81.1%) |
| 1 | 0 (0%) | 361 (100%) | 655 (100%) | 0 (0%) | 1016 (18.9%) |
| as.factor(death) | |||||
| 0 | 1722 (100%) | 361 (100%) | 0 (0%) | 0 (0%) | 2083 (38.7%) |
| 1 | 0 (0%) | 0 (0%) | 655 (100%) | 2641 (100%) | 3296 (61.3%) |
w.normal = subset(women, TscoreBase > -1)
w.osteopenia = subset(women, TscoreBase > -2.5 & TscoreBase <=-1)
w.osteoporosis = subset(women, TscoreBase <= -2.5)
qmatrix.n = crudeinits.msm(state ~ time2event, subject = ID, data = women, qmatrix = Q.m2)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 9335 and 9336, 11800 and 11801
qmatrix.n
## Well Fracture Death
## Well -0.06607449 0.03047103 0.03560346
## Fracture 0.00000000 -0.08769043 0.08769043
## Death 0.00000000 0.00000000 0.00000000
statetable.msm(state, ID, data = women)
## to
## from 1 2 3
## 1 2206 2731 3191
## 2 0 1087 1644
age.w1= msm(state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 1622 and 1623
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 1622 and
## 1623
age.w1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.04046 (-0.04402,-0.03719)
## Well - Fracture 0.01685 ( 0.01495, 0.01899) 1.016 (0.9893,1.044)
## Well - Death 0.02361 ( 0.02101, 0.02653) 1.101 (1.0822,1.120)
## Fracture - Fracture -0.04244 (-0.05884,-0.03061)
## Fracture - Death 0.04244 ( 0.03061, 0.05884) 1.111 (1.0836,1.139)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.0953 (0.01742,0.5212) 1.3571 (1.0737,1.715)
## Well - Death 1.8506 (0.62272,5.4996) 4.2321 (3.3486,5.349)
## Fracture - Fracture
## Fracture - Death 0.4331 (0.10131,1.8517) 0.8199 (0.4471,1.504)
##
## -2 * log-likelihood: 9815.199
hazard.msm(age.w1)
## $age
## HR L U
## Well - Fracture 1.016316 0.9893209 1.044048
## Well - Death 1.100845 1.0821767 1.119836
## Fracture - Death 1.110984 1.0835689 1.139093
##
## $fnbmd
## HR L U
## Well - Fracture 0.09529842 0.01742366 0.5212331
## Well - Death 1.85059831 0.62271903 5.4996137
## Fracture - Death 0.43312046 0.10130852 1.8517034
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.3570601 1.0736910 1.715216
## Well - Death 4.2321292 3.3485628 5.348837
## Fracture - Death 0.8198896 0.4470842 1.503563
multi.we1= msm(state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 1622 and 1623
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 1622 and
## 1623
multi.we1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.03940 (-0.04293,-0.03617)
## Well - Fracture 0.01651 ( 0.01462, 0.01865) 1.011 (0.9833,1.039)
## Well - Death 0.02289 ( 0.02034, 0.02576) 1.092 (1.0732,1.112)
## Fracture - Fracture -0.04008 (-0.05638,-0.02849)
## Fracture - Death 0.04008 ( 0.02849, 0.05638) 1.110 (1.0823,1.139)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.07641 (0.01365,0.4279) 1.422 (1.1365,1.780)
## Well - Death 1.41283 (0.46961,4.2505) 1.009 (0.8474,1.200)
## Fracture - Fracture
## Fracture - Death 0.56273 (0.13082,2.4207) 1.144 (0.8376,1.562)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.4192 (1.1245,1.791) 1.054 (0.8099,1.371)
## Well - Death 1.2384 (1.0389,1.476) 1.505 (1.2640,1.792)
## Fracture - Fracture
## Fracture - Death 0.8879 (0.6401,1.232) 1.265 (0.8964,1.785)
## hypertension copd
## Well - Well
## Well - Fracture 1.224 (0.9821,1.525) 0.8949 (0.6671,1.201)
## Well - Death 1.258 (1.0723,1.477) 1.0888 (0.8906,1.331)
## Fracture - Fracture
## Fracture - Death 1.383 (1.0196,1.876) 1.0417 (0.7003,1.549)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.391 (0.9798,1.975) 1.051 (0.8072,1.369)
## Well - Death 1.796 (1.4205,2.270) 1.042 (0.8602,1.261)
## Fracture - Fracture
## Fracture - Death 2.006 (1.2922,3.113) 1.318 (0.9219,1.885)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.3995 (1.1066,1.770)
## Well - Death 4.4312 (3.5045,5.603)
## Fracture - Fracture
## Fracture - Death 0.9233 (0.5022,1.697)
##
## -2 * log-likelihood: 9708.879
hazard.msm(multi.we1)
## $age
## HR L U
## Well - Fracture 1.010705 0.983259 1.038916
## Well - Death 1.092372 1.073210 1.111875
## Fracture - Death 1.110413 1.082282 1.139275
##
## $fnbmd
## HR L U
## Well - Fracture 0.07641318 0.01364719 0.4278517
## Well - Death 1.41282975 0.46961077 4.2505156
## Fracture - Death 0.56273072 0.13081557 2.4207047
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.422204 1.1365180 1.779702
## Well - Death 1.008561 0.8473727 1.200410
## Fracture - Death 1.143687 0.8376403 1.561553
##
## $fx50
## HR L U
## Well - Fracture 1.4191699 1.124502 1.791053
## Well - Death 1.2384298 1.038857 1.476342
## Fracture - Death 0.8879221 0.640053 1.231782
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.053651 0.8099468 1.370684
## Well - Death 1.505191 1.2640075 1.792394
## Fracture - Death 1.264857 0.8964221 1.784722
##
## $hypertension
## HR L U
## Well - Fracture 1.223768 0.9821088 1.524890
## Well - Death 1.258334 1.0723033 1.476639
## Fracture - Death 1.382975 1.0195735 1.875901
##
## $copd
## HR L U
## Well - Fracture 0.8949429 0.6670537 1.200687
## Well - Death 1.0887815 0.8906425 1.331000
## Fracture - Death 1.0416801 0.7003416 1.549383
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.391170 0.9798001 1.975254
## Well - Death 1.795828 1.4205448 2.270254
## Fracture - Death 2.005525 1.2921811 3.112668
##
## $cancer
## HR L U
## Well - Fracture 1.051253 0.8072309 1.369042
## Well - Death 1.041547 0.8601567 1.261190
## Fracture - Death 1.318220 0.9218535 1.885010
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.3994799 1.1066236 1.769838
## Well - Death 4.4312028 3.5044504 5.603035
## Fracture - Death 0.9233023 0.5022054 1.697487
multi.wa1= msm(state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 1622 and 1623
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 1622 and
## 1623
multi.wa1
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.normal, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.03793 (-0.04143,-0.03472)
## Well - Fracture 0.01583 ( 0.01396, 0.01797) 1.006 (0.9781,1.036)
## Well - Death 0.02209 ( 0.01957, 0.02495) 1.089 (1.0691,1.109)
## Fracture - Fracture -0.03536 (-0.05149,-0.02428)
## Fracture - Death 0.03536 ( 0.02428, 0.05149) 1.111 (1.0815,1.142)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.09993 (0.01718,0.5813) 1.417 (1.1261,1.784)
## Well - Death 1.33794 (0.42837,4.1788) 1.040 (0.8715,1.241)
## Fracture - Fracture
## Fracture - Death 0.59941 (0.12542,2.8649) 1.083 (0.7827,1.498)
## fx50 BMI
## Well - Well
## Well - Fracture 1.404 (1.1059,1.783) 0.9643 (0.9397,0.9895)
## Well - Death 1.200 (1.0036,1.434) 1.0049 (0.9868,1.0233)
## Fracture - Fracture
## Fracture - Death 0.958 (0.6841,1.342) 0.9542 (0.9170,0.9930)
## smoke drink
## Well - Well
## Well - Fracture 0.9149 (0.7239,1.156) 0.9814 (0.7792,1.236)
## Well - Death 1.2585 (1.0644,1.488) 0.8796 (0.7438,1.040)
## Fracture - Fracture
## Fracture - Death 1.3961 (0.9986,1.952) 0.8748 (0.6239,1.226)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.8766 (0.6868,1.1189) 1.043 (0.7970,1.366)
## Well - Death 0.6806 (0.5750,0.8057) 1.424 (1.1919,1.702)
## Fracture - Fracture
## Fracture - Death 0.5954 (0.4251,0.8340) 1.163 (0.8182,1.652)
## hypertension copd
## Well - Well
## Well - Fracture 1.230 (0.9811,1.542) 0.9137 (0.6714,1.243)
## Well - Death 1.249 (1.0612,1.471) 1.0122 (0.8225,1.246)
## Fracture - Fracture
## Fracture - Death 1.312 (0.9559,1.801) 0.9595 (0.6308,1.460)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.559 (1.088,2.235) 1.053 (0.8035,1.380)
## Well - Death 1.542 (1.204,1.977) 1.093 (0.9003,1.327)
## Fracture - Fracture
## Fracture - Death 2.112 (1.317,3.388) 1.241 (0.8591,1.794)
## renal parkinson
## Well - Well
## Well - Fracture 1.377 (0.6045,3.135) 1.263 (0.3166, 5.038)
## Well - Death 1.539 (0.8636,2.744) 1.007 (0.3745, 2.708)
## Fracture - Fracture
## Fracture - Death 2.703 (1.1304,6.464) 1.633 (0.1888,14.129)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.6783 (0.4347,1.059) 1.434 (1.1276,1.823)
## Well - Death 1.0304 (0.7836,1.355) 4.578 (3.6056,5.813)
## Fracture - Fracture
## Fracture - Death 0.6704 (0.3386,1.328) 1.092 (0.5612,2.126)
##
## -2 * log-likelihood: 9412.053
hazard.msm(multi.wa1)
## $age
## HR L U
## Well - Fracture 1.006469 0.9781002 1.035661
## Well - Death 1.089010 1.0690748 1.109316
## Fracture - Death 1.111399 1.0815088 1.142116
##
## $fnbmd
## HR L U
## Well - Fracture 0.09992628 0.01717801 0.5812816
## Well - Death 1.33793874 0.42836796 4.1788375
## Fracture - Death 0.59941428 0.12541562 2.8648542
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.417278 1.1261458 1.783674
## Well - Death 1.039790 0.8714843 1.240599
## Fracture - Death 1.083025 0.7827470 1.498495
##
## $fx50
## HR L U
## Well - Fracture 1.4041809 1.1059345 1.782858
## Well - Death 1.1996873 1.0036057 1.434079
## Fracture - Death 0.9580005 0.6840652 1.341634
##
## $BMI
## HR L U
## Well - Fracture 0.9642697 0.9397042 0.9894774
## Well - Death 1.0048782 0.9868091 1.0232780
## Fracture - Death 0.9542285 0.9169800 0.9929900
##
## $smoke
## HR L U
## Well - Fracture 0.9148815 0.7238587 1.156314
## Well - Death 1.2585013 1.0644315 1.487954
## Fracture - Death 1.3961159 0.9986367 1.951800
##
## $drink
## HR L U
## Well - Fracture 0.9813868 0.7792463 1.235963
## Well - Death 0.8795529 0.7437898 1.040097
## Fracture - Death 0.8747633 0.6239239 1.226449
##
## $physical
## HR L U
## Well - Fracture 0.8765905 0.6867641 1.1188862
## Well - Death 0.6806117 0.5749609 0.8056762
## Fracture - Death 0.5954041 0.4250586 0.8340169
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.043369 0.7969708 1.365945
## Well - Death 1.424172 1.1918505 1.701780
## Fracture - Death 1.162698 0.8182426 1.652158
##
## $hypertension
## HR L U
## Well - Fracture 1.230166 0.9810757 1.542500
## Well - Death 1.249385 1.0611896 1.470957
## Fracture - Death 1.311993 0.9559158 1.800708
##
## $copd
## HR L U
## Well - Fracture 0.9136550 0.6714393 1.243248
## Well - Death 1.0121939 0.8225043 1.245631
## Fracture - Death 0.9595453 0.6307709 1.459686
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.559494 1.088374 2.234546
## Well - Death 1.542476 1.203708 1.976585
## Fracture - Death 2.112027 1.316544 3.388159
##
## $cancer
## HR L U
## Well - Fracture 1.052902 0.8035048 1.379709
## Well - Death 1.093111 0.9003373 1.327159
## Fracture - Death 1.241482 0.8591371 1.793982
##
## $renal
## HR L U
## Well - Fracture 1.376668 0.6044928 3.135214
## Well - Death 1.539216 0.8635569 2.743522
## Fracture - Death 2.703030 1.1304033 6.463510
##
## $parkinson
## HR L U
## Well - Fracture 1.262879 0.3165855 5.037705
## Well - Death 1.007056 0.3745367 2.707776
## Fracture - Death 1.633192 0.1887887 14.128575
##
## $depression
## HR L U
## Well - Fracture 0.6783329 0.4346696 1.058587
## Well - Death 1.0304106 0.7835552 1.355037
## Fracture - Death 0.6704234 0.3385602 1.327585
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.433785 1.1276291 1.823063
## Well - Death 4.578356 3.6056361 5.813494
## Fracture - Death 1.092217 0.5611918 2.125724
age.w2= msm(state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 7212 and 7213
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 7212 and
## 7213
age.w2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.06130 (-0.06370,-0.05898)
## Well - Fracture 0.03147 ( 0.02989, 0.03312) 1.034 (1.023,1.045)
## Well - Death 0.02983 ( 0.02816, 0.03160) 1.113 (1.103,1.123)
## Fracture - Fracture -0.03537 (-0.04181,-0.02992)
## Fracture - Death 0.03537 ( 0.02992, 0.04181) 1.088 (1.077,1.100)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.03462 (0.01277,0.09386) 1.238 (1.119,1.370)
## Well - Death 1.22361 (0.48638,3.07829) 3.355 (2.989,3.765)
## Fracture - Fracture
## Fracture - Death 0.30564 (0.11637,0.80275) 2.466 (1.794,3.391)
##
## -2 * log-likelihood: 36958.14
hazard.msm(age.w2)
## $age
## HR L U
## Well - Fracture 1.034136 1.023392 1.044994
## Well - Death 1.112775 1.103005 1.122631
## Fracture - Death 1.088357 1.077038 1.099795
##
## $fnbmd
## HR L U
## Well - Fracture 0.03461705 0.01276733 0.0938599
## Well - Death 1.22360541 0.48637766 3.0782873
## Fracture - Death 0.30563606 0.11636740 0.8027454
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.238145 1.119305 1.369602
## Well - Death 3.354889 2.989170 3.765352
## Fracture - Death 2.466250 1.793720 3.390934
multi.we2= msm(state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 7212 and 7213
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 7212 and
## 7213
multi.we2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.06034 (-0.06273,-0.05803)
## Well - Fracture 0.03132 ( 0.02974, 0.03298) 1.031 (1.020,1.042)
## Well - Death 0.02902 ( 0.02736, 0.03077) 1.104 (1.094,1.114)
## Fracture - Fracture -0.03430 (-0.04059,-0.02898)
## Fracture - Death 0.03430 ( 0.02898, 0.04059) 1.087 (1.076,1.099)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.03488 (0.01281,0.09498) 1.115 (1.0031,1.239)
## Well - Death 0.99146 (0.39263,2.50361) 0.946 (0.8545,1.047)
## Fracture - Fracture
## Fracture - Death 0.24360 (0.09222,0.64345) 1.006 (0.8780,1.152)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.1934 (1.0815,1.317) 0.9576 (0.8513,1.077)
## Well - Death 1.0588 (0.9648,1.162) 1.3604 (1.2313,1.503)
## Fracture - Fracture
## Fracture - Death 0.9077 (0.7981,1.032) 1.3771 (1.1917,1.591)
## hypertension copd
## Well - Well
## Well - Fracture 1.066 (0.963,1.179) 1.104 (0.9720,1.254)
## Well - Death 1.338 (1.220,1.466) 1.153 (1.0246,1.298)
## Fracture - Fracture
## Fracture - Death 1.323 (1.163,1.505) 1.124 (0.9549,1.324)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.498 (1.236,1.815) 1.051 (0.9318,1.186)
## Well - Death 1.558 (1.314,1.846) 1.071 (0.9573,1.197)
## Fracture - Fracture
## Fracture - Death 1.507 (1.200,1.893) 1.090 (0.9340,1.273)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.253 (1.133,1.386)
## Well - Death 3.446 (3.070,3.868)
## Fracture - Fracture
## Fracture - Death 2.612 (1.897,3.595)
##
## -2 * log-likelihood: 36741.41
hazard.msm(multi.we2)
## $age
## HR L U
## Well - Fracture 1.031155 1.020210 1.042218
## Well - Death 1.104381 1.094416 1.114438
## Fracture - Death 1.087155 1.075719 1.098712
##
## $fnbmd
## HR L U
## Well - Fracture 0.03488443 0.01281271 0.09497784
## Well - Death 0.99145718 0.39262778 2.50361127
## Fracture - Death 0.24359812 0.09222230 0.64344575
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.1147804 1.0030841 1.238914
## Well - Death 0.9459971 0.8545204 1.047266
## Fracture - Death 1.0057279 0.8779990 1.152038
##
## $fx50
## HR L U
## Well - Fracture 1.1934499 1.0815205 1.316963
## Well - Death 1.0588259 0.9648062 1.162008
## Fracture - Death 0.9076654 0.7981379 1.032223
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.9576144 0.851318 1.077183
## Well - Death 1.3604300 1.231318 1.503080
## Fracture - Death 1.3770877 1.191675 1.591348
##
## $hypertension
## HR L U
## Well - Fracture 1.065749 0.9629997 1.179462
## Well - Death 1.337708 1.2204934 1.466179
## Fracture - Death 1.323145 1.1632599 1.505004
##
## $copd
## HR L U
## Well - Fracture 1.104105 0.9720309 1.254124
## Well - Death 1.153081 1.0246382 1.297626
## Fracture - Death 1.124234 0.9548810 1.323624
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.498091 1.236485 1.815045
## Well - Death 1.557543 1.314169 1.845989
## Fracture - Death 1.507459 1.200197 1.893383
##
## $cancer
## HR L U
## Well - Fracture 1.051334 0.9317548 1.186261
## Well - Death 1.070542 0.9573200 1.197155
## Fracture - Death 1.090352 0.9340061 1.272870
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.253235 1.132838 1.386427
## Well - Death 3.445928 3.069689 3.868282
## Fracture - Death 2.611726 1.897240 3.595280
multi.wa2= msm(state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
## Warning in msm.check.times(time, subject, state): Different states observed at
## the same time on the same subject at observations 7212 and 7213
## Warning in msm.check.times(mf$"(time)", mf$"(subject)", mf$"(state)"): Different
## states observed at the same time on the same subject at observations 7212 and
## 7213
multi.wa2
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteopenia, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.05947 (-0.06186,-0.05717)
## Well - Fracture 0.03132 ( 0.02973, 0.03299) 1.029 (1.018,1.041)
## Well - Death 0.02815 ( 0.02651, 0.02989) 1.095 (1.085,1.106)
## Fracture - Fracture -0.03328 (-0.03944,-0.02808)
## Fracture - Death 0.03328 ( 0.02808, 0.03944) 1.089 (1.078,1.101)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.02968 (0.01063,0.0829) 1.1169 (1.0046,1.242)
## Well - Death 1.09181 (0.42119,2.8302) 0.9675 (0.8736,1.071)
## Fracture - Fracture
## Fracture - Death 0.25808 (0.09514,0.7001) 0.9971 (0.8698,1.143)
## fx50 BMI
## Well - Well
## Well - Fracture 1.1876 (1.0754,1.311) 1.0063 (0.9942,1.018)
## Well - Death 1.0488 (0.9549,1.152) 0.9961 (0.9849,1.007)
## Fracture - Fracture
## Fracture - Death 0.8988 (0.7896,1.023) 1.0035 (0.9874,1.020)
## smoke drink
## Well - Well
## Well - Fracture 1.042 (0.940,1.155) 0.9940 (0.8975,1.1009)
## Well - Death 1.285 (1.168,1.414) 0.9187 (0.8356,1.0100)
## Fracture - Fracture
## Fracture - Death 1.293 (1.129,1.480) 0.8258 (0.7219,0.9446)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.8721 (0.7846,0.9695) 0.9462 (0.8406,1.065)
## Well - Death 0.6028 (0.5476,0.6636) 1.3199 (1.1936,1.460)
## Fracture - Fracture
## Fracture - Death 0.7645 (0.6689,0.8739) 1.3191 (1.1393,1.527)
## hypertension copd
## Well - Well
## Well - Fracture 1.052 (0.9501,1.166) 1.090 (0.9580,1.240)
## Well - Death 1.307 (1.1911,1.433) 1.075 (0.9534,1.212)
## Fracture - Fracture
## Fracture - Death 1.284 (1.1268,1.464) 1.065 (0.9023,1.257)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.446 (1.191,1.757) 1.056 (0.9347,1.192)
## Well - Death 1.437 (1.210,1.706) 1.107 (0.9895,1.239)
## Fracture - Fracture
## Fracture - Death 1.381 (1.095,1.743) 1.128 (0.9651,1.318)
## renal parkinson
## Well - Well
## Well - Fracture 1.132 (0.6791,1.888) 1.767 (0.8386,3.725)
## Well - Death 1.253 (0.8202,1.913) 1.852 (0.9203,3.727)
## Fracture - Fracture
## Fracture - Death 1.959 (1.0968,3.499) 1.517 (0.6779,3.394)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.153 (0.9679,1.373) 1.268 (1.146,1.403)
## Well - Death 1.017 (0.8567,1.207) 3.576 (3.184,4.017)
## Fracture - Fracture
## Fracture - Death 1.147 (0.9237,1.424) 2.720 (1.975,3.747)
##
## -2 * log-likelihood: 36338.06
hazard.msm(multi.wa2)
## $age
## HR L U
## Well - Fracture 1.029226 1.018027 1.040549
## Well - Death 1.095492 1.085232 1.105849
## Fracture - Death 1.089265 1.077655 1.100999
##
## $fnbmd
## HR L U
## Well - Fracture 0.02968122 0.01062739 0.08289663
## Well - Death 1.09181153 0.42118924 2.83020627
## Fracture - Death 0.25808040 0.09514253 0.70006016
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.1169157 1.0045538 1.241846
## Well - Death 0.9675033 0.8736095 1.071489
## Fracture - Death 0.9970941 0.8698344 1.142972
##
## $fx50
## HR L U
## Well - Fracture 1.1876044 1.0754202 1.311491
## Well - Death 1.0487512 0.9548505 1.151886
## Fracture - Death 0.8988336 0.7895962 1.023184
##
## $BMI
## HR L U
## Well - Fracture 1.006262 0.9942046 1.018466
## Well - Death 0.996134 0.9849407 1.007454
## Fracture - Death 1.003469 0.9874464 1.019751
##
## $smoke
## HR L U
## Well - Fracture 1.042181 0.9400314 1.155431
## Well - Death 1.285399 1.1683062 1.414227
## Fracture - Death 1.292529 1.1290861 1.479630
##
## $drink
## HR L U
## Well - Fracture 0.9939944 0.8974502 1.1009245
## Well - Death 0.9186916 0.8355966 1.0100499
## Fracture - Death 0.8257634 0.7218907 0.9445823
##
## $physical
## HR L U
## Well - Fracture 0.8721267 0.7845630 0.9694632
## Well - Death 0.6028356 0.5475975 0.6636457
## Fracture - Death 0.7645339 0.6688614 0.8738911
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.9461958 0.8405821 1.065079
## Well - Death 1.3198799 1.1936143 1.459502
## Fracture - Death 1.3190796 1.1393345 1.527182
##
## $hypertension
## HR L U
## Well - Fracture 1.052448 0.950132 1.165782
## Well - Death 1.306659 1.191135 1.433387
## Fracture - Death 1.284382 1.126822 1.463972
##
## $copd
## HR L U
## Well - Fracture 1.089829 0.9580115 1.239784
## Well - Death 1.074924 0.9534467 1.211879
## Fracture - Death 1.064760 0.9022609 1.256525
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.446352 1.190767 1.756795
## Well - Death 1.436918 1.210432 1.705781
## Fracture - Death 1.381179 1.094670 1.742675
##
## $cancer
## HR L U
## Well - Fracture 1.055623 0.9347332 1.192147
## Well - Death 1.107308 0.9894715 1.239177
## Fracture - Death 1.127861 0.9650778 1.318101
##
## $renal
## HR L U
## Well - Fracture 1.132293 0.6790892 1.887952
## Well - Death 1.252644 0.8201822 1.913133
## Fracture - Death 1.959046 1.0967988 3.499149
##
## $parkinson
## HR L U
## Well - Fracture 1.767441 0.8385516 3.725288
## Well - Death 1.852061 0.9203456 3.727003
## Fracture - Death 1.516755 0.6778581 3.393845
##
## $depression
## HR L U
## Well - Fracture 1.152983 0.9678710 1.373499
## Well - Death 1.016724 0.8567254 1.206603
## Fracture - Death 1.147015 0.9237321 1.424270
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.267893 1.145502 1.403360
## Well - Death 3.576426 3.184453 4.016647
## Fracture - Death 2.720496 1.975027 3.747340
age.w3= msm(state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd)
age.w3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd, 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.09373 (-0.09922,-0.08855)
## Well - Fracture 0.05213 ( 0.04837, 0.05617) 1.049 (1.035,1.063)
## Well - Death 0.04161 ( 0.03812, 0.04542) 1.092 (1.077,1.107)
## Fracture - Fracture -0.05835 (-0.07004,-0.04861)
## Fracture - Death 0.05835 ( 0.04861, 0.07004) 1.072 (1.057,1.088)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.04964 (0.009676,0.2547) 1.255 (1.081,1.456)
## Well - Death 0.09627 (0.016387,0.5656) 2.728 (2.291,3.249)
## Fracture - Fracture
## Fracture - Death 0.07958 (0.014708,0.4306) 1.760 (1.271,2.435)
##
## -2 * log-likelihood: 13965.08
hazard.msm(age.w3)
## $age
## HR L U
## Well - Fracture 1.048893 1.035153 1.062815
## Well - Death 1.091532 1.076665 1.106605
## Fracture - Death 1.071955 1.056564 1.087571
##
## $fnbmd
## HR L U
## Well - Fracture 0.04964019 0.009675553 0.2546778
## Well - Death 0.09627402 0.016386937 0.5656143
## Fracture - Death 0.07957964 0.014707988 0.4305769
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.254639 1.081411 1.455615
## Well - Death 2.728086 2.290963 3.248614
## Fracture - Death 1.759573 1.271456 2.435078
multi.we3= msm(state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + cvd.n + hypertension + copd + diabetes.n + cancer)
multi.we3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + 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.09189 (-0.09735,-0.08673)
## Well - Fracture 0.05186 ( 0.04811, 0.05591) 1.045 (1.031,1.059)
## Well - Death 0.04002 ( 0.03657, 0.04380) 1.083 (1.068,1.098)
## Fracture - Fracture -0.05768 (-0.06935,-0.04796)
## Fracture - Death 0.05768 ( 0.04796, 0.06935) 1.069 (1.054,1.085)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.03639 (0.007167,0.1848) 1.027 (0.8682,1.216)
## Well - Death 0.07025 (0.012310,0.4009) 1.117 (0.9374,1.330)
## Fracture - Fracture
## Fracture - Death 0.07830 (0.014305,0.4286) 0.944 (0.7671,1.162)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 0.9596 (0.8278,1.112) 1.1313 (0.9527,1.343)
## Well - Death 1.0917 (0.9311,1.280) 1.4374 (1.2097,1.708)
## Fracture - Fracture
## Fracture - Death 1.1273 (0.9399,1.352) 0.9641 (0.7829,1.187)
## hypertension copd
## Well - Well
## Well - Fracture 1.131 (0.9683,1.320) 0.8531 (0.7034,1.035)
## Well - Death 1.376 (1.1700,1.617) 1.0747 (0.8877,1.301)
## Fracture - Fracture
## Fracture - Death 1.264 (1.0500,1.522) 1.4231 (1.1356,1.783)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 0.8061 (0.5224,1.244) 1.1730 (0.9793,1.405)
## Well - Death 1.7080 (1.2361,2.360) 0.8791 (0.7127,1.084)
## Fracture - Fracture
## Fracture - Death 1.6276 (1.0090,2.625) 1.0514 (0.8426,1.312)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.268 (1.093,1.472)
## Well - Death 2.852 (2.393,3.399)
## Fracture - Fracture
## Fracture - Death 1.881 (1.356,2.610)
##
## -2 * log-likelihood: 13879.85
hazard.msm(multi.we3)
## $age
## HR L U
## Well - Fracture 1.045234 1.031276 1.059381
## Well - Death 1.083011 1.067946 1.098288
## Fracture - Death 1.069218 1.053715 1.084950
##
## $fnbmd
## HR L U
## Well - Fracture 0.03639195 0.007166824 0.1847924
## Well - Death 0.07025014 0.012310499 0.4008840
## Fracture - Death 0.07829803 0.014305070 0.4285601
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.027358 0.8681595 1.215749
## Well - Death 1.116565 0.9374338 1.329925
## Fracture - Death 0.944025 0.7671270 1.161715
##
## $fx50
## HR L U
## Well - Fracture 0.9596073 0.8278398 1.112348
## Well - Death 1.0916875 0.9310613 1.280025
## Fracture - Death 1.1272935 0.9399430 1.351987
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.1313198 0.9527101 1.343415
## Well - Death 1.4373716 1.2096572 1.707953
## Fracture - Death 0.9640754 0.7828833 1.187203
##
## $hypertension
## HR L U
## Well - Fracture 1.130691 0.968255 1.320377
## Well - Death 1.375533 1.169980 1.617199
## Fracture - Death 1.264044 1.050042 1.521661
##
## $copd
## HR L U
## Well - Fracture 0.8531125 0.7033800 1.034719
## Well - Death 1.0747334 0.8876676 1.301221
## Fracture - Death 1.4230568 1.1356212 1.783245
##
## $diabetes.nYes
## HR L U
## Well - Fracture 0.806079 0.5223587 1.243903
## Well - Death 1.707992 1.2361342 2.359967
## Fracture - Death 1.627587 1.0089719 2.625484
##
## $cancer
## HR L U
## Well - Fracture 1.1730291 0.9792579 1.405143
## Well - Death 0.8790734 0.7126930 1.084296
## Fracture - Death 1.0514224 0.8425942 1.312006
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.268334 1.092626 1.472298
## Well - Death 2.851822 2.392556 3.399246
## Fracture - Death 1.881325 1.356102 2.609969
multi.wa3= msm(state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, exacttimes = TRUE,
method = "BFGS", control = list(fnscale = 4000, maxit = 10000), pci = 5, covariates =~ age + fnbmd + fall.yesno
+ fx50 + BMI + smoke + drink + physical + cvd.n + hypertension + copd + diabetes.n + cancer + renal + parkinson
+ depression)
multi.wa3
##
## Call:
## msm(formula = state ~ time2event, subject = ID, data = w.osteoporosis, qmatrix = qmatrix.n, gen.inits = TRUE, covariates = ~age + fnbmd + fall.yesno + fx50 + BMI + smoke + drink + 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.08823 (-0.09367,-0.08310)
## Well - Fracture 0.05140 ( 0.04764, 0.05547) 1.043 (1.028,1.057)
## Well - Death 0.03682 ( 0.03344, 0.04055) 1.076 (1.061,1.092)
## Fracture - Fracture -0.05606 (-0.06772,-0.04641)
## Fracture - Death 0.05606 ( 0.04641, 0.06772) 1.070 (1.054,1.087)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.06756 (0.01242,0.3674) 1.0105 (0.8518,1.199)
## Well - Death 0.31182 (0.04989,1.9491) 1.1410 (0.9564,1.361)
## Fracture - Fracture
## Fracture - Death 0.12067 (0.02044,0.7124) 0.9813 (0.7926,1.215)
## fx50 BMI
## Well - Well
## Well - Fracture 0.9513 (0.8192,1.105) 0.9868 (0.9655,1.0086)
## Well - Death 1.0861 (0.9250,1.275) 0.9510 (0.9288,0.9738)
## Fracture - Fracture
## Fracture - Death 1.0827 (0.9001,1.302) 0.9787 (0.9530,1.0052)
## smoke drink
## Well - Well
## Well - Fracture 1.006 (0.8588,1.178) 0.8703 (0.7468,1.014)
## Well - Death 1.538 (1.3038,1.815) 0.8698 (0.7376,1.026)
## Fracture - Fracture
## Fracture - Death 1.123 (0.9246,1.364) 0.8658 (0.7147,1.049)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.9054 (0.7737,1.0596) 1.1405 (0.9585,1.357)
## Well - Death 0.4366 (0.3690,0.5165) 1.3625 (1.1436,1.623)
## Fracture - Fracture
## Fracture - Death 0.7004 (0.5797,0.8462) 0.9589 (0.7754,1.186)
## hypertension copd
## Well - Well
## Well - Fracture 1.117 (0.9538,1.308) 0.8291 (0.6799,1.011)
## Well - Death 1.368 (1.1600,1.614) 0.9224 (0.7586,1.122)
## Fracture - Fracture
## Fracture - Death 1.218 (1.0060,1.474) 1.3699 (1.0850,1.730)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 0.7397 (0.4738,1.155) 1.195 (0.9960,1.434)
## Well - Death 1.7634 (1.2506,2.486) 0.942 (0.7616,1.165)
## Fracture - Fracture
## Fracture - Death 1.6204 (0.9866,2.661) 1.072 (0.8567,1.341)
## renal parkinson
## Well - Well
## Well - Fracture 1.1493 (0.6756,1.955) 1.9883 (1.0598,3.730)
## Well - Death 0.7298 (0.3773,1.412) 1.2195 (0.5060,2.939)
## Fracture - Fracture
## Fracture - Death 1.2073 (0.6374,2.287) 0.6587 (0.2908,1.492)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.3462 (1.0234,1.771) 1.292 (1.111,1.503)
## Well - Death 1.0452 (0.7637,1.431) 3.165 (2.652,3.777)
## Fracture - Fracture
## Fracture - Death 0.8801 (0.6175,1.254) 1.981 (1.420,2.764)
##
## -2 * log-likelihood: 13558.05
hazard.msm(multi.wa3)
## $age
## HR L U
## Well - Fracture 1.042502 1.027904 1.057308
## Well - Death 1.076397 1.060567 1.092463
## Fracture - Death 1.070267 1.054130 1.086650
##
## $fnbmd
## HR L U
## Well - Fracture 0.06755702 0.01242250 0.3673940
## Well - Death 0.31181680 0.04988510 1.9490734
## Fracture - Death 0.12066547 0.02043911 0.7123674
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.0105398 0.8518271 1.198824
## Well - Death 1.1409635 0.9564012 1.361142
## Fracture - Death 0.9813225 0.7925773 1.215016
##
## $fx50
## HR L U
## Well - Fracture 0.9513184 0.8192151 1.104724
## Well - Death 1.0860815 0.9249994 1.275215
## Fracture - Death 1.0827030 0.9001293 1.302308
##
## $BMI
## HR L U
## Well - Fracture 0.9868248 0.9655400 1.0085790
## Well - Death 0.9510342 0.9288099 0.9737903
## Fracture - Death 0.9787405 0.9529770 1.0052005
##
## $smoke
## HR L U
## Well - Fracture 1.006011 0.8588259 1.178420
## Well - Death 1.538276 1.3037622 1.814974
## Fracture - Death 1.122821 0.9245667 1.363587
##
## $drink
## HR L U
## Well - Fracture 0.8703301 0.7467984 1.014296
## Well - Death 0.8697594 0.7375581 1.025657
## Fracture - Death 0.8658199 0.7147426 1.048831
##
## $physical
## HR L U
## Well - Fracture 0.9054269 0.7737176 1.0595571
## Well - Death 0.4365810 0.3690107 0.5165242
## Fracture - Death 0.7003639 0.5796767 0.8461778
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.1405380 0.9585471 1.357082
## Well - Death 1.3625209 1.1435917 1.623362
## Fracture - Death 0.9588583 0.7753526 1.185795
##
## $hypertension
## HR L U
## Well - Fracture 1.116808 0.9538084 1.307663
## Well - Death 1.368367 1.1600328 1.614118
## Fracture - Death 1.217646 1.0060323 1.473771
##
## $copd
## HR L U
## Well - Fracture 0.8291199 0.6798505 1.011163
## Well - Death 0.9224088 0.7586297 1.121546
## Fracture - Death 1.3699474 1.0850433 1.729660
##
## $diabetes.nYes
## HR L U
## Well - Fracture 0.7397437 0.4738422 1.154859
## Well - Death 1.7633614 1.2506031 2.486355
## Fracture - Death 1.6203928 0.9866289 2.661257
##
## $cancer
## HR L U
## Well - Fracture 1.195178 0.9959564 1.434251
## Well - Death 0.941980 0.7615965 1.165087
## Fracture - Death 1.072026 0.8566901 1.341489
##
## $renal
## HR L U
## Well - Fracture 1.1493453 0.6755898 1.955321
## Well - Death 0.7297847 0.3773059 1.411549
## Fracture - Death 1.2073402 0.6374113 2.286860
##
## $parkinson
## HR L U
## Well - Fracture 1.9883468 1.0598107 3.730405
## Well - Death 1.2194762 0.5060044 2.938951
## Fracture - Death 0.6586598 0.2907782 1.491971
##
## $depression
## HR L U
## Well - Fracture 1.3461950 1.023358 1.770877
## Well - Death 1.0452248 0.763652 1.430619
## Fracture - Death 0.8800612 0.617518 1.254227
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.291972 1.110751 1.502760
## Well - Death 3.165096 2.652129 3.777279
## Fracture - Death 1.981109 1.420022 2.763897