Skip to content

Commit

Permalink
fix image sizes in 2023-1/2022-52 (RJ-2023-026)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-u committed Nov 12, 2023
1 parent 56d965f commit 5334b8a
Show file tree
Hide file tree
Showing 7 changed files with 1,551 additions and 2,350 deletions.
16 changes: 8 additions & 8 deletions _articles/RJ-2023-026/RJ-2023-026.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Please edit RJ-2023-026.Rmd to modify this file

## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, out.width="100%")
library(ggplot2)
#library(kableExtra)


## ----Fig0, fig.height = 12, fig.width=8, fig.cap = "The visual predictive check plot. The solid red line represents the $50^{th}$ percentile of the observed data, and dashed red lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. The solid blue line represents the $50^{th}$ percentile of the simularted data, and dashed blue lines represent the $10^{th}$ and $90^{th}$ percentiles of the simulated data. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."----
## ----Fig0, fig.height = 12, fig.width=8, fig.cap = "The visual predictive check plot. The solid red line represents the $50^{th}$ percentile of the observed data, and dashed red lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. The solid blue line represents the $50^{th}$ percentile of the simularted data, and dashed blue lines represent the $10^{th}$ and $90^{th}$ percentiles of the simulated data. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."----
library(nlmeVPC)
library(ggplot2)
library(gridExtra)
Expand All @@ -23,15 +23,15 @@ C=VPCgraph(origdata,simdata,N_xbin=8,type="CI")+
grid.arrange(A,B,C,nrow=3)


## ----Fig1, fig.height = 4, fig.width=8, fig.cap = "The additive equantile VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."----
## ----Fig1, fig.height = 4, fig.width=8, fig.cap = "The additive equantile VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."----
aqrVPC(origdata,simdata) +labs(caption="")


## ----Fig2, fig.height = 4, fig.width=8, fig.cap = "The bootstrap VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line, and the pink areas represent the 95% confidence areas of the $50^{th}$ percentile line, calculated from the bootstrap samples of the observed data."----
## ----Fig2, fig.height = 4, fig.width=8, fig.cap = "The bootstrap VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line, and the pink areas represent the 95\\% confidence areas of the $50^{th}$ percentile line, calculated from the bootstrap samples of the observed data."----
bootVPC(origdata,simdata,N_xbin=8)


## ----Fig3, fig.height = 8, fig.width=8,fig.cap = "The average shifted VPC plot. Dots indicate the observed data. The solid line represents the 50th quantiles of the observed data, and dashed lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles."----
## ----Fig3, fig.height = 8, fig.width=8,fig.cap = "The average shifted VPC plot. Dots indicate the observed data. The solid line represents the 50th quantiles of the observed data, and dashed lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles."----
A=asVPC(origdata,simdata,type="CI",N_xbin=8,N_hist=3,weight_method="bin") +labs(caption="")
B=asVPC(origdata,simdata,type="CI",N_xbin=8,N_hist=3,weight_method="distance")+labs(caption="")
grid.arrange(A,B,nrow=2)
Expand All @@ -41,7 +41,7 @@ grid.arrange(A,B,nrow=2)
NumericalCheck(origdata,simdata,pred.level=c(0,0.2,0.4,0.6,0.8,0.9),N_xbin=8)$NPC


## ----Fig4, fig.height = 10, fig.width=6, fig.cap = "The coverage plot and the coverage detailed plot for the 80% prediction interval. In the coverage plot, the X-axis is the level of the prediction interval. The Y-axis is the ratio between the number of observed data and the number of expected data of the lower and upper parts in each level of the prediction interval. The white line is the reference line, and the gray area represents the confidence area of the ratios. If the solid lines are near the white line, we can conclude that the suggested model is suitable. In the coverage detailed plot, the white dots represent the expected percentages of lower and upper prediction intervals of, 10%, and 90%, respectively. The upper and lower percentages of observation in each time bin are darker gray."----
## ----Fig4, out.width="90%", fig.height = 10, fig.width=6, fig.cap = "The coverage plot and the coverage detailed plot for the 80\\% prediction interval. In the coverage plot, the X-axis is the level of the prediction interval. The Y-axis is the ratio between the number of observed data and the number of expected data of the lower and upper parts in each level of the prediction interval. The white line is the reference line, and the gray area represents the confidence area of the ratios. If the solid lines are near the white line, we can conclude that the suggested model is suitable. In the coverage detailed plot, the white dots represent the expected percentages of lower and upper prediction intervals of, 10\\%, and 90\\%, respectively. The upper and lower percentages of observation in each time bin are darker gray."----

A=coverageplot(origdata,simdata,N_xbin=8) +ggtitle("(A) Coverage Plot")
B=coverageDetailplot(origdata,simdata,N_xbin=8,predL=0.8) +
Expand Down Expand Up @@ -256,13 +256,13 @@ B=coverageplot(origdata,simdata.F,conf.level=0.9,N_xbin=8)+labs(title="Model 2")
grid.arrange(A,B,ncol=2)


## ----M16,fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=50%."----
## ----M16,fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=50\\%."----
A=coverageDetailplot(origdata,simdata.T,predL=0.5,N_xbin=8)+labs(title="Model 1")
B=coverageDetailplot(origdata,simdata.F,predL=0.5,N_xbin=8)+labs(title="Model 2")
grid.arrange(A,B,ncol=2)


## ----M17, fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=80%."----
## ----M17, fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=80\\%."----
A=coverageDetailplot(origdata,simdata.T,predL=0.8,N_xbin=8)+labs(title="Model 1")
B=coverageDetailplot(origdata,simdata.F,predL=0.8,N_xbin=8)+labs(title="Model 2")
grid.arrange(A,B,ncol=2)
Expand Down
19 changes: 9 additions & 10 deletions _articles/RJ-2023-026/RJ-2023-026.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ author:
orcid: 0000-0003-0817-5000
type: package
output:
rjtools::rjournal_article:
rjtools::rjournal_web_article:
self_contained: yes
toc: no
bibliography: EunKyung_Lee.bib
Expand All @@ -44,9 +44,8 @@ journal:
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, out.width="100%")
library(ggplot2)
#library(kableExtra)
```
Expand Down Expand Up @@ -97,7 +96,7 @@ As the number of bins decreases, the lines become smoother and more regular, how
`VPCgraph` provides the automatic binning with `optK` and `makeCOVbin`; here, `optK` finds the optimal number of bins, and `makeCOVbin` finds the optimal cutoffs of bins using Lavielle and Bleakley's method.


```{r Fig0, fig.height = 12, fig.width=8, fig.cap = "The visual predictive check plot. The solid red line represents the $50^{th}$ percentile of the observed data, and dashed red lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. The solid blue line represents the $50^{th}$ percentile of the simularted data, and dashed blue lines represent the $10^{th}$ and $90^{th}$ percentiles of the simulated data. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."}
```{r Fig0, fig.height = 12, fig.width=8, fig.cap = "The visual predictive check plot. The solid red line represents the $50^{th}$ percentile of the observed data, and dashed red lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. The solid blue line represents the $50^{th}$ percentile of the simularted data, and dashed blue lines represent the $10^{th}$ and $90^{th}$ percentiles of the simulated data. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."}
library(nlmeVPC)
library(ggplot2)
library(gridExtra)
Expand All @@ -119,7 +118,7 @@ To overcome the difficulties of making bins as well as determining the number of
@jamsen2018regression used additive quantile regression to calculate the quantiles of the observed and simulated data. This regression method makes it possible to estimate quantiles without discrete binning, which is especially useful when the data are insufficient, irregular, or inappropriate to configure the bins. To fit the additive quantile regression, we used the `rqss` function in the \CRANpkg{quantreg} [@quantreg] package and developed the `aqrVPC` function to draw the VPC type plot with additive quantile regression. Figure \@ref(fig:Fig1) shows the additive quantile regression VPC plot. The solid and dashed lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ additive quantile regression lines of the observed data, and the pink and light blue areas represent the confidence areas of the additive quantile regression lines of the simulated data. Lines and areas in the additive quantile regression VPC plot are much smoother than those in the original VPC plot.


```{r Fig1, fig.height = 4, fig.width=8, fig.cap = "The additive equantile VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."}
```{r Fig1, fig.height = 4, fig.width=8, fig.cap = "The additive equantile VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$ and $90^{th}$ percentile lines."}
aqrVPC(origdata,simdata) +labs(caption="")
```

Expand All @@ -131,7 +130,7 @@ This plot reflects the uncertainty of the observed data and allows for more obje
Figure \@ref(fig:Fig2) shows the bootstrap VPC plot using `bootVPC`. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line, and the pink areas represent the 95$\%$ confidence areas of the $50^{th}$ percentile line, calculated from the bootstrap samples of the observed data. If the solid blue line and the solid red line are similar, the solid blue line is in the pink area, and the pink area is located between two dashed blue lines,
then this is evidence that the fitted model fit the observed data well.

```{r Fig2, fig.height = 4, fig.width=8, fig.cap = "The bootstrap VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line, and the pink areas represent the 95% confidence areas of the $50^{th}$ percentile line, calculated from the bootstrap samples of the observed data."}
```{r Fig2, fig.height = 4, fig.width=8, fig.cap = "The bootstrap VPC plot. Dots indicate the observed data. The solid and dashed blue lines represent the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles of the simulated data. The solid red line represents the $50^{th}$ percentile line, and the pink areas represent the 95\\% confidence areas of the $50^{th}$ percentile line, calculated from the bootstrap samples of the observed data."}
bootVPC(origdata,simdata,N_xbin=8)
```

Expand Down Expand Up @@ -180,7 +179,7 @@ In the asVPC plot, the observations in each bin are combined using weights. Typi
Figure \@ref(fig:Fig3) shows the results from the `asVPC` function using bin-related weights and distance-related weights. The solid and dashed lines represent the average shifted quantile lines of the observed data, and the pink and light blue areas represent the confidence areas of the simulated data. The lines in the asVPC plot are smoother than those in the original VPC plot, and the confidence areas in the asVPC plot are thinner than those in the original VPC plot.


```{r Fig3, fig.height = 8, fig.width=8,fig.cap = "The average shifted VPC plot. Dots indicate the observed data. The solid line represents the 50th quantiles of the observed data, and dashed lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. Light blue and pink areas represent the 95% confidence areas of the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles."}
```{r Fig3, fig.height = 8, fig.width=8,fig.cap = "The average shifted VPC plot. Dots indicate the observed data. The solid line represents the 50th quantiles of the observed data, and dashed lines represent the $10^{th}$ and $90^{th}$ percentiles of the observed data. Light blue and pink areas represent the 95\\% confidence areas of the $10^{th}$, $50^{th}$, and $90^{th}$ percentiles."}
A=asVPC(origdata,simdata,type="CI",N_xbin=8,N_hist=3,weight_method="bin") +labs(caption="")
B=asVPC(origdata,simdata,type="CI",N_xbin=8,N_hist=3,weight_method="distance")+labs(caption="")
grid.arrange(A,B,nrow=2)
Expand Down Expand Up @@ -228,7 +227,7 @@ Unlike the VPC plot, which represents the data space, the information in the obs
Figure \@ref(fig:Fig4)(B) is the result of `coverageDetailplot` when the prediction level is 80$\%$. The white dots represent the expected percentages of the lower and upper the prediction intervals, 10$\%$, and 90$\%$, respectively. The upper and lower percentages of observation in each time bin are shown in darker gray. The left bin(before 0.045 hours) shows all light gray in the coverage detailed plot, and it is quite different patterns from the expected one. However, it is mainly due to the characteristics of this example data. All observations in this bin are 0. It makes the lower and upper bound of the prediction interval all 0, and the lower and upper percentages become 0.


```{r Fig4, fig.height = 10, fig.width=6, fig.cap = "The coverage plot and the coverage detailed plot for the 80% prediction interval. In the coverage plot, the X-axis is the level of the prediction interval. The Y-axis is the ratio between the number of observed data and the number of expected data of the lower and upper parts in each level of the prediction interval. The white line is the reference line, and the gray area represents the confidence area of the ratios. If the solid lines are near the white line, we can conclude that the suggested model is suitable. In the coverage detailed plot, the white dots represent the expected percentages of lower and upper prediction intervals of, 10%, and 90%, respectively. The upper and lower percentages of observation in each time bin are darker gray."}
```{r Fig4, out.width="90%", fig.height = 10, fig.width=6, fig.cap = "The coverage plot and the coverage detailed plot for the 80\\% prediction interval. In the coverage plot, the X-axis is the level of the prediction interval. The Y-axis is the ratio between the number of observed data and the number of expected data of the lower and upper parts in each level of the prediction interval. The white line is the reference line, and the gray area represents the confidence area of the ratios. If the solid lines are near the white line, we can conclude that the suggested model is suitable. In the coverage detailed plot, the white dots represent the expected percentages of lower and upper prediction intervals of, 10\\%, and 90\\%, respectively. The upper and lower percentages of observation in each time bin are darker gray."}
A=coverageplot(origdata,simdata,N_xbin=8) +ggtitle("(A) Coverage Plot")
B=coverageDetailplot(origdata,simdata,N_xbin=8,predL=0.8) +
Expand Down Expand Up @@ -503,13 +502,13 @@ Figure \@ref(fig:M15) shows the `coverageplot` results for Model 1 and Model 2.
The upper and lower percentages in both figures are close to the white points in Model 1. On the other hand, the upper percentages of the most time bins are far from the white points in Model 2, especially the time bin (3.54,5.28] when PI = 50$\%$. When PI = 80$\%$, most upper and lower percentages are far from the white points.


```{r M16,fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=50%."}
```{r M16,fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=50\\%."}
A=coverageDetailplot(origdata,simdata.T,predL=0.5,N_xbin=8)+labs(title="Model 1")
B=coverageDetailplot(origdata,simdata.F,predL=0.5,N_xbin=8)+labs(title="Model 2")
grid.arrange(A,B,ncol=2)
```

```{r M17, fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=80%."}
```{r M17, fig.height = 3, fig.width=7.5,fig.cap = "The coverage detailed plots for Model 1 and Model 2 when PI=80\\%."}
A=coverageDetailplot(origdata,simdata.T,predL=0.8,N_xbin=8)+labs(title="Model 1")
B=coverageDetailplot(origdata,simdata.F,predL=0.8,N_xbin=8)+labs(title="Model 2")
grid.arrange(A,B,ncol=2)
Expand Down
Loading

0 comments on commit 5334b8a

Please sign in to comment.