data(data_3class)
## One covariate
out1 <- clus_lme(fixed_formula = Y ~ X1, name_class = "D",
name_clust = "id_Clus", data = data_3class)
### Estimate covariate-specific optimal thresholds at multiple values of one covariate,
### with 3 methods
out_thres_1 <- clus_opt_thres3(method = c("GYI", "MV", "CtP"),
out_clus_lme = out1,
newdata = data.frame(X1 = 1), ap_var = TRUE)
print(out_thres_1)
plot(out_thres_1)
## Two covariates
out2 <- clus_lme(fixed_formula = Y ~ X1 + X2, name_class = "D",
name_clust = "id_Clus", data = data_3class)
### Estimate covariate-specific optimal thresholds at one point, with 3 methods
out_thres_2 <- clus_opt_thres3(method = c("GYI", "MV", "CtP"),
out_clus_lme = out2,
newdata = data.frame(X1 = 1, X2 = 0),
ap_var = TRUE)
print(out_thres_2)
plot(out_thres_2)
### Estimate covariate-specific optimal thresholds at three points, with 3 methods
out_thres_3 <- clus_opt_thres3(method = c("GYI", "MV", "CtP"),
out_clus_lme = out2,
newdata = data.frame(X1 = c(-0.5, 0.5, 0.5),
X2 = c(0, 0, 1)),
ap_var = TRUE)
print(out_thres_3)
plot(out_thres_3, colors = c("forestgreen", "blue"))
Run the code above in your browser using DataLab