Open andkov opened 7 years ago
education
from years of education into tertiles: ds_clean$educat <- car::Recode(ds_clean$edu,
" 1:9 = '-1';
10:11 = '0';
12:30 = '1';
")
my models involving this covariate will have a harder time converging, at times failing to. Any similar experiences?
Q
and E
. An example would be:# Specification of the fitted models
# common value for all models
q <- .01
# ---- model-A --------------
# transition matrix
Q <- rbind( c(0, q, q, q),
c(q, 0, q, q),
c(0, q, 0, q),
c(0, 0, 0, 0))
# misclassification matrix
E <- rbind( c(0, 0, 0, 0),
c(0, 0, 0, 0),
c(0, 0, 0, 0),
c(0, 0, 0, 0) )
# transition names
qnames = c(
"Healthy - Mild", # q12
"Health - Severe", # q13
"Healthy - Dead", # q14
"Mild - Healthy", # q21
"Mild - Severe", # q23
"Mild - Dead", # q24
"Severe - Mild", # q32
"Severe - Dead" # q34
)
A <- list(q=q, Q=Q, E=E, qnames = qnames)
#
# add definition for B, C, and D
#
model_specification <- list(A=A, B=B, C=C, D=D)
# use in estimation:
# define specification matrices
(Q <- model_specification[["A"]][["Q"]])
(E <- model_specification[["A"]][["E"]])
(qnames <- model_specification[["A"]][["qnames"]])
# compile model objects with msm() call
mA1 <- estimate_multistate(ds, Q, E, qnames,cov_names = "age")
mA2 <- estimate_multistate(ds, Q, E, qnames,cov_names = "age + age_bl")
mA3 <- estimate_multistate(ds, Q, E, qnames,cov_names = "age + age_bl + male")
mA4 <- estimate_multistate(ds, Q, E, qnames,cov_names = "age + age_bl + male + educat")
mA4_edu <- estimate_multistate(ds, Q, E, qnames,cov_names = "age + age_bl + male + edu")
# save models estimated by msm() in a external object for faster access in the future
models_A <- list("age" = mA1,
"age_bl" = mA2,
"male" = mA3,
"educat" = mA4, # estimated with only 200 ids
"edu" = mA4_edu) # turn of after estimation
saveRDS(models, "./data/shared/derived/models/version-2/models_A.rds") # turn of after estimation
models_A <- readRDS("./data/shared/derived/models/version-2/models_A.rds")
lapply(models_A, names)
Andrey
Robson
Graciela = or use the starting values from the model that did not include education at
Annie
Emiel
Johan
Andrey
Robson
Emiel
Graciela
Annie
Centering age: study specific age. Use whatever work for your estimation case.
Robson
Andrey
Judith
....
Graciela
Next meeting is scheduled for Friday, 2016-09-02-08:00 PDT (16:00 UCT)
Discussion topics