Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paper3 #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.Rproj.user
.Rhistory
.RData
.rda
.RDA
.Ruserdata
/archive/
.csv
/data/
/result/
/nonlinear_sim1000_ss1000_anchor3/
/nonlinear_sim1000_ss1000_anchor4/
/nonlinear_sim1000_ss1000_anchor6/
1 change: 0 additions & 1 deletion 03_table3_multiple-alpha_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ predicted_test<- predict(lm_bks_train, newdata = test_new)
# s <- coef(lm_bks_train) %>% as.matrix()
# mm <- model.matrix(lm_bks_train, data = train_new)
# g(mm, s, nderiv = 1)
View(bks)
summary(bks)


Expand Down
31 changes: 14 additions & 17 deletions 05_figure2_individual_plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ comment = "#>",
error = FALSE)

## clean the R environment
graphics.off()
rm(list = ls())
freshr::freshr()

## load packages
library(here, quietly = TRUE)
Expand Down Expand Up @@ -152,7 +149,7 @@ test_eld_n10 <- pred_matching(
train_data = train_data,
test_data = test_data,
match_methods = "euclidean",
match_num = 10,
match_num = 30,
gamlss_formula = "ht ~ cs(time, df = 3)",
gamsigma_formula = "~ cs(time, df = 1)",
match_plot = TRUE,
Expand All @@ -164,7 +161,7 @@ test_mhl_n10 <- pred_matching(
train_data = train_data,
test_data = test_data,
match_methods = "mahalanobis",
match_num = 10,
match_num = 30,
gamlss_formula = "ht ~ cs(time, df = 3)",
gamsigma_formula = "~ cs(time, df = 1)",
match_plot = TRUE,
Expand Down Expand Up @@ -203,7 +200,7 @@ test_sgl10_n10 <- pred_matching(
train_data = train_data,
test_data = test_data,
match_methods = "single",
match_num = 10,
match_num = 30,
match_time = 12,
match_alpha = NULL,
gamlss_formula = "ht ~ cs(time, df = 3)",
Expand All @@ -215,7 +212,7 @@ test_sgl10_n10 <- pred_matching(

sgl10_n10_m <- test_sgl10_n10$matching_trajectory +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$S_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$S_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand All @@ -229,7 +226,7 @@ sgl10_n10_m <- test_sgl10_n10$matching_trajectory +

eld_n10_m <- test_eld_n10$matching_trajectory +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$E_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$E_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand All @@ -244,7 +241,7 @@ eld_n10_m <- test_eld_n10$matching_trajectory +

mhl_n10_m <- test_mhl_n10$matching_trajectory +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$M_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$M_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand Down Expand Up @@ -285,7 +282,7 @@ mhl_p80_m <- test_mhl_p80$matching_trajectory +

sgl10_n10_t <- test_sgl10_n10$predictive_centiles +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$S_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$S_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand All @@ -299,7 +296,7 @@ sgl10_n10_t <- test_sgl10_n10$predictive_centiles +

eld_n10_t <- test_eld_n10$predictive_centiles +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$E_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$E_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand All @@ -313,7 +310,7 @@ eld_n10_t <- test_eld_n10$predictive_centiles +

mhl_n10_t <- test_mhl_n10$predictive_centiles +
ylim(c(80, 210)) +
labs(title = parse(text = latex2exp::TeX("$M_{\\kappa = 10}$")),
labs(title = parse(text = latex2exp::TeX("$M_{\\kappa = 30}$")),
y = "Height (cm)",
x = "Time (year)") +
theme(axis.text.x = element_text(size = 15),
Expand Down Expand Up @@ -355,24 +352,24 @@ mhl_p80_t <- test_mhl_p80$predictive_centiles +



```{r, fig.height= 12, fig.width=10}
```{r, fig.height= 10, fig.width=8}
library(ggpubr)

figure1 <- ggarrange(sgl10_n10_m, sgl10_n10_t,
# + theme(axis.text.x=element_blank()),
eld_n10_m, eld_n10_t,
# eld_n10_m, eld_n10_t,
# + theme(axis.text.x=element_blank()),
mhl_n10_m, mhl_n10_t,
# mhl_n10_m, mhl_n10_t,
# + theme(axis.text.x=element_blank()),
mhl_p80_m, mhl_p80_t,
mhl_p90_m, mhl_p90_t,
# + theme(axis.text.x=element_blank()),
ncol = 2, nrow = 5) +
ncol = 2, nrow = 3) +
theme(plot.margin = margin(2, 0.5, 0.5, 0.5, "cm"))


figure1
ggsave(filename = paste0("figure/S05_trajectory_final_plots_id_", id, "_", Sys.Date(), "_2alpha.png"))
ggsave(filename = paste0("figure2/S05_trajectory_final_plots_id_", id, "_", Sys.Date(), "_2alpha.png"))
```


Expand Down
Binary file modified 05_figure2_individual_plot.pdf
Binary file not shown.
Binary file removed 07_figure4_large_simulation.pdf
Binary file not shown.
Loading