-
# Report of *ncappc*^* package
-
-
^\* Acharya, C., Hooker, A. C., Turkyilmaz, G. Y., Jonsson, S., Karlsson, M. O., A diagnostic tool for population models using non-compartmental analysis: The ncappc package for R, *Computer Methods and Programs in Biomedicine*, 2016, Vol. 127, 83-93

--------------------------------------------------------------

==============================================================


```{r main, echo=FALSE}
arglist  <- fnOut$arglist
case     <- fnOut$case
txt      <- fnOut$TXT
pddf     <- fnOut$pddf
prnTab   <- fnOut$prnTab
nsim     <- fnOut$NSIM
conc     <- fnOut$conc
histobs  <- fnOut$histobs
pop      <- fnOut$pop
dev      <- fnOut$dev
outlier  <- fnOut$outlier
forest   <- fnOut$forest
npde     <- fnOut$npde
histnpde <- fnOut$histnpde
hth      <- fnOut$phth
wth      <- fnOut$pwth

if(fnOut$spread=="ppi"){
  sprtxt <- "95% parametric prediction interval of the NCA metrics"
}else if(fnOut$spread=="npi"){
  sprtxt <- "95% nonparametric prediction interval of the NCA metrics"
}

```

-

Summary of the data set and the results
-
-


```{r txt, echo=FALSE}
cat(txt)
```

-

```{r table, echo=FALSE, results='asis'}
kable(pddf, align='c')
```


-------------------------------
-
Command-line arguments passed to *ncappc* function
-
-

```{r cmd, echo=FALSE}
print(arglist)
```


-
-
-

------------------------------
-
Description of the tabular output
-
-

**Table 1 (ncaOutput.tsv).** The *ncappc* functionality produces this table to report the estimated values of the NCA metrics described in the documentation for each individual along with other stratifiers (eg. population group ID, dose ID, etc.) if specified in the input command. The extension "tsv" stands for "tab separated variable", *i.e.*, the columns in this table are separated by tabs. "NaN" or "NA" is produced for the NCA metrics which are irrelevant for the specified data type. This table also reports three additional columns for each of the eight NCA metrics that can be used for the diagnostics (AUClast, AUMClast, AUClower_upper, Tmax, Cmax, HL_Lambda_z, AUCINF_obs, AUCINF_pred). The names of the additional column for AUClast is simAUClast, where simAUClast for an individual represents the median of the estimated AUClast values obtained from the set of simulated data. Similar names are assigned to the additional columns for the other seven metrics. Below is an excerpt of selected columns of top 100 rows.


## Table 1. ncaOutput.tsv (selected columns of top 100 rows)

```{r Final table, echo=FALSE, results='asis'}
suppressPackageStartupMessages(require(xtable))
print(xtable(prnTab, align=rep("c",ncol(prnTab)+1), rotate.colnames = T), include.rownames=FALSE, type = 'html')
```

-
-

**Table 2 (Obs_Stat.tsv).** A set of statistical parameters calculated for the entire population or the stratified population for the median values of the following NCA metrics estimated from the simulated data: Tmax, Cmax, AUClast, AUClower_upper, AUCINF_obs, AUC_pExtrap_obs, AUCINF_pred, AUC_pExtrap_pred, AUMClast, AUMCINF_obs, AUMC_pExtrap_obs, AUMCINF_pred, AUMC_pExtrap_pred, HL_Lambda_z, Rsq, Rsq_adjusted, No_points_Lambda_z obtained from the observed data. Brief description of the calculated statistical parameters: **Ntot** = Total number of data points, **Nunique** = number of unique data points, **Min** = minimum value, **Max** = maximum value, **Mean** = mean/average value, **SD** = standard deviation, **SE** = standard error, **CVp** = coefficient of variation %, **a95CIu** = upper limit of 95% arithmetic confidence interval, **a95CIl** = lower limit of 95% arithmetic confidence interval, **gMean** = geometric mean, **gCVp** = geometric coefficient of variation %.

-
-

**Table 3 (Sim_Stat.tsv).** A set of statistical parameters calculated for the entire population or the stratified population for the median values of the following NCA metrics estimated from the simulated data: Tmax, Cmax, AUClast, AUClower_upper, AUCINF_obs, AUC_pExtrap_obs, AUCINF_pred, AUC_pExtrap_pred, AUMClast, AUMCINF_obs, AUMC_pExtrap_obs, AUMCINF_pred, AUMC_pExtrap_pred, HL_Lambda_z, Rsq, Rsq_adjusted, No_points_Lambda_z obtained from the estimated data. Brief description of the calculated statistical parameters: **Ntot** = Total number of data points, **Nunique** = number of unique data points, **Min** = minimum value, **Max** = maximum value, **Mean** = mean/average value, **SD** = standard deviation, **SE** = standard error, **CVp** = coefficient of variation %, **a95CIu** = upper limit of 95% arithmetic confidence interval, **a95CIl** = lower limit of 95% arithmetic confidence interval, **gMean** = geometric mean, **gCVp** = geometric coefficient of variation %.

-
-

**Table 4 (ncaSimData.tsv).** Simulated concentration-time profiles for each individual obtained from each simulation. "NSUB" column denotes the simulation number.

-
-

**Table 5 (ncaSimEst.tsv).** Estimated NCA metrics for each individual using the simulated concentration-time profile obtained from each simulation. "NSUB" column denotes the simulation number.


-
-

---------------------------------
Description of the graphical output
-
-

```{r concplot, echo=FALSE, fig.height=4, fig.width=6, fig.align='center', dpi=90}
if (length(conc)>0){
  for (i in 1:length(conc)){suppressMessages(suppressWarnings(grid.draw(conc[[i]]))); Sys.sleep(0.5); grid.newpage()}
}else{
  print("No concentration vs time plot is available.")
}
```

**Figure 1.** [Individual level] Concentration vs time profile for each individual stratified by dose or population group, if any, as obtained from the observed data. The left panels represent the concentration data in linear scale, while the right panels represent the concentration data in semi-logarithmic scale. Each of the lines represents individual data.

-
-

```{r histobsplot, echo=FALSE, fig.height=9, fig.width=8, fig.align='center', dpi=80}
if (length(histobs)>0){
  for (i in 1:length(histobs)){suppressMessages(suppressWarnings(grid.draw(histobs[[i]]))); Sys.sleep(0.5); grid.newpage()}
}else{
  print("No histogram is available as the number of individuals is less than 5 in each population strata!")
}
```

**Figure 2.** [Population level] Histogram of four selected NCA metrics (AUClast, AUCINF_obs, Cmax, Tmax) estimated from the observed data. The solid blue vertical and dotted lines represent the population median and the "spread" of the data. The "spread" is defined by `r sprtxt` obtained from the observed data.

-
-

```{r popplot, echo=FALSE, fig.height=9, fig.width=8, fig.align='center', dpi=80}
if (length(pop)>0){
  suppressPackageStartupMessages(require(gridExtra))
  for (i in 1:length(pop)){suppressMessages(suppressWarnings(grid.draw(pop[[i]]))); Sys.sleep(0.5); grid.newpage()}
}else{
  print("No plot is available.")
}
```

**Figure 3.** [Population level] Histogram of the population median of the NCA metrics obtained from the simulated data from the `r nsim` simulations. The red and blue solid vertical lines represent the population median of the NCA matric obtained from the observed data and the median of the population medians of the same NCA metric obtained from the `r nsim` number of simulations, respectively. The blue dashed vertical lines represent the "spread" of the simulated distribution. The "spread" is defined as `r sprtxt` obtained from the simulated data.

