diff --git a/Development/interval_CR.R b/Development/interval_CR.R index e630228..73a7caf 100644 --- a/Development/interval_CR.R +++ b/Development/interval_CR.R @@ -57,25 +57,27 @@ eventDF$stop[eventDF$start == eventDF$stop] <- 1e-05 attr(eventDF$weight, "integrate") <- eventDF$intgr_ -CoxFit <- coxph(Surv(start, stop, event) ~ DxAge + strata(strt), data = eventDF, +CoxFit <- coxph(Surv(start, stop, event) ~ density:strata(strt), data = eventDF, weights = eventDF$weight, model = TRUE) lmeFit <- lme(PSAValue ~ ns(time, k = c(1.49, 3.535), B = c(0, 10.223)) + DxAge, data = train.dat, random = list(CISNET_ID = pdDiag(form = ~ ns(time, k = c(1.49, 3.535), B = c(0, 10.223))))) -lmeFit <- lme(PSAValue ~ ns(time, k = c(1.49, 3.535), B = c(0, 10.223)) + DxAge, - data = train.dat, - random = ~ ns(time, k = c(1.49, 3.535), B = c(0, 10.223)) | CISNET_ID) +lmeFit <- lme(PSAValue ~ ns(time, df = 3) + DxAge, + data = train.dat, control = lmeControl(opt = 'optim'), + random = ~ ns(time, df = 3) | CISNET_ID) jmFit <- jm(CoxFit, lmeFit, time_var = "time", functional_forms = ~ value(PSAValue):strt + slope(PSAValue,eps = 1, direction = "back"):strt, - n_iter = 6500L, n_burnin = 2500L) + n_iter = 6500L, n_burnin = 500L) summary(jmFit) iccsjm.model$summary$coef + + Surv_object = CoxFit Mixed_objects = lmeFit time_var = 'time' diff --git a/NAMESPACE b/NAMESPACE index 6cdd8e9..38c0160 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,7 +8,8 @@ export(area, calibration_metrics, calibration_plot, cumuplot, coef, compare_jm, import(Rcpp) importFrom("utils", "glob2rx", "tail", "head", "combn") importFrom("stats", "coef", "terms", "model.frame", "model.frame.default", - "model.matrix", "model.matrix.default", "family", "lm.fit", "sd", + "model.matrix", "model.matrix.default", "model.weights", "family", + "lm.fit", "sd", "ar", "var", "vcov", "optim", "delete.response", "model.response", "rnorm", "quantile", "runif", "rlnorm", "cov2cor", "as.formula", "gaussian", ".getXlevels", "makepredictcall", "plogis", diff --git a/R/jm_fit.R b/R/jm_fit.R index b2ae5e5..56df1f2 100644 --- a/R/jm_fit.R +++ b/R/jm_fit.R @@ -34,7 +34,7 @@ jm_fit <- function (model_data, model_info, initial_values, priors, control) { id_h_ <- unlist(mapply2(function (x, ind) if (sum(ind) > 0) x[!duplicated(ind)] else x, split(id_h, id_h), split(model_data$intgr_ind, id_h))) } else { - id_h2 <- 0 + id_h2 <- id_h_ <- 0 } model_data <- c(model_data, create_Wlong_mats(model_data, model_info,