#Low BMD and Mortality Risk- Sub-group analysis for Hip 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_HIPFX_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] 29936 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.04669003 0.003156235 0.04353379
## Fracture 0.00000000 -0.183392936 0.18339294
## Death 0.00000000 0.000000000 0.00000000
statetable.msm(state, ID, data = men)
## to
## from 1 2 3
## 1 2021 227 3131
## 2 0 62 165
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.0276679 (-0.0300400,-0.025483)
## Well - Fracture 0.0008723 ( 0.0005558, 0.001369) 1.114 (1.0532,1.177)
## Well - Death 0.0267956 ( 0.0246451, 0.029134) 1.115 (1.1044,1.126)
## Fracture - Fracture -0.0857168 (-0.2893097,-0.025396)
## Fracture - Death 0.0857168 ( 0.0253962, 0.289310) 1.066 (0.9836,1.156)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.8834 (0.02118, 36.841) 2.8721 (1.2431,6.636)
## Well - Death 0.7266 (0.37759, 1.398) 3.5539 (3.0420,4.152)
## Fracture - Fracture
## Fracture - Death 1.0106 (0.00341,299.480) 0.7886 (0.1173,5.301)
##
## -2 * log-likelihood: 10686.03
hazard.msm(age.m1)
## $age
## HR L U
## Well - Fracture 1.113551 1.0532085 1.177350
## Well - Death 1.115122 1.1043584 1.125990
## Fracture - Death 1.066356 0.9836261 1.156045
##
## $fnbmd
## HR L U
## Well - Fracture 0.8833554 0.021180513 36.841262
## Well - Death 0.7266328 0.377588231 1.398336
## Fracture - Death 1.0105553 0.003409985 299.479885
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.8721157 1.2430514 6.636128
## Well - Death 3.5539080 3.0420415 4.151903
## Fracture - Death 0.7886354 0.1173267 5.300976
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.0266328 (-0.0289580,-0.024494)
## Well - Fracture 0.0006437 ( 0.0003823, 0.001084) 1.110 (1.0477,1.176)
## Well - Death 0.0259892 ( 0.0238762, 0.028289) 1.111 (1.0999,1.122)
## Fracture - Fracture -0.1212711 (-0.4780782,-0.030762)
## Fracture - Death 0.1212711 ( 0.0307621, 0.478078) 1.065 (0.9757,1.163)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.06931 (0.000927, 5.183) 1.7861 (0.9182,3.474)
## Well - Death 0.59003 (0.306909, 1.134) 0.9825 (0.8676,1.113)
## Fracture - Fracture
## Fracture - Death 0.73749 (0.001256,433.145) 1.7258 (0.6345,4.694)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.5057 (0.6605,3.433) 0.8333 (0.3605,1.926)
## Well - Death 0.9874 (0.8382,1.163) 1.4761 (1.2952,1.682)
## Fracture - Fracture
## Fracture - Death 1.9817 (0.6727,5.837) 0.4915 (0.1464,1.649)
## hypertension copd
## Well - Well
## Well - Fracture 4.4641 (2.1528,9.257) 0.5273 (0.1271, 2.188)
## Well - Death 1.3462 (1.2034,1.506) 1.3452 (1.1337, 1.596)
## Fracture - Fracture
## Fracture - Death 0.5063 (0.2032,1.262) 12.3023 (2.3620,64.076)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 0.6377 (0.1932, 2.105) 0.8468 (0.3521,2.036)
## Well - Death 1.5177 (1.2978, 1.775) 1.1292 (0.9800,1.301)
## Fracture - Fracture
## Fracture - Death 11.3722 (2.6914,48.051) 0.6764 (0.1868,2.449)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 2.9659 (1.2896,6.821)
## Well - Death 3.7175 (3.1817,4.344)
## Fracture - Fracture
## Fracture - Death 0.8334 (0.1011,6.866)
##
## -2 * log-likelihood: 10521.97
hazard.msm(multi.me1)
## $age
## HR L U
## Well - Fracture 1.109940 1.0477346 1.175838
## Well - Death 1.110994 1.0998712 1.122229
## Fracture - Death 1.065428 0.9757136 1.163391
##
## $fnbmd
## HR L U
## Well - Fracture 0.06931075 0.0009269506 5.182563
## Well - Death 0.59002889 0.3069092741 1.134322
## Fracture - Death 0.73749446 0.0012556943 433.145304
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.7860845 0.9182036 3.474282
## Well - Death 0.9824877 0.8676425 1.112534
## Fracture - Death 1.7258417 0.6344990 4.694301
##
## $fx50
## HR L U
## Well - Fracture 1.5057273 0.6604833 3.432660
## Well - Death 0.9873559 0.8381997 1.163054
## Fracture - Death 1.9816538 0.6727187 5.837435
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.8332914 0.3605293 1.925987
## Well - Death 1.4760859 1.2952087 1.682223
## Fracture - Death 0.4914557 0.1464320 1.649426
##
## $hypertension
## HR L U
## Well - Fracture 4.4641101 2.1528212 9.256821
## Well - Death 1.3461722 1.2033711 1.505919
## Fracture - Death 0.5063213 0.2032056 1.261586
##
## $copd
## HR L U
## Well - Fracture 0.5273385 0.1270833 2.188217
## Well - Death 1.3452311 1.1337387 1.596176
## Fracture - Death 12.3023303 2.3620021 64.075867
##
## $diabetes.nYes
## HR L U
## Well - Fracture 0.6377094 0.1932343 2.104561
## Well - Death 1.5176762 1.2977809 1.774830
## Fracture - Death 11.3721846 2.6914261 48.051323
##
## $cancer
## HR L U
## Well - Fracture 0.8467648 0.3520943 2.036416
## Well - Death 1.1291715 0.9800007 1.301048
## Fracture - Death 0.6764205 0.1867947 2.449452
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.9658602 1.2896284 6.820822
## Well - Death 3.7175242 3.1816661 4.343632
## Fracture - Death 0.8333508 0.1011473 6.865964
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.0261860 (-0.0284931,-0.024066)
## Well - Fracture 0.0005998 ( 0.0003512, 0.001024) 1.125 (1.0589,1.196)
## Well - Death 0.0255862 ( 0.0234895, 0.027870) 1.107 (1.0956,1.118)
## Fracture - Fracture -0.0906450 (-0.6108298,-0.013451)
## Fracture - Death 0.0906450 ( 0.0134514, 0.610830) 1.098 (0.9501,1.269)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.03008 (3.428e-04, 2.639) 1.7102 (0.8742, 3.346)
## Well - Death 0.56195 (2.888e-01, 1.094) 0.9678 (0.8541, 1.097)
## Fracture - Fracture
## Fracture - Death 0.80190 (4.807e-05,13378.137) 4.7734 (1.2161,18.736)
## fx50 BMI
## Well - Well
## Well - Fracture 1.4419 (0.6274,3.314) 1.069 (0.9826,1.163)
## Well - Death 0.9601 (0.8147,1.131) 1.013 (0.9968,1.029)
## Fracture - Fracture
## Fracture - Death 0.8144 (0.2101,3.157) 1.204 (0.9989,1.452)
## smoke drink
## Well - Well
## Well - Fracture 0.9273 (0.4761, 1.806) 1.002 (0.8019,1.251)
## Well - Death 1.2551 (1.1114, 1.417) 1.001 (0.9633,1.041)
## Fracture - Fracture
## Fracture - Death 5.1807 (1.2527,21.426) 1.044 (0.5870,1.856)
## physical cvd.nYes
## Well - Well
## Well - Fracture 1.0113 (0.5107,2.0026) 0.8254 (0.35479,1.920)
## Well - Death 0.8637 (0.7679,0.9714) 1.5125 (1.32731,1.724)
## Fracture - Fracture
## Fracture - Death 0.2611 (0.0619,1.1013) 0.3182 (0.05712,1.773)
## hypertension copd
## Well - Well
## Well - Fracture 4.07499 (1.948842,8.5207) 0.4964 (0.1184, 2.080)
## Well - Death 1.30354 (1.163643,1.4602) 1.3207 (1.1117, 1.569)
## Fracture - Fracture
## Fracture - Death 0.05234 (0.008308,0.3297) 19.2157 (1.4404,256.346)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 0.5596 (0.1678, 1.866) 0.7934 (0.32729,1.9233)
## Well - Death 1.4933 (1.2724, 1.752) 1.1428 (0.99133,1.3175)
## Fracture - Fracture
## Fracture - Death 16.7544 (1.7091,164.248) 0.1880 (0.03609,0.9789)
## renal parkinson
## Well - Well
## Well - Fracture 0.9140 (0.22673, 3.6845) 1.160 (0.3280, 4.099)
## Well - Death 0.4436 (0.34119, 0.5769) 1.559 (1.2674, 1.917)
## Fracture - Fracture
## Fracture - Death 0.7945 (0.01708,36.9484) 4.811 (0.2666,86.828)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 3.311 (1.1427, 9.594) 2.956 (1.2848, 6.800)
## Well - Death 0.848 (0.6171, 1.165) 3.843 (3.2881, 4.492)
## Fracture - Fracture
## Fracture - Death 3.743 (0.2725,51.412) 1.275 (0.1438,11.299)
##
## -2 * log-likelihood: 10414.64
hazard.msm(multi.ma1)
## $age
## HR L U
## Well - Fracture 1.125432 1.0589119 1.196130
## Well - Death 1.106966 1.0956029 1.118446
## Fracture - Death 1.098215 0.9501214 1.269392
##
## $fnbmd
## HR L U
## Well - Fracture 0.0300773 3.428407e-04 2.638672
## Well - Death 0.5619548 2.887515e-01 1.093650
## Fracture - Death 0.8019031 4.806712e-05 13378.137095
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.7101567 0.8741707 3.345612
## Well - Death 0.9678077 0.8540915 1.096664
## Fracture - Death 4.7733674 1.2161177 18.735880
##
## $fx50
## HR L U
## Well - Fracture 1.4418531 0.6274020 3.313570
## Well - Death 0.9600583 0.8146624 1.131403
## Fracture - Death 0.8144344 0.2101120 3.156903
##
## $BMI
## HR L U
## Well - Fracture 1.069228 0.9826153 1.163475
## Well - Death 1.012613 0.9967869 1.028691
## Fracture - Death 1.204216 0.9989021 1.451731
##
## $smoke
## HR L U
## Well - Fracture 0.9272616 0.4761348 1.805821
## Well - Death 1.2550568 1.1113883 1.417297
## Fracture - Death 5.1807183 1.2526623 21.426239
##
## $drink
## HR L U
## Well - Fracture 1.001732 0.8019306 1.251314
## Well - Death 1.001246 0.9632639 1.040726
## Fracture - Death 1.043699 0.5870354 1.855609
##
## $physical
## HR L U
## Well - Fracture 1.0113007 0.5107050 2.0025829
## Well - Death 0.8636745 0.7678565 0.9714492
## Fracture - Death 0.2610937 0.0619006 1.1012803
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.8254468 0.35478717 1.920482
## Well - Death 1.5125447 1.32731326 1.723626
## Fracture - Death 0.3182106 0.05711902 1.772754
##
## $hypertension
## HR L U
## Well - Fracture 4.0749885 1.948841532 8.5207191
## Well - Death 1.3035366 1.163642953 1.4602483
## Fracture - Death 0.0523371 0.008308044 0.3297012
##
## $copd
## HR L U
## Well - Fracture 0.4963839 0.1184481 2.080210
## Well - Death 1.3207092 1.1117078 1.569003
## Fracture - Death 19.2157384 1.4404177 256.345502
##
## $diabetes.nYes
## HR L U
## Well - Fracture 0.5596422 0.1678439 1.866016
## Well - Death 1.4932820 1.2724491 1.752440
## Fracture - Death 16.7543775 1.7090609 164.247608
##
## $cancer
## HR L U
## Well - Fracture 0.7933972 0.32729103 1.9233011
## Well - Death 1.1428449 0.99132814 1.3175199
## Fracture - Death 0.1879525 0.03608793 0.9788913
##
## $renal
## HR L U
## Well - Fracture 0.9139935 0.22673017 3.6844860
## Well - Death 0.4436417 0.34118972 0.5768578
## Fracture - Death 0.7944612 0.01708245 36.9483600
##
## $parkinson
## HR L U
## Well - Fracture 1.159629 0.3280345 4.099381
## Well - Death 1.558861 1.2674238 1.917312
## Fracture - Death 4.811002 0.2665705 86.827855
##
## $depression
## HR L U
## Well - Fracture 3.311084 1.1426693 9.594444
## Well - Death 0.847973 0.6171165 1.165190
## Fracture - Death 3.743077 0.2725189 51.411584
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.955885 1.2848276 6.800336
## Well - Death 3.843276 3.2880880 4.492206
## Fracture - Death 1.274629 0.1437893 11.299031
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.035406 (-0.037767,-0.033193)
## Well - Fracture 0.002668 ( 0.002118, 0.003362) 1.107 (1.077,1.138)
## Well - Death 0.032738 ( 0.030610, 0.035014) 1.117 (1.108,1.126)
## Fracture - Fracture -0.119344 (-0.188071,-0.075732)
## Fracture - Death 0.119344 ( 0.075732, 0.188071) 1.063 (1.029,1.098)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.0002119 (1.062e-05,4.228e-03) 2.8433 (1.8893,4.279)
## Well - Death 0.8547494 (3.562e-01,2.051e+00) 3.3244 (2.9329,3.768)
## Fracture - Fracture
## Fracture - Death 4.5339703 (1.298e-01,1.584e+02) 0.7614 (0.4083,1.420)
##
## -2 * log-likelihood: 15317.97
hazard.msm(age.m2)
## $age
## HR L U
## Well - Fracture 1.107069 1.077308 1.137652
## Well - Death 1.117171 1.108240 1.126173
## Fracture - Death 1.062755 1.028636 1.098006
##
## $fnbmd
## HR L U
## Well - Fracture 0.0002118728 0.0000106165 4.228331e-03
## Well - Death 0.8547493569 0.3561664920 2.051278e+00
## Fracture - Death 4.5339703456 0.1297903315 1.583854e+02
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.8432606 1.8892678 4.278975
## Well - Death 3.3244433 2.9329025 3.768254
## Fracture - Death 0.7613921 0.4083114 1.419794
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.034634 (-0.036973,-0.032442)
## Well - Fracture 0.002474 ( 0.001946, 0.003145) 1.100 (1.070,1.132)
## Well - Death 0.032160 ( 0.030048, 0.034420) 1.112 (1.103,1.121)
## Fracture - Fracture -0.137540 (-0.224581,-0.084234)
## Fracture - Death 0.137540 ( 0.084234, 0.224581) 1.057 (1.022,1.094)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 8.141e-05 (4.087e-06,1.621e-03) 1.3816 (0.9810,1.9458)
## Well - Death 6.833e-01 (2.839e-01,1.645e+00) 0.8964 (0.8052,0.9979)
## Fracture - Fracture
## Fracture - Death 5.033e+00 (1.319e-01,1.920e+02) 1.0745 (0.6896,1.6744)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.0134 (0.6792,1.512) 1.709 (1.1908,2.452)
## Well - Death 1.0950 (0.9743,1.231) 1.447 (1.2962,1.616)
## Fracture - Fracture
## Fracture - Death 0.7122 (0.4240,1.196) 1.012 (0.6541,1.566)
## hypertension copd
## Well - Well
## Well - Fracture 1.428 (1.0245,1.990) 0.9549 (0.5555,1.641)
## Well - Death 1.104 (1.0006,1.217) 1.3675 (1.1832,1.580)
## Fracture - Fracture
## Fracture - Death 1.238 (0.8227,1.863) 2.3489 (1.2113,4.555)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.7761 (1.0544,2.992) 0.8303 (0.5361,1.286)
## Well - Death 1.5213 (1.2956,1.786) 1.1827 (1.0526,1.329)
## Fracture - Fracture
## Fracture - Death 0.8408 (0.4283,1.650) 0.9306 (0.5539,1.563)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 3.0147 (2.0005,4.543)
## Well - Death 3.4619 (3.0532,3.925)
## Fracture - Fracture
## Fracture - Death 0.6294 (0.3273,1.211)
##
## -2 * log-likelihood: 15176.23
hazard.msm(multi.me2)
## $age
## HR L U
## Well - Fracture 1.100180 1.069518 1.131721
## Well - Death 1.112106 1.102909 1.121380
## Fracture - Death 1.057377 1.021942 1.094041
##
## $fnbmd
## HR L U
## Well - Fracture 8.140531e-05 4.087321e-06 1.621313e-03
## Well - Death 6.832977e-01 2.838974e-01 1.644594e+00
## Fracture - Death 5.032950e+00 1.319449e-01 1.919785e+02
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.3816369 0.9810438 1.9458057
## Well - Death 0.8963798 0.8052194 0.9978605
## Fracture - Death 1.0745497 0.6896056 1.6743729
##
## $fx50
## HR L U
## Well - Fracture 1.0134487 0.6792233 1.512136
## Well - Death 1.0949818 0.9743146 1.230594
## Fracture - Death 0.7122155 0.4240106 1.196316
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.708785 1.1908438 2.451998
## Well - Death 1.447412 1.2961896 1.616277
## Fracture - Death 1.012190 0.6541104 1.566294
##
## $hypertension
## HR L U
## Well - Fracture 1.427822 1.0244703 1.989981
## Well - Death 1.103512 1.0006468 1.216952
## Fracture - Death 1.237860 0.8226948 1.862536
##
## $copd
## HR L U
## Well - Fracture 0.9548638 0.5554918 1.641365
## Well - Death 1.3675169 1.1832414 1.580491
## Fracture - Death 2.3488684 1.2113214 4.554681
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.7760900 1.0544188 2.991691
## Well - Death 1.5212848 1.2956425 1.786224
## Fracture - Death 0.8408041 0.4283392 1.650448
##
## $cancer
## HR L U
## Well - Fracture 0.8303394 0.5361098 1.286049
## Well - Death 1.1827156 1.0526291 1.328879
## Fracture - Death 0.9305928 0.5538937 1.563482
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 3.0147397 2.0005271 4.543130
## Well - Death 3.4619114 3.0531756 3.925366
## Fracture - Death 0.6294272 0.3272522 1.210622
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.033942 (-0.036264,-0.031768)
## Well - Fracture 0.002414 ( 0.001893, 0.003077) 1.094 (1.062,1.126)
## Well - Death 0.031528 ( 0.029433, 0.033773) 1.110 (1.101,1.120)
## Fracture - Fracture -0.131540 (-0.215189,-0.080407)
## Fracture - Death 0.131540 ( 0.080407, 0.215189) 1.050 (1.014,1.088)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 8.076e-05 (3.854e-06,1.692e-03) 1.4337 (1.0177,2.020)
## Well - Death 6.698e-01 (2.743e-01,1.635e+00) 0.8897 (0.7987,0.991)
## Fracture - Fracture
## Fracture - Death 1.051e+01 (1.633e-01,6.759e+02) 1.2133 (0.7546,1.951)
## fx50 BMI
## Well - Well
## Well - Fracture 1.011 (0.6768,1.510) 1.0019 (0.9510,1.056)
## Well - Death 1.108 (0.9858,1.245) 1.0181 (1.0031,1.033)
## Fracture - Fracture
## Fracture - Death 0.693 (0.4042,1.188) 0.9855 (0.9236,1.052)
## smoke drink
## Well - Well
## Well - Fracture 0.9478 (0.6773,1.327) 0.9012 (0.7977,1.018)
## Well - Death 1.2558 (1.1349,1.389) 0.9878 (0.9549,1.022)
## Fracture - Fracture
## Fracture - Death 0.8719 (0.5606,1.356) 0.9166 (0.7893,1.064)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.8558 (0.6077,1.205) 1.6486 (1.1445,2.375)
## Well - Death 0.8478 (0.7664,0.938) 1.4007 (1.2531,1.566)
## Fracture - Fracture
## Fracture - Death 0.7632 (0.4977,1.170) 0.9826 (0.6246,1.546)
## hypertension copd
## Well - Well
## Well - Fracture 1.408 (1.0032,1.976) 0.9701 (0.5656,1.664)
## Well - Death 1.054 (0.9541,1.164) 1.2845 (1.1097,1.487)
## Fracture - Fracture
## Fracture - Death 1.199 (0.7556,1.903) 2.1907 (1.1149,4.305)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.7280 (1.0238,2.916) 0.8400 (0.5411,1.304)
## Well - Death 1.4398 (1.2242,1.693) 1.1582 (1.0304,1.302)
## Fracture - Fracture
## Fracture - Death 0.8377 (0.4204,1.669) 0.9358 (0.5489,1.596)
## renal parkinson
## Well - Well
## Well - Fracture 0.7377 (0.3799,1.4325) 1.372 (0.7863,2.392)
## Well - Death 0.4415 (0.3552,0.5487) 1.617 (1.3722,1.904)
## Fracture - Fracture
## Fracture - Death 0.8961 (0.3570,2.2489) 1.088 (0.5228,2.263)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.4652 (0.14667,1.476) 3.0583 (2.0280,4.612)
## Well - Death 0.9865 (0.77312,1.259) 3.6368 (3.2052,4.127)
## Fracture - Fracture
## Fracture - Death 0.3227 (0.04439,2.345) 0.7144 (0.3643,1.401)
##
## -2 * log-likelihood: 15043.97
hazard.msm(multi.ma2)
## $age
## HR L U
## Well - Fracture 1.093664 1.062146 1.126117
## Well - Death 1.110308 1.100781 1.119917
## Fracture - Death 1.050250 1.013834 1.087974
##
## $fnbmd
## HR L U
## Well - Fracture 8.075669e-05 3.853954e-06 1.692195e-03
## Well - Death 6.697570e-01 2.743019e-01 1.635331e+00
## Fracture - Death 1.050556e+01 1.632849e-01 6.759154e+02
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.4337361 1.0176927 2.0198624
## Well - Death 0.8896517 0.7987031 0.9909567
## Fracture - Death 1.2133215 0.7545502 1.9510289
##
## $fx50
## HR L U
## Well - Fracture 1.0108201 0.6767591 1.509780
## Well - Death 1.1079642 0.9858023 1.245265
## Fracture - Death 0.6929824 0.4041758 1.188158
##
## $BMI
## HR L U
## Well - Fracture 1.0019120 0.9509699 1.055583
## Well - Death 1.0180846 1.0030512 1.033343
## Fracture - Death 0.9854844 0.9235865 1.051531
##
## $smoke
## HR L U
## Well - Fracture 0.9478454 0.6772511 1.326555
## Well - Death 1.2557811 1.1349338 1.389496
## Fracture - Death 0.8718665 0.5606000 1.355960
##
## $drink
## HR L U
## Well - Fracture 0.9012399 0.7977482 1.018157
## Well - Death 0.9877874 0.9549120 1.021795
## Fracture - Death 0.9165591 0.7892971 1.064340
##
## $physical
## HR L U
## Well - Fracture 0.8558053 0.6076863 1.2052314
## Well - Death 0.8478478 0.7663740 0.9379831
## Fracture - Death 0.7631817 0.4977229 1.1702219
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.6485735 1.1444794 2.374699
## Well - Death 1.4007320 1.2530542 1.565814
## Fracture - Death 0.9825558 0.6246301 1.545580
##
## $hypertension
## HR L U
## Well - Fracture 1.407880 1.0031534 1.975895
## Well - Death 1.053895 0.9541259 1.164096
## Fracture - Death 1.199144 0.7556497 1.902927
##
## $copd
## HR L U
## Well - Fracture 0.9700916 0.5656276 1.663776
## Well - Death 1.2845287 1.1097145 1.486882
## Fracture - Death 2.1906831 1.1148736 4.304607
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.7279571 1.0237779 2.916488
## Well - Death 1.4398211 1.2242411 1.693363
## Fracture - Death 0.8376683 0.4203992 1.669100
##
## $cancer
## HR L U
## Well - Fracture 0.8399906 0.5410824 1.304024
## Well - Death 1.1581977 1.0304186 1.301822
## Fracture - Death 0.9358492 0.5488922 1.595603
##
## $renal
## HR L U
## Well - Fracture 0.7377000 0.3799060 1.4324630
## Well - Death 0.4415182 0.3552498 0.5487359
## Fracture - Death 0.8960824 0.3570449 2.2489151
##
## $parkinson
## HR L U
## Well - Fracture 1.371561 0.7863145 2.392402
## Well - Death 1.616531 1.3721636 1.904419
## Fracture - Death 1.087737 0.5228481 2.262936
##
## $depression
## HR L U
## Well - Fracture 0.4652175 0.14666868 1.475621
## Well - Death 0.9864729 0.77311889 1.258705
## Fracture - Death 0.3226693 0.04438948 2.345499
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 3.058321 2.0280080 4.612076
## Well - Death 3.636841 3.2051929 4.126619
## Fracture - Death 0.714420 0.3643155 1.400972
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.06776 (-0.07995,-0.05742)
## Well - Fracture 0.01694 ( 0.01245, 0.02305) 1.104 (1.048,1.163)
## Well - Death 0.05082 ( 0.04180, 0.06178) 1.108 (1.078,1.138)
## Fracture - Fracture -0.12169 (-0.23943,-0.06185)
## Fracture - Death 0.12169 ( 0.06185, 0.23943) 1.098 (1.027,1.174)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.05124 (1.895e-05,138.50) 0.9705 (0.5316,1.772)
## Well - Death 6.37299 (4.869e-02,834.24) 3.2166 (2.2352,4.629)
## Fracture - Fracture
## Fracture - Death 0.04202 (2.157e-05, 81.86) 0.8041 (0.3468,1.864)
##
## -2 * log-likelihood: 1771.779
hazard.msm(age.m3)
## $age
## HR L U
## Well - Fracture 1.104362 1.048434 1.163274
## Well - Death 1.107659 1.078283 1.137836
## Fracture - Death 1.097885 1.027070 1.173583
##
## $fnbmd
## HR L U
## Well - Fracture 0.05123568 1.895374e-05 138.50010
## Well - Death 6.37298962 4.868530e-02 834.23530
## Fracture - Death 0.04201946 2.156993e-05 81.85631
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 0.9705391 0.5315694 1.772010
## Well - Death 3.2165987 2.2351776 4.628942
## Fracture - Death 0.8040699 0.3468088 1.864222
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.06543 (-0.07759,-0.05518)
## Well - Fracture 0.01657 ( 0.01209, 0.02273) 1.102 (1.043,1.163)
## Well - Death 0.04886 ( 0.03994, 0.05977) 1.104 (1.074,1.136)
## Fracture - Fracture -0.06821 (-0.16363,-0.02843)
## Fracture - Death 0.06821 ( 0.02843, 0.16363) 1.163 (1.073,1.261)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.017610 (6.142e-06, 50.49) 1.2266 (0.6451,2.332)
## Well - Death 8.537102 (5.243e-02,1390.18) 0.6972 (0.4852,1.002)
## Fracture - Fracture
## Fracture - Death 0.008924 (2.899e-06, 27.47) 1.1116 (0.3564,3.467)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.221 (0.6382,2.336) 0.9273 (0.4237,2.029)
## Well - Death 1.067 (0.7547,1.509) 1.6078 (1.1180,2.312)
## Fracture - Fracture
## Fracture - Death 0.634 (0.2582,1.557) 1.7790 (0.6205,5.100)
## hypertension copd
## Well - Well
## Well - Fracture 1.391 (0.7476,2.589) 1.554 (0.6929,3.487)
## Well - Death 1.362 (0.9900,1.872) 1.403 (0.9092,2.165)
## Fracture - Fracture
## Fracture - Death 1.940 (0.7658,4.917) 3.598 (1.3964,9.270)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.809 (0.6308, 5.188) 0.9437 (0.4553,1.956)
## Well - Death 1.815 (1.0332, 3.188) 1.2868 (0.8920,1.856)
## Fracture - Fracture
## Fracture - Death 2.950 (0.7312,11.905) 0.4867 (0.1717,1.380)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.022 (0.5559,1.878)
## Well - Death 3.576 (2.4723,5.172)
## Fracture - Fracture
## Fracture - Death 1.469 (0.5309,4.064)
##
## -2 * log-likelihood: 1734.78
hazard.msm(multi.me3)
## $age
## HR L U
## Well - Fracture 1.101502 1.043104 1.163170
## Well - Death 1.104375 1.073709 1.135917
## Fracture - Death 1.163071 1.072559 1.261222
##
## $fnbmd
## HR L U
## Well - Fracture 0.017610401 6.142237e-06 50.49076
## Well - Death 8.537101534 5.242624e-02 1390.18367
## Fracture - Death 0.008923578 2.898802e-06 27.47005
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.2265780 0.6451286 2.332083
## Well - Death 0.6972492 0.4851966 1.001978
## Fracture - Death 1.1115656 0.3564232 3.466605
##
## $fx50
## HR L U
## Well - Fracture 1.2211406 0.6382254 2.336454
## Well - Death 1.0672538 0.7547119 1.509226
## Fracture - Death 0.6340009 0.2581906 1.556823
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.9273372 0.4237292 2.029490
## Well - Death 1.6077841 1.1179742 2.312191
## Fracture - Death 1.7790189 0.6205458 5.100201
##
## $hypertension
## HR L U
## Well - Fracture 1.391316 0.7476195 2.589230
## Well - Death 1.361511 0.9900288 1.872383
## Fracture - Death 1.940448 0.7658072 4.916824
##
## $copd
## HR L U
## Well - Fracture 1.554268 0.6928697 3.486586
## Well - Death 1.402918 0.9091531 2.164849
## Fracture - Death 3.597889 1.3964330 9.269907
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.809055 0.6307744 5.188353
## Well - Death 1.814790 1.0331772 3.187705
## Fracture - Death 2.950441 0.7311884 11.905419
##
## $cancer
## HR L U
## Well - Fracture 0.9436910 0.4553282 1.955848
## Well - Death 1.2868040 0.8920091 1.856331
## Fracture - Death 0.4867447 0.1717368 1.379555
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.021761 0.5558765 1.878109
## Well - Death 3.575934 2.4723019 5.172225
## Fracture - Death 1.468805 0.5308672 4.063893
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.06247 (-0.07468,-0.05226)
## Well - Fracture 0.01508 ( 0.01065, 0.02136) 1.132 (1.066,1.202)
## Well - Death 0.04739 ( 0.03851, 0.05832) 1.113 (1.079,1.147)
## Fracture - Fracture -0.07478 (-0.19356,-0.02889)
## Fracture - Death 0.07478 ( 0.02889, 0.19356) 1.141 (1.043,1.247)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.005766 (1.324e-06, 25.11) 1.3740 (0.7076, 2.668)
## Well - Death 6.106992 (3.050e-02,1222.79) 0.7304 (0.5073, 1.052)
## Fracture - Fracture
## Fracture - Death 0.029591 (4.443e-06, 197.10) 2.3990 (0.5233,10.997)
## fx50 BMI
## Well - Well
## Well - Fracture 1.2233 (0.6178,2.422) 1.0499 (0.9515,1.159)
## Well - Death 1.0861 (0.7589,1.554) 0.9816 (0.9311,1.035)
## Fracture - Fracture
## Fracture - Death 0.7243 (0.1989,2.638) 0.8809 (0.7076,1.097)
## smoke drink
## Well - Well
## Well - Fracture 2.374 (1.1385,4.951) 0.8511 (0.6673,1.086)
## Well - Death 1.121 (0.7980,1.575) 1.0389 (0.9245,1.167)
## Fracture - Fracture
## Fracture - Death 1.873 (0.4898,7.162) 0.7662 (0.5216,1.125)
## physical cvd.nYes
## Well - Well
## Well - Fracture 1.6838 (0.85084,3.3322) 0.7433 (0.3290,1.679)
## Well - Death 1.1820 (0.84727,1.6489) 1.8469 (1.2590,2.709)
## Fracture - Fracture
## Fracture - Death 0.3049 (0.09535,0.9752) 1.7633 (0.5417,5.739)
## hypertension copd
## Well - Well
## Well - Fracture 1.2387 (0.6376,2.406) 1.630 (0.6963,3.818)
## Well - Death 1.4925 (1.0732,2.076) 1.317 (0.8405,2.064)
## Fracture - Fracture
## Fracture - Death 0.9785 (0.3060,3.129) 3.520 (1.2465,9.940)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.829 (0.6255, 5.349) 1.0192 (0.4749,2.187)
## Well - Death 1.828 (1.0269, 3.253) 1.2467 (0.8562,1.815)
## Fracture - Fracture
## Fracture - Death 4.018 (0.6838,23.613) 0.5277 (0.1579,1.763)
## renal parkinson
## Well - Well
## Well - Fracture 0.4698 (0.1364,1.6187) 2.0723 (0.7795,5.509)
## Well - Death 0.3783 (0.1941,0.7372) 1.7944 (1.1292,2.852)
## Fracture - Fracture
## Fracture - Death 0.8253 (0.1247,5.4632) 0.6312 (0.1411,2.824)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 2.3751 (0.7879,7.159) 1.111 (0.5980,2.063)
## Well - Death 0.4836 (0.2034,1.150) 4.003 (2.7482,5.832)
## Fracture - Fracture
## Fracture - Death 1.2129 (0.3078,4.780) 2.013 (0.6064,6.682)
##
## -2 * log-likelihood: 1692.986
hazard.msm(multi.ma3)
## $age
## HR L U
## Well - Fracture 1.131591 1.065580 1.201690
## Well - Death 1.112737 1.079451 1.147049
## Fracture - Death 1.140722 1.043494 1.247010
##
## $fnbmd
## HR L U
## Well - Fracture 0.005766459 1.324306e-06 25.10904
## Well - Death 6.106992004 3.050030e-02 1222.78646
## Fracture - Death 0.029591133 4.442501e-06 197.10410
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.3740084 0.7076070 2.668005
## Well - Death 0.7304307 0.5073384 1.051624
## Fracture - Death 2.3989716 0.5233398 10.996803
##
## $fx50
## HR L U
## Well - Fracture 1.2233210 0.6178337 2.422196
## Well - Death 1.0861102 0.7589155 1.554370
## Fracture - Death 0.7242697 0.1988619 2.637844
##
## $BMI
## HR L U
## Well - Fracture 1.0499292 0.9515079 1.158531
## Well - Death 0.9816339 0.9311165 1.034892
## Fracture - Death 0.8809087 0.7076139 1.096643
##
## $smoke
## HR L U
## Well - Fracture 2.374224 1.1385486 4.950987
## Well - Death 1.121139 0.7980268 1.575077
## Fracture - Death 1.872884 0.4897954 7.161553
##
## $drink
## HR L U
## Well - Fracture 0.8511372 0.6672674 1.085674
## Well - Death 1.0388725 0.9244607 1.167444
## Fracture - Death 0.7661503 0.5215708 1.125420
##
## $physical
## HR L U
## Well - Fracture 1.6837970 0.85083668 3.3322169
## Well - Death 1.1819884 0.84726780 1.6489432
## Fracture - Death 0.3049312 0.09535154 0.9751601
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.7433411 0.3290340 1.679328
## Well - Death 1.8469464 1.2590327 2.709390
## Fracture - Death 1.7632558 0.5417026 5.739443
##
## $hypertension
## HR L U
## Well - Fracture 1.2386539 0.6375617 2.406455
## Well - Death 1.4924921 1.0732098 2.075580
## Fracture - Death 0.9785125 0.3060132 3.128907
##
## $copd
## HR L U
## Well - Fracture 1.630400 0.6962608 3.817828
## Well - Death 1.317072 0.8404661 2.063948
## Fracture - Death 3.520011 1.2465248 9.940015
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.829123 0.6254901 5.348914
## Well - Death 1.827868 1.0269416 3.253448
## Fracture - Death 4.018340 0.6838337 23.612547
##
## $cancer
## HR L U
## Well - Fracture 1.0191801 0.4749175 2.187176
## Well - Death 1.2466510 0.8562353 1.815084
## Fracture - Death 0.5276542 0.1579168 1.763074
##
## $renal
## HR L U
## Well - Fracture 0.4698122 0.1363580 1.6187065
## Well - Death 0.3782503 0.1940759 0.7372025
## Fracture - Death 0.8252581 0.1246616 5.4631966
##
## $parkinson
## HR L U
## Well - Fracture 2.0723314 0.7795243 5.509203
## Well - Death 1.7944486 1.1291640 2.851708
## Fracture - Death 0.6311636 0.1410526 2.824248
##
## $depression
## HR L U
## Well - Fracture 2.3750733 0.7879412 7.159129
## Well - Death 0.4836322 0.2034167 1.149857
## Fracture - Death 1.2129413 0.3077930 4.779922
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.110776 0.5980438 2.063097
## Well - Death 4.003445 2.7481904 5.832046
## Fracture - Death 2.012880 0.6063711 6.681859
#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)
qmatrix.n
## Well Fracture Death
## Well -0.04879279 0.007182461 0.04161033
## Fracture 0.00000000 -0.143403582 0.14340358
## Death 0.00000000 0.000000000 0.00000000
statetable.msm(state, ID, data = women)
## to
## from 1 2 3
## 1 3153 779 4513
## 2 0 251 528
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)
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.024930 (-0.0278062,-0.022352)
## Well - Fracture 0.001465 ( 0.0009103, 0.002358) 1.056 (0.9932,1.123)
## Well - Death 0.023465 ( 0.0209761, 0.026249) 1.100 (1.0830,1.117)
## Fracture - Fracture -0.180527 (-0.3962579,-0.082245)
## Fracture - Death 0.180527 ( 0.0822446, 0.396258) 1.090 (1.0248,1.159)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.009225 (8.637e-05, 0.9852) 5.654 (2.25188,14.1942)
## Well - Death 1.543087 (5.831e-01, 4.0835) 4.284 (3.44389, 5.3288)
## Fracture - Fracture
## Fracture - Death 0.246722 (1.083e-03,56.2184) 0.167 (0.04751, 0.5868)
##
## -2 * log-likelihood: 7412.435
hazard.msm(age.w1)
## $age
## HR L U
## Well - Fracture 1.056019 0.993185 1.122828
## Well - Death 1.099605 1.082965 1.116502
## Fracture - Death 1.089740 1.024793 1.158802
##
## $fnbmd
## HR L U
## Well - Fracture 0.009224716 8.637394e-05 0.9851975
## Well - Death 1.543087141 5.831122e-01 4.0834648
## Fracture - Death 0.246721692 1.082770e-03 56.2184164
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 5.6536283 2.25187704 14.1941643
## Well - Death 4.2838969 3.44388964 5.3287923
## Fracture - Death 0.1669778 0.04751245 0.5868271
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)
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.024103 (-0.0269208,-0.021580)
## Well - Fracture 0.001288 ( 0.0007849, 0.002113) 1.052 (0.9871,1.121)
## Well - Death 0.022815 ( 0.0203684, 0.025555) 1.092 (1.0746,1.109)
## Fracture - Fracture -0.187852 (-0.5603295,-0.062978)
## Fracture - Death 0.187852 ( 0.0629781, 0.560329) 1.065 (0.9903,1.145)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.002419 (1.805e-05, 0.3244) 1.250 (0.7180,2.174)
## Well - Death 1.246411 (4.631e-01, 3.3549) 1.050 (0.9015,1.222)
## Fracture - Fracture
## Fracture - Death 0.625270 (7.301e-04,535.5134) 1.896 (0.8869,4.055)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 1.0618 (0.5936,1.899) 0.8665 (0.4434,1.693)
## Well - Death 1.1997 (1.0293,1.398) 1.4476 (1.2375,1.693)
## Fracture - Fracture
## Fracture - Death 0.7085 (0.2974,1.688) 2.1207 (0.8027,5.603)
## hypertension copd
## Well - Well
## Well - Fracture 1.2726 (0.7480,2.165) 0.4565 (0.1814,1.149)
## Well - Death 1.2844 (1.1140,1.481) 1.0679 (0.8916,1.279)
## Fracture - Fracture
## Fracture - Death 0.9624 (0.3992,2.320) 1.6620 (0.3481,7.935)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 3.171 (1.619,6.210) 1.675 (0.9360,2.999)
## Well - Death 1.748 (1.413,2.163) 1.038 (0.8744,1.232)
## Fracture - Fracture
## Fracture - Death 2.910 (1.252,6.764) 1.706 (0.7813,3.725)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 5.9511 (2.3700,14.943)
## Well - Death 4.4561 (3.5814, 5.544)
## Fracture - Fracture
## Fracture - Death 0.2506 (0.0427, 1.470)
##
## -2 * log-likelihood: 7314.185
hazard.msm(multi.we1)
## $age
## HR L U
## Well - Fracture 1.051853 0.9870560 1.120905
## Well - Death 1.091731 1.0746477 1.109085
## Fracture - Death 1.064669 0.9903288 1.144589
##
## $fnbmd
## HR L U
## Well - Fracture 0.002419473 1.804606e-05 0.324384
## Well - Death 1.246410717 4.630720e-01 3.354855
## Fracture - Death 0.625270108 7.300708e-04 535.513430
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.249535 0.7180335 2.174463
## Well - Death 1.049575 0.9015034 1.221968
## Fracture - Death 1.896413 0.8868822 4.055083
##
## $fx50
## HR L U
## Well - Fracture 1.0617763 0.5936089 1.899178
## Well - Death 1.1997399 1.0293296 1.398362
## Fracture - Death 0.7084774 0.2974391 1.687539
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.8664593 0.4433649 1.693304
## Well - Death 1.4476068 1.2375164 1.693364
## Fracture - Death 2.1206685 0.8026851 5.602739
##
## $hypertension
## HR L U
## Well - Fracture 1.2725948 0.7480103 2.165074
## Well - Death 1.2843777 1.1139634 1.480862
## Fracture - Death 0.9624435 0.3992096 2.320329
##
## $copd
## HR L U
## Well - Fracture 0.4564748 0.1813505 1.148986
## Well - Death 1.0678902 0.8916348 1.278987
## Fracture - Death 1.6620068 0.3480949 7.935383
##
## $diabetes.nYes
## HR L U
## Well - Fracture 3.170824 1.619084 6.209762
## Well - Death 1.747887 1.412708 2.162590
## Fracture - Death 2.909758 1.251656 6.764393
##
## $cancer
## HR L U
## Well - Fracture 1.675393 0.9360250 2.998790
## Well - Death 1.038065 0.8744101 1.232351
## Fracture - Death 1.705913 0.7812937 3.724768
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 5.9510616 2.36997513 14.943252
## Well - Death 4.4560717 3.58138238 5.544388
## Fracture - Death 0.2505635 0.04270374 1.470177
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(state ~ time2event, subject = ID, data = w.normal, qmatrix =
## qmatrix.n, : Optimisation has probably not converged to the maximum likelihood -
## Hessian is not positive definite.
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))
##
## Optimisation probably not converged to the maximum likelihood.
## optim() reported convergence but estimated Hessian not positive-definite.
##
## -2 * log-likelihood: 7072.293
hazard.msm(multi.wa1)
## $age
## HR
## Well - Fracture 1.019729
## Well - Death 1.088401
## Fracture - Death 1.081400
##
## $fnbmd
## HR
## Well - Fracture 0.00157367
## Well - Death 1.17700422
## Fracture - Death 0.19394335
##
## $fall.yesnoYes
## HR
## Well - Fracture 1.083429
## Well - Death 1.071895
## Fracture - Death 1.325434
##
## $fx50
## HR
## Well - Fracture 1.125293
## Well - Death 1.177046
## Fracture - Death 1.447163
##
## $BMI
## HR
## Well - Fracture 0.9388954
## Well - Death 0.9981658
## Fracture - Death 0.8778585
##
## $smoke
## HR
## Well - Fracture 0.5855884
## Well - Death 1.2408398
## Fracture - Death 1.5862647
##
## $drink
## HR
## Well - Fracture 1.0143968
## Well - Death 0.8666315
## Fracture - Death 1.9200000
##
## $physical
## HR
## Well - Fracture 0.5328116
## Well - Death 0.6785694
## Fracture - Death 0.3154436
##
## $cvd.nYes
## HR
## Well - Fracture 0.8013177
## Well - Death 1.3865347
## Fracture - Death 0.8719159
##
## $hypertension
## HR
## Well - Fracture 1.3157898
## Well - Death 1.2743339
## Fracture - Death 0.9894255
##
## $copd
## HR
## Well - Fracture 0.4354887
## Well - Death 1.0049365
## Fracture - Death 4.7762432
##
## $diabetes.nYes
## HR
## Well - Fracture 3.643828
## Well - Death 1.524614
## Fracture - Death 3.579977
##
## $cancer
## HR
## Well - Fracture 1.727676
## Well - Death 1.078745
## Fracture - Death 1.324013
##
## $renal
## HR
## Well - Fracture 0.1003066
## Well - Death 1.7668631
## Fracture - Death 1.0149574
##
## $parkinson
## HR
## Well - Fracture 6.3300502
## Well - Death 0.8959109
## Fracture - Death 1.0719702
##
## $depression
## HR
## Well - Fracture 0.6247572
## Well - Death 0.9439663
## Fracture - Death 1.5656684
##
## $`timeperiod[5,Inf)`
## HR
## Well - Fracture 7.2127397
## Well - Death 4.6566511
## Fracture - Death 0.9701404
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)
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.034201 (-0.035959,-0.032529)
## Well - Fracture 0.004946 ( 0.004356, 0.005617) 1.085 (1.065,1.107)
## Well - Death 0.029255 ( 0.027703, 0.030894) 1.107 (1.099,1.115)
## Fracture - Fracture -0.064421 (-0.091081,-0.045564)
## Fracture - Death 0.064421 ( 0.045564, 0.091081) 1.073 (1.050,1.095)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.005016 (0.0006742, 0.03731) 2.769 (2.1658,3.540)
## Well - Death 0.837563 (0.3886997, 1.80476) 3.750 (3.3721,4.171)
## Fracture - Fracture
## Fracture - Death 2.431218 (0.1836711,32.18156) 1.498 (0.8458,2.653)
##
## -2 * log-likelihood: 28048.05
hazard.msm(age.w2)
## $age
## HR L U
## Well - Fracture 1.085399 1.064508 1.106700
## Well - Death 1.107027 1.098787 1.115329
## Fracture - Death 1.072510 1.050053 1.095447
##
## $fnbmd
## HR L U
## Well - Fracture 0.005015578 0.0006742485 0.03730972
## Well - Death 0.837562892 0.3886997215 1.80476486
## Fracture - Death 2.431217960 0.1836710566 32.18155806
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.768868 2.1658079 3.539848
## Well - Death 3.750348 3.3721468 4.170967
## Fracture - Death 1.497859 0.8457609 2.652736
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)
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.033501 (-0.035241,-0.031847)
## Well - Fracture 0.004914 ( 0.004326, 0.005584) 1.082 (1.060,1.103)
## Well - Death 0.028587 ( 0.027053, 0.030207) 1.100 (1.091,1.108)
## Fracture - Fracture -0.064137 (-0.090375,-0.045516)
## Fracture - Death 0.064137 ( 0.045516, 0.090375) 1.072 (1.049,1.095)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.003596 (0.0004781, 0.02704) 1.1507 (0.9355,1.415)
## Well - Death 0.669533 (0.3096124, 1.44786) 0.9725 (0.8942,1.058)
## Fracture - Fracture
## Fracture - Death 1.898468 (0.1323376,27.23474) 0.9244 (0.7157,1.194)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 0.9570 (0.7866,1.164) 1.020 (0.8108,1.284)
## Well - Death 1.0508 (0.9729,1.135) 1.347 (1.2378,1.465)
## Fracture - Fracture
## Fracture - Death 0.7893 (0.6190,1.006) 1.118 (0.8380,1.492)
## hypertension copd
## Well - Well
## Well - Fracture 1.238 (1.0165,1.508) 1.051 (0.8129,1.359)
## Well - Death 1.323 (1.2249,1.429) 1.134 (1.0274,1.252)
## Fracture - Fracture
## Fracture - Death 1.150 (0.9029,1.464) 1.165 (0.8460,1.603)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.216 (0.8133,1.817) 0.9678 (0.7577,1.236)
## Well - Death 1.626 (1.4171,1.865) 1.0555 (0.9611,1.159)
## Fracture - Fracture
## Fracture - Death 1.849 (1.1490,2.975) 1.1741 (0.8802,1.566)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 2.798 (2.1887,3.578)
## Well - Death 3.858 (3.4687,4.292)
## Fracture - Fracture
## Fracture - Death 1.553 (0.8779,2.748)
##
## -2 * log-likelihood: 27860.04
hazard.msm(multi.we2)
## $age
## HR L U
## Well - Fracture 1.081590 1.060415 1.103189
## Well - Death 1.099619 1.091229 1.108073
## Fracture - Death 1.071703 1.049153 1.094737
##
## $fnbmd
## HR L U
## Well - Fracture 0.003595861 0.000478118 0.02704399
## Well - Death 0.669532671 0.309612444 1.44785524
## Fracture - Death 1.898468004 0.132337642 27.23473620
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.1506874 0.9354834 1.415398
## Well - Death 0.9724870 0.8942373 1.057584
## Fracture - Death 0.9244381 0.7157263 1.194012
##
## $fx50
## HR L U
## Well - Fracture 0.9569590 0.7866063 1.164205
## Well - Death 1.0508118 0.9729022 1.134960
## Fracture - Death 0.7893227 0.6190371 1.006451
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.020363 0.8108376 1.284030
## Well - Death 1.346665 1.2377583 1.465154
## Fracture - Death 1.118331 0.8380360 1.492374
##
## $hypertension
## HR L U
## Well - Fracture 1.238242 1.016509 1.508343
## Well - Death 1.323001 1.224908 1.428950
## Fracture - Death 1.149540 0.902904 1.463546
##
## $copd
## HR L U
## Well - Fracture 1.051192 0.8129195 1.359304
## Well - Death 1.133967 1.0274319 1.251550
## Fracture - Death 1.164586 0.8459881 1.603169
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.215582 0.8133398 1.816756
## Well - Death 1.625637 1.4170506 1.864926
## Fracture - Death 1.848758 1.1489861 2.974713
##
## $cancer
## HR L U
## Well - Fracture 0.9678193 0.7576550 1.236281
## Well - Death 1.0554751 0.9610836 1.159137
## Fracture - Death 1.1740585 0.8801860 1.566048
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.798489 2.1886767 3.578209
## Well - Death 3.858325 3.4686689 4.291753
## Fracture - Death 1.553100 0.8778943 2.747619
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)
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.032855 (-0.034584,-0.031213)
## Well - Fracture 0.004839 ( 0.004253, 0.005505) 1.077 (1.055,1.099)
## Well - Death 0.028017 ( 0.026495, 0.029626) 1.093 (1.084,1.102)
## Fracture - Fracture -0.059150 (-0.084198,-0.041553)
## Fracture - Death 0.059150 ( 0.041553, 0.084198) 1.075 (1.052,1.099)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.004809 (0.0005997, 0.03857) 1.1554 (0.9382,1.423)
## Well - Death 0.705139 (0.3188150, 1.55959) 0.9950 (0.9147,1.082)
## Fracture - Fracture
## Fracture - Death 2.317091 (0.1503591,35.70724) 0.8869 (0.6836,1.151)
## fx50 BMI
## Well - Well
## Well - Fracture 0.9516 (0.7804,1.160) 0.9743 (0.9499,0.9994)
## Well - Death 1.0355 (0.9581,1.119) 0.9995 (0.9901,1.0090)
## Fracture - Fracture
## Fracture - Death 0.8151 (0.6378,1.042) 0.9819 (0.9492,1.0157)
## smoke drink
## Well - Well
## Well - Fracture 1.081 (0.8795,1.328) 0.9248 (0.7557,1.1318)
## Well - Death 1.298 (1.1981,1.406) 0.8847 (0.8171,0.9579)
## Fracture - Fracture
## Fracture - Death 1.128 (0.8673,1.466) 1.0493 (0.8087,1.3615)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.7809 (0.6345,0.9611) 0.9898 (0.7850,1.248)
## Well - Death 0.6431 (0.5934,0.6970) 1.3058 (1.1995,1.422)
## Fracture - Fracture
## Fracture - Death 0.8181 (0.6367,1.0510) 1.0954 (0.8142,1.474)
## hypertension copd
## Well - Well
## Well - Fracture 1.255 (1.0277,1.532) 1.035 (0.7977,1.343)
## Well - Death 1.293 (1.1962,1.398) 1.055 (0.9547,1.166)
## Fracture - Fracture
## Fracture - Death 1.159 (0.9086,1.478) 1.157 (0.8364,1.600)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.204 (0.8038,1.803) 0.967 (0.7551,1.238)
## Well - Death 1.481 (1.2888,1.703) 1.088 (0.9906,1.196)
## Fracture - Fracture
## Fracture - Death 1.812 (1.0997,2.984) 1.211 (0.9034,1.624)
## renal parkinson
## Well - Well
## Well - Fracture 2.119 (0.9950,4.513) 0.7707 (0.1073, 5.534)
## Well - Death 1.198 (0.8293,1.730) 1.7891 (1.0573, 3.027)
## Fracture - Fracture
## Fracture - Death 2.548 (0.9759,6.655) 1.4367 (0.1943,10.623)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.3600 (0.9828,1.882) 2.824 (2.2064,3.613)
## Well - Death 1.0983 (0.9556,1.262) 3.994 (3.5892,4.444)
## Fracture - Fracture
## Fracture - Death 0.9926 (0.6568,1.500) 1.684 (0.9392,3.019)
##
## -2 * log-likelihood: 27497.44
hazard.msm(multi.wa2)
## $age
## HR L U
## Well - Fracture 1.076617 1.054809 1.098876
## Well - Death 1.093009 1.084405 1.101681
## Fracture - Death 1.075451 1.052298 1.099113
##
## $fnbmd
## HR L U
## Well - Fracture 0.00480912 0.0005997012 0.03856526
## Well - Death 0.70513911 0.3188150477 1.55959126
## Fracture - Death 2.31709065 0.1503591324 35.70723642
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 1.1554497 0.9381786 1.423038
## Well - Death 0.9949804 0.9147214 1.082281
## Fracture - Death 0.8868658 0.6835589 1.150641
##
## $fx50
## HR L U
## Well - Fracture 0.9515703 0.7803769 1.160319
## Well - Death 1.0354805 0.9581048 1.119105
## Fracture - Death 0.8150947 0.6378091 1.041659
##
## $BMI
## HR L U
## Well - Fracture 0.9743187 0.9499006 0.9993645
## Well - Death 0.9994807 0.9900662 1.0089846
## Fracture - Death 0.9818902 0.9492397 1.0156638
##
## $smoke
## HR L U
## Well - Fracture 1.080745 0.8795234 1.328003
## Well - Death 1.297714 1.1981225 1.405584
## Fracture - Death 1.127663 0.8673482 1.466105
##
## $drink
## HR L U
## Well - Fracture 0.9248438 0.7557260 1.1318072
## Well - Death 0.8847301 0.8171249 0.9579286
## Fracture - Death 1.0493024 0.8086974 1.3614925
##
## $physical
## HR L U
## Well - Fracture 0.7809370 0.6345254 0.9611319
## Well - Death 0.6431323 0.5934159 0.6970140
## Fracture - Death 0.8180506 0.6367135 1.0510328
##
## $cvd.nYes
## HR L U
## Well - Fracture 0.989784 0.7849508 1.248069
## Well - Death 1.305842 1.1994758 1.421640
## Fracture - Death 1.095427 0.8142469 1.473705
##
## $hypertension
## HR L U
## Well - Fracture 1.254805 1.0277335 1.532046
## Well - Death 1.292965 1.1962171 1.397538
## Fracture - Death 1.158942 0.9085679 1.478311
##
## $copd
## HR L U
## Well - Fracture 1.034944 0.7977034 1.342740
## Well - Death 1.055123 0.9546784 1.166136
## Fracture - Death 1.156726 0.8363673 1.599794
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.203867 0.8038432 1.802959
## Well - Death 1.481330 1.2888191 1.702596
## Fracture - Death 1.811553 1.0996671 2.984290
##
## $cancer
## HR L U
## Well - Fracture 0.9669586 0.7551454 1.238184
## Well - Death 1.0884748 0.9906226 1.195993
## Fracture - Death 1.2113020 0.9033749 1.624190
##
## $renal
## HR L U
## Well - Fracture 2.118944 0.9949821 4.512568
## Well - Death 1.197736 0.8292927 1.729873
## Fracture - Death 2.548449 0.9759110 6.654904
##
## $parkinson
## HR L U
## Well - Fracture 0.770711 0.1073377 5.533895
## Well - Death 1.789121 1.0572982 3.027485
## Fracture - Death 1.436731 0.1943127 10.623067
##
## $depression
## HR L U
## Well - Fracture 1.3599989 0.9827844 1.881997
## Well - Death 1.0983045 0.9555897 1.262333
## Fracture - Death 0.9926084 0.6567925 1.500126
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 2.823585 2.2064015 3.613408
## Well - Death 3.993979 3.5892470 4.444349
## Fracture - Death 1.683721 0.9391717 3.018529
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.05878 (-0.06274,-0.05507)
## Well - Fracture 0.01544 ( 0.01369, 0.01741) 1.063 (1.041,1.084)
## Well - Death 0.04334 ( 0.04011, 0.04683) 1.090 (1.078,1.102)
## Fracture - Fracture -0.05879 (-0.08280,-0.04174)
## Fracture - Death 0.05879 ( 0.04174, 0.08280) 1.072 (1.048,1.097)
## fnbmd timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.03209 (0.002524,0.4080) 1.365 (1.075,1.733)
## Well - Death 0.05130 (0.012489,0.2107) 2.947 (2.537,3.425)
## Fracture - Fracture
## Fracture - Death 0.12128 (0.006425,2.2890) 2.258 (1.253,4.069)
##
## -2 * log-likelihood: 11703.63
hazard.msm(age.w3)
## $age
## HR L U
## Well - Fracture 1.062529 1.041197 1.084297
## Well - Death 1.090170 1.078292 1.102179
## Fracture - Death 1.072357 1.048163 1.097110
##
## $fnbmd
## HR L U
## Well - Fracture 0.03208694 0.002523581 0.4079804
## Well - Death 0.05130009 0.012489466 0.2107135
## Fracture - Death 0.12127655 0.006425388 2.2890448
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.364817 1.074707 1.733240
## Well - Death 2.947443 2.536685 3.424715
## Fracture - Death 2.257543 1.252586 4.068783
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.05744 (-0.06137,-0.05376)
## Well - Fracture 0.01520 ( 0.01345, 0.01717) 1.061 (1.039,1.084)
## Well - Death 0.04224 ( 0.03904, 0.04570) 1.082 (1.070,1.094)
## Fracture - Fracture -0.05949 (-0.08384,-0.04221)
## Fracture - Death 0.05949 ( 0.04221, 0.08384) 1.069 (1.044,1.095)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.01947 (0.001509,0.2513) 0.7567 (0.5706,1.004)
## Well - Death 0.04656 (0.011441,0.1895) 1.0607 (0.9230,1.219)
## Fracture - Fracture
## Fracture - Death 0.10250 (0.005216,2.0146) 1.0200 (0.7332,1.419)
## fx50 cvd.nYes
## Well - Well
## Well - Fracture 0.7597 (0.6019,0.9589) 1.0826 (0.8246,1.421)
## Well - Death 1.0905 (0.9582,1.2411) 1.2996 (1.1303,1.494)
## Fracture - Fracture
## Fracture - Death 1.2800 (0.9730,1.6838) 0.9575 (0.6940,1.321)
## hypertension copd
## Well - Well
## Well - Fracture 1.170 (0.9183,1.490) 0.889 (0.6538,1.209)
## Well - Death 1.366 (1.1995,1.556) 1.130 (0.9685,1.318)
## Fracture - Fracture
## Fracture - Death 1.109 (0.8275,1.486) 1.213 (0.8460,1.739)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.172 (0.6378,2.155) 0.9646 (0.7176,1.296)
## Well - Death 1.563 (1.1836,2.063) 0.9688 (0.8253,1.137)
## Fracture - Fracture
## Fracture - Death 1.985 (1.0388,3.793) 1.0404 (0.7294,1.484)
## timeperiod[5,Inf)
## Well - Well
## Well - Fracture 1.381 (1.087,1.755)
## Well - Death 3.047 (2.621,3.542)
## Fracture - Fracture
## Fracture - Death 2.372 (1.316,4.274)
##
## -2 * log-likelihood: 11623.72
hazard.msm(multi.we3)
## $age
## HR L U
## Well - Fracture 1.061305 1.039472 1.083597
## Well - Death 1.082061 1.069991 1.094268
## Fracture - Death 1.069140 1.044138 1.094741
##
## $fnbmd
## HR L U
## Well - Fracture 0.01947414 0.001508977 0.2513240
## Well - Death 0.04656274 0.011440830 0.1895045
## Fracture - Death 0.10250482 0.005215522 2.0146094
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 0.7567484 0.5706492 1.003538
## Well - Death 1.0606863 0.9230409 1.218858
## Fracture - Death 1.0200094 0.7332230 1.418967
##
## $fx50
## HR L U
## Well - Fracture 0.759686 0.6018894 0.9588518
## Well - Death 1.090511 0.9582139 1.2410743
## Fracture - Death 1.279955 0.9729918 1.6837611
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.082630 0.8245569 1.421476
## Well - Death 1.299607 1.1303246 1.494243
## Fracture - Death 0.957549 0.6940244 1.321135
##
## $hypertension
## HR L U
## Well - Fracture 1.169672 0.9182932 1.489864
## Well - Death 1.366108 1.1994595 1.555909
## Fracture - Death 1.108899 0.8275086 1.485974
##
## $copd
## HR L U
## Well - Fracture 0.8889941 0.6538435 1.208715
## Well - Death 1.1300373 0.9685426 1.318460
## Fracture - Death 1.2128430 0.8459636 1.738832
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.172459 0.637794 2.155337
## Well - Death 1.562593 1.183615 2.062915
## Fracture - Death 1.984932 1.038823 3.792714
##
## $cancer
## HR L U
## Well - Fracture 0.9645718 0.7176496 1.296453
## Well - Death 0.9687617 0.8253298 1.137120
## Fracture - Death 1.0404369 0.7293896 1.484130
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.381356 1.087033 1.755369
## Well - Death 3.046521 2.620683 3.541554
## Fracture - Death 2.371566 1.315873 4.274218
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.05561 (-0.05952,-0.05196)
## Well - Fracture 0.01490 ( 0.01316, 0.01687) 1.058 (1.035,1.081)
## Well - Death 0.04071 ( 0.03755, 0.04414) 1.078 (1.065,1.091)
## Fracture - Fracture -0.05469 (-0.07849,-0.03811)
## Fracture - Death 0.05469 ( 0.03811, 0.07849) 1.073 (1.047,1.100)
## fnbmd fall.yesnoYes
## Well - Well
## Well - Fracture 0.05153 (0.003412,0.7782) 0.7369 (0.5523,0.9832)
## Well - Death 0.19531 (0.044077,0.8654) 1.0800 (0.9386,1.2427)
## Fracture - Fracture
## Fracture - Death 0.20682 (0.008388,5.0995) 1.1092 (0.7833,1.5705)
## fx50 BMI
## Well - Well
## Well - Fracture 0.7438 (0.5871,0.9424) 0.9824 (0.9495,1.0165)
## Well - Death 1.0735 (0.9418,1.2237) 0.9634 (0.9455,0.9816)
## Fracture - Fracture
## Fracture - Death 1.2460 (0.9366,1.6576) 0.9886 (0.9471,1.0320)
## smoke drink
## Well - Well
## Well - Fracture 1.0323 (0.8040,1.326) 0.7762 (0.6099,0.9879)
## Well - Death 1.4121 (1.2354,1.614) 0.8924 (0.7809,1.0198)
## Fracture - Fracture
## Fracture - Death 0.9802 (0.7194,1.336) 0.8737 (0.6491,1.1759)
## physical cvd.nYes
## Well - Well
## Well - Fracture 0.8856 (0.6938,1.1303) 1.0876 (0.8260,1.432)
## Well - Death 0.5336 (0.4668,0.6098) 1.2725 (1.1053,1.465)
## Fracture - Fracture
## Fracture - Death 0.6838 (0.5068,0.9228) 0.9458 (0.6782,1.319)
## hypertension copd
## Well - Well
## Well - Fracture 1.204 (0.9417,1.541) 0.8893 (0.6488,1.219)
## Well - Death 1.319 (1.1554,1.507) 1.0153 (0.8670,1.189)
## Fracture - Fracture
## Fracture - Death 1.066 (0.7849,1.447) 1.1456 (0.7906,1.660)
## diabetes.nYes cancer
## Well - Well
## Well - Fracture 1.145 (0.6144,2.135) 0.9985 (0.7407,1.346)
## Well - Death 1.583 (1.1843,2.116) 1.0105 (0.8594,1.188)
## Fracture - Fracture
## Fracture - Death 2.045 (1.0067,4.154) 1.1354 (0.7840,1.644)
## renal parkinson
## Well - Well
## Well - Fracture 0.8887 (0.3317,2.381) 1.4027 (0.5144,3.825)
## Well - Death 0.9857 (0.6175,1.574) 1.1365 (0.6253,2.066)
## Fracture - Fracture
## Fracture - Death 0.5458 (0.1278,2.331) 0.5328 (0.1269,2.237)
## depression timeperiod[5,Inf)
## Well - Well
## Well - Fracture 0.8678 (0.5338,1.411) 1.449 (1.135,1.848)
## Well - Death 0.9832 (0.7736,1.250) 3.230 (2.777,3.758)
## Fracture - Fracture
## Fracture - Death 0.8573 (0.4556,1.613) 2.604 (1.406,4.823)
##
## -2 * log-likelihood: 11340.75
hazard.msm(multi.wa3)
## $age
## HR L U
## Well - Fracture 1.058093 1.035364 1.081322
## Well - Death 1.077829 1.065166 1.090642
## Fracture - Death 1.073427 1.047389 1.100112
##
## $fnbmd
## HR L U
## Well - Fracture 0.05152757 0.003411982 0.7781668
## Well - Death 0.19530621 0.044077207 0.8654023
## Fracture - Death 0.20681859 0.008387934 5.0994594
##
## $fall.yesnoYes
## HR L U
## Well - Fracture 0.7368665 0.5522534 0.983194
## Well - Death 1.0799762 0.9385921 1.242658
## Fracture - Death 1.1091704 0.7833385 1.570533
##
## $fx50
## HR L U
## Well - Fracture 0.7438152 0.5870929 0.9423739
## Well - Death 1.0735071 0.9417616 1.2236827
## Fracture - Death 1.2459881 0.9365741 1.6576227
##
## $BMI
## HR L U
## Well - Fracture 0.9824112 0.9494817 1.0164828
## Well - Death 0.9633822 0.9455472 0.9815535
## Fracture - Death 0.9886347 0.9471238 1.0319651
##
## $smoke
## HR L U
## Well - Fracture 1.0323125 0.8039528 1.325537
## Well - Death 1.4121184 1.2354220 1.614087
## Fracture - Death 0.9802159 0.7194371 1.335521
##
## $drink
## HR L U
## Well - Fracture 0.7761922 0.6098672 0.987878
## Well - Death 0.8923809 0.7809024 1.019774
## Fracture - Death 0.8736850 0.6491320 1.175917
##
## $physical
## HR L U
## Well - Fracture 0.8855614 0.6937869 1.1303456
## Well - Death 0.5335588 0.4668351 0.6098191
## Fracture - Death 0.6838379 0.5067574 0.9227973
##
## $cvd.nYes
## HR L U
## Well - Fracture 1.0875769 0.8259589 1.432061
## Well - Death 1.2725306 1.1053494 1.464998
## Fracture - Death 0.9458312 0.6782481 1.318981
##
## $hypertension
## HR L U
## Well - Fracture 1.204489 0.9417499 1.540531
## Well - Death 1.319357 1.1553678 1.506623
## Fracture - Death 1.065587 0.7848784 1.446689
##
## $copd
## HR L U
## Well - Fracture 0.8893185 0.6487531 1.219088
## Well - Death 1.0152692 0.8670057 1.188887
## Fracture - Death 1.1455885 0.7906137 1.659942
##
## $diabetes.nYes
## HR L U
## Well - Fracture 1.145383 0.6144431 2.135108
## Well - Death 1.583040 1.1842945 2.116040
## Fracture - Death 2.045016 1.0066645 4.154404
##
## $cancer
## HR L U
## Well - Fracture 0.9985438 0.7407466 1.346061
## Well - Death 1.0105191 0.8593801 1.188239
## Fracture - Death 1.1354405 0.7839900 1.644441
##
## $renal
## HR L U
## Well - Fracture 0.8887082 0.3316919 2.381132
## Well - Death 0.9857369 0.6174545 1.573683
## Fracture - Death 0.5458029 0.1278064 2.330876
##
## $parkinson
## HR L U
## Well - Fracture 1.4026558 0.5143643 3.825000
## Well - Death 1.1365225 0.6252505 2.065865
## Fracture - Death 0.5328432 0.1269083 2.237221
##
## $depression
## HR L U
## Well - Fracture 0.8677538 0.5337526 1.410760
## Well - Death 0.9832013 0.7736211 1.249558
## Fracture - Death 0.8573277 0.4555707 1.613385
##
## $`timeperiod[5,Inf)`
## HR L U
## Well - Fracture 1.448564 1.135280 1.848299
## Well - Death 3.230492 2.776776 3.758344
## Fracture - Death 2.604018 1.405994 4.822860