%\VignetteIndexEntry{PKgraph Overview}
%\VignetteDepends{PKgraph}
%\VignetteKeywords{PKgraph}
%\VignetteKeywords{PKgraph}
%\VignetteKeywords{PKgraph}
%\VignettePackage{PKgraph}
\documentclass[a4paper]{article}

\newcommand{\Rfunction}[1]{{\texttt{#1}}}
\newcommand{\Robject}[1]{{\texttt{#1}}}
\newcommand{\Rpackage}[1]{{\textit{#1}}}
\newcommand{\Rclass}[1]{{\textit{#1}}}
\newcommand{\Rmethod}[1]{{\textit{#1}}}

\author{Xiaoyong Sun$^\dagger$$^\ddagger$\footnote{johnsunx1@gmail.com}}

\usepackage{Sweave}
\begin{document}

\setkeys{Gin}{width=1\textwidth}

\title{User Guide for PKgraph Package}
\maketitle
\begin{center}$^\dagger$Binformatics and Computational Biology Program, $^\ddagger$Department of Statistics \\ Iowa State University, Ames, Iowa 50010, USA
\end{center}

\tableofcontents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Introduction}
Population pharmacokinetic (PopPK) modeling has become increasing important in
drug development because it allows unbalanced design, sparse data and the study
of individual variation. However, this complexity of the model makes it a challenge
to diagnose the fit.  Graphics can play an important and unique role in PopPK model diagnostics.
The software described in this paper, PKgraph, provides a graphical user interface for
PopPK model diagnosis with interactive graphics. It also provides an integrated and comprehensive platform for analysis
of pharmacokinetic data including exploratory data analysis, goodness of model fit,
model validation and model comparison. It can be used with a variety of modeling fitting software,
including NONMEM, Monolix, SAS and R. PKGraph is programmed in R, and uses the R packages
lattice, ggplot2 for static graphics, and rggobi for interactive graphics. This R package is
supported with a user-friendly graphical user interface so that users can easily control diagnosing
with simple clicks. The PKGraph software serves as a supplement to the existing packages:
NONMEM, Xpose and PsN for diagnosing models.
\newline
\newline
PKgraph is a R packaged built on the following R packages: RGtk2, gWidgets, gWidgetsRGtk2,
lattice, and ggplot2. It requires R ($>$ 2.0) and  GTK+, and runs under Windows, Linux and Mac.
\section{Installation}
PKgraph needs to install the following programs and R packages:
\newline \newline
1. install GTK \newline
For Windows, you can download the GTK Developer's Pack from
\newline
   http://gladewin32.sourceforge.net/
\newline
\newline
For Unix, you can fetch the source files for the different
libraries from
\newline
   ftp://ftp.gtk.org/pub/gtk/v2.8/
\newline
\newline
2. Install RGtk2 (Please see RGtk2 Installation notes if you have problems) \newline
a. Install R package, RGtk2: \textit{install.packages(``RGtk2'')} \newline \newline
3. install rggobi   \newline
a. Download and install ggobi (www.ggobi.org)  \newline
b. Install rggobi: \textit{install.packages(``rggobi'')} \newline \newline
4. Install gWidgets  \newline
a. Install R package, gWidgets: \textit{install.packages(``gWidgets'')} \newline \newline
5. Install gWidgetsRGtk2 \newline
a. Install R package, gWidgetsRGtk2: \textit{install.packages(``gWidgetsRGtk2'')} \newline \newline
6. Install lattice  \newline
a. Install R package, lattice: \textit{install.packages(``lattice'')} \newline \newline
7. Install ggplot2  \newline
a. Install R package, lattice: \textit{install.packages(``ggplot2'')} \newline \newline
\section{PKgraph infrastructure}
The software incorporates a key concept: interactive graphics to link various datasets and diagnostics plots. The framework is programmed using RGtk2 and consists of main formats of interfaces,
(1) main, containing links to all parts of the software, and handles the basic data management, and links to diagnostic modules, and (2) graph, which provides tools specifically for each diagnostic module. (2). Basic module: data input/output module, configuration module, and data management module.
\newline
\newline
\subsection{Graphical user interfaces}
\subsubsection{Main interface}
The main interface (Figure~\ref{c4_s2_1}) of PKgraph provide the links to all components of the software. There are four areas: (1) tool area (tool bar and menu bar, top), (2) directory area (middle-left), (3) data area (middle-right) and (4) status bar (bottom).
\newline
\newline
\begin{itemize}
	\item The tool area has menu items linking to the basic management modules (project, configuration, data management) and the diagnostic modules (exploratory data analysis, PK models, model validation, model comparison and interactive diagnostics). These are menu items containing numerous functions associated with each of the different types of diagnostics.
	\item The directory area shows current directory and all of its files. These files might be data files, or code, depending on the modeling software used.
	\item Clicking on any of the data files, will open them and display them in the data area (3).  Choosing the file also brings up a panel allowing for different formats to be read, thus handling all possible modeling software formats. The data files might contain raw data, and model diagnostics such as parameter estimates, fitted values and residuals and these are displayed in the table view of the data area.
	\item The stats bar displays the progress of the different functions, for example here it says ``Data is loaded successfully'' to indicate that there were no problems with opening the data file.
\end{itemize}
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_1main.pdf}
\caption{Main interface of PKgraph}
\label{c4_s2_1}
\end{figure}
\subsubsection{Graph interface}
Selecting an item from a diagnostic module menu brings up a graph interface (Figure~\ref{c4_s2_2}). The style of the interface is the same for all diagnostic functionality.  It contains three areas: 1) parameter setup area, 2) tool bar, 3) plot area.
\newline
\newline
\begin{itemize}
	\item The parameter area setup allows choice of variable, plot labels, layout for trellis or facetted plots. A choice of lattice or ggplot2 graphics is provided.
	\item The tool bar allows the plots to be saved, opening the plot in ggobi for interaction on the plot (\textit{ctrl + b} for brushing data), synchronize subset selection from ggobi to the data in R, and close ggobi.
	\item The plot area displays the figure, and multiple figures if more than one are created.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{c4_s2_2graph.pdf}
\caption{Graph interface of PKgraph}
\label{c4_s2_2}
\end{figure}
\subsection{Functional module}
Functional module matches the menu items in PKgraph toolbar. It includes the following menu itmes: \newline
\begin{itemize}
	\item Project
	\item Configure
	\item Data management
	\item Exploratory data analysis
	\item PK models
	\item Model validation
	\item Model comparison
	\item Interactive graphics
\end{itemize}
In the next sections, I will go through each menu item in detail.
\section{Functions}
In this section, I will go through each function in the menu item of toolbar.
\subsection{Project}
This menu itme is in charge of input, output and save data. It has the following functions (Figure~\ref{project}),
\begin{itemize}
	\item \textit{Open data}: open modeling fit result from NONMEM, Monolix, SAS, R or other software.
  It has options to setup the data format, start line and separation symbol.
	\item \textit{Save a file}: save a file.
	\item \textit{Save a workspace}: save a workspace for later usage. It generally saves a group of lists
	for configuration and related data.
	\item \textit{Restore old workspace}: restore the workspace from the data and list you saved from previous step.
	\item \textit{Exit}: exit from PKgraph.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{project.pdf}
\caption{Menu items in \textit{Project}}
\label{project}
\end{figure}
\subsection{Configure}
This menu itme is utilized to configure PKgraph. It has the following functions (Figure~\ref{configure}),
\begin{itemize}
	\item \textit{Set working directory}: change current directory.
	\item \textit{Set saving format}: set up saving format for figures, including pdf, jpg, tiff, png
  bmp, win.metafile, and figure width and height. If figure width and height is not setup, a default one
  will be used.
	\item \textit{Save a workspace}: save a workspace for later usage. It generally saves a group of lists
	for configuration and related data.
	\item \textit{Set figure configuration}: color and loess can be setup here for figures.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{configure.pdf}
\caption{Menu items in \textit{Configure}}
\label{configure}
\end{figure}
\subsection{Data management}
This menu item is utilized to manage data. It has the following functions (Figure~\ref{data}),
\begin{itemize}
	\item \textit{Subset}: subset current data.
	\item \textit{Factor}: factor categorical variables. Graphical packages require
	variables to be factor type in order to display related symbol in figures.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{data.pdf}
\caption{Menu items in \textit{Data management}}
\label{data}
\end{figure}
\subsection{Exploratory data analysis}
This menu item is utilized to explore data and screen patterns. It has the following functions (Figure~\ref{eda}),
\begin{itemize}
	\item \textit{Univariates}: plot univariate varaiables.
	\item \textit{Bivariates}: plot bivariate variables.
	\item \textit{Parallel coordinate plot}: Parallel coordinate plot for multivariate variables.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{eda.pdf}
\caption{Menu items in \textit{Exploratory data analysis}}
\label{eda}
\end{figure}
\subsubsection{Univariate}
When clicking this menu item, users will generate a ``graph interface''(Figure~\ref{c4_s2_2}). In this interface, users can specify all parameters in the left area of window. In the right area of window, it has the following four buttons on the top:
\begin{itemize}
	\item \textit{save}: save figures.
	\item \textit{ggobi}: open the plot in ggobi for interaction on the plot.
	\item \textit{ synchronize}: synchronize subset selection from ggobi to the data in R.
	\item \textit{close}: close ggobi.
\end{itemize}
\subsubsection{Bivariate}
This menu item also generates a ``graph interface''. It is similar to the Univariate interface, except that users will have two variables instead of one.
\subsubsection{Parallel coordinate plots}
This menu item provides access to lattice function: \textit{parallel} function from lattice package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{PK models}
This menu item is utilized to check model assumptions and goodness of fit. The guideline follows Census menu (http://census.sourceforge.net/). It has the following functions (Figure~\ref{pkmodel}),
\begin{itemize}
	\item \textit{Configure model result}: This is the key step to match data variables to default metric system. By this step, data from any platform (NONMEM, Monolix, SAS, R) can be interpreted graphically in figures.
	\item \textit{Individual plots}: Bivariate plot for each individual.
	\item \textit{Goodness of fit plots}: Goodness of fit plot is one of key tools to check model fitting. These kinds of plots will give an overall perspective of model performance, including scatter plot for concentration versus PRED, concentration versus IPRED, PRED versus time and IPRED versus time.
\item \textit{Parameters}: Generally, there are assumptions for distribution of parameters during modeling process. The histogram is utilized to check this distribution. In addition, the correlation of parameters has significant effect on modeling performance, and it can be checked by scatter plots or a scatterplot matrix.
\item \textit{Random effects}: The assumptions for random effects also need to be tested for distribution and correlation by histogram, scatter plots or a scatterplot matrix.
\item \textit{Structural model}: Structural model can be diagnosed by PRED versus concentration conditioned on time, IPRED versus concentration conditioned on time, WRES versus time, WRES versus PRED, PRED versus concentration conditioned on covariates, IPRED versus concentration conditioned on covariates.
\item \textit{Residual error model}: Two assumptions are related to this submodel: 1) homoscedastic variability; 2) symmetrically distributed residuals. To test these assumptions, we applied the following techniques: 1) histogram for distributions of WRES; 2) histogram for individual distribution of WRES; 3) scatterplot of $|$WRES$|$ versus PRED to check the shape of residual; 4) scatterplot of $|$WRES$|$ versus PRED conditioned on covariates to screen the covariate effects; 5) autocorrelation of WRES.
\item \textit{Covariate model}: Parameters, ETA and WRES are of great use to help screen proper covariates. We can utilize the following methods to check covariate models: 1) scatter plot for parameters versus covariates, ETAs versus covariates, WRES versus covariates; 2) scatterplot matrix of covariates.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{pkmodel.pdf}
\caption{Menu items in \textit{PK models}}
\label{pkmodel}
\end{figure}
Users have to configure data variable first before going to specific model diagnostics. To illustrate the usage of this menu item, I will use \textit{Configure model result} and \textit{Parameters} as examples.
%%%%%%%%%%%%%%
\subsubsection{Configure model result}
The interface for this function is shown in Figure~\ref{pkmodel_config}. The fixed variables are from data, and the flexible variables are from default metric system (Table~\ref{c2_s3_t1}).
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{pkmodel_config.pdf}
\caption{\textit{Configure model result} in \textit{PK models}}
\label{pkmodel_config}
\end{figure}
\begin{table}[h!tb] \centering
% Use: \begin{tabular{|lcc|} to put table in a box
\begin{tabular}{lcc} \hline
\textbf{Package variable} & \textbf{Description}  \\ \hline
ID & Patient ID \\
TIME & Time after dose \\
CONC & The concentration of drug in the body \\
PRED & Prediction generated from model fitting \\
RES & Residual \\
WRES & Weighted residual \\
IPRED & Individual prediction \\
IWRES & Individual weighted residual \\
COV & Covariates \\ \hline
\end{tabular}
\caption{Package metric system}
\label{c2_s3_t1}
\end{table}
%%%%%%%%%%%%%%
\subsubsection{Parameters}
The interface for this function is shown in Figure~\ref{pkmodel_para}. After users choose proper figures in the left window, the system will produce all figures automatically. Users can pick specific figures for diagnosing with functions in the toolbar.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{pkmodel_para.pdf}
\caption{\textit{Parameters} in \textit{PK models}}
\label{pkmodel_para}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Model validation}
Resampling methods has been extensively employed in the model validation. Currently, bootstrap targets for confidence interval, case deletion diagnostics identify influential cases, and stochastic simulation is utilized to compare models (PsN).
PKgraph mainly focuses on case deletion diagnostics and bootstrap. It provides the following functions (Figure~\ref{modelv}),
\begin{itemize}
	\item \textit{Influence analysis summary (PsN)}: analyze PsN \textit{cdd} results.
	\item \textit{Visualization for influence analysis}: apply parallel coordinate plots and multidimensional scaling to visualize data from case deletion diagnostics (multiple NONMEM runs).
	\item \textit{Bootstrap summary (PsN)}: analyze PsN \textit{boot} results.
	\item \textit{Visualization for bootstrap}: visualize data from bootstrap (multiple NONMEM runs).
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelv.pdf}
\caption{Menu items in \textit{Model validation}}
\label{modelv}
\end{figure}
%%%%%%%%%%%%%%%
\subsubsection{Influence analysis summary (PsN)}
This function is specifically for PsN \textit{cdd} results (Figure~\ref{infPsN}). It takes two result files from PsN: \textit{raw\_results1.csv} and \textit{skipped\_individuals1.csv}, and generates a scatter plot for cov.raito versus cov.score.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{infPsN.pdf}
\caption{Influence analysis summary (PsN)}
\label{infPsN}
\end{figure}
%%%%%%%%%%%%%%
\subsubsection{Visualization for influence analysis}
This function is to visualize data from case deletion diagnostics (multiple NONMEM runs). Let's use multiple NONMEM run form PsN (Figure~\ref{infCddData}), and find file directory for these runs. Then we can select parameters as shown in Figure~\ref{infCddPara}.  These parameters include:
\begin{itemize}
	\item \textit{Target directory path}: the path for multiple NONMEM runs. It is a required parameter.
	\item \textit{Simulation folder pattern}: the common name style for multiple NONMEM runs. For this example, it is \textit{NM\_run}. It is a required parameter.
	\item \textit{Patient ID}: the ID for each subject. It is a required parameter.
	\item \textit{Plot variable}: the variable you use to detect difference among patients. For this example, we choose \textit{CL}. It is a required parameter.
	\item \textit{xlabel}: the name label for each NONMEM run. It is optional.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{infCddData.pdf}
\caption{Multiple NONMEM runs for case deletion diagnostics}
\label{infCddData}
\end{figure}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{infCddPara.pdf}
\caption{Parameters and results for case deletion diagnostics}
\label{infCddPara}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Bootstrap summary (PsN)}
This function is specifically for PsN \textit{boot} results (Figure~\ref{bootPsN}). It takes two result files from PsN: \textit{raw\_results1.csv} and \textit{included\_individuals1.csv}, and generates related plots.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{bootPsN.pdf}
\caption{Bootstrap summary (PsN)}
\label{bootPsN}
\end{figure}
%%%%%%%%%%%%%%%%%%%
\subsubsection{Visualization for bootstrap}
This function is to visualize data from boostrap (multiple NONMEM runs). Let's use multiple NONMEM run form PsN (Figure~\ref{bootData}), and find file directory for these runs. Then we can select parameters as shown in Figure~\ref{bootPara}.  These parameters include:
\begin{itemize}
	\item \textit{Target directory path}: the path for multiple NONMEM runs. It is a required parameter.
	\item \textit{Bootstrap folder pattern}: the common name style for multiple NONMEM runs. For this example, it is \textit{NM\_run}. It is a required parameter.
	\item \textit{NONMEM result file name}: the fit result for each NONMEM run. In this example, it is \textit{CS1\_IV1ESTFPDF-1.fit }. It is a required parameter.
	\item \textit{Bootstrap key table path}: the path for bootstrap key file, which is file describing the sampling schema for patient IDs. It is a required parameter.
	\item \textit{Bootstrap key table name}: The file describes the sampling schema for patient IDs In this example, it is \textit{included\_individuals1.csv}. It is a required parameter.
	\item \textit{Patient ID}: the ID for each subject. It is a required parameter.
	\item \textit{Plot variable}: the variable you use to detect difference among patients. For this example, we choose \textit{CL}. It is a required parameter.
	\item \textit{xlabel}: the name label for each NONMEM run. It is optional.
\end{itemize}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{bootData.pdf}
\caption{Multiple NONMEM runs for bootstrap}
\label{bootData}
\end{figure}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{bootPara.pdf}
\caption{Parameters and results for bootstrap visualization}
\label{bootPara}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Model comparison}
In this process, there are three main steps: 1) select datasets; 2) configure mapping; 3) comparison (Figure~\ref{modelc}). The first step is to select datasets for comparison. Currently the program only supports comparison of two models. Then users proceed to configure mapping by matching column names or variable names from two data sets. These matching variables are generally the variables from original data sets and they are not related to model fitting. When all parameters are set, the program offers three choices for comparison: ``histogram comparison'' (distribution comparison), ``scatter plot comparison'' and ``transform comparison''.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelc.pdf}
\caption{Menu items in \textit{Model comparison}}
\label{modelc}
\end{figure}
%%%%%%%%%%%
\subsubsection{Select datasets}
This function is to select datasets available in the PKgraph data area. Figure~\ref{modelcData} shows there are three data sets available, including fit result 2:  2\_CS1\_IV1ESTFPDF.fit (fit with additive error model) and fit result 3: 3\_ CS1\_IV1ESTFPDF.fit2 (proportional error model). In this example, we will compare these two models.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelcData.pdf}
\caption{\textit{Select datasets} in \textit{Model comparison}}
\label{modelcData}
\end{figure}
%%%%%%%%%%%%%%
\subsubsection{Configure mapping}
This step will join two fit results. As a result, users have to match the original data variables between two fit results. For example (Figure~\ref{modelcMap}),
\begin{itemize}
	\item \textit{Matching variables}: \textit{ID, Time, Concentration, WT, AGE}, etc must be matched in this step. These variables do not change with different models.
	\item \textit{Non-matching variables}: \textit{RES, PRED, WRES}, etc are fit results, and should NOT be matched. These variables change with different models.
\end{itemize}
After mapping, a new dataset joining two fit results will show in data area of main interface.
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelcMap.pdf}
\caption{\textit{Configure mapping} in \textit{Model comparison}}
\label{modelcMap}
\end{figure}
%%%%%%%%%%%%%%%
\subsubsection{Comparison}
``histogram comparison'' enables to compare distributions of matching parameters from two models. ``scatter plot comparison''  provides a environment to compare matching parameters by scatter plot. ``transform comparison''  transforms data by ratio or log ratio in order to visualize the difference between variables from two models. All these models can be linked directly to ggobi for interactive diagnostics by clicking second button in the tool bar area on the top right panel.
\newline
\newline
All variable names for model 1 will have additional ``.x'' label, and all variable names for model 2 will have additional ``.y'' label.
\newline
\newline
Let us look at ``histogram comparison'' as one example. First, we need to make sure that current data set is ``4\_ModelComparison'' (Figure~\ref{modelcc1}); second, we click ``histogram comparison''. To compare \textit{CL}, we select \textit{ISM (gender)} as the conditional variable, and the result is shown in (Figure~\ref{modelcc2}).
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelcc1.pdf}
\caption{Current data set for \textit{Model comparison}}
\label{modelcc1}
\end{figure}
\begin{figure}[h!tb] \centering
\includegraphics[scale=0.6]{modelcc2.pdf}
\caption{\textit{histogram comparison} for \textit{Model comparison}}
\label{modelcc2}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Interactive graphics}
This functional module incorporates a unique feature: interactive graphics into every step of model diagnostics. It targets to link diverse data sets in one integrative platform. Users can have access to this feature through \textit{ggobi} button in the graph interface. In addition, users have flexibility to apply this feature to achieve their specific goals. In the toolbar, there is option: \textit{interactive graphics}, designed for this purpose. It includes three steps: select datasets; configure mapping; and diagnostics. By linking diverse data sets with a key variable, users can seek patterns by brushing, linking and diagnosing patterns conveniently.
\newline
\newline
In ggobi, the main operation for brushing data is \textit{ctrl + b}. By moving the brushing rectangle, the users can select interesting subsets in ggobi. More information is available in http:\\www.ggobi.org if needed.
\section{Example}
One dataset from NONMEM is utilized to demonstrate PKgraph. This data set has 100 patients with covariates: ISM (gender), AGE, and WT. The data is fitted with one compartment model with zero order absorption and first order elimination.
\newline
\newline
As a text file, the fitting result from NONMEM is imported into PKgraph for further investigation and analysis. In the ``open'' dialog, we set up file format for reading with default parameters, and as a result, the input data shows up on the right panel while a message, ``Data is loaded successfully'' appears in the status bar at bottom of panel.
\newline
\newline
To further explore data, first, we choose ``Bivariates'' from ``Exploratory Data Analysis'' located at menu bar to check the scatter plots of interested variables(Figure~\ref{c4_s2_5eda1}, Figure~\ref{c4_s2_5eda2}). The option ``cond'' from the functional model interface helps user to draw conditional plots to seek patterns for subgroups. Certainly, users can also select ``ggplot2'' graphic package with different taste of figure. Next, we can take advantage of interactive techniques to look at maximum concentration by clicking second image button on the right panel. This will start ggobi and load related data. GGobi includes two windows: console window and plot window. In order to link figures together, users need to open all interested figures by ``Display'' option in the menu bar. The following figure clearly shows that maximum concentration comes from male patients (value: 1). To look at these data in detail, we go back to the figure graphical user interface and click third image button to check selected data set in ggobi. The selected data set pops up and links to patient with ID: 55. We repeat the same procedure for other variables to check patterns.
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_5eda1.pdf}
\caption{Exploratory data analysis. Peak is identified with brushing. This patient is from light weight and middle age group.}
\label{c4_s2_5eda1}
\end{figure}
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_5eda2.pdf}
\caption{Exploratory data analysis. The detailed information for this patient is selected for investigation.}
\label{c4_s2_5eda2}
\end{figure}
\newline
\newline
Next, we utilize ``PK model'' option to check model assumptions and diagnose model fitting. The program provides default names such as ID, TIME, COV, etc in order to automatically generate diagnosing results. After we match data variables to the default names, we can proceed to automatically generate routine goodness of fit plots for interested models. Figure ~\ref{c4_s2_6} is one of the results for structural model diagnostics.
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_6.pdf}
\caption{Structural model diagnostics.}
\label{c4_s2_6}
\end{figure}
\newline
\newline
To further look at the influential cases from same data set, we can link them together by ``model validation'' option in menu bar. In this process, we have 100 NONMEM runs available at directory: C:$\backslash$ Projects$\backslash$modelfit\_dir1 using PsN function: cdd. Let's input the path of these NONM runs, and select plot variable as ``CL''. After clicking ``OK'', we will have the parallel coordinates plot showing the CL variables for all NONMEM runs. From Figure ~\ref{c4_s2_7}, we can see some patients have more influential effects on CL when records from these patients are deleted.
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_7.pdf}
\caption{Influence analysis}
\label{c4_s2_7}
\end{figure}
\newline
\newline
Let's identify these influential cases with interactive graphics. Figure ~\ref{c4_s2_8} clearly demonstrates that these influential cases come from patient 52 and 20 based on multidimensional scaling and parallel coordinate plots.
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_8.pdf}
\caption{Influence analysis: linking results from multidimensional scaling and parallel coordinate plots.}
\label{c4_s2_8}
\end{figure}
\newline
\newline
In addition, we compare additive error model (2\_CS1\_IV1ESTFPDF.fit) with proportional error model (3\_ CS1\_IV1ESTFPDF.fit2) by ``model comparison'' function in the menu bar. By comparing the distribution of two models, Figure ~\ref{c4_s2_9} does not find significant difference between two models for CL. In addition, using gender as a conditional variable, we found first model always gave a higher peak value for both male and female.
\begin{figure}[h!tb]
\centering
\includegraphics[scale=0.6]{c4_s2_9.pdf}
\caption{Histogram comparison for
comparing distributions of CL from two models.}
\label{c4_s2_9}
\end{figure}



\end{document}
