content
stringlengths 0
14.9M
| filename
stringlengths 44
136
|
---|---|
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @describeIn ind.plots.wres.hist Histograms of conditional
#' weighted residuals for each individual
#' @export
ind.plots.cwres.hist <-
function(object,
wres="cwres",
...) {
obj <- ind.plots.wres.hist(object,wres=wres,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ind.plots.cwres.hist.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @describeIn ind.plots.wres.qq Q-Q plots of conditional
#' weighted residuals for each individual
#' @export
ind.plots.cwres.qq <-
function(object,
wres="cwres",
...) {
obj <- ind.plots.wres.qq(object,wres="cwres",...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ind.plots.cwres.qq.R |
#' Histograms of weighted residuals for each individual in an Xpose data
#' object, for Xpose 4
#'
#' This is a compound plot consisting of histograms of the distribution of
#' weighted residuals (any weighted residual available from NONMEM) for every
#' individual in the dataset. It is a wrapper encapsulating arguments to the
#' \code{\link{xpose.plot.histogram}} function.
#'
#' Matrices of histograms of weighted residuals in each included individual are
#' displayed. \code{ind.plots.cwres.hist} is just a wrapper for
#' \code{ind.plots.wres.hist(object,wres="cwres").}
#'
#' @param object An xpose.data object.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param wres Which weighted residual should we plot? Defaults to the WRES.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param layout A list giving the layout of the graphs on the plot, in columns
#' and rows. The default is 4x4.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot. The default is FALSE.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param scales see \code{\link{xpose.plot.histogram}}
#' @param aspect see \code{\link{xpose.plot.histogram}}
#' @param force.by.factor see \code{\link{xpose.plot.histogram}}
#' @param ids see \code{\link{xpose.plot.histogram}}
#' @param as.table see \code{\link{xpose.plot.histogram}}
#' @param hiborder the border colour of the histogram - an integer or string.
#' The default is black (see \code{\link[lattice]{histogram}}).
#' @param hicol the fill colour of the histogram - an integer or string. The
#' default is blue (see \code{\link[lattice]{histogram}}).
#' @param hilty the border line type of the histogram - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hilwd the border line width of the histogram - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hidcol the fill colour of the density line - an integer or string.
#' The default is black (see \code{\link[lattice]{histogram}}).
#' @param hidlty the border line type of the density line - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hidlwd the border line width of the density line - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param prompt Specifies whether or not the user should be prompted to press
#' RETURN between plot pages. Default is FALSE.
#' @param mirror Mirror plots are not yet implemented in this function and this
#' argument must contain a value of \code{NULL}
#' @param main.cex The size of the title.
#' @param max.plots.per.page Maximum number of plots per page
#' @param \dots Other arguments passed to \code{\link{xpose.plot.histogram}}.
#' @return Returns a compound plot comprising histograms of weighted residual
#' conditioned on individual.
#' @author E. Niclas Jonsson, Mats Karlsson, Justin Wilkins & Andrew Hooker
#' @seealso \code{\link{xpose.plot.histogram}},
#' \code{\link{xpose.panel.histogram}}, \code{\link[lattice]{histogram}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' ## A plot of the first 16 individuals
#' ind.plots.cwres.hist(xpdb, subset="ID<18")
#'
#' @export
#' @family specific functions
ind.plots.wres.hist <-
function(object,
main = "Default",
wres="wres",
#xlb = NULL,
# ylb = xlabel(xvardef("dv",object),object),
ylb = NULL,
layout=c(4,4),
inclZeroWRES=FALSE,
subset=xsubset(object),
scales=list(cex=0.7,tck=0.5),
aspect="fill",
force.by.factor=TRUE,
ids=F,
as.table=TRUE,
hicol = object@[email protected]$hicol,
hilty = object@[email protected]$hilty,
hilwd = object@[email protected]$hilwd,
hidcol = object@[email protected]$hidcol,
hidlty = object@[email protected]$hidlty,
hidlwd = object@[email protected]$hidlwd,
hiborder = object@[email protected]$hiborder,
prompt = FALSE,
mirror=NULL,
main.cex=0.9,
max.plots.per.page=1,
#lty=c(0,1,1),
#pch=c(21,32,32),
#type="o",
#col=c(1,object@[email protected]$smcol,object@[email protected]$lmcol),
#lwd=1,
...) {
## Make sure we have the necessary variables defined in the ##
## object. ##
if(is.null(check.vars(c("id",wres),object))) {
return(NULL)
}
## check for mirror
if(!is.null(mirror)){
cat("Mirror not currently implemented for individual plots\n")
return()
}
data <- Data(object,inclZeroWRES,subset=subset)
## Bin them
list.id <- unique(data[[xvardef("id",object)]])
length.id <- length(list.id)
plots.per.page <- layout[1] * layout[2]
plots.cur <- 0
pages <- 1
page.breaks <- c(0)
old.obj <- object
new.obj <- object
new.obj@Data <- NULL
for (i in list.id) {
plots.cur <- plots.cur + 1
if (plots.cur == plots.per.page) {
pages <- pages + 1
plots.cur <- 0
page.breaks <- c(page.breaks, i)
}
}
if (max(page.breaks) < max(list.id)) {
page.breaks <- c(page.breaks, max(list.id))
}
data$bin <- cut(data$ID, page.breaks, include.lowest=T)
id.levels <- levels(data$bin)
plot.num <- 0
plotList <- vector("list",length(id.levels))
for (i in id.levels) { ## start loop
new.obj@Data <- data[data$bin==i,] #subset(data, bin == i)
## Set up the data ##
## nobj <- new("xpose.data",
## Runno=object@Runno,
## Data = NULL
## )
## Data(nobj) <- Data(new.obj,inclZeroWRES=inclZeroWRES,
## subset=subset)
if(is.null(xvardef(wres,object))){
plotvar <- wres
}else{
plotvar <- xvardef(wres,object)
}
## Fix any main and/or axis titles
default.plot.title <- paste("Individual plots of", plotvar, sep=" ")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
# Set y axis title
## if (is.null(xlb)) {
## xlb <- xlabel(xvardef("wres",object),object)
## }
## if (is.null(ylb)) {
## ylb <- "Proportion"
## }
xplot <- xpose.plot.histogram(plotvar,#xvardef("wres",nobj),
new.obj,
#xlb = xlb,
#ylb = ylb,
by=xvardef("id",new.obj),
main=plotTitle,
#group="ind",
layout=layout,
scales=scales,
aspect=aspect,
xvar = plotvar,#xvardef("wres",object),
force.by.factor=force.by.factor,
ids=ids,
subset=subset,
as.table=as.table,
hicol = hicol,
hilty = hilty,
hilwd = hilwd,
hidcol = hidcol,
hidlty = hidlty,
hidlwd = hidlwd,
hiborder = hiborder,
main.cex=main.cex,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
obj <- xpose.multiple.plot(plotList,max.plots.per.page=max.plots.per.page,plotTitle=NULL,prompt=prompt,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ind.plots.wres.hist.R |
#' Quantile-quantile plots of weighted residuals for each individual in an
#' Xpose data object, for Xpose 4
#'
#' This is a compound plot consisting of QQ plots of the distribution of
#' weighted residuals (any weighted residual produced by NONMEM) for every
#' individual in the dataset. The function is a wrapper encapsulating
#' arguments to the \code{\link{xpose.plot.qq}} function.
#'
#' Matrices of Q-Q plots of weighted residuals in each included individual are
#' displayed.
#'
#' A wide array of extra options controlling Q-Q plots are available. See
#' \code{\link{xpose.plot.qq}} for details.
#'
#' @param object An xpose.data object.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param wres Which weighted residual should we plot? Defaults to the WRES.
#' @param layout A list giving the layout of the graphs on the plot, in columns
#' and rows. The default is 4x4.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot. The default is FALSE.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param scales See \code{\link{xpose.plot.qq}}.
#' @param aspect See \code{\link{xpose.plot.qq}}.
#' @param force.by.factor See \code{\link{xpose.plot.qq}}.
#' @param ids See \code{\link{xpose.plot.qq}}.
#' @param as.table See \code{\link{xpose.plot.qq}}.
#' @param type 1-character string giving the type of plot desired. The
#' following values are possible, for details, see 'plot': '"p"' for points,
#' '"l"' for lines, '"o"' for over-plotted points and lines, '"b"', '"c"') for
#' (empty if '"c"') points joined by lines, '"s"' and '"S"' for stair steps and
#' '"h"' for histogram-like vertical lines. Finally, '"n"' does not produce
#' any points or lines.
#' @param col The color for lines and points. Specified as an integer or a text
#' string. A full list is obtained by the R command \code{colours()}. The
#' default is blue (col=4).
#' @param pch The plotting character, or symbol, to use. Specified as an
#' integer. See R help on \code{\link{points}}. The default is an open circle.
#' @param cex The amount by which plotting text and symbols should be scaled
#' relative to the default. 'NULL' and 'NA' are equivalent to '1.0'.
#' @param abllwd Line width of the line of identity.
#' @param abllty Line type of the line of identity.
#' @param ablcol Line colour of the line of identity.
#' @param prompt Specifies whether or not the user should be prompted to press
#' RETURN between plot pages. Default is FALSE.
#' @param mirror Mirror plots are not yet implemented in this function and this
#' argument must contain a value of \code{NULL}
#' @param main.cex The size of the title.
#' @param max.plots.per.page Maximum number of plots per page
#' @param \dots Other arguments passed to \code{link{xpose.plot.qq}}.
#' @return Returns a compound plot comprising QQ plots of weighted residuals
#' conditioned on individual.
#' @author E. Niclas Jonsson, Mats Karlsson, Justin Wilkins & Andrew Hooker
#' @seealso \code{\link{xpose.plot.qq}}, \code{\link{xpose.panel.qq}},
#' \code{\link{qqplot}}, \code{\link[lattice]{qqmath}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' ind.plots.cwres.qq(simpraz.xpdb,subset="ID<18")
#'
#' @export
#' @family specific functions
ind.plots.wres.qq <-
function(object,
main = "Default",
wres="wres",
#xlb = NULL,
# ylb = xlabel(xvardef("dv",object),object),
#ylb = NULL,
layout=c(4,4),
inclZeroWRES=FALSE,
subset=xsubset(object),
scales=list(cex=0.7,tck=0.5),
aspect="fill",
force.by.factor=TRUE,
ids=F,
as.table=TRUE,
type="o",
pch=object@[email protected]$pch,
col=object@[email protected]$col,
cex=object@[email protected]$cex,
abllty = object@[email protected]$abllty,
abllwd = object@[email protected]$abllwd,
ablcol = object@[email protected]$ablcol,
prompt = FALSE,
main.cex=0.9,
mirror=NULL,
max.plots.per.page=1,
...) {
## check for mirror
if(!is.null(mirror)){
cat("Mirror not currently implemented for individual plots\n")
return()
}
## Make sure we have the necessary variables defined in the ##
## object. ##
if(is.null(check.vars(c("id",wres),object,silent=F))) {
return(NULL)
}
## subset the data
data <- Data(object,inclZeroWRES,subset=subset)
## get plotvar
if(is.null(xvardef(wres,object))){
plotvar <- wres
}else{
plotvar <- xvardef(wres,object)
}
## Fix any main and/or axis titles
default.plot.title <- paste("Individual Q-Q plots of", plotvar, sep=" ")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
## Bin them
list.id <- unique(data[[xvardef("id",object)]])
length.id <- length(list.id)
plots.per.page <- layout[1] * layout[2]
plots.cur <- 0
pages <- 1
page.breaks <- c(0)
old.obj <- object
new.obj <- object
new.obj@Data <- NULL
for (i in list.id) {
plots.cur <- plots.cur + 1
if (plots.cur == plots.per.page) {
pages <- pages + 1
plots.cur <- 0
page.breaks <- c(page.breaks, i)
}
}
if (max(page.breaks) < max(list.id)) {
page.breaks <- c(page.breaks, max(list.id))
}
data$bin <- cut(data$ID, page.breaks, include.lowest=T)
id.levels <- levels(data$bin)
plot.num <- 0
plotList <- vector("list",length(id.levels))
for (i in id.levels) { ## start loop
#new.obj@Data <- subset(data, bin == i)
new.obj@Data <- data[data$bin==i,] #subset(data, bin == i)
## Set up the data ##
## Figure out what variables we have defined
## select <- xvardef("wres",object)
## numpans <- length(select)
## nobj <- new("xpose.data",
## Runno=object@Runno,
## Data = NULL
## )
## Data(nobj) <- Data(new.obj,inclZeroWRES=inclZeroWRES,
## subset=subset)
xplot <- xpose.plot.qq(plotvar,
new.obj,
##xlb = xlb,
##ylb = ylb,
by=xvardef("id",new.obj),
main=plotTitle,
##group="ind",
layout=layout,
scales=scales,
aspect=aspect,
xvar = plotvar,
force.by.factor=force.by.factor,
ids=ids,
pch=pch,
#col=col,
abllty=abllty,
abllwd=abllwd,
ablcol=ablcol,
subset=subset,
as.table=as.table,
main.cex=main.cex,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
obj <- xpose.multiple.plot(plotList,max.plots.per.page=max.plots.per.page,plotTitle=NULL,prompt=prompt,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ind.plots.wres.qq.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Individual predictions (IPRED) plotted against the independent variable
#' (IDV) for Xpose 4
#'
#' This is a plot of Individual predictions (IPRED) vs the independent variable
#' (IDV), a specific function in Xpose 4. It is a wrapper encapsulating
#' arguments to the \code{xpose.plot.default} function. Most of the options
#' take their default values from xpose.data object but may be overridden by
#' supplying them as arguments.
#'
#' A wide array of extra options controlling \code{xyplot}s are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns an xyplot of IPRED vs IDV.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.panel.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' ipred.vs.idv(xpdb)
#'
#' ## A conditioning plot
#' ipred.vs.idv(xpdb, by="HCTZ")
#'
#' ## Logarithmic Y-axis
#' ipred.vs.idv(xpdb, logy=TRUE)
#'
#' ## Custom colours and symbols, IDs
#' ipred.vs.idv(xpdb, cex=0.6, pch=3, col=1, ids=TRUE)
#'
#' @export ipred.vs.idv
#' @family specific functions
ipred.vs.idv <-
function(object,
smooth=TRUE,
...) {
## Make sure we have the necessary variables defined
if(is.null(check.vars(c("ipred","idv"),object))) {
return(NULL)
}
xplot <- xpose.plot.default(xvardef("idv",object),
xvardef("ipred",object),
smooth=smooth,
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ipred.vs.idv.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @rdname check.vars
"is.readable.file" <- function(filename )
{
## If we are not dealing with R -> Splus
if(is.null(version$language)) {
cat("This version of Xpose needs to be run with R")
## if(platform() == "WIN386") {
## access(filename, 4) == 0
## } else {
## filename <- paste("'", filename, "'", sep = "")
## sapply(paste("test -f", filename, "-a -r", filename), unix,
## output = F) == 0
## }
} else {
return(file.exists(filename)[1])
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/is.readable.file.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Histogram of individual weighted residuals (IWRES), for Xpose 4
#'
#' This is a histogram of the distribution of individual weighted residuals
#' (IWRES) in the dataset, a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.histogram} function.
#'
#' Displays a histogram of the individual weighted residuals (IWRES).
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{\link{xpose.plot.histogram}}.
#' @return Returns a histogram of individual weighted residuals (IWRES).
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.histogram}},
#' \code{\link{xpose.panel.histogram}}, \code{\link[lattice]{histogram}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' iwres.dist.hist(simpraz.xpdb)
#'
#' @export iwres.dist.hist
#' @family specific functions
iwres.dist.hist <-
function(object,
...) {
## Make sure we have the necessary variables defined
if(is.null(check.vars(c("iwres"),object))) {
return(NULL)
}
xplot <- xpose.plot.histogram(xvardef("iwres",object),
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/iwres.dist.hist.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 28/11/2005
#' Quantile-quantile plot of individual weighted residuals (IWRES), for Xpose 4
#'
#' This is a QQ plot of the distribution of individual weighted residuals
#' (IWRES) in the dataset, a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.qq} function.
#'
#' Displays a QQ plot of the individual weighted residuals (IWRES).
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{link{xpose.plot.qq}}.
#' @return Returns a QQ plot of individual weighted residuals (IWRES).
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.qq}}, \code{\link{xpose.panel.qq}},
#' \code{\link[lattice]{qqmath}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' iwres.dist.qq(simpraz.xpdb)
#'
#' @export iwres.dist.qq
#' @family specific functions
"iwres.dist.qq" <-
function(object,
...) {
## Make sure we have the necessary variables defined
if(is.null(check.vars(c("iwres"),object))) {
return(NULL)
}
xplot <- xpose.plot.qq(xvardef("iwres",object),
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/iwres.dist.qq.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Individual weighted residuals (IWRES) plotted against the independent
#' variable (IDV) for Xpose 4
#'
#' This is a plot of individual weighted residuals (IWRES) vs the independent
#' variable (IDV), a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} function. Most of
#' the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' A wide array of extra options controlling \code{xyplots} are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param abline Vector of arguments to the \code{\link[lattice]{panel.abline}}
#' function. No abline is drawn if \code{NULL}. Here, the default is c(0,0),
#' specifying a horizontal line at y=0.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns an xyplot of IWRES vs IDV.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.panel.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' iwres.vs.idv(xpdb)
#'
#' ## A conditioning plot
#' iwres.vs.idv(xpdb, by="HCTZ")
#'
#' @export iwres.vs.idv
#' @family specific functions
"iwres.vs.idv" <-
function(object,
abline=c(0,0),
smooth=TRUE,
...) {
if(is.null(check.vars(c("idv","iwres"),
object,silent=FALSE))) {
return()
}
xplot <- xpose.plot.default(xvardef("idv",object),
xvardef("iwres",object),
object,
smooth = smooth,
abline=abline,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/iwres.vs.idv.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Kaplan-Meier plots of (repeated) time-to-event data
#'
#' Kaplan-Meier plots of (repeated) time-to-event data. Includes VPCs.
#'
#'
#' @param x The independent variable.
#' @param y The dependent variable. event (>0) or no event (0).
#' @param id The ID variable in the dataset.
#' @param data A dataset can be used instead of the data in an Xpose object.
#' Must have the same form as an xpose data object \code{xpdb@Data}.
#' @param evid The EVID data item. If not present then all rows are considered
#' events (can be censored or an event). Otherwise, EVID!=0 are dropped from
#' the data set.
#' @param by A vector of conditioning variables.
#' @param xlab X-axis label
#' @param ylab Y-axis label
#' @param object An Xpose object. Needed if no \code{data} is supplied.
#' @param events.to.plot Vector of events to be plotted. "All" means that all
#' events are plotted.
#' @param sim.data The simulated data file. Should be a table file with one
#' header row and have, at least, columns with headers corresponding to
#' \code{x}, \code{y}, \code{id}, \code{by} (if used), \code{nsim.lab} and
#' \code{sim.evct.lab}.
#' @param sim.zip.file The \code{sim.data} can be in \.zip format and xpose
#' will unzip the file before reading in the data. Must have the same
#' structure as described above in \code{sim.data}.
#' @param VPC \code{TRUE} or \code{FALSE}. If \code{TRUE} then Xpose will
#' search for a zipped file with name
#' \code{paste("simtab",object@Runno,".zip",sep="")}, for example
#' "simtab42.zip".
#' @param nsim.lab The column header for \code{sim.data} that contains the
#' simulation number for that row in the data.
#' @param sim.evct.lab The column header for \code{sim.data} that contains the
#' individual event counter information. For each individual the event counter
#' should increase by one for each event (or censored event) that occurs.
#' @param probs The probabilities (non-parametric percentiles) to use in
#' computation of the prediction intervals for the simulated data.
#' @param add.baseline Should a (x=0,y=1) baseline measurement be added to each
#' individual in the dataset. Otherwise each plot will begin at the first event
#' in the dataset.
#' @param add.last.area Should an area be added to the VPC extending the last
#' PI?
#' @param subset The subset of the data and sim.data to use.
#' @param main The title of the plot. Can also be \code{NULL} or
#' \code{"Default"}.
#' @param main.sub The title of the subplots. Must be a list, the same length
#' as the number of subplots (actual graphs), or \code{NULL} or
#' \code{"Default"}.
#' @param main.sub.cex The size of the title of the subplots.
#' @param nbins The number of bins to use in the VPC. If \code{NULL}, the the
#' number of unique \code{x} values in \code{sim.data} is used.
#' @param real.se Should the standard errors of the real (non simulated) data
#' be plotted? Calculated using \code{\link[survival]{survfit}}.
#' @param real.se.type Type for the standard errors.
#' @param real.type Type for the real data.
#' @param real.lwd Line width (lwd) for the real data.
#' @param real.lty Line type (lty) for the curve of the original (or real)
#' data.
#' @param real.col Color for the curve of the original (or real) data.
#' @param real.se.lty Line type (lty) for the standard error lines.
#' @param real.se.lwd Line width (lwd) for the standard error lines.
#' @param real.se.col Color for the standard error lines.
#' @param cens.type Type for the censored lines.
#' @param cens.lty Line type (lty) for the censored lines.
#' @param cens.col Color for the censored lines.
#' @param cens.lwd Line width for the censored lines.
#' @param cens.rll The relative line length of the censored line compared to the limits of the y-axis.
#' @param cov The covariate in the dataset to plot instead of the survival
#' curve.
#' @param cov.fun The summary function for the covariate in the dataset to plot
#' instead of the survival curve.
#' @param inclZeroWRES Include WRES=0 rows from the real data set in the plots?
#' @param onlyfirst Include only the first measurement for the real data in the
#' plots?
#' @param samp Simulated data in the xpose data object can be used as the
#' "real" data. \code{samp} is a number selecting which simulated data set to
#' use.
#' @param poly.alpha The transparency of the VPC shaded region.
#' @param poly.fill The fill color of the VPC shaded region.
#' @param poly.line.col The line colors for the VPC region.
#' @param poly.lty The line type for the VPC region.
#' @param censor.lines Should censored observations be marked on the plot?
#' @param ylim Limits for the y-axes
#' @param \dots Additional arguments passed to the function.
#' @return returns an object of class "xpose.multiple.plot".
#' @author Andrew C. Hooker
#' @seealso \code{\link[survival]{survfit}}, \code{\link[survival]{Surv}},
#' \code{\link{xpose.multiple.plot}}.
#' @examples
#'
#' \dontrun{
#' library(xpose4)
#'
#' ## Read in the data
#' runno <- "57"
#' xpdb <- xpose.data(runno)
#'
#' ####################################
#' # here are the real data plots
#' ####################################
#'
#' kaplan.plot(x="TIME",y="DV",object=xpdb)
#' kaplan.plot(x="TIME",y="DV",object=xpdb,
#' events.to.plot=c(1,2),
#' by=c("DOSE==0","DOSE!=0"))
#' kaplan.plot(x="TIME",y="DV",object=xpdb,
#' events.to.plot=c(1,2),
#' by=c("DOSE==0","DOSE==10",
#' "DOSE==50","DOSE==200"))
#'
#' ## make a PDF of the plots
#' pdf(file=paste("run",runno,"_kaplan.pdf",sep=""))
#' kaplan.plot(x="TIME",y="DV",object=xpdb,
#' by=c("DOSE==0","DOSE==10",
#' "DOSE==50","DOSE==200"))
#' dev.off()
#'
#' ####################################
#' ## VPC plots
#' ####################################
#'
#' kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,events.to.plot=c(1))
#' kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
#' events.to.plot=c(1,2,3),
#' by=c("DOSE==0","DOSE!=0"))
#' kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
#' events.to.plot=c(1),
#' by=c("DOSE==0","DOSE==10","DOSE==50","DOSE==200"))
#'
#' ## make a PDF of all plots
#' pdf(file=paste("run",runno,"_kaplan.pdf",sep=""))
#' kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,
#' by=c("DOSE==0","DOSE==10","DOSE==50","DOSE==200"))
#' dev.off()
#' }
#'
#' @export
#' @family specific functions
kaplan.plot <-
function(x="TIME",y="DV",id="ID",
data= NULL,
evid="EVID",
by=NULL,
xlab="Time",
#ylab="Survival (%)",
ylab="Default",
object=NULL,
events.to.plot="All",
sim.data=NULL,
sim.zip.file=NULL,
VPC = FALSE,
nsim.lab="simNumber",
sim.evct.lab="counter",
probs=c(0.025,0.975),
add.baseline=T,
add.last.area=T,
subset=NULL,
##subset.real=NULL,
main="Default",
main.sub="Default",
main.sub.cex = 0.8,
nbins=NULL,
real.type="l",
real.lty=1,
real.lwd=1,
real.col="blue",
real.se= if(!is.null(sim.data)) F else T,
real.se.type="l",
real.se.lty=2,
real.se.lwd=0.5,
real.se.col="red",
cens.type="l",
cens.lty=1,
cens.col="black",
cens.lwd=1,
cens.rll=0.02,
inclZeroWRES=TRUE,
onlyfirst=FALSE,
#RTTE=FALSE,
samp=NULL,
poly.alpha=1,
poly.fill="lightgreen",
poly.line.col="darkgreen",
poly.lty=2,
censor.lines=TRUE,
ylim=c(-5,105),
cov = NULL,
cov.fun = "mean",
...)
{
## example call
## kaplan.plot(x="TIME",y="DV",object=xpdb,VPC=T,cov="DOSE",cov.fun="mean")
## make max/min of VPC and read data the limits of the x and y-axis
## use latticeExtra C command
##Get data for xpose object
if(is.null(object) && is.null(data)) cat("one of data or object should be defined in function input.")
if(!is.null(data)){
if(!is.null(subset)){
#on.exit(detach(data))
#attach(data,warn.conflicts=F)
#data <- data[eval(parse(text=paste("data$", subset))),]
data<-with(data,data[eval(parse(text=subset)),])
if(dim(data)[1]==0) return(NULL)
}
}
if(!is.null(object)){
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
}
if (VPC && !is.null(object)) sim.zip.file <- paste("simtab",object@Runno,".zip",sep="")
if (!is.null(sim.zip.file)){
sim.data <- read.table(unz(sim.zip.file,
sub(".zip", "",sim.zip.file)),
skip=0,header=T)
}
if(!is.null(sim.data)){
if(!is.null(subset)){
#on.exit(detach(sim.data))
#attach(sim.data,warn.conflicts=F)
#sim.data <- sim.data[eval(parse(text=paste("sim.data$", subset))),]
sim.data<-with(sim.data,sim.data[eval(parse(text=subset)),])
if(dim(sim.data)[1]==0) return(NULL)
}
}
## Check if this is RTTE or TTE data
data$counter <- 0
counter <- 0
old.id <- 0
for(i in 1:length(data$counter)){
new.id <- data[[id]][i]
if(new.id != old.id){counter <- 0}
old.id <- new.id
if(!is.null(data[[evid]])){ # filter on evid
if (data[[evid]][i]==0) counter=counter+1
} else { # all rows are events
counter=counter+1
}
data$counter[i]=counter
}
events <- max(data$counter)
RTTE = FALSE
if(events>1) RTTE = TRUE
max.events <- events
if(!is.null(sim.data)){
sim.events <- max(sim.data[[sim.evct.lab]])
#if(sim.events>1) RTTE = TRUE
#max.events <- max(sim.events,events)
}
full.data <- data
y.true <- y
if(!is.null(sim.data)){
full.sim.data <- sim.data
## add sim.ID
## add a unique ID identifier to simulated data.
rle.result <- rle(full.sim.data[[id]])
rle.result$values <- 1:length(rle.result$values)
new.id <- inverse.rle(rle.result)
full.sim.data$sim.ID <- new.id
}
#browser()
#by <- c("DOSE==0","DOSE!=0")
by.no <- length(by)
#by.no
if(!all(is.na(match(events.to.plot,"All")))){
num.of.plots <- max.events
if(by.no>0) num.of.plots <- num.of.plots*by.no
plotList <- vector("list",num.of.plots)
event.list <- 1:max.events
} else {
num.of.plots <- length(events.to.plot)
if(by.no>0) num.of.plots <- num.of.plots*by.no
plotList <- vector("list",num.of.plots)
event.list <- events.to.plot
}
plot.num <- 0
for(event.no in event.list){
if(is.null(by)) by=c(1)
for(by.val in by){
#i=1 # for testing
if(by.val==1){
by.val=NULL
by=NULL
}
tmp.cex <- main.sub.cex
if (is.null(main.sub) | num.of.plots==1){
tmp.name <- NULL
} else {
if(!is.na(match(main.sub,"Default"))) {
tmp.name <- paste("Event",event.no,sep=" ")
if(!is.null(by.val)) tmp.name <- paste(tmp.name,by.val,sep=", ")
} else {
tmp.name <- main.sub[plot.num+1]
}
}
data <- full.data
if(!is.null(sim.data)) sim.data <- full.sim.data
data <- subset(data,counter<=event.no)
if(!is.null(data[[evid]])){
data <- data[data[evid]==0,]
}
if(!is.null(sim.data)) sim.data <- subset(sim.data,eval(parse(text=sim.evct.lab))<=event.no)
data <- data[!duplicated(data[[id]], fromLast = TRUE),]
if(!is.null(sim.data)) sim.data <- sim.data[!duplicated(sim.data$sim.ID, fromLast = TRUE),]
## account for censoring and values larger than 1
data$tmp.event <- 0
data$tmp.event[data[y.true]!=0] = 1 # values larger than 1 set to 1
data$tmp.event[data$counter < event.no] = 0 # censored events set to zero
y="tmp.event"
## need to account for simulated data as well
if(!is.null(sim.data)){
sim.data$tmp.event <- 0
sim.data$tmp.event[sim.data[y.true]!=0] = 1 # values larger than 1 set to 1
sim.data$tmp.event[sim.data[[sim.evct.lab]] < event.no] = 0 # censored events set to zero
}
if(!is.null(by.val)){
data <- subset(data,eval(parse(text=by.val)))
#data <- full.data[eval(parse(text=paste("full.data$", by.val))),]
if(dim(data)[1]==0) return(NULL)
if(!is.null(sim.data)){
sim.data <- subset(sim.data,eval(parse(text=by.val)))
#sim.data <- full.sim.data[eval(parse(text=paste("full.sim.data$", by.val))),]
if(dim(sim.data)[1]==0) return(NULL)
}
}
#sim.data$tmp.event <- sim.data[[y]]
##d.sub[c("ID","new.DV","TIME")]
##d.sub$ETMP = 0
#d.sub$ETMP[d.sub$TYPE!=3] = 1
#names(d.sub)
#kaplan.plot(x="TIME",y="DV",data=d.sub)
#browser()
## make new column for when censoring (no event) occurs
## if(!RTTE){
## data$tmp.event <- 0
## data$tmp.event[data[y]!=0] = 1
## sim.data$tmp.event <- sim.data[[y]]
## y="tmp.event"
## }
#browser()
S <- survival::Surv(data[,x],data[,y])
##f.1 <- survfit(S)
f.1 <- survival::survfit(S~1)
a.1 <- summary(f.1)
# plot(f.1)
## f.2 <- survfit(S~data[,"DOSE"])
## plot(f.2,lty=1:4,col=1:4,yscale=100,ylab="Survival (%)", xlab="Time")
## legend(350, 1.0, c("Placebo", "10 mg","50 mg", "100 mg"), lty = 1:4,col=1:4)
##browser()
## ## covariate plots
cov.plot <- FALSE
censored.ids <- FALSE
if(!is.null(cov)) cov.plot <- TRUE
if(cov.plot){
if(is.factor(data[,cov])){
cat("\n Transforming",cov,"from levels to numeric\n",sep=" ")
data[,cov] <- as.numeric(levels(data[,cov]))[data[,cov]]
}
tmp.y.cov <- c()
## the full covariate set
tmp.cov.prev <- data[,cov]
for(i in 1:length(f.1$time)){
if(f.1$n.censor[i]>0 && f.1$n.event[i]==0){ # we have only censored events at this time point
##tmp.cov <- data[,cov][data[,x]>=f.1$time[i]] # Include the censored ID in covariate list
#print("hi\n")
tmp.cov <- tmp.cov.prev
} else { # Include IDs that survive beyond that time in cov list
tmp.cov <- data[,cov][data[,x]>f.1$time[i]]
}
tmp.y.cov <- c(tmp.y.cov,do.call(cov.fun,list(tmp.cov)))
#print(mean(tmp))
tmp.cov.prev <- tmp.cov
}
}
##fit a Kaplan-Meier and plot it
##fit <- survfit(Surv(time, status) ~ x, data = aml)
##plot(fit, lty = 2:3)
##legend(100, .8, c("Maintained", "Nonmaintained"), lty = 2:3)
##fit a Cox proportional hazards model and plot the
##predicted survival for a 60 year old
##fit <- coxph(Surv(futime, fustat) ~ age, data = ovarian)
##plot(survfit(fit, newdata=data.frame(age=60)),
## xscale=365.25, xlab = "Years", ylab="Survival")
if(!is.null(sim.data)){
times <- sort(unique(sim.data[,x]))
m1 <- matrix(nrow=length(unique(sim.data[,nsim.lab])),#number of simulaitons
ncol=length(times)) # number of times
if(cov.plot){
m2 <- m1
}
ii=0
for(i in unique(sim.data[,nsim.lab])){
ii=ii+1
##tmp <- subset(sim.data[,nsim==i],nsim==i)
tmp <- sim.data[eval(parse(text=paste("sim.data$", nsim.lab,"==",i))),]
#if(dim(tmp)[1]==0) browser()
S.sim <- survival::Surv(tmp[,x],tmp[,y])
##f.sim <- survfit(S.sim~tmp$TRT)
f.1.sim <- survival::survfit(S.sim~1)
##a.sim <- summary(f.sim)
a.1.sim <- summary(f.1.sim)
tmp.times <- f.1.sim$time
col.index <- match(tmp.times,times)
## plot the simulated k-m curves
#browser()
#plot(f.1.sim)
if(cov.plot){
if(is.factor(tmp[,cov])){
cat("\n Transforming",cov,"from levels to numeric\n",sep=" ")
tmp[,cov] <- as.numeric(levels(tmp[,cov]))[tmp[,cov]]
}
tmp.y.cov.sim.n <- c()
for(j in 1:length(f.1.sim$time)){
if(f.1.sim$n.censor[j]>0 && f.1.sim$n.event[j]==0){
tmp1.cov <- tmp[,cov][tmp[,x]>=f.1.sim$time[j]]
#print("hi\n")
} else {
tmp1.cov <- tmp[,cov][tmp[,x]>f.1.sim$time[j]]
}
tmp.y.cov.sim.n <- c(tmp.y.cov.sim.n,do.call(cov.fun,list(tmp1.cov)))
#print(mean(tmp1))
}
}
##print(dim(m1))
##print(col.index)
##print(i)
##print(by.val)
## add the new information
m1[ii,col.index] <- f.1.sim$surv
## make sure the total prop is carried through in the times
if(is.na(m1[ii,1])){
m1[ii,1] <- 1
}
for(j in 2:length(times)){
if(is.na(m1[ii,j])){
m1[ii,j] <- m1[ii,j-1]
}
}
if(cov.plot){
## add the new information
m2[ii,col.index] <- tmp.y.cov.sim.n
## make sure the total is carried through in the times
if(is.na(m2[ii,1])){
m2[ii,1] <- do.call(cov.fun,list(tmp[,cov]))
}
for(j in 2:length(times)){
if(is.na(m2[ii,j])){
m2[ii,j] <- m2[ii,j-1]
}
}
}
}
if(cov.plot){
m1 <- m2
}
#browser()
#m1[,1] # this list should actally not contain any NA
## should be 1 or a value.
#dim(m1)
#m1[,129]
if(is.null(nbins)){
quants <- matrix(nrow=2,ncol=dim(m1)[2])
time.bin <- times
for(j in 1:dim(quants)[2]){
quants[,j] <- quantile(m1[,j],probs=probs,na.rm=F)
}
} else {
remainder.times <- 0
ncomb <- floor(dim(m1)[2]/nbins)
if(ncomb==0){
ncomb <- 1
quants <- matrix(nrow=2,ncol=dim(m1)[2])
time.bin <- c()
} else {
remainder.times <- dim(m1)[2]-ncomb*nbins
quants <- matrix(nrow=2,ncol=nbins)
time.bin <- c()
}
k.add.this <- 0
for(j in 1:dim(quants)[2]){
##j <- 1
tmp.bin <- c()
if(remainder.times>0){
ncomb.tmp <- ncomb+1
remainder.times <- remainder.times - 1
} else {
ncomb.tmp <- ncomb
}
for(k in 1:ncomb.tmp){
##k.add.this <- (j-1)*ncomb
if(k==1) time.bin <- c(time.bin,times[k+k.add.this])
if(k+k.add.this>dim(m1)[2]) next
tmp.bin <- c(tmp.bin,m1[,k+k.add.this])
}
k.add.this <- k.add.this+ncomb.tmp
quants[,j] <- quantile(tmp.bin,probs=probs,na.rm=F)
}
}
if(add.baseline){
tmp.mat <- matrix(nrow=dim(quants)[1],ncol=dim(quants)[2]+1)
tmp.mat[,1] <- 1
if(cov.plot) tmp.mat[,1] <- do.call(cov.fun,list(sim.data[,cov]))
tmp.mat[,-1] <- quants
tmp.x <- c(0,time.bin)
} else {
tmp.mat <- quants
tmp.x <- time.bin
}
PI.up <- c()
PI.down <- c()
PI.times <- c()
n.times <- length(tmp.x)
for(i in 1:n.times){
PI.reps=2
time.reps=2
if(i==1) time.reps=1
if(i==n.times) PI.reps=1
PI.up <- c(PI.up,rep(tmp.mat[2,i],PI.reps))
PI.down <- c(PI.down,rep(tmp.mat[1,i],PI.reps))
PI.times <- c(PI.times,rep(tmp.x[i],time.reps))
}
if(add.last.area){
if(tail(tail(PI.times,n=1))==tail(times,n=1)){
time.pt <- (tail(PI.times,n=1)-PI.times[1])*1.01
} else {
time.pt <- (tail(times,n=1)-PI.times[1])*1.01
}
PI.times=c(PI.times,time.pt)
PI.up <- c(PI.up,tail(PI.up,n=1))
PI.down <- c(PI.down,tail(PI.down,n=1))
}
if(!cov.plot){
PI.up <- PI.up*100
PI.down <- PI.down*100
}
} else{
PI.up=NULL
PI.down=NULL
PI.times=NULL
} # end simulation stuff
if(add.baseline){
tmp.y <- c(1,f.1$surv)
tmp.x <- c(0,f.1$time)
tmp.y.upper <- c(1,f.1$upper)
tmp.y.lower <- c(1,f.1$lower)
if(cov.plot) tmp.y.cov <- c(do.call(cov.fun,list(data[,cov])),tmp.y.cov)
} else {
tmp.y <- c(f.1$surv)
tmp.x <- c(f.1$time)
tmp.y.upper <- c(f.1$upper)
tmp.y.lower <- c(f.1$lower)
}
if(cov.plot){
tmp.y <- tmp.y.cov
}
real.data <- c()
real.times <- c()
real.data.upper <- c()
real.data.lower <- c()
for(i in 1:length(tmp.y)){
y.reps=2
x.reps=2
if(i==1) x.reps=1
if(i==length(tmp.y)) y.reps=1
real.data <- c(real.data,rep(tmp.y[i],y.reps))
real.times <- c(real.times,rep(tmp.x[i],x.reps))
real.data.upper <- c(real.data.upper,rep(tmp.y.upper[i],y.reps))
real.data.lower <- c(real.data.lower,rep(tmp.y.lower[i],y.reps))
}
if(!cov.plot){
real.data <- real.data*100
real.data.upper <- real.data.upper*100
real.data.lower <- real.data.lower*100
}
if(cov.plot){
if(!is.null(sim.data)) {
if(!any(grepl("ylim",names(match.call())))){
ylim <- c(min(range(real.data)[1],range(PI.down)[1])*0.9,max(range(real.data)[2],range(PI.up)[2])*1.1)
}
} else {
if(!any(grepl("ylim",names(match.call())))){
ylim <- c(min(range(real.data)[1])*0.9,max(range(real.data)[2])*1.1)
}
}
real.se <- FALSE
#censor.lines <- FALSE
if(!is.na(match(ylab,"Default"))) {
ylab <- paste(cov.fun,cov)
}
cen.x0 <- f.1$time[f.1$n.censor>0]
cen.x1 <- f.1$time[f.1$n.censor>0]
cen.y0 <- tmp.y[match(f.1$time[f.1$n.censor>0],tmp.x)] -(ylim[2] - ylim[1])*cens.rll
cen.y1 <- tmp.y[match(f.1$time[f.1$n.censor>0],tmp.x)] +(ylim[2] - ylim[1])*cens.rll
}
#print(xyplot(real.data~real.times))
xplot <-
xyplot(real.data~real.times,
main=list(tmp.name,cex=tmp.cex),
ylim = ylim,
xlab=xlab,
ylab=if(!is.na(match(ylab,"Default"))){"Survival (%)"}else{ylab},
real.type=real.type,
PI.up=PI.up,PI.down=PI.down,
PI.times=PI.times,
real.data.upper=real.data.upper,
real.data.lower=real.data.lower,
real.se.type=real.se.type,
real.se.lty=real.se.lty,
real.se.col=real.se.col,
f.1=f.1,
...,
panel=function(x,y,PI.up,PI.down,PI.times,
real.data.upper,real.data.lower,
real.se.type=real.se.type,
real.type=real.type,
real.se.lty=real.se.lty,
real.se.col=real.se.col,
f.1=f.1,
...){
if(!is.null(sim.data)){
grid.polygon(c(PI.times,rev(PI.times)),c(PI.up,rev(PI.down)),
default.units="native",
gp=gpar(fill=poly.fill,alpha=poly.alpha,col=poly.line.col,lty=poly.lty)
)
}
panel.xyplot(x,y,type=real.type,lwd=real.lwd,col=real.col,lty=real.lty,...)
if(real.se) panel.xyplot(x,real.data.upper,type=real.se.type,
lty=real.se.lty,
col=real.se.col,
lwd=real.se.lwd,
...)
if(real.se) panel.xyplot(x,real.data.lower,
type=real.se.type,
lty=real.se.lty,
col=real.se.col,
lwd=real.se.lwd,
...)
if(censor.lines){
if(any(f.1$n.censor>0)){
if(cov.plot){
panel.segments(x0=cen.x0,
y0=cen.y0,
x1=cen.x1,
y1=cen.y1,
...)
} else {
# cen.y0 <- tmp.y[match(f.1$time[f.1$n.censor>0],tmp.x)] -(ylim[2] - ylim[1])*0.01
# cen.y1 <- tmp.y[match(f.1$time[f.1$n.censor>0],tmp.x)] +(ylim[2] - ylim[1])*0.01
# browser()
panel.segments(x0=c(f.1$time[f.1$n.censor>0]),
y0=c(f.1$surv[f.1$n.censor>0]*100-(ylim[2] - ylim[1])*cens.rll),
x1=c(f.1$time[f.1$n.censor>0]),
y1=c(f.1$surv[f.1$n.censor>0]*100+(ylim[2] - ylim[1])*cens.rll),
type=cens.type,
lty=cens.lty,
col=cens.col,
lwd=cens.lwd,
...)
}
}
}
}
)
plot.num <- plot.num+1
#if(plot.num>152) browser()
plotList[[plot.num]] <- xplot
}
}
default.plot.title <- "Kaplan-Meier plots"
if(cov.plot) default.plot.title <- paste(cov.fun,cov)
if (num.of.plots==1) default.plot.title <- paste("Kaplan-Meier plot for event",event.list[1])
if (num.of.plots==1 && cov.plot) default.plot.title <- paste(cov.fun, cov, "for event",event.list[1])
if(!is.null(object)){
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
} else {
if (is.null(main)){
plotTitle <- NULL
} else {
if(!is.na(match(main,"Default"))) {
plotTitle <- default.plot.title
if (!is.null(subset)){
plotTitle <- paste(plotTitle,"\n[",subset,"]",sep="")
}
} else {
plotTitle <- main
}
}
}
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/kaplan.plot.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
"list.gam.settings"<-
function(object)
{
### Displays the name of the current database.
if(exists("object")) {
cat(paste("\nThe current run number is ", object@Runno, ".\n\n", sep=""))
if(!any(is.null(object@Prefs@Xvardef$parms)))
cat("Parameters:",object@Prefs@Xvardef$parms,fill=60)
if(!any(is.null(object@Prefs@Xvardef$covariates))) {
cat("Covariates:",object@Prefs@Xvardef$covariates,fill=60)
conts <- cats <- character(0)
for(i in xvardef("covariates", object))
if(!is.factor(object@Data[[i]])) {
if(length(conts))
conts <- c(conts,i)
else
conts <- i
} else {
if(length(cats))
cats <- c(cats,i)
else
cats <- i
}
cat(" ( Continuous:",conts,")",fill=60)
cat(" ( Categorical:",cats,")",fill=60)
}
if(!any(is.null(object@[email protected]$disp))){
cat("Use a dispersion factor (null/true): ",
object@[email protected]$disp,"\n")
}
if(!any(is.null(object@[email protected]$steppit))){
cat("Use stepwise search for covariates (true/false): ",
object@[email protected]$steppit,"\n")
}
if(!any(is.null(object@[email protected]$onlyfirst))){
cat("Use only the first value in each individual: ",
object@[email protected]$onlyfirst,"\n")
}
if(!any(is.null(object@Prefs@Subset)))
cat("Subset:",object@Prefs@Subset,"\n")
if(!any(is.null(object@[email protected]$start.mod))){
cat("Starting model: ",
object@[email protected]$start.mod,"\n")
}
cat("Normalize to median: ",TRUE,"\n")
if(!any(is.null(object@[email protected]$plot.ids))){
cat("Use ID labels in GAM plots: ",
object@[email protected]$plot.ids,"\n")
}
}
else {
cat("The current run number is", object@Runno,
"but no matching database was found.\n")
}
return()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/list.gam.settings.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
"main.menu" <- function() {
choices <- c("Documentation ->",
"Preferences ->",
"Data checkout ->",
"Goodness of fit plots ->",
"Parameters ->",
"Covariate model ->",
"Model comparison ->",
"Conditional weighted residuals ->",
"Visual and numerical predictive check plots ->",
"License and citation information",
"Quit")
title=paste(
"\nMAIN MENU",
"\n Enter an item from the menu, or 0 to exit",
"\n -> : Indicates a directory",
"\n * : Indicates functionality not yet available",
sep="")
pick <- menu(choices,title=title)
qx <- 0
switch(pick + 1,
qx <- 1,
qx <- documentation.menu(),
qx <- preferences.menu(),
qx <- data.checkout.menu(),
qx <- gof.menu(),
qx <- parameters.menu(),
qx <- covariate.model.menu(),
qx <- model.comparison.menu(),
qx <- cwres.menu(),
qx <- vpc.npc.menu(),
xpose.license.citation(),
qx <- 1
)
# quit menu system
if(qx == 1 || qx==2) {
## Turn of graphics window
##if(dev.cur() > 1){
## dev.off()
##}
return(invisible(1))
} else {
Recall()
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/main.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Make stacked bar data set.
#'
#' Function to make stacked bar data set for categorical data plots.
#'
#'
#' @param data Data set to transform.
#' @param idv the independent variable.
#' @param dv the dependent variable.
#' @param nbins the number of bins.
#' @param by Conditioning variable.
#' @param by.nbins by.nbins.
#' @param \dots additional arguments.
#' @author The Xpose team.
#' @keywords methods
#' @export make.sb.data
#' @family data functions
"make.sb.data" <- function(data,idv,dv,nbins=6,by=NULL,
by.nbins = 6,
#ordby = NULL,
#byordfun = "median",
#shingnum = 6,
#shingol = 0.5,
...)
{
if(is.null(idv)){
idv <- "all.values"
data[idv] <- 1
}
if(nbins < length(unique(data[,idv]))){
data$bins.tmp <- xpose.bin(data,idv,bins=nbins)
idv <- "bins.tmp"
}
doses <- unique(data[,idv])
#doses <- as.vector(doses[order(doses)],"numeric")
doses <- doses[order(doses)]
dvs <- unique(data[,dv])
#dvs <- as.vector(dvs[order(dvs)],"numeric")
dvs <- dvs[order(dvs)]
## get conditioning
if(is.null(by)){## No conditioning
nlevels <- 1
levs <- 1
by <- "all.values"
data[by] <- 1
} else {
if(by.nbins < length(unique(data[,by]))){
data$by.bins.tmp <- xpose.bin(data,by,bins=by.nbins)
by <- "by.bins.tmp"
}
levs <- unique(data[,by])
levs <- levs[order(levs)]
nlevels <- length(levs)
## ##could be done with shingles like this...kinda
## if(!is.factor(data[,by])) {
## data[,by] <- equal.count(data[,by],number=shingnum,overl=shingol)
## } else {
## if(!is.null(ordby)) {
## data[,by] <- reorder.factor(data[,by],data[,ordby],byordfun)
## }
## if(names(data[,by,drop=F])!="ind") {
## levels(data[,by]) <-
## paste(xlabel(names(data[,by,drop=F]),object),":", ## Needs to be fixed
## levels(data[,by]),sep="")
## }
## }
## ## end shingle stuff
}
## Set up the data frame for the data to be plotted
num.row <- length(dvs)
num.col <- length(doses)
##if(!is.null(by)) num.col <- num.col+1
ret <- data.frame(matrix(nrow = num.row,
ncol = num.col))
wdths <- rep(1,length(doses))
#row.names(ret) <- paste("P", as.vector(dvs,"numeric"), sep = "")
row.names(ret) <- paste(dv,"=",dvs, sep = "")
names(ret) <- doses
## Set up the data frame for the data to be plotted
num.col.new <- 5
num.row.new <- length(doses)*length(dvs)*nlevels
ret.new <- data.frame(matrix(nrow = num.row.new,
ncol = num.col.new))
names(ret.new) <- c("idv","dv","proportion","by.var","wdth")
if(!is.null(levels(doses))){
ret.new["idv"] <- factor(ret.new["idv"],levels=levels(doses))
}
ret.new["dv"] <- factor(ret.new["dv"],levels=levels(dvs))
if(!is.null(levels(levs))){
ret.new["by.var"] <- factor(ret.new["by.var"],levels=levels(levs))
}
## add loop here to go through all the levels
i <- 1
for(LEVS in 1:nlevels){
tmp.by=levs[LEVS]
dat1 <- data[data[,by] == levs[LEVS], ,drop=F ]
for(DOS in 1:length(doses)){
tmp.idv <- doses[DOS]
dat2 <- dat1[dat1[,idv] == doses[DOS], ,drop=F ]
tmp.wdth <- nrow(dat2)
for(DV in 1:length(dvs)){
tmp.dv <- dvs[DV]
if(nrow(dat2) == 0) {
tmp.proportion <- 0
} else {
if(is.null(nrow(dat2[dat2[, dv] == dvs[DV],,drop=F]))) {
tmp.proportion <- 0
} else {
tmp.proportion <- nrow(dat2[dat2[, dv] == dvs[DV],,drop=F])/
nrow(dat2)
}
}
ret.new[i,"idv"] <- tmp.idv
ret.new[i,"dv"] <- tmp.dv
ret.new[i,"proportion"] <- tmp.proportion
ret.new[i,"by.var"] <- tmp.by
ret.new[i,"wdth"] <- tmp.wdth
i <- i+1
}
}
}
#ret$idv[(ii-1)*] <- rep(paste(dv,"=",dvs, sep = ""),nlevels)
## Fill in the data frame
for(dos in 1:length(doses)) {
dat1 <- data[data[,idv] == doses[dos], ,drop=F ]
wdths[dos] <- nrow(dat1)
for(d in 1:num.row) {
if(nrow(dat1) == 0) {
ret[d, dos] <- 0
next
}
if(is.null(nrow(dat1[dat1[, dv] == dvs[d],,drop=F]))) {
ret[d, dos] <- 0
} else {
ret[d, dos] <- nrow(dat1[dat1[, dv] == dvs[d],,drop=F])/
nrow(dat1)
}
}
}
retlist <- list(ret=ret,wdths=wdths)
retlist.new <- list(ret=ret.new)
##return(retlist)
return(retlist.new)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/make.sb.data.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
"manage.db"<-
function(){
## Manage databases
choices <- c("Return to the previous menu ->",
"Change run number/database",
"List items in current database",
"View the documentation for the current database",
"Change the documentation for the current database",
"Change xpose defined variables (id, idv, dv, etc.)",
"Change independent variable (idv)",
"Change parameter scope",
"Change covariate scope",
"Export variable definitions to a file",
"Import variable definitions from a file",
#"Change ID variable",
#"Change dependent variable (DV)",
#"Change PRED variable",
#"Change IPRED variable",
#"Change RES variable",
#"Change WRES variable",
#"Change IWRES variable",
#"Change occasion variable",
#"Change variable to label data points with",
"Change the subset expression",
"Change missing data variable (MDV)",
"Change category threshold for variables",
"Change category threshold for DV",
"Change name of a variable",
#"Change typical parameter scope",
"* Map random effects to typical parameters",
"* Map typical parameters to parameters",
"* Copy variable definitions from another database"
)
title="\nDATABASE MANAGEMENT MENU\n \\main\\preferences\\Manage variables in the current database"
pick <- menu(choices,title=title)
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
change.xp.obj(),
db.names(eval(parse(text=".cur.db"))),
get.doc(eval(parse(text=".cur.db")), classic = T),
set.doc(eval(parse(text=".cur.db")), classic = T),
change.xvardef(eval(parse(text=".cur.db")), classic=T),
change.xvardef(eval(parse(text=".cur.db")), classic=T, var="idv"),
change.xvardef(eval(parse(text=".cur.db")), classic=T, var="parm"),
change.xvardef(eval(parse(text=".cur.db")), classic=T, var="covariates"),
export.variable.definitions(eval(parse(text=".cur.db"))),
import.variable.definitions(eval(parse(text=".cur.db")), classic = T),
#change.id(eval(parse(text=".cur.db")), classic = T),
#change.idv(eval(parse(text=".cur.db")), classic = T),
#change.dv(eval(parse(text=".cur.db")), classic = T),
#change.pred(eval(parse(text=".cur.db")), classic = T),
#change.ipred(eval(parse(text=".cur.db")), classic = T),
#change.res(eval(parse(text=".cur.db")), classic = T),
#change.wres(eval(parse(text=".cur.db")), classic = T),
#change.iwres(eval(parse(text=".cur.db")), classic = T),
#change.occ(eval(parse(text=".cur.db")), classic = T),
#change.label(eval(parse(text=".cur.db")), classic = T),
change.subset(eval(parse(text=".cur.db")), classic = T),
change.miss(eval(parse(text=".cur.db")), classic = T),
change.cat.levels(eval(parse(text=".cur.db")), classic = T),
change.dv.cat.levels(eval(parse(text=".cur.db")), classic = T),
change.var.name(eval(parse(text=".cur.db")), classic = T),
#change.covs(eval(parse(text=".cur.db")), classic = T),
#change.tvparms(eval(parse(text=".cur.db")), classic = T),
cat("Not yet implemented!\n"), # change.ranpar(eval(parse(text=".cur.db")), classic = T),
cat("Not yet implemented!\n"), # change.tvpar(eval(parse(text=".cur.db")), classic = T),
cat("Not yet implemented!\n") # copy.attr(eval(parse(text=".cur.db")), classic = T)
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/manage.db.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
model.comparison.covariates.menu <-
function() {
choices <- c("Return to previous menu ->",
"|Delta PRED| vs covariates",
"|Delta IPRED| vs covariates",
"|Delta weighted residuals| vs covariates"
)
title="\nMODEL COMPARISON MENU - COVARIATES\n \\main\\model comparison\\covariates"
pick <- menu(choices,title=title)
if(is.null(check.vars(c("cwres"),eval(parse(text=".cur.db")),silent=TRUE))) {
wres <- "wres"
}else{
wres <- "cwres"
}
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
print(absval.dpred.vs.cov.model.comp(eval(parse(text=".cur.db")))),
print(absval.dipred.vs.cov.model.comp(eval(parse(text=".cur.db")))),
##print(absval.dwres.vs.cov.model.comp(eval(parse(text=".cur.db"))))
print(eval(parse(text=paste("absval.d",wres,".vs.cov.model.comp(.cur.db)",sep=""))))
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/model.comparison.covariates.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
model.comparison.menu <-
function() {
choices <- c("Return to previous menu ->",
"Read in comparison model to Xpose",
"Read in second comparison model to Xpose",
"Basic model comparisons",
"Additional model comparisons",
"Delta OFV vs ID",
"Delta OFV vs Covariates",
"Delta OFV1 vs Delta OFV2",
"Delta PRED/IPRED/Weighted residuals vs covariates ->"
)
title="\nMODEL COMPARISON MENU\n \\main\\model comparison"
pick <- menu(choices,title=title)
if(is.null(check.vars(c("cwres"),eval(parse(text=".cur.db")),silent=TRUE))) {
wres <- ""
}else{
wres <- ".cwres"
}
ref.db <- NULL
if(exists(".ref.db")) ref.db <- eval(parse(text=".ref.db"))
ref.db2 <- NULL
if(exists(".ref.db2")) ref.db2 <- eval(parse(text=".ref.db2"))
run.basic.model.comp <- function(){
cat("\nRunning command:\n",
"basic.model.comp(.cur.db,object.ref=ref.db)\n",
sep="")
print(basic.model.comp(eval(parse(text=".cur.db")),object.ref=ref.db))
}
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
ref.db <- get.refrunno(),
ref.db2 <- get.refrunno(database=".ref.db2"),
run.basic.model.comp(),
##print(basic.model.comp(eval(parse(text=".cur.db")),object.ref=ref.db)),
##print(add.model.comp(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("add.model.comp",
wres,"(.cur.db,object.ref=ref.db)",sep="")))),
print(dOFV.vs.id(eval(parse(text=".cur.db")),ref.db)),
print(dOFV.vs.cov(eval(parse(text=".cur.db")),ref.db)),
print(dOFV1.vs.dOFV2(eval(parse(text=".cur.db")),ref.db,ref.db2)),
qx <- model.comparison.covariates.menu()
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/model.comparison.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Function to plot the coverage of the Numerical Predictive Check
#'
#' This function takes the output from the \code{npc} command in Perl Speaks
#' NONMEM (PsN) and makes a coverage plot. A coverage plot for the NPC looks
#' at different prediction intervals (PIs) for each data point and calculates
#' the total number of data points in the data set lying outside of these PIs.
#' The plot shows the relative amount of data points outside of their PI
#' compared to the expected amount at that PI. In addition a confidence
#' interval around these values are computed based on the simulated data.
#'
#'
#' @param npc.info The results file from the \code{npc} command in PsN. For
#' example, \file{npc_results.csv}, or if the file is in a separate directory
#' \file{./npc_dir1/npc_results.csv}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' \code{"Default"} creates a default title.
#' @param main.sub Used for names above each plot when using multiple plots.
#' Should be a vector \code{c("Group 1","Group 2")}
#' @param main.sub.cex The size of the \code{main.sub} titles.
#' @param \dots Other arguments passed to
#' \code{\link{xpose.multiple.plot.default}}, \code{\link[lattice]{xyplot}} and
#' others. Please see these functions (and below) for more descriptions of what you can do.
#' @return A list of plots
#' @section Additional arguments for the NPC coverage plots:
#'
#' \strong{Additional plot features}
#'
#' \describe{
#' \item{\code{CI}}{Specifies
#' whether confidence intervals (as lines, a shaded area or both) should be
#' added to the plot. Allowed values are: \code{"area"},
#' \code{"lines"}, \code{"both"}, or \code{NULL}.}
#' \item{\code{mark.outside.data}}{Should the points outside the CI be marked in a different
#' color to identify them. Allowed values are \code{TRUE} or \code{FALSE}.}
#' \item{\code{abline}}{Should there be a line
#' to mark the value of y=1? Possible values are \code{TRUE}, \code{FALSE} and
#' \code{NULL}.}
#' }
#'
#' \strong{Line and area control. See \code{\link[graphics]{plot}},
#' \code{\link[grid]{grid.polygon}} and \code{\link[lattice]{xyplot}} for more
#' details.}
#'
#' \describe{ \item{\code{CI.area.col}}{Color of the area
#' for the CI. Defaults to \code{"blue"}}
#' \item{\code{CI.area.alpha}}{Transparency of the \code{CI.area.col}. Defaults to 0.3.}
#' \item{\code{ab.lwd}}{The width of the abline. Default is 1.}
#' \item{\code{ab.lty}}{Line type of the abline. Default is \code{"dashed"}}
#' \item{\code{CI.upper.lty}}{Line type of the line at the upper
#' edge of the CI.}
#' \item{\code{CI.upper.col}}{Color of the line at the upper edge of the CI.}
#' \item{\code{CI.upper.lwd}}{The line width of
#' the line at the upper edge of the CI.}
#' \item{\code{CI.lower.lty}}{The line type at
#' the lower edge of the CI.}
#' \item{\code{CI.lower.col}}{The color of the line at the
#' lower edge of the CI.}
#' \item{\code{CI.lower.lwd}}{The line width of the line at the lower
#' edge of the CI.}
#' \item{\code{obs.col}}{The color of the observed values.}
#' \item{\code{obs.pch}}{The type of point to use for the observed values.}
#' \item{\code{obs.lty}}{The type of line to use for the observed values.}
#' \item{\code{obs.type}}{The combination of lines and points
#' to use for the observed values. Default is \code{"b"} for both.}
#' \item{\code{obs.cex}}{The size of the
#' points to use for the observed values.}
#' \item{\code{obs.lwd}}{The line
#' width to use for the observed values.}
#' \item{\code{out.col}}{The color of the observed values that lie outside of the CI. Only used if
#' \code{mark.outside.data=TRUE}.}
#' \item{\code{out.pch}}{The type of point
#' to use for the observed values that lie outside of the CI. Only used if
#' \code{mark.outside.data = TRUE}.}
#' \item{\code{out.cex}}{The size of the
#' points of the observed values that lie outside of the CI. Only used if
#' \code{mark.outside.data = TRUE}.}
#' \item{\code{out.lwd}}{The line width of
#' the observed values that lie outside of the CI. Only used if
#' \code{mark.outside.data = TRUE}.} }
#' @author Andrew Hooker
#' @seealso \code{\link{read.npc.vpc.results}}
#' \code{\link{xpose.multiple.plot.default}} \code{\link[lattice]{xyplot}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' library(xpose4)
#'
#' npc.coverage()
#'
#' ## to read files in a directory different than the current working directory
#' npc.file <- "./another_directory/npc_results.csv"
#' npc.coverage(npc.info=npc.file)
#' }
#'
#' @export npc.coverage
#' @family PsN functions
"npc.coverage" <-
function(npc.info="npc_results.csv", #name of PSN file to use
#object = NULL,
#by=NULL,
main="Default",
main.sub=NULL, # used for names above each plot when
#using multiple plots
#Should be a vector c("","")
main.sub.cex=0.85, # size of main.sub
...) {
#npc.info <- npc.file
#file.info <- read.npc.vpc.results(npc.results=npc.info)
file.info <- read.npc.vpc.results(npc.results=npc.info,...)
num.tables <- file.info$num.tables
npc.tables <- file.info$result.tables
myPanel <- function(x,y,
npc.table,
subscripts,
CI="area",
#CI.lines=NULL,
mark.outside.data=TRUE,
CI.area.col = "blue",
CI.area.alpha = 0.3,
ab.lty="dashed",
ab.lwd=1,
CI.upper.lty="dotted",
CI.upper.col="brown",
CI.upper.lwd="2",
CI.lower.lty="dotted",
CI.lower.col="brown",
CI.lower.lwd="2",
obs.col="black",
obs.pch=19,
obs.lty="solid",
obs.type="b",
obs.cex=1,
obs.lwd=1,
out.col="red",
out.pch=8,
out.cex=1.3,
out.lwd=1,
abline = TRUE,
...){
npc.table <- npc.table[subscripts,]
x.poly <- c(npc.table$PI,rev(npc.table$PI))
y.poly <- c(npc.table$upper.CI,rev(npc.table$lower.CI))
if(!is.null(CI) & (CI=="area" | CI=="both")){
grid.polygon(x.poly,y.poly,
default.units="native",
gp=gpar(fill=CI.area.col,#"burlywood1",#
alpha=CI.area.alpha,
col=NULL,lty=0),
...)
}
if(abline==TRUE) panel.abline(lm(1~1),lty=ab.lty,lwd=ab.lwd,...)
if(!is.null(CI) & (CI=="lines" | CI=="both")){
##if(!is.null(CI.lines)){
panel.lines(npc.table$PI,npc.table$upper.CI,
type="l",
lty=CI.upper.lty,#"dotted",
col=CI.upper.col,#"brown",
lwd=CI.upper.lwd,#"2",
...)
panel.lines(npc.table$PI,npc.table$lower.CI,
type="l",
lty=CI.lower.lty,#"dotted",
col=CI.lower.col,#"brown",
lwd=CI.lower.lwd,#"2",
...)
}
panel.xyplot(x,y,
col=obs.col,#"black",
pch=obs.pch,#19,
lty = obs.lty,#"solid",
type = obs.type,#"b",
cex = obs.cex,#1,
lwd = obs.lwd,#1,
...)
if (mark.outside.data){
outside.data <- npc.table[npc.table$outside.PI == "*",]
#outside.data <- subset(npc.table,outside.PI == "*")
if(dim(outside.data)[1]>0){
panel.xyplot(outside.data$PI,outside.data$observed,
col=out.col,#"red",
pch=obs.pch,
type = "p",
cex = obs.cex,
lwd = obs.lwd,
...)
panel.xyplot(outside.data$PI,outside.data$observed,
col=out.col,
pch=out.pch,#8,
type = "p",
cex = out.cex,#1.3,
lwd = out.lwd,#1,
...)
}
}
}
myPrePanel <- function(x,y,
npc.table,
subscripts,...) {
npc.table <- npc.table[subscripts,]
x.poly <- c(npc.table$PI,rev(npc.table$PI))
y.poly <- c(npc.table$upper.CI,rev(npc.table$lower.CI))
ylim <- c(min(y.poly,y),
max(y.poly,y))
xlim <- c(min(x)-1,max(x)+1)
list(xlim=xlim,ylim=ylim)
}
plotList <- vector("list",num.tables)
plot.num <- 0 # initialize plot number
for (i in 1:num.tables){
if(num.tables==1) final.table <- npc.tables
if(num.tables!=1) final.table <- npc.tables[[i]]
final.table$expected.pct <- (100 - final.table$PI)/2
final.table$lower.y <- final.table$points.below.PI/final.table$expected.pct
final.table$upper.y <- final.table$points.above.PI/final.table$expected.pct
final.table$y.poly.lowPI.upCI <- final.table[["95.CI.below.to"]]/final.table$expected.pct
final.table$y.poly.lowPI.lowCI <- final.table[["95.CI.below.from"]]/final.table$expected.pct
final.table$y.poly.upPI.upCI <- final.table[["95.CI.above.to"]]/final.table$expected.pct
final.table$y.poly.upPI.lowCI <- final.table[["95.CI.above.from"]]/final.table$expected.pct
npc.table <- reshape(final.table, direction= "long",
varying=list(
c("lower.y","upper.y"),
c("y.poly.lowPI.lowCI","y.poly.upPI.lowCI"),
c("y.poly.lowPI.upCI","y.poly.upPI.upCI"),
c("outside.CI.for.below.PI","outside.CI.for.above.PI")
),
v.names=c("observed","lower.CI","upper.CI","outside.PI"),
idvar="PI",times=c("Lower PI Limit","Upper PI Limit"))
sub.main <- NULL
if(num.tables>1) sub.main <- file.info$result.tables[[num.tables+1]][i]
if(!is.null(main.sub)) sub.main <- main.sub[i]
xplot <- xyplot(observed ~ PI | time,
data=npc.table,
npc.table=npc.table,
prepanel=myPrePanel,
panel=myPanel,
layout=c(1,2),
ylab="Observed/Expected",
xlab="Prediction Interval",
main=list(sub.main,cex=main.sub.cex),
##auto.key=list(title="foobar"),
##scales=list(y="free"),
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
default.plot.title.1 <- "Coverage for Numerical Predictive Check\n"
default.plot.title.2 <- paste("For",file.info$dv.var,"in",file.info$model.file,sep=" ")
default.plot.title <- paste(default.plot.title.1,default.plot.title.2,sep="")
if (is.null(main)){
plotTitle <- NULL
} else {
if(!is.na(match(main,"Default"))) {
plotTitle <- default.plot.title
} else {
plotTitle <- main
}
}
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/npc.coverage.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Extract or set the value of the Nsim slot.
#'
#' Extract or set the value of the Nsim slot of an "xpose.data" object.
#'
#'
#' @aliases nsim nsim<-
#' @param object An "xpose.data" object.
#' @author Niclas Jonsson
#' @seealso \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## Report number of simulations
#' nsim(xpdb5)
#' }
#'
#' @export nsim
#' @family data functions
nsim <- function(object) {
return(object@Nsim)
}
"nsim<-" <- function(object, value) {
object@Nsim <- value
return(object)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/nsim.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
parameters.menu <-
function() {
choices <- c("Return to previous menu ->",
"Numerically summarize the parameters",
"Distribution of parameters (QQ plots)",
"Distribution of parameters (histograms)",
"Scatterplot matrix of parameters",
"Parameter vs parameter",
"Distribution of random parameters (QQ plots)",
"Distribution of random parameters (histograms)",
"Scatterplot matrix of random parameters",
"* Random effects vs typical parameter values"
)
title="\nPARAMETER PLOTS MENU\n \\main\\parameters"
pick <- menu(choices,title=title)
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
parm.summary(eval(parse(text=".cur.db")),out.file=".ask"),
print(parm.qq(eval(parse(text=".cur.db")),prompt=FALSE)),
print(parm.hist(eval(parse(text=".cur.db")),prompt=FALSE)),
print(parm.splom(eval(parse(text=".cur.db")))),
print(parm.vs.parm(eval(parse(text=".cur.db")))),
print(ranpar.qq(eval(parse(text=".cur.db")))),
print(ranpar.hist(eval(parse(text=".cur.db")))),
print(ranpar.splom(eval(parse(text=".cur.db")))),
cat("\nNot defined yet\n")
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parameters.menu.R |
#' @describeIn par_cov_hist parameter distributions
#' @export
parm.hist <-
function(object,
onlyfirst=TRUE,
main="Default",
...) {
if(any(is.null(xvardef("parms",object)))) {
return(cat("No parameters are defined in the current database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("parms", object)) {
number.of.plots <- number.of.plots + 1
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop
for (i in xvardef("parms", object)) {
xplot <- xpose.plot.histogram(i,
object,
main=NULL,
onlyfirst = onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
default.plot.title <- "Distribution of parameters"
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.hist.R |
#' @describeIn par_cov_qq parameter distributions
#' @export
parm.qq <-
function(object,
onlyfirst=TRUE,
main="Default",
...) {
## is everything in place?
if(any(is.null(xvardef("parms",object)))) {
return(cat("Parameters are not defined in the current database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("parms", object)) {
if(!is.factor(object@Data[[i]])){
number.of.plots <- number.of.plots + 1
}
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop (ranpar)
for (i in xvardef("parms", object)) {
if(!is.factor(object@Data[[i]])){
xplot <- xpose.plot.qq(i,
object,
main=NULL,
onlyfirst=onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
}
default.plot.title <- "Distribution of parameters"
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.qq.R |
#' Plot scatterplot matrices of parameters, random parameters or covariates
#'
#' These functions plot scatterplot matrices of parameters, random parameters
#' and covariates.
#'
#' The parameters or covariates in the Xpose data object, as specified in
#' \code{object@Prefs@Xvardef$parms}, \code{object@Prefs@Xvardef$ranpar} or
#' \code{object@Prefs@Xvardef$covariates}, are plotted together as scatterplot
#' matrices.
#'
#' A wide array of extra options controlling scatterplot matrices are
#' available. See \code{\link{xpose.plot.splom}} for details.
#'
#' To control the appearance of the labels and names in the scatterplot matrix
#' plots you can try \code{varname.cex=0.5} and \code{axis.text.cex=0.5} (this
#' changes the tick labels and the variable names to be half as large as
#' normal).
#'
#' @param object An xpose.data object.
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param varnames A vector of strings containing labels for the variables in
#' the scatterplot matrix.
#' @param onlyfirst Logical value indicating if only the first row per
#' individual is included in the plot.
#' @param lmline logical variable specifying whether a linear regression line
#' should be superimposed over an \code{\link[lattice]{xyplot}}. \code{NULL} ~
#' FALSE. (\code{y~x})
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param \dots Other arguments passed to \code{\link{xpose.plot.histogram}}.
#' @return Delivers a scatterplot matrix.
#' @author Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.splom}}, \code{\link{xpose.panel.splom}},
#' \code{\link[lattice]{splom}}, \code{\link{xpose.data-class}},
#' \code{\link{xpose.prefs-class}}
#' @examples
#'
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' ## A scatterplot matrix of parameters, grouped by sex
#' parm.splom(xpdb, groups="SEX")
#'
#' ## A scatterplot matrix of ETAs, grouped by sex
#' ranpar.splom(xpdb, groups="SEX")
#'
#' ## Covariate scatterplots, with text customization
#' cov.splom(xpdb, varname.cex=0.4, axis.text.cex=0.4, smooth=NULL, cex=0.4)
#'
#' @name par_cov_splom
#' @family specific functions
NULL
#' @describeIn par_cov_splom A scatterplot matrix of parameters
#' @export
parm.splom <-
function(object,
main =
xpose.multiple.plot.title(object=object,
plot.text = "Scatterplot matrix of parameters",
...),
varnames = NULL,
#xlb = NULL,
#ylb = NULL,
onlyfirst=TRUE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
smooth = TRUE,
lmline = NULL,
#groups = NULL,
#main.cex=NULL,
...) {
if(any(is.null(xvardef("parms",object)))) {
return(cat("Parameters are not defined in the current database!\n"))
}
if(is.null(varnames)) {
varnames <- c()
for (i in xvardef("parms", object)) {
varnames <- c(varnames, xlabel(i, object))
}
}
xplot <- xpose.plot.splom(xvardef("parms", object),
object,
varnames=varnames,
main = main,
onlyfirst = onlyfirst,
#inclZeroWRES = inclZeroWRES,
#subset = subset,
#groups = groups,
smooth = smooth,
lmline = lmline,
#ylb = ylb,
#xlb = xlb,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.splom.R |
#' @describeIn par_cov_summary Parameter summary
#' @export
parm.summary <- function(object,
onlyfirst=TRUE,
subset=xsubset(object),
inclZeroWRES=FALSE,
out.file=".screen", # can be ".ask" ".graph" or a file name,
#out.file.sep=",",
main="Default",
fill = "gray",
values.to.use=xvardef("parms",object),
value.name="Parameter",
max.plots.per.page=1,
...){
## if(is.null(object@Prefs@Xvardef$parms))
if(is.null(values.to.use)){
cat("The current database has no", value.name,"defined!\n")
return()
}
data <- Data(object,onlyfirst=onlyfirst,subset=subset,inclZeroWRES=inclZeroWRES)
#if(any(is.null(data))) {
# return("The subset expression is invalid.")
#}
#data <- object@Data
##parnams <- object@Prefs@Xvardef$parms
parnams <- values.to.use
cats <- NULL
conts <- NULL
for(parm in parnams) {
if(is.factor(data[[parm]])) {
cats <- c(cats,parm)
} else {
conts <- c(conts,parm)
}
}
if(!is.null(cats)) {
cat.mat <- categorical.table(object, cats, onlyfirst=onlyfirst, subset=subset,
inclZeroWRES=inclZeroWRES)
}
if(!is.null(conts)) {
con.mat <- continuous.table(object, conts, onlyfirst=onlyfirst, subset=subset,
inclZeroWRES=inclZeroWRES)
}
if (out.file==".ask"){
cat("Would you like to export the table(s) as a text file? n(y)\n")
out.to.text <- readline()
if(out.to.text == "y") {
cat("Please type a filename (excluding the .csv extension):\n")
out.file <- readline()
} else {
cat("Would you like the table to be output as a graph? n(y)\n")
out.to.text <- readline()
if(out.to.text == "y") {
out.file <- ".graph"
} else {
out.file <- ".screen"
}
}
}
if (out.file==".screen" | out.file==".graph"){
if (out.file==".screen"){
if(!is.null(cats))
Hmisc::print.char.matrix(cat.mat)
cat("\n")
if(!is.null(conts))
Hmisc::print.char.matrix(con.mat)
}
if (out.file==".graph"){
table.list=list()
iii <- 1
if(!is.null(conts)) table.list[[iii]] <- con.mat ; iii <- iii+1
if(!is.null(cats)) {
## find max height for row
num.rows <- dim(cat.mat)[2]
num.cols <- dim(cat.mat)[1]
for(jjj in 1:num.cols){
max.lines <- 1
num.lines <- rep(1,num.rows)
cell.ht <- gregexpr("\n",cat.mat[jjj,])
for(k in 1:num.rows){
if(all(cell.ht[[k]]==-1)) {
num.lines[k]=1
} else {
num.lines[k]=length(cell.ht[[k]])+1
}
}
max.lines <- max(num.lines)
line.diff <- max.lines-num.lines
for(kk in 1:num.rows){
tmp <- paste(rep("\n",line.diff[kk]),sep="",collapse="")
cat.mat[jjj,kk] <- paste(cat.mat[jjj,kk],tmp,sep="")
}
}
table.list[[iii]] <- cat.mat
iii <- iii+1
}
#table.list <- list(con.mat,cat.mat)
num.tables <- length(table.list)
plotList <- vector("list",num.tables)
vp1 <- viewport(x=0, y=1, just=c("left","top"),
width=1, height=0.9,
gp=gpar(#lineheight=1.0,
cex=0.9#txt.cex,
## font=0.01#txt.font
),
name="vp1")
for(jj in 1:num.tables){
psobj <- table.list[[jj]]
##iter <- 7 * length(xvardef("parms", object))
##iter <- 7 * length(conts)
if(is.null(psobj)) break
cols <- psobj[1,]
nr <- dim(psobj)[1]
nc <- dim(psobj)[2]
#grid.newpage()
# xpose.multiple.plot.default(list(1),plotTitle=plotTitle,...)
textColumnList <- vector("list",nc)
for(ii in 1:nc){
textColumnList[[ii]] <- psobj[-1,ii]
}
xpose.table <- add.grid.table(textColumnList,col.nams=cols,ystart=unit(1,"npc"),
vp=list(vp1),cell.padding=1,center.table=TRUE,
fill.type="both",
v.space.before=0.25,
v.space.after=0.5,
draw=FALSE,
use.rect=TRUE,...)
plotList[[jj]] <- xpose.table$xpose.table
}
default.plot.title <- paste(value.name,"Summary",sep=" ")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
subset=subset,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
} else {
if(!is.null(cats)) {
print(cat.mat, file = paste(out.file, ".csv", sep = ""),
hsep=",",vsep="",csep="",top.border=FALSE,left.border=FALSE)
#write.table(cat.mat, file = paste(out.file, ".csv", sep = ""),
# append = FALSE, quote = FALSE, sep = ",",
# row.names = FALSE,
# col.names = FALSE)
}
if(!is.null(conts)){
write.table(con.mat, file = paste(out.file, ".csv", sep = ""),
append = TRUE, quote = FALSE, sep = ",",
row.names = FALSE,
col.names = FALSE)
# print(con.mat, file = paste(out.file, ".csv", sep = ""),
# hsep=",",vsep=NULL,csep=NULL)
}
invisible()
}
#invisible()
#return(cat(""))
#return()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.summary.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 9/11/2005
## edited by andrew Hooker fall 2006
#' Parameters plotted against covariates, for Xpose 4
#'
#' This creates a stack of plots of Bayesian parameter estimates plotted
#' against covariates, and is a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} function. Most of
#' the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' Each of the parameters in the Xpose data object, as specified in
#' \code{object@Prefs@Xvardef$parms}, is plotted against each covariate
#' present, as specified in \code{object@Prefs@Xvardef$covariates}, creating a
#' stack of plots.
#'
#' A wide array of extra options controlling \code{xyplots} are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param type The plot type - defaults to points only.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns a stack of xyplots and histograms of parameters against
#' covariates.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.plot.histogram}}, \code{\link[lattice]{xyplot}},
#' \code{\link[lattice]{histogram}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb <- xpose.data(5)
#'
#' ## A vanilla plot
#' parm.vs.cov(xpdb)
#'
#' ## Custom colours and symbols, IDs
#' parm.vs.cov(xpdb, cex=0.6, pch=3, col=1, ids=TRUE)
#' }
#'
#' @export parm.vs.cov
#' @family specific functions
"parm.vs.cov" <-
function(object,
#xlb = NULL,
#ylb = NULL,
onlyfirst=TRUE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
## abline=c(0,1),
smooth=TRUE,
##abllwd=2,
#mirror=FALSE,
#seed = NULL,
#prompt = FALSE,
type="p",
main="Default",
...) {
## is everything in place?
if (is.null(xvardef("covariates", object))) {
return(cat("Covariates are not properly set in the database!\n"))
}
if(is.null(xvardef("parms",object))) {
return(cat("Parameters are not properly set in the database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("parms", object)) {
for (j in xvardef("covariates", object)) {
if(!is.factor(object@Data[[i]])){
number.of.plots <- number.of.plots + 1
}
}
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## big loop (parms)
for (i in xvardef("parms", object)) {
## small loop (covs
for (j in xvardef("covariates", object)) {
if(!is.factor(object@Data[[i]])){
xplot <- xpose.plot.default(j,
i,
object,
main=NULL,
#xlb = xlb,
#ylb = ylb,
##abline=abline,
##abllwd=abllwd,
smooth=smooth,
#subset=subset,
type=type,
onlyfirst=onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
}
}
default.plot.title <- "Parameters vs. covariates "
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.vs.cov.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Andrew Hooker
## 21/12/2005
#' Plot parameters vs other parameters
#'
#' This function plots the parameter values stored in an Xpose data object
#' versus each other in a series of graphs. The mirror functionality is
#' available for this function.
#'
#' Each of the parameters in the Xpose data object, as specified in
#' \code{object@Prefs@Xvardef$parms}, is plotted against the rest, creating a
#' stack of plots.
#'
#' A wide array of extra options controlling \code{xyplots} are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param abline Allows for a line of identity.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param type The plot type - defaults to points only.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param \dots Other arguments passed to \code{xpose.plot.default}.
#' @return Returns a stack of xyplots and histograms of parameters against
#' parameters.
#' @author Andrew Hooker
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb <- xpose.data(5)
#'
#'
#' parm.vs.parm(xpdb)
#'
#'
#' parm.vs.parm(xpdb,mirror=3)
#' }
#'
#' @export parm.vs.parm
#' @family specific functions
"parm.vs.parm" <-
function(object,
#xlb = NULL,
#ylb = NULL,
onlyfirst=TRUE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
#mirror=FALSE,
#seed = NULL,
#bins = NULL,
#samp = NULL,
abline= FALSE,
smooth=TRUE,
#prompt = FALSE,
type="p",
main="Default",
...) {
## is everything in place?
for (i in xvardef("parms", object)) {
if(is.null(i)) {
cat("Parameters are not properly set in the database!\n")
return()
}
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("parms", object)) {
for (j in xvardef("parms", object)) {
if (j!=i) {
if(!is.factor(object@Data[[i]])){
number.of.plots <- number.of.plots + 1
}
}
}
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop over params
for (i in xvardef("parms", object)) {
for (j in xvardef("parms", object)) {
if (j!=i) {
if(!is.factor(object@Data[[i]])){
xplot <- xpose.plot.default(j,
i,
object,
main=NULL,
#xlb = xlb,
#ylb = ylb,
abline=abline,
#abllwd=abllwd,
onlyfirst = onlyfirst,
#inclZeroWRES = inclZeroWRES,
#subset = subset,
smooth=smooth,
type=type,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
}
}
}
default.plot.title <- "Parameters vs. parameters "
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/parm.vs.parm.R |
#' Simulated prazosin Xpose database.
#'
#' Xpose database from the NONMEM output of a model for prazosin using
#' simulated data (and NONMEM 7.3).
#'
#' The database can be used to test functions in Xpose 4. This database is
#' slightly different than the database that is created when reading in the
#' files created by \code{\link{simprazExample}} using
#' \code{\link{xpose.data}}.
#'
#' @name simpraz.xpdb
#' @docType data
#' @format an xpose.data object
#' @seealso \code{\link{simprazExample}}
#' @keywords datasets
#' @examples
#'
#' xpose.print(simpraz.xpdb)
#' Data(simpraz.xpdb)
#' str(simpraz.xpdb)
#'
"simpraz.xpdb"
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/prazosin_xpdb.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Population predictions (PRED) plotted against the independent variable (IDV)
#' for Xpose 4
#'
#' This is a plot of population predictions (PRED) vs the independent variable
#' (IDV), a specific function in Xpose 4. It is a wrapper encapsulating
#' arguments to the \code{xpose.plot.default} function. Most of the options
#' take their default values from xpose.data object but may be overridden by
#' supplying them as arguments.
#'
#' A wide array of extra options controlling \code{xyplots} are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns an xyplot of PRED vs IDV.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.panel.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' pred.vs.idv(xpdb)
#'
#' ## A conditioning plot
#' pred.vs.idv(xpdb, by="HCTZ")
#'
#' ## Logarithmic Y-axis
#' pred.vs.idv(xpdb, logy=TRUE)
#'
#' ## Custom colours and symbols, IDs
#' pred.vs.idv(xpdb, cex=0.6, pch=3, col=1, ids=TRUE)
#'
#'
#' @export
#' @family specific functions
pred.vs.idv <-
function(object,
smooth=TRUE,
...) {
## Make sure we have the necessary variables defined
if(is.null(check.vars(c("pred","idv"),object))) {
return(NULL)
}
xplot <- xpose.plot.default(xvardef("idv",object),
xvardef("pred",object),
smooth=smooth,
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/pred.vs.idv.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
preferences.menu <-
function() {
choices <- c("Return to the main menu ->",
"Change run number/database",
"Manage variables in the current database ->",
"Create/modify items in the current database ->",
#"Variable preferences ->",
"Change graphical parameters (line colors, widths, etc) ->"
)
title="\nPREFERENCES MENU\n \\main\\preferences"
pick <- menu(choices,title=title)
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
change.xp.obj(),
qx <- manage.db(),
qx <- add.modify.db.items.menu(),
#qx <- table.file.read.settings.menu(),
qx <- change.graphical.par()
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/preferences.menu.R |
#' Print an Xpose multiple plot object.
#'
#' Print an Xpose multiple plot object, which is the output from the function
#' \code{\link{xpose.multiple.plot}}.
#'
#' Print method for a plot class.
#'
#' @param x Output object from the function \code{\link{xpose.multiple.plot}}.
#' @param \dots Additional options passed to function.
#' @author Niclas Jonsson and Andrew C. Hooker
#' @seealso \code{\link{xpose.multiple.plot}}.
#' @method print xpose.multiple.plot
#' @export
print.xpose.multiple.plot <- function(x,...) {
xpose.multiple.plot.default(x@plotList,
plotTitle=x@plotTitle,
prompt=x@prompt,
[email protected],
[email protected],
title=x@title,
mirror=x@mirror,
[email protected],
...)
invisible()
}
setMethod("show","xpose.multiple.plot",function(object) print(x=object))
# #' Show an Xpose multiple plot object.
# #'
# #' Show an Xpose multiple plot object, which is the output from the function
# #' \code{\link{xpose.multiple.plot}}.
# #'
# #' Show method for a plot class.
# #'
# #' @param x Output object from the function \code{\link{xpose.multiple.plot}}.
# #' @param \dots Additional options passed to function.
# #' @author Niclas Jonsson and Andrew C. Hooker
# #' @seealso \code{\link{xpose.multiple.plot}}.
# #' @method show xpose.multiple.plot
# #' @export
# show.xpose.multiple.plot <- function(x,...){
# xpose.multiple.plot.default(x@plotList,
# plotTitle=x@plotTitle,
# prompt=x@prompt,
# [email protected],
# [email protected],
# title=x@title,
# mirror=x@mirror,
# [email protected],
# ...)
#
# invisible()
# }
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/print.xpose.multiple.plot.R |
#' Function to create a histogram of results from the randomization test tool
#' (\code{randtest}) in \href{https://uupharmacometrics.github.io/PsN/}{PsN}
#'
#' Reads results from the \code{randtest} tool in \href{https://uupharmacometrics.github.io/PsN/}{PsN}
#' and then creates a histogram.
#'
#'
#' @param results.file The location of the results file from the
#' \code{randtest} tool in \href{https://uupharmacometrics.github.io/PsN/}{PsN}
#' @param df The degrees of freedom between the full and reduced model used in
#' the randomization test.
#' @param p.val The p-value you would like to use.
#' @param main The title of the plot.
#' @param xlim The limits of the x-axis
#' @param PCTSlcol Color of the empirical line
#' @param vlcol Colors of the original and nominal line
#' @param \dots Additional arguments that can be passed to
#' \link{xpose.plot.histogram}, \link{xpose.panel.histogram},
#' \link[lattice]{histogram} and other \link[lattice]{lattice-package}
#' functions.
#' @return A lattice object
#' @author Andrew Hooker
#' @seealso \link{xpose.plot.histogram}, \link{xpose.panel.histogram},
#' \link[lattice]{histogram} and other \link[lattice]{lattice-package}
#' functions.
#' @references \href{https://uupharmacometrics.github.io/PsN/}{PsN}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' randtest.hist(results.file="randtest_dir1/raw_results_run1.csv",df=2)
#' }
#'
#' @export randtest.hist
#' @family PsN functions
randtest.hist <-
function(results.file="raw_results_run1.csv",
df=1,
p.val=0.05,
main="Default",
xlim=NULL,
PCTSlcol = "black",
vlcol=c("red","orange"),
...)
{
##rm(list=ls())
##p.val <- 0.05
##df <- 2
##main="Default"
##results <- read.csv("randtest_dir1/raw_results_run1.csv")
crit.val.nom <- qchisq(1-p.val, df=df)
##Read in all results
results <- read.csv(results.file)
## check that classes are present
#createXposeClasses()
if (!isClass("xpose.data") || !isClass("xpose.prefs")) {
createXposeClasses()
}
## Create the object
xpobj <- new("xpose.data",
Runno="PsN Randomization Test",
Data = NULL)
## read local options
if (is.readable.file("xpose.ini")) {
xpobj <- xpose.read(xpobj, file="xpose.ini")
} else {
## read global options
rhome <- R.home()
xdefini <- paste(rhome, "\\library\\xpose4\\xpose.ini", sep="")
if (is.readable.file(xdefini)) {
xpobj <- xpose.read(xpobj, file=xdefini)
}else{
xdefini2 <- paste(rhome, "\\library\\xpose4\\xpose.ini", sep="")
if (is.readable.file(xdefini2)) {
xpobj <- xpose.read(xpobj, file=xdefini2)
}
}
}
results$ID <-1
results$WRES <- 1
num_na <- length(results$deltaofv[is.na(results$deltaofv)])
if(num_na>0){
warning("Removing ",num_na," NONMEM runs that did not result in OFV values")
results <- results[!is.na(results$deltaofv),]
}
Data(xpobj,keep.structure=T) <- results[-c(1,2),]
crit.val.emp <- quantile(xpobj@Data$deltaofv,probs=p.val)
orig = results$deltaofv[2] #dOFV for original dataset
xpose.plot.histogram("deltaofv",
xpobj,
bins.per.panel.equal=FALSE,
#layout=layout,
#vdline=if(showOriginal){c(o1[all.index])} else {NULL},
#showMean=showMean,
#showMedian=showMedian,
xlim = if(is.null(xlim)){c(min(c(orig,crit.val.emp,xpobj@Data$deltaofv))-1,
max(c(orig,crit.val.emp,xpobj@Data$deltaofv,0))+0.2)},
showPCTS=TRUE,
PCTS=c(p.val),
PCTSlcol = PCTSlcol,
vline=c(orig,-crit.val.nom),
vlcol=vlcol,
main=if(main=="Default"){"Change in OFV for Randomization Test"}else{main},
key=list(#title = "Critical value lines",
columns = 1,
lines = list(type="l",col =c(vlcol,PCTSlcol)),#,lty=c(vlty,PCTSlty)),
#lines = list(type="l",col =c("red","orange","black")),
text = list(c("Original data", "Nominal", "Empirical (rand. test)")),
##space="right",
corner=c(0.05,0.95),
border=T,
#transparent=FALSE,
alpha.background=1,
background = "white"
),
...
)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/randtest.hist.R |
#' @describeIn par_cov_hist random parameter distributions
#' @export
ranpar.hist <-
function(object,
onlyfirst=TRUE,
main="Default",
...) {
if(any(is.null(xvardef("ranpar",object)))) {
return(cat("No ETAs are defined in the current database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("ranpar", object)) {
number.of.plots <- number.of.plots + 1
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop
for (i in xvardef("ranpar", object)) {
xplot <- xpose.plot.histogram(i,
object,
main=NULL,
onlyfirst = onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
default.plot.title <- "Distribution of ETAs"
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ranpar.hist.R |
#' @describeIn par_cov_qq random parameter distributions
#' @export
ranpar.qq <-
function(object,
onlyfirst=TRUE,
main="Default",
...) {
## is everything in place?
if(is.null(xvardef("ranpar",object))) {
return(cat("There are no ETAs in the database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("ranpar", object)) {
if(!is.factor(object@Data[[i]])){
number.of.plots <- number.of.plots + 1
}
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop (ranpar)
for (i in xvardef("ranpar", object)) {
if(!is.factor(object@Data[[i]])){
xplot <- xpose.plot.qq(i,
object,
main=NULL,
onlyfirst=onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
}
default.plot.title <- "Distribution of random parameters"
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ranpar.qq.R |
#' @describeIn par_cov_splom A scatterplot matrix of random parameters
#' @export
ranpar.splom <- function(object,
main = xpose.multiple.plot.title(object=object,
plot.text = "Scatterplot matrix of random parameters",
...),
varnames = NULL,
#xlb = NULL,
#ylb = NULL,
onlyfirst=TRUE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
smooth = TRUE,
lmline = NULL,
#groups = NULL,
#main.cex=NULL,
...) {
if(any(is.null(xvardef("ranpar",object)))) {
return(cat("ETAs are not defined in the current database!\n"))
}
if(is.null(varnames)) {
varnames <- c()
for (i in xvardef("ranpar", object)) {
varnames <- c(varnames, xlabel(i, object))
}
}
xplot <- xpose.plot.splom(xvardef("ranpar", object),
object,
varnames=varnames,
main = main,
onlyfirst = onlyfirst,
#inclZeroWRES = inclZeroWRES,
#subset = subset,
#groups = groups,
smooth = smooth,
lmline = lmline,
#ylb = ylb,
#xlb = xlb,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ranpar.splom.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Random parameters plotted against covariates, for Xpose 4
#'
#' This creates a stack of plots of Bayesian random parameter estimates plotted
#' against covariates, and is a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} function. Most of
#' the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' Each of the random parameters (ETAs) in the Xpose data object, as specified
#' in \code{object@Prefs@Xvardef$ranpar}, is plotted against each covariate
#' present, as specified in \code{object@Prefs@Xvardef$covariates}, creating a
#' stack of plots.
#'
#' A wide array of extra options controlling \code{xyplots} are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param type The plot type - defaults to points only.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns a stack of xyplots and histograms of random parameters
#' against covariates.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.plot.histogram}}, \code{\link[lattice]{xyplot}},
#' \code{\link[lattice]{histogram}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb <- xpose.data(5)
#'
#' ## A vanilla plot
#' ranpar.vs.cov(xpdb)
#'
#' ## Custom colours and symbols, IDs
#' ranpar.vs.cov(xpdb, cex=0.6, pch=3, col=1, ids=TRUE)
#' }
#'
#' @export ranpar.vs.cov
#' @family specific functions
"ranpar.vs.cov" <-
function(object,
#xlb = NULL,
#ylb = NULL,
onlyfirst=TRUE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
## abline=c(0,1),
smooth=TRUE,
##abllwd=2,
#mirror=FALSE,
#seed = NULL,
#prompt = FALSE,
type="p",
main="Default",
...) {
## is everything in place?
if (is.null(xvardef("covariates", object))) {
return(cat("Covariates are not properly set in the database!\n"))
}
if(is.null(xvardef("ranpar",object))) {
return(cat("ETAs are not properly set in the database!\n"))
}
## create enpty list for plots
number.of.plots <- 0
for (i in xvardef("ranpar", object)) {
for (j in xvardef("covariates", object)) {
if(!is.factor(object@Data[[i]])){
number.of.plots <- number.of.plots + 1
}
}
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## big loop (ranpar)
for (i in xvardef("ranpar", object)) {
## small loop (covs
for (j in xvardef("covariates", object)) {
if(!is.factor(object@Data[[i]])){
xplot <- xpose.plot.default(j,
i,
object,
main=NULL,
#xlb = xlb,
#ylb = ylb,
##abline=abline,
##abllwd=abllwd,
smooth=smooth,
#subset=subset,
type=type,
onlyfirst=onlyfirst,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
}
}
default.plot.title <- "Parameters vs. covariates "
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/ranpar.vs.cov.R |
#' Read (repeated) time-to-event simulation data files.
#'
#' @param sim.file Name of the simulated file.
#' @param subset subset to extract.
#' @param headers headers in file.
#' @param xpose.table.file xpose table files.
#' @param \dots Extra arguments passed to function.
#' @author Andrew C. Hooker
#' @export read.TTE.sim.data
#' @family data functions
read.TTE.sim.data <-
function(sim.file,
subset=NULL,
headers=c("REP", "ID", "DV", "TIME", "FLAG2","DOSE"),
xpose.table.file=FALSE,
...)
{
if(xpose.table.file){
sim.data <- read.nm.tables(sim.file,quiet=T,...)
} else {
sim.data <- read.table(sim.file,skip=0,header=F)
names(sim.data) <- headers
}
d.sim.sub <- sim.data[eval(parse(text=paste("sim.data$", subset))),]
## add a unique ID identifier
rle.result <- rle(d.sim.sub$ID)
rle.result$values <- 1:length(rle.result$values)
new.id <- inverse.rle(rle.result)
d.sim.sub$new.id <- new.id
## old way to add a unique ID identifier
## d.sim.sub$new.id <- max(unique(d.sim.sub$ID))*(d.sim.sub$REP-1)+d.sim.sub$ID
tmp <- d.sim.sub
tmp2 <- tmp[!duplicated(tmp$new.id, fromLast = TRUE),]
d.sim <- tmp2
return(d.sim)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.TTE.sim.data.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @describeIn read_NM_output parses information out of NONMEM output.
#' @export
read.lst <- function(filename) {
## The function determines the NONMEM version used to produce the
## list file and invokes the appropriate read.lst function.
listfile <- scan(filename, sep = "\n", what = character(),quiet=TRUE)
## Match the VERSION string
versionline <- grep("1NONLINEAR", listfile)
if(is.null(version$language)){
cat("need to use R for this version of Xpose")
##&&
## platform() == "WIN386" &&
## version$major <6) {
## versionVIpat <- "*VERSION*VI\\s*" #Not tested
## versionVIIpat <- "*VERSION*7.*" #Not tested
} else {
versionVIpat <- "VERSION VI\\s"
versionVIIpat <- "VERSION 7."
}
versionVIpatline <- grep(versionVIpat, listfile)
versionVIIpatline <- grep(versionVIIpat, listfile)
## Check that we found a NONMEM version
if(length(versionVIpatline) == 0 && length(versionVIIpatline)==0) stop("Can not establish NONMEM version\n")
NMversion <- NA
## Check which version we are dealing with
if(length(versionVIpatline) !=0 ) {
if(any(versionline == versionVIpatline)) NMversion <- 6
}
if(length(versionVIIpatline) !=0 && is.na(NMversion)) {
if(any(versionline == versionVIIpatline)) NMversion <- 7
}
if(is.na(NMversion)) stop("Can not establish NONMEM version\n")
if(NMversion==6) {
return(read.lst6(filename))
} else {
return(read.lst7(filename))
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.lst.R |
read.lst6 <- function(filename) {
## Function to split character strings
string2num <- function(x)
{
oldopts <- options(warn = -1)
on.exit(options(oldopts))
nc <- nchar(x)
tmp <- substring(x, 1:nc, 1:nc)
spc <- tmp == " "
st <- !spc & c(T, spc[ - nc])
end <- !spc & c(spc[-1], T)
as.numeric(substring(x, (1:nc)[st], (1:nc)[end]))
}
listfile <- scan(filename, sep = "\n", what = character(),quiet=TRUE)
## Find termination messages
minim <- pmatch("0MINIMIZATION", listfile)
if(!is.na(minim)) {
fin.minim <- pmatch("1", listfile[minim:length(listfile)],
duplicates.ok = T)
termes <- listfile[minim:(minim + fin.minim - 2)]
termes <- substring(termes, 2)
} else {
termes <- NULL
#ret.list <- list(term = termes,
# ofv = NULL,
# thetas = NULL,
# omega = NULL,
# sigma = NULL,
# sethetas = NULL,
# seomegas = NULL,
# sesigmas = NULL)
#return(ret.list)
}
## Find ofv
if(is.null(version$language)){
cat("need to use R for this version of Xpose")
##&&
## platform() == "WIN386" &&
## version$major <6) {
##minvalpat <- "*MINIMUM*VALUE*"
} else {
minvalpat <- "MINIMUM VALUE"
}
line <- grep(minvalpat, listfile)
ofvline <- listfile[line + 4] ## Need +3 for S-PLUS?
ofv <- as.numeric(substring(ofvline, 52, 71))
## Find parameter estimates
if(is.null(version$language)) {
cat("need to use R for this version of Xpose")
## &&
## platform() == "WIN386" &&
## version$major < 6) {
## finalparpat <- "*FINAL*PARAMETER*"
## sepat <- "*STANDARD*ERROR*OF"
## tmatpat <- "*T MATRIX*"
## thvecpat <- "*THETA*"
## omegapat <- "*OMEGA*"
## sigmapat <- "*SIGMA*"
## pluspat <- "*+*"
## etpat <- "*ET*"
## eppat <- "*EP*"
## covmatpat <- "*COVARIANCE*MATRIX*OF*ESTIMATE*"
## tablepat <- "*TABLES*OF*DATA*"
## notepat <- "*1 Note:*"
} else {
finalparpat <- "FINAL PARAMETER"
sepat <- "STANDARD ERROR OF"
tmatpat <- "\\*+ +T MATRIX +\\*+"
rmatpat <- "\\*+ +R MATRIX +\\*+"
smatpat <- "\\*+ +S MATRIX +\\*+"
thvecpat <- "THETA"
omegapat <- "OMEGA"
sigmapat <- "SIGMA"
pluspat <- "\\+"
etpat <- "ET"
eppat <- "EP"
covmatpat <- "COVARIANCE MATRIX OF ESTIMATE"
tablepat <- "TABLES OF DATA"
notepat <- "1 Note" # Fix for c255
}
finline <- grep(finalparpat, listfile)
seline <- grep(sepat, listfile)
tmatline <- grep(tmatpat, listfile)
rmatline <- grep(rmatpat, listfile)
smatline <- grep(smatpat, listfile)
noteline <- grep(notepat, listfile)
tableline <- grep(tablepat, listfile)
if(length(seline) == 0 && length(tmatline) == 0
&& length(noteline) == 0 && length(tableline) == 0
&& length(rmatline) == 0
&& length(smatline) == 0) {
if(length(grep(pluspat, listfile[length(listfile)])) == 0) {
final.block <- listfile[finline:(length(listfile) - 1)]
} else {
final.block <- listfile[finline:length(listfile)]
}
} else if(length(seline) !=0) {
final.block <- listfile[finline:seline[1]]
} else if (length(noteline)!=0) {
## If the last line of the lst file does not include a line
## beginning with a plus, i.e. an omega or sigma estimate
## This should always be true if length(noteline) >0
if(length(grep(pluspat, listfile[length(listfile)])) == 0) {
g <- 1
final.block <- listfile[finline:(length(listfile) - (g+1))]
## This is tricky. The while loop is dangerous.
while(length(grep(pluspat, listfile[length(listfile)-g])) == 0) {
final.block <- listfile[finline:(length(listfile) - (g+1))]
g <- g+1
}
}
} else if (length(tmatline)!=0){
final.block <- listfile[finline:(tmatline-3)]
} else if (length(rmatline)!=0){
final.block <- listfile[finline:(rmatline-3)]
} else if (length(smatline)!=0){
final.block <- listfile[finline:(rmatline-3)]
} else if (length(tableline)!=0){
final.block <- listfile[finline:(tableline-3)]
} else {
stop("the NONMEM output file has a strange format and cannot be read")
}
## Check if we have sigmas. If not set sigmaline to length(final.block)
sigmaline <- grep(sigmapat, final.block)
nosigma <- 0
if(length(sigmaline) == 0) {
nosigma <- 1
sigmaline <- length(final.block)
}
## Find thetas
nthlines <- grep(omegapat, final.block) - 4 - 1
nthlines <- nthlines/2
thetas <- NULL
for(i in (4 + 1 + nthlines):(grep(omegapat, final.block) - 1))
thetas <- paste(thetas, final.block[i], sep = " ")
thetas <- string2num(thetas)
## Find omegas
omega.block <- final.block[(grep(omegapat, final.block) + 1):
(sigmaline - 1)]
omega.block <- omega.block[ - grep(etpat, omega.block)]
omegas <- substring(omega.block, 2)
starlines <- grep("\\*\\*\\*\\*",omegas)
if(length(starlines)!=0){
omegas <- omegas[-starlines]
}
omegas <- omegas[sapply(omegas, nchar) != 0]
omega <- list()
for(i in 1:length(omegas))
omega[[i]] <- string2num(omegas[i])
omega <- fix.wrapped.lines(omega)
## Find sigmas
if(!nosigma) {
if(length(seline) == 0) {
sigma.block <- final.block[(grep(sigmapat, final.block) + 1):
length(final.block)]
} else {
sigma.block <- final.block[(grep(sigmapat, final.block) + 1):
(length(final.block) - 4)]
}
## check to make sure that there is no extra text at end of block
pluslines <- grep(pluspat, sigma.block) # find the lines with '+' at the start
lastplusline <- pluslines[length(pluslines)] # last line with '+' at the start
nextline <- lastplusline+1
while (((nextline+1) < length(sigma.block)) &&
length(grep("[[:alnum:]]", sigma.block[nextline]))!=0 ) {
nextline <- nextline+1
}
lastSigmaLine <- nextline-1
sigma.block <- sigma.block[1:lastSigmaLine]
## now extract sigmas
sigma.block <- sigma.block[ - grep(eppat, sigma.block)]
sigmas <- substring(sigma.block, 2)
sigmas <- sigmas[sapply(sigmas, nchar) != 0]
sigma <- list()
for(i in 1:length(sigmas))
sigma[[i]] <- string2num(sigmas[i])
sigma <- fix.wrapped.lines(sigma)
} else {
sigma <- NULL
}
##
## Find standard errors
##
if(length(seline) == 0) {
sethetas <- NULL
seomega <- NULL
sesigma <- NULL
} else {
covmatline <- grep(covmatpat, listfile)[1]
se.block <- listfile[seline:(covmatline - 4)]
sigmaline <- grep(sigmapat, se.block)
nosigma <- 0
if(length(sigmaline) == 0) {
nosigma <- 1
sigmaline <- length(se.block)
}
## Find sethetas
nthlines <- grep(omegapat, se.block) - 4 - 1
nthlines <- nthlines/2
sethetas <- NULL
for(i in (4 + 1 + nthlines):(grep(omegapat, se.block) - 1))
sethetas <- paste(sethetas, se.block[i], sep = " ")
sethetas <- string2num(sethetas)
na2zero <- function(x)
{
if(is.na(x))
return(0)
else return(x)
}
## Find omegas
omega.block <- se.block[(grep(omegapat, se.block) + 1):
(sigmaline - 1)]
omega.block <- omega.block[ - grep(etpat, omega.block)]
seomegas <- substring(omega.block, 2)
seomegas <- seomegas[sapply(seomegas, nchar) != 0]
seomega <- list()
for(i in 1:length(seomegas)) {
##seomega[[i]] <- sapply(string2num(seomegas[i]), na2zero)
seomega[[i]] <- string2num(seomegas[i])
}
seomega <- fix.wrapped.lines(seomega)
## Find sigmas
if(!nosigma) {
sigma.block <- se.block[(sigmaline + 1):
length(se.block)]
sigma.block <- sigma.block[ - grep(eppat, sigma.block)]
sesigmas <- substring(sigma.block, 2)
sesigmas <- sesigmas[sapply(sesigmas, nchar) != 0]
sesigma <- list()
for(i in 1:length(sesigmas))
sesigma[[i]] <- string2num(sesigmas[i])
sesigma <- fix.wrapped.lines(sesigma)
} else {
sesigma <- NULL
}
}
ret.list <- list(term = termes, ofv = ofv, thetas = thetas, omega =
omega, sigma = sigma, sethetas = sethetas,
seomegas = seomega,
sesigmas = sesigma)
return(ret.list)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.lst6.R |
read.lst7 <- function(filename) {
## Function to split character strings
string2num <- function(x)
{
oldopts <- options(warn = -1)
on.exit(options(oldopts))
nc <- nchar(x)
tmp <- substring(x, 1:nc, 1:nc)
spc <- tmp == " "
st <- !spc & c(T, spc[ - nc])
end <- !spc & c(spc[-1], T)
as.numeric(substring(x, (1:nc)[st], (1:nc)[end]))
}
listfile <- scan(filename, sep = "\n", what = character(),quiet=TRUE)
## Find termination messages
minimStart <- grep("#TERM:",listfile)
minimEnd <- grep("#TERE:",listfile)
if(length(minimStart)>1) {
stop("There seems to be more than one set of termination messages. This is not supported in the current version of Xpose.\n")
} else if(length(minimStart)==0 || length(minimEnd) == 0) {
termes <- NULL
} else {
termes <- listfile[(minimStart+1):(minimEnd-1)]
termes <- substring(termes, 2)
}
## Figure out the name of the raw results file
rawfile <- paste(sub("\\.\\w*$",'',filename),".ext",sep="")
if(!is.readable.file(rawfile)) {
stop(paste("Could not find the raw results file (",rawfile,") for list file: ",filename,"\n"))
} else {
rawres <- read.table(rawfile,skip=1,header=T)
}
## Extract OFV
ofv <- rawres$OBJ[rawres$ITERATION==-1000000000]
## Extract parameter estimates
## Get lines with relevant info
finalEstLine <- as.numeric(rawres[rawres$ITERATION==-1000000000,])
## Extract theta estimates
thetas <- finalEstLine[grep("THETA",names(rawres))]
## Extract omega estimates
omindx <- grep("OMEGA",names(rawres))
omega <- list()
seenOM <- NULL
seenOM[1:100] <- 0
for(om in omindx) {
omnam <- names(rawres)[om]
omcol <- as.numeric(sub("OMEGA\\.\\w*\\.",'',omnam,perl=TRUE))
tmp1 <- sub("OMEGA\\.",'',omnam,perl=TRUE)
omrow <- as.numeric(sub("\\.\\w*\\.$",'',tmp1,perl=TRUE))
seenOM[omrow] <- seenOM[omrow]+1
if(seenOM[omrow]==1) {
omega[omrow][omcol] <- finalEstLine[om]
} else {
omega[[omrow]] <- c(omega[[omrow]],as.numeric(finalEstLine[om]))
}
}
## Extract sigma estimates
siindx <- grep("SIGMA",names(rawres))
sigma <- list()
seenSI <- NULL
seenSI[1:100] <- 0
if(length(siindx)!=0) {
for(si in siindx) {
sinam <- names(rawres)[si]
sicol <- as.numeric(sub("SIGMA\\.\\w*\\.",'',sinam,perl=TRUE))
tmp1 <- sub("SIGMA\\.",'',sinam,perl=TRUE)
sirow <- as.numeric(sub("\\.\\w*\\.$",'',tmp1,perl=TRUE))
seenSI[sirow] <- seenSI[sirow]+1
if(seenSI[sirow]==1) {
sigma[sirow][sicol] <- finalEstLine[si]
} else {
sigma[[sirow]] <- c(sigma[[sirow]],as.numeric(finalEstLine[si]))
}
}
} else {
sigma <- NULL
}
## Extract standard error estimates
## Extract line with relevant info
seEstLine <- as.numeric(rawres[rawres$ITERATION==-1000000001,])
if(length(seEstLine)[1] == 0) {
sethetas <- NULL
seomega <- NULL
sesigma <- NULL
} else {
## Extract theta estimates
sethetas <- seEstLine[grep("THETA",names(rawres))]
sethetas[sethetas == 1.00000E+10] <- NA
## Extract omega estimates
omindx <- grep("OMEGA",names(rawres))
seomega <- list()
seeseOM <- NULL
seeseOM[1:100] <- 0
for(om in omindx) {
omnam <- names(rawres)[om]
omcol <- as.numeric(sub("OMEGA\\.\\w*\\.",'',omnam,perl=TRUE))
tmp1 <- sub("OMEGA\\.",'',omnam,perl=TRUE)
omrow <- as.numeric(sub("\\.\\w*\\.$",'',tmp1,perl=TRUE))
if(!is.na(seEstLine[om])){
if(seEstLine[om] == 1.00000E+10) seEstLine[om] <- NA
}
seeseOM[omrow] <- seeseOM[omrow]+1
if(seeseOM[omrow]==1) {
seomega[omrow][omcol] <- seEstLine[om]
} else {
seomega[[omrow]] <- c(seomega[[omrow]],as.numeric(seEstLine[om]))
}
}
## Extract sigma estimates
siindx <- grep("SIGMA",names(rawres))
sesigma <- list()
seenseSI <- NULL
seenseSI[1:100] <- 0
if(length(siindx)!=0) {
for(si in siindx) {
sinam <- names(rawres)[si]
sicol <- as.numeric(sub("SIGMA\\.\\w*\\.",'',sinam,perl=TRUE))
tmp1 <- sub("SIGMA\\.",'',sinam,perl=TRUE)
sirow <- as.numeric(sub("\\.\\w*\\.$",'',tmp1,perl=TRUE))
if(!is.na(seEstLine[si])){
if(seEstLine[si] == 1.00000E+10) seEstLine[si] <- NA
}
seenseSI[sirow] <- seenseSI[sirow]+1
if(seenseSI[sirow]==1) {
sesigma[sirow][sicol] <- seEstLine[si]
} else {
sesigma[[sirow]] <- c(sesigma[[sirow]],as.numeric(seEstLine[si]))
}
}
} else {
sesigma <- NULL
}
}
ret.list <- list(term = termes, ofv = ofv, thetas = thetas, omega =
omega, sigma = sigma, sethetas = sethetas,
seomegas = seomega,
sesigmas = sesigma)
return(ret.list)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.lst7.R |
#' Reading NONMEM table files
#'
#' Reads one or more NONMEM table files, removes duplicated columns and merges
#' the data into a data.frame.
#'
#' Reads one or more table files, removes duplicate columns and merges the
#' data. The function also checks to see if the table files are of the same
#' length (required).
#'
#' If there are header lines in the table files (for example if your data are
#' simulated with NSUB>1), these are removed.
#'
#' The table file names to read are constructed from the file name templates of
#' \code{table.names}. The \code{runno} and \code{tab.suffix} are appended to
#' the file name template before checking if the file is readable.
#'
#' Xpose expects, by default, to find the following NONMEM tables in the
#' working directory to be able to create an Xpose data object (using a run
#' number of 5 as an example):
#'
#' sdtab5: The 'standard' parameters, including IWRE, IPRE, TIME, and the
#' NONMEM default items (DV, PRED, RES and WRES) that are added when NOAPPEND
#' is not present in the \code{$TABLE} record.
#'
#' \code{ $TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab5}
#'
#' patab5: The empirical Bayes estimates of individual model parameter values,
#' or posthoc estimates. These are model parameters, such as CL, V2, ETA1, etc.
#'
#' \code{ $TABLE ID CL V2 KA K F1 ETA1 ETA2 ETA3 NOPRINT NOAPPEND ONEHEADER
#' FILE=patab5 }
#'
#' catab5: Categorical covariates, e.g. SEX, RACE.
#'
#' \code{ $TABLE ID SEX HIV GRP NOPRINT NOAPPEND ONEHEADER FILE=catab5 }
#'
#' cotab5: Continuous covariates, e.g. WT, AGE.
#'
#' \code{ $TABLE ID WT AGE BSA HT GGT HB NOPRINT NOAPPEND ONEHEADER FILE=cotab5}
#'
#' mutab5, mytab5, extra5, xptab5: Additional variables of any kind. These
#' might be useful if there are more covariates than can be accommodated in the
#' covariates tables, for example, or if you have other variables that should
#' be added, e.g. CMAX, AUC.
#'
#' @param table.files Exact names of table files to read. If not provided then
#' the exact names are created using the other arguments to the function.
#' @param runno Run-number to identify sets of table files.
#' @param tab.suffix Table file name suffix.
#' @param table.names Vector of template table file names to read.
#' @param cwres.name Vector of CWRES table file names to read.
#' @param cwres.suffix CWRES table file name suffix.
#' @param quiet Logical value to indicate whether some warnings should be quiet
#' or not.
#' @param new_methods Should faster methods of reading tables be used (uses readr package)?
#' @param \dots Additional arguments passed to this function
#' @return A dataframe.
#' @author Niclas Jonsson, Andrew Hooker
#' @seealso \code{\link{xpose.data-class}}, \code{\link{compute.cwres}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory, and that the table files have
#' ## a suffix of '.dat', e.g. sdtab5.dat
#'
#' my.dataframe <- read.nm.tables(5, tab.suffix = ".dat")
#' }
#'
#'
#'
#' @export
#' @family data functions
read.nm.tables <-
function(table.files=NULL,
runno=NULL,
tab.suffix="",
##sim.suffix="sim",
table.names=c("sdtab","mutab","patab","catab",
"cotab","mytab","extra","xptab"),
cwres.name=c("cwtab"),
cwres.suffix="",
quiet=FALSE,
new_methods=TRUE,
...) {
if (is.null(table.files)){
if(is.null(runno)) {
cat(paste("runno must be specified if no table files provided\n"))
return(NULL)
}
match.pos <- match(cwres.name,table.names)
if (!is.na(match.pos)) table.names <- table.names[-match.pos]
tab.files <- sapply(table.names,paste,runno,tab.suffix,sep="")
cwres.files <- sapply(cwres.name,paste,runno,cwres.suffix,tab.suffix,sep="")
tab.files <- c(tab.files,cwres.files)
} else {
tab.files <- table.files
}
## Read in the table files
totab <- NULL
totnam <- NULL
seen.files <- NULL
filedim <- NULL
for(i in 1:length(tab.files)) {
filename <- tab.files[i]
if(!is.readable.file(filename)) {
##if (!quiet) {cat(filename,"not readable\n")}
next
} else {
cat(paste(" Reading",filename,"\n"))
if(new_methods){
assign(paste0("n.",filename),read_nm_table(filename, quiet=quiet,...))
} else {
## Check which type of separator we have in our tables
header.line = scan(file=filename,nlines=1,skip=1,what="character",sep="\n",quiet=T)
sep.char = ""
if(length(grep(",",header.line))!=0) sep.char = ","
## Check if we have unequal number of fields in the file
## used for multiple simulations
fields.per.line <- count.fields(filename)
fields.in.first.line <- fields.per.line[1]
fields.in.rest <- fields.per.line[-1]
if((length(unique(fields.in.rest))!=1) ||
(all(fields.in.first.line==fields.in.rest))){
if(!quiet) {
cat(paste("Found different number of fields in ",filename,".\n",sep=""))
cat("This may be due to multiple TABLE and header rows \n")
cat("caused by running multiple simulations in NONMEM (NSIM > 1).\n")
cat("Will try to remove these rows. It may take a while...\n")
}
tmp <- readLines(filename, n = -1)
inds <- grep("TABLE",tmp)
if (length(inds)!=1){
inds <- inds[c(2:length(inds))]
inds2 <- inds+1
tempfile<- paste(filename,".xptmp",sep="")
write.table(tmp[-c(inds,inds2)],file=tempfile,
row.names=FALSE,quote=FALSE)
assign(paste("n.",filename,sep=""),read.table(tempfile,skip=2,header=T,sep=sep.char))
unlink(tempfile)
} else {
assign(paste("n.",filename,sep=""),read.table(filename,skip=1,header=T,sep=sep.char))
}
} else {
assign(paste("n.",filename,sep=""),read.table(filename,skip=1,header=T,sep=sep.char))
}
}
## Remember the files seen
##if(is.null(seen.files)) {
## seen.files <- paste("n.",filename,sep="")
##} else {
seen.files <- c(seen.files,paste("n.",filename,sep=""))
##}
}
}
## Check if we found any table files
if(any(is.null(seen.files))) {
#if(tab.suffix!=sim.suffix) {
cat("Couldn't find any table files that match run number",
runno, "!\n")
return(NULL)
#} else {
# cat("Couldn't find any simulation table files that match run number",
# runno, "!\n")
#}
}
## Check if the files have the same length
for(nfile in seen.files) {
if(is.null(filedim)) {
filedim <- nrow(get(nfile))
} else {
filedim <- c(filedim,nrow(get(nfile)))
}
}
file.df <- data.frame(seen.files=seen.files,filedim=filedim)
lngths <- sort(unique(file.df$filedim))
if(length(lngths) !=1) {
cat("\nThe table files associated with this run number (",runno,
") appear\n")
cat("to have different lengths.\n")
cat("You will have to sort this out and try again!\n")
return(NULL)
}
## Add the tables to totab and replicate the shorter ones to match
## the size of the longest one
maxlngth <- max(file.df$filedim)
##singdef <-
## c("id","idlab","idv","dv","pred","ipred","iwres","wres","res")
for(ii in 1:nrow(file.df)) {
filnam <- as.character(file.df[ii,"seen.files"])
new.df <- get(filnam)
sz <- file.df[ii,"filedim"]
rl <- maxlngth/sz
if(any(is.null(totab))) {
totab <- cbind(new.df)
#totab <- new.df
} else {
totab <- cbind(totab,new.df)
}
totnam <- c(totnam,names(new.df))
## store parameters & covariates for Data.R & SData.R
## if(!is.na(pmatch("n.patab", filnam))){
## write(names(new.df), file=".patab.names.tmp")
## } else {
## if(!is.na(pmatch("n.catab", filnam))){
## write(names(new.df), file=".catab.names.tmp")
## } else {
## if(!is.na(pmatch("n.cotab", filnam))){
## write(names(new.df), file=".cotab.names.tmp")
## }
## }
## }
# if(!is.na(pmatch("n.patab", filnam))){
# write(names(new.df), file=".patab.names.tmp")
# } else {
# if(!is.na(pmatch("n.catab", filnam))){
# write(names(new.df), file=".catab.names.tmp")
# } else {
# if(!is.na(pmatch("n.cotab", filnam))){
# write(names(new.df), file=".cotab.names.tmp")
# } else {
# if(!is.na(pmatch("n.sdtab", filnam))){
# write(names(new.df), file=".sdtab.names.tmp")
# }
# }
# }
# }
if(length(grep("sdtab",filnam))==1) write(names(new.df), file=".sdtab.names.tmp")
if(length(grep("patab",filnam))==1) write(names(new.df), file=".patab.names.tmp")
if(length(grep("catab",filnam))==1) write(names(new.df), file=".catab.names.tmp")
if(length(grep("cotab",filnam))==1) write(names(new.df), file=".cotab.names.tmp")
}
# cat(totnam, "\n")
## Delete all duplicates
totab <- totab[, !duplicated(totnam)]
return(totab)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.nm.tables.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Read the results file from a Numerical or Visual Predictive Check run in PsN
#'
#' This function reads in a results file from running either the PsN command
#' \code{vpc} or \code{npc}. The function then parses the file and passes the
#' result to plotting functions.
#'
#' One of \code{vpc.results} or \code{npc.results} are necessary. If both or
#' none are defined then the function does nothing and a \code{NULL} is
#' returned from the function.
#'
#' @param vpc.results The name of the results file from running the PsN command
#' \code{vcp}. Often this is named \file{vpc_results.csv}. If the file is in
#' a directory different then the working directory then you can define a
#' relative or absolute path to the file by, for example,
#' \file{./vpc_strat_WT_4_mirror_5/vpc_results.csv}.
#' @param npc.results The name of the results file from running the PsN command
#' \code{npc}. Often this is named \file{npc_results.csv}. relative or
#' absolute paths to the file are allowed as for \code{vpc.results}.
#' @param verbose Text messages passed to screen or not.
#' @param \dots arguments passed to other functions.
#' @return A list of values is returned. \item{model.file }{The model file
#' that PsN ran either the \code{npc} or \code{vpc} with} \item{dv.var }{The
#' dependent variable used in the calculations.} \item{idv.var }{The
#' independent variable used in the calculations. \code{NULL} if
#' \code{npc.results} is used.} \item{num.tables }{The number of separate
#' tables in the results file.} \item{by.interval }{The conditioning interval
#' for the stratification variable, only returned if \code{vpc.results} is
#' used.} \item{result.tables }{The results tables from the results file. this
#' is a list.}
#' @author Andrew Hooker
#' @seealso \code{\link{xpose.VPC}} \code{\link{npc.coverage}}
#' @keywords methods
#' @export read.npc.vpc.results
#' @family PsN functions
"read.npc.vpc.results" <-
function(vpc.results=NULL,
npc.results=NULL,
verbose=FALSE,
...) {
## Make sure we have the necessary variables defined
if(is.null(vpc.results) & is.null(npc.results)){
cat(paste("Both the arguments vpc.results and npc.results are NULL\n"))
cat(paste("One of these must be defined\n"))
return(NULL)
}
## Make sure we have the necessary variables defined
if(!is.null(vpc.results) & !is.null(npc.results)){
cat(paste("Both the arguments vpc.results and npc.results are defined\n"))
cat(paste("ONLY one of these may be defined\n"))
return(NULL)
}
vpc <- FALSE
npc <- FALSE
if(!is.null(vpc.results)) vpc <- TRUE
if(!is.null(npc.results)) npc <- TRUE
if(vpc) filename <- vpc.results
if(npc) filename <- npc.results
if(is.readable.file(filename)){
if(verbose) cat(paste(" Reading",filename,"\n"))
file.scan <- scan(filename,sep="\n",
what = character(),
quiet=TRUE,
blank.lines.skip = FALSE)
} else {
cat(paste(filename,"was not found for reading\n"))
return(NULL)
}
blank.line.pat <- "^$"
if(vpc){
table.start.pat <- "VPC results"
table.head.pat <- "<="
}
if(npc){
table.start.pat <- "NPC results"
table.head.pat <- "points below PI"
}
table.start <- grep(table.start.pat,file.scan)
num.tables <- length(table.start)
table.head <- grep(table.head.pat,file.scan)
## get end of table
blank.line <- grep(blank.line.pat,file.scan)
table.stop <- c()
for(i in 1:num.tables){
for(j in 1:length(blank.line)){
if (table.start[i]>blank.line[j]) next
if (table.start[i]<blank.line[j]) {
table.stop <- c(table.stop,blank.line[j]-1)
break
}
}
}
table.rows.to.read <- table.stop-table.head
## get the DV and IDV for the plot
dv.pat <- "Dependent variable"
idv.pat <- "Independent variable"
mod.pat <- "Modelfile"
dv.idv.table.start <- grep(dv.pat,file.scan)
dv.idv.table.stop <- NULL
for(j in 1:length(blank.line)){
if (dv.idv.table.start>blank.line[j]) next
if (dv.idv.table.start<blank.line[j]) {
dv.idv.table.stop <- blank.line[j]-1
break
}
}
dv.idv.table <- read.table(filename,
skip=dv.idv.table.start-1,
nrows=dv.idv.table.stop - dv.idv.table.start,
sep=",",comment.char="",
header=T,strip.white=TRUE)
dv.var <- paste(dv.idv.table[[grep("Dependent.variable",names(dv.idv.table))]])
##dv.var <- paste(dv.idv.table$Dependent.variable)
model.file <- paste(dv.idv.table[[grep("Modelfile",names(dv.idv.table))]])
##model.file <- paste(dv.idv.table$Modelfile)
if (vpc) idv.var <- paste(dv.idv.table[[grep("Independent.variable",names(dv.idv.table))]])
##if (vpc) idv.var <- paste(dv.idv.table$Independent.variable)
## get categorical boundaries if present
cat.tables <- F
cen.tables <- F
cat.boundaries <- NULL
lloq <- NA
uloq <- NA
pred.corr <- FALSE
var.corr <- FALSE
add.feats.row <- grep("Additional.feature",file.scan)
##if(!is.null(dv.idv.table$Additional.features)){
if(length(add.feats.row)!=0){
for(i in 1:length(add.feats.row)){
##if(dv.idv.table$Additional.features=="Categorization"){
if(length(grep("Categorization",file.scan[add.feats.row[i]+1]))!=0){
##if(dv.idv.table[[add.feats.row[i]]]=="Categorization"){
cat.tables <- T
boundary.table <- read.table(filename,
skip=add.feats.row[i]+1,
nrows=1,
sep=",",
fill=T,
comment.char="",
strip.white=TRUE,
header=T)
boundary.rows <- grep("Boundary",names(boundary.table))
cat.boundaries <- boundary.table[,boundary.rows]
}
if(length(grep("Censored.data",file.scan[add.feats.row[i]+1]))!=0){
##if(dv.idv.table[[add.feats.row]]=="Censored data"){
##if(dv.idv.table$Additional.features=="Censored data"){
cen.tables <- T
censored.table <- read.table(filename,
skip=add.feats.row[i]+1,
nrows=1,
sep=",",
fill=T,
comment.char="",
strip.white=TRUE,
header=T)
lloq <- censored.table$LLOQ
uloq <- censored.table$ULOQ
##lloq.row <- grep("LLOQ",names(dv.idv.table))
##uloq.row <- grep("ULOQ",names(dv.idv.table))
##lloq <- dv.idv.table[,lloq.row]
##uloq <- dv.idv.table[,uloq.row]
}
if(length(grep("Prediction.correction",file.scan[add.feats.row[i]+1]))!=0){
##if(dv.idv.table[[add.feats.row[i]]]=="Categorization"){
pred.corr <- T
}
if(length(grep("Variability.correction",file.scan[add.feats.row[i]+1]))!=0){
##if(dv.idv.table[[add.feats.row[i]]]=="Categorization"){
var.corr <- T
}
}
}
##get the numerous tables
by.interval <- NULL
strata.names <- NULL
if(num.tables>1){
bin.table <- vector("list",num.tables+1)
strata.names <- c()
tmp.interval <- c()
for(i in 1:num.tables){
## get the names of the strata
strata.pat <- "strata"
strata.line <- file.scan[table.start[i]]
strata.start <- regexpr(strata.pat,strata.line)+7
if(strata.start==6){ ## there is no strata
tmp.strata <- NULL
tmp.interval <- NULL
} else {
strata.stop <- regexpr(",",strata.line)-1
if (strata.stop==-2) strata.stop <- regexpr("$",strata.line)
tmp.strata <- substring(strata.line,strata.start,strata.stop)
strata.var.stop <- regexpr(" ",tmp.strata)-1
strata.int.start <- regexpr(" ",tmp.strata)+1
strata.var <- substring(tmp.strata,1,strata.var.stop)
strata.int <- substring(tmp.strata,strata.int.start)
tmp.strata = gsub("\\[",">= ",tmp.strata)
tmp.strata = gsub("\\]",paste(" >=",strata.var,sep=" "),tmp.strata)
tmp.strata = gsub("\\(","> ",tmp.strata)
tmp.strata = gsub("\\)",paste(" >",strata.var,sep=" "),tmp.strata)
tmp.strata = gsub("\\;"," \\& ",tmp.strata)
tmp.strata = gsub(" = ", " == ",tmp.strata)
}
strata.names <- c(strata.names,tmp.strata)
if(!is.null(tmp.strata)){
if(regexpr(">",tmp.strata)!=-1){ #then we have a continuous variable
## set the intervals for the continuous variable
semi.loc <- regexpr("\\;",strata.int)
lt.GE.loc <- regexpr("\\[",strata.int)
lt.GT.loc <- regexpr("\\(",strata.int)
rt.LE.loc <- regexpr("\\]",strata.int)
rt.LT.loc <- regexpr("\\)",strata.int)
strata.int.low <- substring(strata.int,1,semi.loc-1)
strata.int.low <- gsub("\\[","",strata.int.low)
strata.int.low <- gsub("\\(","",strata.int.low)
strata.int.low <- gsub(" ","",strata.int.low)
strata.int.low <- as.numeric(strata.int.low)
strata.int.high <- substring(strata.int,semi.loc+1)
strata.int.high <- gsub("\\]","",strata.int.high)
strata.int.high <- gsub("\\)","",strata.int.high)
strata.int.high <- gsub(" ","",strata.int.high)
strata.int.high <- as.numeric(strata.int.high)
interval.length <- strata.int.high - strata.int.low
add.to.ends <- interval.length*0.0000001
if(lt.GT.loc!=-1) strata.int.low <- strata.int.low+add.to.ends
if(rt.LT.loc!=-1) strata.int.high <- strata.int.high-add.to.ends
tmp.interval <- c(tmp.interval,strata.int.low,strata.int.high)
}
}
## get the table
bin.table[[i]] <- read.table(filename,
skip=table.head[i]-1,
nrows=table.rows.to.read[i],
sep=",",comment.char="",
header=T,strip.white=TRUE,
blank.lines.skip=FALSE)
}
if(length(tmp.interval)!=0){
by.interval <- matrix(tmp.interval,
nrow=num.tables,
ncol=2,byrow=T)
}
bin.table[[num.tables+1]] <- strata.names
} else {
bin.table <- read.table(filename,
skip=table.head-1,
nrows=table.rows.to.read,
sep=",",comment.char="",
header=T,strip.white=TRUE,
blank.lines.skip=FALSE)
}
## rename headers for tables
for(i in 1:num.tables){
if (num.tables==1){
tmp.table <- bin.table
} else {
tmp.table <- bin.table[[i]]
}
if(vpc){
tmp.table$X <- NULL
tmp.table$X.1 <- NULL
names(tmp.table)[1] <- "lower"
names(tmp.table)[2] <- "upper"
names(tmp.table)[3] <- "nobs"
}
if(npc){
names(tmp.table)[1] <- "PI"
tmp.table$PI <- as.numeric(sub("% PI","",tmp.table$PI))
}
tmp.names <- names(tmp.table)
tmp.names <- sub("X\\.*","",tmp.names)
tmp.names <- gsub("_",".",tmp.names)
tmp.names <- gsub("\\.+","\\.",tmp.names)
tmp.names <- gsub("\\.$","",tmp.names)
names(tmp.table) <- tmp.names
##browser()
##names(bin.table)
##names(tmp.table)
if (num.tables==1){
bin.table <- tmp.table
} else {
bin.table[[i]] <- tmp.table
}
}
## make a categorical, censored and continuous list if needed
table.multiples = 1
if(cat.tables) table.multiples=table.multiples+1
if(cen.tables) table.multiples=table.multiples+1
if(table.multiples > 1){
bin.table.cont <- vector("list",num.tables/table.multiples)
if(cat.tables) bin.table.cat <- vector("list",num.tables/table.multiples)
if(cen.tables) bin.table.cen <- vector("list",num.tables/table.multiples)
sub.i <- 0
for(ii in seq(1,num.tables,by=table.multiples)){
sub.i <- sub.i+1
bin.table.cont[[sub.i]] <- bin.table[[ii]]
}
if(sub.i==1) bin.table.cont <- bin.table.cont[[sub.i]]
cen.start = 2
if(table.multiples==3){
cat.start = 3
} else {
cat.start = 2
}
if(cen.tables){
sub.i <- 0
for(ii in seq(cen.start,num.tables,by=table.multiples)){
sub.i <- sub.i+1
bin.table.cen[[sub.i]] <- bin.table[[ii]]
}
if(sub.i==1) bin.table.cen <- bin.table.cen[[sub.i]]
} else {
bin.table.cen <- NULL
}
if(cat.tables){
sub.i <- 0
for(ii in seq(cat.start,num.tables,by=table.multiples)){
sub.i <- sub.i+1
bin.table.cat[[sub.i]] <- bin.table[[ii]]
}
if(sub.i==1) bin.table.cat <- bin.table.cat[[sub.i]]
} else {
bin.table.cat <- NULL
}
if(cat.tables){
num.tables.cat <- num.tables/table.multiples
} else {
num.tables.cat <- NULL
}
if(cen.tables){
num.tables.cen <- num.tables/table.multiples
} else {
num.tables.cen <- NULL
}
num.tables.cont <- num.tables/table.multiples
strata.names <- strata.names[seq(1,num.tables,by=table.multiples)]
} else {
bin.table.cont <- bin.table
bin.table.cat <- NULL
bin.table.cen <- NULL
num.tables.cont <- num.tables
num.tables.cat <- NULL
num.tables.cen <- NULL
}
if(npc) return(list(model.file=model.file,
dv.var=dv.var,
idv.var=NULL,
num.tables=num.tables,
result.tables=bin.table))
if(vpc) return(list(model.file=model.file,
dv.var=dv.var,
idv.var=idv.var,
num.tables=num.tables.cont,
by.interval=by.interval,
result.tables=bin.table.cont,
strata.names=strata.names,
num.tables.cat=num.tables.cat,
result.tables.cat=bin.table.cat,
cat.boundaries=cat.boundaries,
num.tables.cen=num.tables.cen,
result.tables.cen=bin.table.cen,
lloq=lloq,uloq=uloq,
pred.corr=pred.corr,
var.corr=var.corr
))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.npc.vpc.results.R |
read.phi <-
function(phi.file=NULL,
phi.prefix="run",
runno=NULL,
phi.suffix=".phi",
##sim.suffix="sim",
quiet=TRUE,
nm7=TRUE,
directory=".",
...)
{
if (!nm7){
if(!quiet) cat("This function only works for NONMEM 7")
return(NULL)
}
## create file name
if(is.null(phi.file)){
if(is.null(runno)) {
cat(paste("runno must be specified if no phi file name is provided\n"))
return(NULL)
}
filename <- file.path(directory, paste0(phi.prefix, runno, phi.suffix))
} else {
filename <- phi.file
}
if(!is.readable.file(filename)) {
if (!quiet) {cat(filename,"not readable\n")}
return(NULL)
} else {
cat(paste(" Reading",filename,"\n"))
##ind.vals <- read.table(filename,header=T,skip=1)
## Check which type of separator we have in our tables
header.line = scan(file=filename,nlines=1,skip=1,what="character",sep="\n",quiet=T)
sep.char = ""
##if(length(grep(",",header.line))!=0) sep.char = ","
## Check if we have unequal number of fields in the file
## used for multiple simulations
fields.per.line <- count.fields(filename)
fields.in.first.line <- fields.per.line[1]
fields.in.rest <- fields.per.line[-1]
if((length(unique(fields.in.rest))!=1) ||
(all(fields.in.first.line==fields.in.rest))){
if(!quiet) {
cat(paste("Found different number of columns in different rows of ",filename,".\n",sep=""))
cat("This may be due to multiple header rows \n")
cat("caused by running multiple simulations in NONMEM (NSIM > 1).\n")
cat("Will try to remove these rows. It may take a while...\n")
}
tmp <- readLines(filename, n = -1)
inds <- grep("TABLE",tmp)
if (length(inds)!=1){
inds <- inds[c(2:length(inds))]
inds2 <- inds+1
tempfile<- paste(filename,".xptmp",sep="")
write.table(tmp[-c(inds,inds2)],file=tempfile,
row.names=FALSE,quote=FALSE)
ind.vals <- read.table(tempfile,skip=2,header=T,sep=sep.char)
unlink(tempfile)
} else {
ind.vals <- read.table(filename,skip=1,header=T,sep=sep.char)
}
} else {
ind.vals <- read.table(filename,skip=1,header=T,sep=sep.char)
}
return(ind.vals)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.phi.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Read the vpctab file from PsN into Xpose
#'
#' This function read in the vpctab file created from PsN and gathers the
#' information needed to make a vpc plot.
#'
#'
#' @param vpctab The vpctab file from a '\code{vpc}' run in PsN.
#' @param object An xpose data object. Created from \code{\link{xpose.data}}.
#' One of \code{object} or \code{vpctab} is required. If both are present then
#' the information from the \code{vpctab} will over-ride the xpose data object
#' \code{object} (i.e. the values from the vpctab will replace any matching
#' values in the \code{object@Data} portion of the xpose data object). If only
#' \code{object} is present then the function will look for a vpctab with the
#' same run number as the one associated with the object.
#' @param vpc.name The default name of the vpctab file. Used if only
#' \code{object} is supplied.
#' @param vpc.suffix The suffix of the vpctab file. Used if only \code{object}
#' is supplied.
#' @param tab.suffix The table suffix of the vpctab file. Used if only
#' \code{object} is supplied. Final order of the file would be then
#' \code{paste(vpc.name,object@Runno,vpc.suffix,tab.suffix)}
#' @param inclZeroWRES If there are no zero valued weighted residuals in the
#' \code{object} then this should be \code{TRUE}.
#' @param verbose Text messages passed to screen or not.
#' @param \dots Other arguments passed to other functions.
#' @return Returned is an xpose data object with vpctab information included.
#' @author Andrew Hooker
#' @seealso \code{\link{xpose.VPC}}
#' @keywords methods
#' @export read.vpctab
#' @family PsN functions
read.vpctab <- function(vpctab=NULL,
object=NULL,
vpc.name="vpctab",
vpc.suffix="",
tab.suffix="",
inclZeroWRES=FALSE,
verbose=FALSE,
...) {
## Make sure we have the necessary variables defined
if(is.null(object) & is.null(vpctab)){
cat(paste("Both the arguments object and vpctab are NULL\n"))
cat(paste("At least one of these must be defined\n"))
return(NULL)
}
if(is.null(vpctab)){
vpc.file <- sapply(vpc.name,paste,object@Runno,vpc.suffix,tab.suffix,sep="")
} else {
vpc.file <- vpctab
}
if(!is.readable.file(vpc.file)) {
if (verbose) cat(paste(vpc.file,"not readable\n"))
return(NULL)
} else {
if(verbose) cat(paste(" Reading",vpc.file,"\n"))
orig.data <- read.table(file=vpc.file,header=T,sep=",",colClasses="numeric")
}
## check that classes are present
if (!isClass("xpose.data") || !isClass("xpose.prefs")) {
createXposeClasses()
}
## get the VPC run number
if(!is.null(vpctab)){
vpctabnum.start <- gregexpr("vpctab[[:digit:]]",vpctab)
if(vpctabnum.start!=-1){
vpc.num <- substring(vpctab,vpctabnum.start[[1]][1]+6)
} else {
vpc.num <- "0"
}
} else {
vpc.num <- object@Runno
}
##create vpcdb
vpcdb <- new("xpose.data",
Runno=vpc.num,
Doc=NULL,
Data = NULL
)
## read local options
if (is.readable.file("xpose.ini")) {
vpcdb <- xpose.read(vpcdb, file="xpose.ini")
} else {
## read global options
rhome <- R.home()
xdefini <- paste(rhome, "\\library\\xpose4\\xpose.ini", sep="")
if (is.readable.file(xdefini)) {
vpcdb <- xpose.read(vpcdb, file=xdefini)
}
}
## Add data to vpcdb
Data(vpcdb) <- orig.data
## if object exists add vpcdb to @Data and @Labels structure
if(!is.null(object)){
if(!inclZeroWRES) {
zero.wres.locs <- object@Data[,xvardef("wres",object)]!=0
} else {
zero.wres.locs <- rep(TRUE,length(object@Data$ID))
}
obj.data.red <- Data(object,inclZeroWRES,onlyfirst=FALSE,subset=NULL)
## check that the data objects have the same length
if(!length(obj.data.red$ID) == length(vpcdb@Data$ID)){
cat(paste(vpc.file,"and the data in the xpose database ('object')\n"))
cat(paste("have different lengths after subsetting on WRES\n"))
cat(paste("This must be resolved\n"))
return(NULL)
}
## check that the data objects have the same ID values
if(!all(obj.data.red$ID == vpcdb@Data$ID)){
cat(paste(vpc.file, "and the data in the xpose database ('object')\n"))
cat(paste("have different ID values on some rows in the data after subsetting on WRES\n"))
cat(paste("This must be resolved\n"))
return(NULL)
}
## merge the data
vpc.names <- names(vpcdb@Data)
obj.names <- names(object@Data)
extra.names <- c()
for(i in vpc.names){
tmp <- grep(i,obj.names)
if((length(tmp)==0)) extra.names <- c(extra.names,i)
}
object@Data[extra.names] <- NA
object@Data[zero.wres.locs,vpc.names] <- vpcdb@Data
## add extra names to Labels list
object@Prefs@Labels[extra.names] <- extra.names
} else {
object <- vpcdb
##inclZeroWRES=TRUE
}
return(object)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read.vpctab.R |
#' Read NONMEM table files produced from simulation.
#'
#' The function reads in NONMEM table files produced from the \code{$SIM} line
#' in a NONMEM model file.
#'
#' Currently the function expects the \code{$TABLE} to have a header for each
#' new simulation. This means that the \code{NOHEADER} option or
#' \code{ONEHEADER} option in the table file is not allowed.
#'
#' @param nm_table The NONMEM table file to read. A text string.
#' @param only_obs Should the non-observation lines in the data set be removed?
#' Currently filtered using the expected \code{MDV} column. \code{TRUE} or
#' \code{FALSE}.
#' @param method The methods to use for reading the tables, Can be "readr_1", "readr_2", readr_3" or "slow".
#' @param quiet Should the error message be verbose or not?
#' @param sim_num Should a simulation number be added to simulation tables?
#' @param sim_name What name should one use to name the column of the simulation number?
#'
#' @return Returns a data frame of the simulated table with an added column for
#' the simulation number. The data frame is given class \code{c("tbl_df",
#' "tbl", "data.frame")} for easy use with \code{\link[dplyr]{dplyr}}.
#'
#'
#' @export
#' @family data functions
read_nm_table <- function (nm_table, only_obs=FALSE, method="default",quiet=TRUE,sim_num=FALSE,sim_name="NSIM") {
# if(method=="default") method <- "readr_1"
if(method=="default") method <- "slow"
read_nm_tab_readr_1 <- function(nm_table,sim_num){
#tab_dat <- read_table(nm_table, skip = 1)
#tab_dat <- tab_dat %>% mutate_each(funs(suppressWarnings(as.numeric(.))))
## get header names
header_line <- readr::read_lines(nm_table,n_max=2)[2]
comma_sep <- FALSE
if(length(grep(",",header_line))!=0) comma_sep <- TRUE
header_line <- sub("^\\s+","",header_line)
header_names <- strsplit(header_line,"\\s+,*\\s*")[[1]]
#final_line <- readr::read_lines(nm_table,n_max=2)[-1]
if(!comma_sep){
# check if it is fixed width or not
data_lines <- readr::read_lines(nm_table,n_max=10)[-c(1,2)]
fixed_width <- FALSE
if(length(unique(nchar(data_lines)))==1) fixed_width <- TRUE
if(fixed_width){
tab_dat <- readr::read_table(nm_table, col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = 2,na=c("NA"))
} else {
tab_dat <- readr::read_delim(nm_table, delim=" ",skip=2,
col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""))
}
} else {
# tab_dat <- readr::read_csv(nm_table, col_names = header_names,
# col_types=paste0(rep("d",length(header_names)),collapse = ""),
# skip = 2)
tab_dat <- readr::read_csv(nm_table,skip=1,col_types = readr::cols())
}
# Handle multiple simulations
if(any(is.na(tab_dat[1]))){
if(sim_num){
## create simulation number
args <- lazyeval::interp(~ cumsum(is.na(var))+1, var = as.name(names(tab_dat)[1]))
tab_dat <- dplyr::mutate_(tab_dat,NSIM=args)
}
## filter out NA columns
if(packageVersion("dplyr") < "0.7.0"){
args <- lazyeval::interp(~ !is.na(var), var = as.name(names(tab_dat)[1]))
tab_dat <- dplyr::filter_(tab_dat,args)
} else {
var_name = as.name(names(tab_dat)[1])
tab_dat <- dplyr::filter(tab_dat,!is.na({{var_name}}))
}
}
return(tab_dat)
}
read_nm_tab_readr_2 <- function(nm_table){
## get header names
header_line <- readr::read_lines(nm_table,n_max=2)[2]
comma_sep <- FALSE
if(length(grep(",",header_line))!=0) comma_sep <- TRUE
header_line <- sub("^\\s+","",header_line)
header_names <- strsplit(header_line,"\\s+,*\\s*")[[1]]
## Check if we have unequal number of fields in the file
## used for multiple simulations
tmp <- readr::read_lines(nm_table)
inds <- grep("TABLE",tmp)
if (length(inds)!=1){
inds <- inds[c(2:length(inds))]
inds2 <- inds+1
tempfile<- paste(nm_table,".xptmp",sep="")
write.table(tmp[-c(inds,inds2)],file=tempfile,
row.names=FALSE,quote=FALSE,col.names = FALSE)
#assign(paste("n.",filename,sep=""),read.table(tempfile,skip=2,header=T,sep=sep.char))
if(!comma_sep){
tab_dat <- readr::read_table(tempfile, col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = 2)
} else {
tab_dat <- readr::read_csv(tempfile, col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = 2)
}
unlink(tempfile)
} else {
if(!comma_sep){
tab_dat <- readr::read_table(nm_table, col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = 2)
} else {
tab_dat <- readr::read_csv(nm_table, col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = 2)
}
}
return(tab_dat)
}
read_nm_tab_readr_3 <- function(nm_table,sim_num){
## get header names
header_line <- readr::read_lines(nm_table,n_max=2)[2]
comma_sep <- FALSE
if(length(grep(",",header_line))!=0) comma_sep <- TRUE
header_line <- sub("^\\s+","",header_line)
header_names <- strsplit(header_line,"\\s+,*\\s*")[[1]]
# read in all lines of file
tmp <- readr::read_lines(nm_table)
#tmp_table <- nm_table
tmp_table <- paste(tmp,collapse="\n")
fun_name <- "readr::read_table"
if(comma_sep) fun_name <- "readr::read_csv"
skip=2
## Check for multiple table lines
inds <- grep("TABLE",tmp)
if (length(inds)!=1){
inds2 <- inds+1 # additional header lines
if(sim_num){
NSIM <- rep(1,length(tmp))
NSIM[inds] <- NA
NSIM <- cumsum(is.na(NSIM))
tmp <- paste(tmp,NSIM)
header_names <- c(header_names,"NSIM")
}
tmp_table <- paste(tmp[-c(inds,inds2)],collapse="\n")
skip=0
}
tab_dat <- do.call(eval(parse(text=paste0(fun_name))),args = list(tmp_table,col_names = header_names,
col_types=paste0(rep("d",length(header_names)),collapse = ""),
skip = skip))
return(tab_dat)
}
read_nm_tab_slow <- function (filename, quiet) {
## Check which type of separator we have in our tables
header.line = scan(file=filename,nlines=1,skip=1,what="character",sep="\n",quiet=T)
sep.char = ""
if(length(grep(",",header.line))!=0) sep.char = ","
## Check if we have unequal number of fields in the file
## used for multiple simulations
fields.per.line <- count.fields(filename)
fields.in.first.line <- fields.per.line[1]
fields.in.rest <- fields.per.line[-1]
if((length(unique(fields.in.rest))!=1) ||
(all(fields.in.first.line==fields.in.rest))){
if(!quiet) {
cat(paste("Found different number of fields in ",filename,".\n",sep=""))
cat("This may be due to multiple TABLE and header rows \n")
cat("caused by running multiple simulations in NONMEM (NSIM > 1).\n")
cat("Will try to remove these rows. It may take a while...\n")
}
tmp <- readLines(filename, n = -1)
inds <- grep("TABLE",tmp)
if (length(inds)!=1){
inds <- inds[c(2:length(inds))]
inds2 <- inds+1
tempfile<- paste(filename,".xptmp",sep="")
write.table(tmp[-c(inds,inds2)],file=tempfile,
row.names=FALSE,quote=FALSE)
#assign(paste("n.",filename,sep=""),read.table(tempfile,skip=2,header=T,sep=sep.char))
tab_dat <- read.table(tempfile,skip=2,header=T,sep=sep.char)
unlink(tempfile)
} else {
#assign(paste("n.",filename,sep=""),read.table(filename,skip=1,header=T,sep=sep.char))
tab_dat <- read.table(filename,skip=1,header=T,sep=sep.char)
}
} else {
#assign(paste("n.",filename,sep=""),read.table(filename,skip=1,header=T,sep=sep.char))
tab_dat <- read.table(filename,skip=1,header=T,sep=sep.char)
}
return(tab_dat)
}
tab_dat <- switch(method,
readr_1 = read_nm_tab_readr_1(nm_table, sim_num=sim_num),
readr_2 = read_nm_tab_readr_2(nm_table),
readr_3 = read_nm_tab_readr_3(nm_table,sim_num=sim_num),
slow = read_nm_tab_slow(nm_table,quiet=quiet)
)
## remove non-observation rows
MDV <- c()
if(only_obs){
if(any("MDV"==names(tab_dat))){
tab_dat <- dplyr::filter(tab_dat,MDV==0)
} else {
warning('\nMDV data item not listed in header,
Could not remove dose events!\n')
}
}
if(sim_num) names(tab_dat)[match("NSIM",names(tab_dat))] <- sim_name
tab_dat <- data.frame(tab_dat)
if(packageVersion("tibble") < "2.0.0"){
tab_dat <- tibble::as_data_frame(tab_dat)
} else {
tab_dat <- tibble::as_tibble(tab_dat)
}
return(tab_dat)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/read_nm_table.R |
#' Resets Xpose variable definitions to factory settings
#'
#' Function to reset Xpose's graphics parameters definitions to the default.
#'
#' This functions is used to reset Xpose's graphic settings definitions to
#' their default values. Graphical settings are read from the file 'xpose.ini'
#' in the root of the 'xpose4' package.
#'
#' @param object An \code{xpose.data} object.
#' @param classic A logical operator specifying whether the function should
#' assume the classic menu system. This is an internal option and need never be
#' called from the command line.
#' @return An \code{\link{xpose.data}} object (classic == FALSE) or null
#' (classic == TRUE).
#' @author Niclas Jonsson & Justin Wilkins
#' @seealso \code{\link{xpose.prefs-class}}, \code{\link{import.graph.par}},
#' \code{\link{change.xvardef}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## Import graphics preferences you saved earlier using export.graph.par
#' xpdb5 <- import.graph.par(xpdb5)
#'
#' ## Reset to default values
#' xpdb5 <- reset.graph.par(xpdb5)
#'
#' ## Change WRES definition
#' xpdb5 <- change.wres(xpdb5)
#' }
#'
"reset.graph.par" <- function(object, classic=FALSE) {
xpobj <- object
rhome <- R.home()
xdefini <- paste(rhome, "\\library\\xpose4\\xpose.fac", sep="")
# read global options
if (is.readable.file(xdefini)) {
xpobj <- xpose.read(object, file=xdefini)
} else {
cat("No factory settings found! Check that the file 'xpose.fac'\n")
cat("is available and readable in your Xpose package root folder\n")
cat(paste("(", xdefini, ").", sep=""))
return(cat(""))
}
if (classic==TRUE) {
c1<-call("assign",paste("xpdb", object@Runno, sep = ""), data, immediate=T, envir = .GlobalEnv)
eval(c1)
c2<-call("assign",pos = 1, ".cur.db", eval(as.name(paste("xpdb", object@Runno, sep = ""))))
eval(c2)
return(cat(""))
} else {
return(xpobj)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/reset.graph.par.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
residual.diagnostics.menu <-
function() {
choices <- c("Return to previous menu ->",
"Distribution of weighted residuals (hist)",
"Distribution of weighted residuals (QQ)",
"Individual distributions of weighted residuals (hist)",
"Individual distributions of weighted residuals (QQ)",
"Absolute value of weighted residuals/IWRES vs predictions/IPRED",
"Absolute value of weighted residuals vs predictions",
"Absolute value of IWRES vs IPRED",
"Covariates vs absolute value of weighted residuals (BW)",
"Absolute value of weighted residuals vs pred|covariates",
"Absolute value of IWRES vs ipred|covariates",
"Autocorrelation of weighted residuals"
)
title="\nRESIDUAL DIAGNOSTICS MENU\n \\main\\goodness of fit plots\\Residual error model diagnostics"
pick <- menu(choices,title=title)
if(is.null(check.vars(c("cwres"),eval(parse(text=".cur.db")),silent=TRUE))) {
wres <- "wres"
}else{
wres <- "cwres"
}
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
##print(wres.dist.hist(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".dist.hist(.cur.db)",sep="")))),
##print(wres.dist.qq(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".dist.qq(.cur.db)",sep="")))),
##print(ind.plots.wres.hist(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("ind.plots.",wres,".hist(.cur.db)",sep="")))),
##print(ind.plots.wres.qq(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("ind.plots.",wres,".qq(.cur.db)",sep="")))),
##print(absval.iwres.wres.vs.ipred.pred(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("absval.iwres.",wres,".vs.ipred.pred(.cur.db)",sep="")))),
##print(absval.wres.vs.pred(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("absval.",wres,".vs.pred(.cur.db)",sep="")))),
print(absval.iwres.vs.ipred(eval(parse(text=".cur.db")))),
##print(absval.wres.vs.cov.bw(eval(parse(text=".cur.db")),bins=9)),
print(eval(parse(text=paste("absval.",wres,".vs.cov.bw(.cur.db),bins=9)",sep="")))),
##print(absval.wres.vs.pred.by.cov(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("absval.",wres,".vs.pred.by.cov(.cur.db)",sep="")))),
print(absval.iwres.vs.ipred.by.cov(eval(parse(text=".cur.db")))),
##print(autocorr.wres(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste("autocorr.",wres,"(.cur.db)",sep=""))))
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/residual.diagnostics.menu.R |
#' Print run summary in Xpose 4
#'
#' Function to build Xpose run summaries.
#'
#'
#' @param object An xpose.data object.
#' @param dir The directory to look for the model and output file of a NONMEM
#' run.
#' @param modfile The name of the NONMEM control stream associated with the
#' current run.
#' @param listfile The name of the NONMEM output file associated with the
#' current run.
#' @param main A string giving the main heading. \code{NULL} if none.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param show.plots Logical indicating if GOF plots should be shown in the run
#' summary.
#' @param txt.cex Number indicating the size of the txt in the run summary.
#' @param txt.font Font of the text in the run summary.
#' @param show.ids Logical indicating if IDs should be plotted in the plots for
#' the run summary.
#' @param param.table Logical indicating if the parameter table should be shown
#' in the run summary.
#' @param txt.columns The number of text columns in the run summary.
#' @param force.wres Plot the WRES even if other residuals are available.
#' @param \dots Other arguments passed to the various functions.
#' @return A compound plot containing an Xpose run summary is created.
#' @author Niclas Jonsson and Andrew Hooker
#' @keywords methods
#' @examples
#' od = setwd(tempdir()) # move to a temp directory
#' (cur.files <- dir()) # current files in temp directory
#'
#' simprazExample(overwrite=TRUE) # write files
#' (new.files <- dir()[!(dir() %in% cur.files)]) # what files are new here?
#'
#' xpdb <- xpose.data(1)
#' runsum(xpdb)
#'
#'
#' file.remove(new.files) # remove these files
#' setwd(od) # restore working directory
#'
#'
#' @export runsum
#' @family specific functions
runsum <-
function(object,
dir="",
modfile=paste(dir,"run",object@Runno,".mod",sep=""),
listfile=paste(dir,"run",object@Runno,".lst",sep=""),
main=NULL,
subset=xsubset(object),
show.plots=TRUE,
txt.cex=0.7,
txt.font=1,
show.ids=FALSE,
param.table=TRUE,
txt.columns=2,
force.wres=FALSE,
...)
{
## Read model file
if(is.readable.file(modfile)) {
modfile <- scan(modfile,sep="\n",what=character(),quiet=TRUE)
mod.file.lines <- length(modfile)
} else {
cat(paste("model file",modfile,"not found, run summary not created!\n"))
return()
}
## Global settings concerning number of lines, number of columns etc.
#txtnrow <- 63 # Number of rows in each column
parameter.list <- create.parameter.list(listfile)
#attach(parameter.list,warn.conflicts=F)
## Set up screen
grid.newpage()
gr.width <- par("din")[1]
gr.height <- par("din")[2]
title.size <- 0.05
graph.size <- 0.25
graph2.size <- 0
if (gr.width < gr.height){
graph.size <- graph.size*gr.width/gr.height
graph2.size <- graph2.size*gr.width/gr.height
}
text.size <- 1 - (graph.size + graph2.size + title.size)
title.vp <- viewport(x=0, y=1, just=c("left","top"),
width=1, height=title.size,
name="title.vp")
graph.1.vp <-(viewport(x=0, y=1-title.size, just=c("left","top"),
width=.25, height=graph.size,
#layout=grid.layout(1,4),
name="graph.1.vp"))
graph.2.vp <-(viewport(x=.25, y=1-title.size, just=c("left","top"),
width=.25, height=graph.size,
#layout=grid.layout(1,4),
name="graph.2.vp"))
graph.3.vp <-(viewport(x=.50, y=1-title.size, just=c("left","top"),
width=.25, height=graph.size,
#layout=grid.layout(1,4),
name="graph.3.vp"))
graph.4.vp <-(viewport(x=.75, y=1-title.size, just=c("left","top"),
width=.25, height=graph.size,
#layout=grid.layout(1,4),
name="graph.4.vp"))
graph.5.vp <-(viewport(x=0, y=1-title.size-graph.size, just=c("left","top"),
width=1, height=graph2.size,
#layout=grid.layout(1,4),
name="graph.5.vp"))
## create text column viewports
textColumnList <- vector("list",txt.columns) # empty list for viewports
for(col.num in 1:txt.columns){
txt.margin <- 0.015
x.val <- 1/txt.columns*(col.num-1) + txt.margin
w.val <- 1/txt.columns - (txt.margin)
##cat(paste(x.val,w.val,"\n"))
textColumnList[[col.num]] <- viewport(x=x.val,
y=text.size,
just=c("left","top"),
width=w.val,
height=text.size,
gp=gpar(lineheight=1.0,
cex=txt.cex,font=txt.font
),
name=paste("text",col.num,"vp",
sep="."))
}
## text.1.vp <- viewport(x=0.015, y=text.size, just=c("left","top"),
## w=0.485, h=text.size,gp=gpar(lineheight=1.0,
## cex=txt.cex,font=2),
## name="text.1.vp")
## text.2.vp <- viewport(x=0.515, y=text.size, just=c("left","top"),
## w=0.485, h=text.size,gp=gpar(lineheight=1.0,
## cex=txt.cex,font=2),
## name="text.2.vp")
## ## to look at how page is set up:
## ##
## grid.show.viewport(
## viewport(x=0.515, y=text.size, just=c("left","top"),
## w=0.485, h=text.size,gp=gpar(lineheight=1.0,
## cex=txt.cex,font=2),
## name="text.2.vp")
## )
## add the title
pushViewport(title.vp)
if(!is.null(subset)) {
maintit <- paste("Summary of run ",object@Runno,
", ",subset,sep="")
} else {
maintit <- paste("Summary of run ",object@Runno,sep="")
}
title.gp=gpar(cex=1.2,fontface="bold") # title fontsize
grid.text(maintit,gp=title.gp)
upViewport()
## Add the plots
if(show.plots){
## create plots
lw <- list(left.padding = list(x = -0.05, units="snpc"))
lw$right.padding <- list(x = -0.05,units="snpc")
lh <- list(bottom.padding = list(x = -0.05,units="snpc"))
lh$top.padding <- list(x = -0.05,units="snpc")
if(show.ids) plt.id=TRUE else plt.id=FALSE
##grid.rect(gp=gpar(col="grey"))
pushViewport(graph.1.vp)
##xplot1 <- dv.vs.pred(object,runsum=TRUE,
xplot1 <- dv.vs.pred(object,main=NULL,xlb=NULL,ylb=NULL,
##main=list("DV vs PRED",cex=0.00005),
aspect="fill",
subset=subset,
type="b",
ids=plt.id,
lty=8,
abllwd=2,
##xlb=list("",cex=0.00001),ylb=list("",cex=0.00001),
cex=0.5,lwd=0.1,
scales=list(cex=0.7,tck=c(0.3),y=list(rot=90)),
lattice.options = list(layout.widths = lw,
layout.heights = lh),
...)
print(xplot1,newpage=FALSE)
grid.text("DV vs PRED",x=0.5,y=1,just=c("center","top"),gp=gpar(cex=0.5))
upViewport()
pushViewport(graph.2.vp)
xplot2 <- dv.vs.ipred(object,
main=NULL,xlb=NULL,ylb=NULL,
#runsum=TRUE,
##main=list("DV vs PRED",cex=0.00005),
aspect="fill",
subset=subset,
type="b",
ids=plt.id,
lty=8,
abllwd=2,
##xlb=list("",cex=0.00001),
##ylb=list("",cex=0.00001),
cex=0.5,lwd=0.1,
scales=list(cex=0.7,tck=c(0.3),
y=list(rot=90)),
lattice.options = list(layout.widths = lw,
layout.heights = lh),
...)
print(xplot2,newpage=FALSE)
grid.text("DV vs IPRED",x=0.5,y=1,
just=c("center","top"),
gp=gpar(cex=0.5))
upViewport()
pushViewport(graph.3.vp)
xplot3 <- absval.iwres.vs.ipred(object,
main=NULL,xlb=NULL,ylb=NULL,
##runsum=TRUE,
##main=list("DV vs PRED",cex=0.00005),
aspect="fill",
subset=subset,
##type="b",
ids=F,
##lty=8,
##abllwd=2,
##xlb=list("",cex=0.00001),
##ylb=list("",cex=0.00001),
cex=0.5,lwd=0.1,
scales=list(cex=0.7,tck=c(0.3),
y=list(rot=90)),
lattice.options = list(layout.widths = lw,
layout.heights = lh),
...)
print(xplot3,newpage=FALSE)
grid.text("|IWRES| vs IPRED",x=0.5,y=1,
just=c("center","top"),gp=gpar(cex=0.5))
upViewport()
pushViewport(graph.4.vp)
use.cwres=TRUE
if(force.wres){
use.cwres=FALSE
} else {
if(is.null(check.vars(c("cwres"),object,silent=TRUE))) {
use.cwres=FALSE
}
}
if(use.cwres){
xplot4 <- cwres.vs.idv(object,
main=NULL,xlb=NULL,ylb=NULL,
##runsum=TRUE,
##main=list("DV vs PRED",cex=0.00005),
aspect="fill",
subset=subset,
type="b",
ids=plt.id,
lty=8,
abllwd=2,
##xlb=list("",cex=0.00001),
##ylb=list("",cex=0.00001),
cex=0.5,lwd=0.1,
scales=list(cex=0.7,tck=c(0.3),y=list(rot=90)),
lattice.options = list(layout.widths = lw,
layout.heights = lh),
...)
res.txt <- "CWRES"
}else{
xplot4 <- wres.vs.idv(object,
main=NULL,xlb=NULL,ylb=NULL,
##runsum=TRUE,
##main=list("DV vs PRED",cex=0.00005),
aspect="fill",
subset=subset,
type="b",
ids=plt.id,
lty=8,
abllwd=2,
##xlb=list("",cex=0.00001),
##ylb=list("",cex=0.00001),
cex=0.5,lwd=0.1,
scales=list(cex=0.7,tck=c(0.3),y=list(rot=90)),
lattice.options = list(layout.widths = lw,
layout.heights = lh),
...)
res.txt <- "WRES"
}
print(xplot4,newpage=FALSE)
grid.text(paste(res.txt,"vs",xvardef("idv",object)),
x=0.5,y=1,
just=c("center","top"),gp=gpar(cex=0.5))
upViewport()
## pushViewport(graph.5.vp)
## xplot5 <- dv.preds.vs.idv(object,
## runsum=TRUE,
## ##main=list("DV vs PRED",cex=0.00005),
## aspect="fill",
## subset=subset,
## type="b",
## ids=plt.id,
## lty=8,
## abllwd=2,
## ##xlb=list("",cex=0.00001),ylb=list("",cex=0.00001),
## cex=0.5,lwd=0.1,
## #scales=list(cex=0.7,tck=c(0.3),y=list(rot=90)),
## lattice.options = list(layout.widths = lw, layout.heights = lh),
## ...)
## print(xplot5,newpage=FALSE)
## grid.text(paste("WRES vs",xvardef("idv",xpdb)),x=0.5,y=1,just=c("center","top"),gp=gpar(cex=0.5))
## upViewport()
} # end show plots
## add text
#text.vp.list <- list(text.1.vp,text.2.vp)
text.vp.list <- textColumnList
ystart <- unit(1,"npc")
vp.num <- 1
space.avail <- TRUE
## Add the termination messages
if(parameter.list$seenterm == 1 && space.avail) {
termtxt <- parameter.list$term
txt.marker <- add.grid.text(txt=termtxt,
ystart=ystart,
vp=text.vp.list,
vp.num=vp.num,
spaces.before=1,
...)
ystart <- txt.marker$ystart
space.avail <- is.null(txt.marker$stop.pt)
vp.num <- txt.marker$vp.num
}
## Add objective
if(parameter.list$seenobj == 1 && space.avail) {
obj.txt <- paste("Objective:",parameter.list$ofv)
txt.marker <- add.grid.text(txt=obj.txt,
ystart=ystart,
vp=text.vp.list,
vp.num=vp.num,
spaces.before=1,
...)
ystart <- txt.marker$ystart
space.avail <- is.null(txt.marker$stop.pt)
vp.num <- txt.marker$vp.num
}
###############################
## Table of parameters and RSEs
################################
table.txt <- list(parameter.list$parnam,format(parameter.list$parval,digits=3))
table.col.names <- c("Par","Val")
have.ses <- 0
if(parameter.list$seenseth ==1 || parameter.list$seenseom==1 || parameter.list$seensesi==1) {
have.ses <- 1
table.txt <- list(parameter.list$parnam,format.default(parameter.list$parval,digits=3),parameter.list$separval)
table.col.names <- c("Par","Val","RSE")
}
##ystart <- unit(3,"lines")
txt.marker <- add.grid.table(table.txt,
col.nams=table.col.names,
ystart=ystart,
vp=text.vp.list,
vp.num=vp.num,
##center.table=TRUE,
##col.optimize=FALSE,
##equal.widths=TRUE,
##mult.col.padding=2,
...)
ystart <- txt.marker$ystart
space.avail <- is.null(txt.marker$stop.pt)
vp.num <- txt.marker$vp.num
## Add model file
if(space.avail) {
txt.marker <- add.grid.text(txt=modfile,
ystart=ystart,
vp=text.vp.list,
vp.num=vp.num,
spaces.before=1,
# spaces.before=0,
...)
ystart <- txt.marker$ystart
space.avail <- is.null(txt.marker$stop.pt)
vp.num <- txt.marker$vp.num
}
#detach(parameter.list)
invisible()
#return()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/runsum.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
runsum.print <- function(object,
##dev="win",
##printer="HP8150",
modfile=paste("run",object@Runno,".mod",sep=""),
listfile=paste("run",object@Runno,".lst",sep=""),
##new.version=TRUE,
print.cex=0.45,
print.columns=3,
...) {
## Get the name of the model file to use
cat("Type the name of the model file (0=cancel, return=",modfile,")\n",sep="")
ans <- readline()
cmdfile <- NULL
if(ans==0) {
return()
} else if (ans=="") {
if(is.readable.file(modfile)) {
cmdfile <- modfile
}
} else {
if(is.readable.file(ans)) {
cmdfile <- ans
}
}
if(is.null(cmdfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return()
}
## Get the name of the list file to use
cat("Type the name of the output file (0=cancel, return=",listfile,")\n",sep="")
ans <- readline()
lstfile <- NULL
if(ans==0) {
return()
} else if (ans=="") {
if(is.readable.file(listfile)) {
lstfile <- listfile
}
} else {
if(is.readable.file(ans)) {
lstfile <- ans
}
}
if(is.null(lstfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return()
}
## Start the printing device
cat("Do you want to optimize the summary output for printing n(y)?\n")
printit <- readline()
if(printit=="y") {
dev.new(height=11.7,width=8.25)
}
if(printit=="y") {
runsum(object,
modfile=cmdfile,
listfile = lstfile,
txt.columns=print.columns,
txt.cex=print.cex,
...)
} else {
runsum(object,
modfile=cmdfile,
listfile = lstfile,
##txt.cex=0.7,
...)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/runsum.print.R |
#' @describeIn change_misc_parameters set the documentation field in the Xpose data object.
#' @export
set.doc<-
function(object, classic = FALSE)
{
cat("Type any documentation for the new database and finish with\n")
cat("a blank line:\n")
doc <- scan(what = character(), sep = "\n")
dat <- object
dat@Doc <- doc
if (classic==TRUE) {
c1<-call("assign",paste("xpdb", object@Runno, sep = ""), data, immediate=T, envir = .GlobalEnv)
eval(c1)
c2<-call("assign",pos = 1, ".cur.db", eval(as.name(paste("xpdb", object@Runno, sep = ""))))
eval(c2)
return(cat(""))
} else {
return(dat)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/set.doc.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Function to create files for the simulated prazosin example in Xpose
#'
#' Creates NONMEM data, model and output files for a model of prazosin using
#' simulated data.
#'
#' Creates files in the current working directory named: run1.ext run1.lst
#' run1.mod simpraz.dta xptab1
#'
#' @param overwrite Logical. Should the function overwrite files with the same
#' names already in the current working directory?
#' @author Niclas Jonsson and Andrew Hooker
#' @keywords methods
#' @examples
#'
#' od = setwd(tempdir()) # move to a temp directory
#' (cur.files <- dir()) # current files in temp directory
#'
#' simprazExample(overwrite=TRUE) # write files
#'
#' (new.files <- dir()[!(dir() %in% cur.files)]) # what files are new here?
#'
#' file.remove(new.files) # remove these files
#' setwd(od) # restore working directory
#'
#' @export simprazExample
#' @family data functions
simprazExample <- function(overwrite=FALSE) {
writeMod <- function() {
cat(file="run1.mod","$PROB Simpraz model
;; 1. Based on: First run [nodOFV]
;; First run with a one compartment model and first order absorption
;; 2. Structural model:
;; One compartment model with first order absorption
;; 3. Covariate model:
;; No covariates
;; 4. Inter-individual variability:
;; ETAs on CL, V and KA
;; 5. Residual variability:
;; Proportional
;; 6. Estimation:
;; FOCE INTER
$INPUT ID SEX AGE RACE HT SMOK HCTZ PROP CON AMT WT TIME SECR
DV RATE EVID OCC
$DATA simpraz.dta IGNORE=@
$SUBROUTINE ADVAN2 TRANS2
$PK
TVCL = THETA(1)
TVV = THETA(2)
TVKA = THETA(3)
CL = TVCL*EXP(ETA(1))
V = TVV *EXP(ETA(2))
KA = TVKA*EXP(ETA(3))
S2=V
$ERROR
IPRED = F
IRES = DV - F
W = F
IF(W.EQ.0) W = 1
IWRES = IRES/W
Y = IPRED + W*EPS(1)
$THETA
(0,18.7) ; CL (L/h)
(0,87.3) ; V (L)
(0,2.13) ; KA (1/h)
$OMEGA
0.128 ; omCL
0.142 ; omV
1.82 ; omKA
$SIGMA
0.0231 ; Prop error
$EST NOABORT METHOD=1 INTER PRINT=1
$COV PRINT=E
$TABLE ID TIME IPRED IWRES CWRES
CL V KA ETA1 ETA2 ETA3
AGE HT WT SECR
SEX RACE SMOK HCTZ PROP CON OCC
NOPRINT ONEHEADER FILE=xptab1
"
)
}
writeDta <- function() {
cat(file="simpraz.dta","ID SEX AGE RACE HT SMOK HCTZ PROP CON AMT WT TIME SECR DV RATE EVID OCC
1 2 55 2 154 0 1 1 1 10000 80.97 0 1 0 0 1 0
1 2 55 2 154 0 1 1 1 0 80.97 1 1 71.74 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 2 1 72.61 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 3 1 88.01 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 4 1 53.13 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 5 1 56.83 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 6 1 51.94 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 7 1 52.89 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 9 1 26.95 0 0 0
1 2 55 2 154 0 1 1 1 0 80.97 11 1 26.17 0 0 0
2 1 37 1 179 1 0 0 0 10000 93.21 0 1.2 0 0 1 0
2 1 37 1 179 1 0 0 0 0 93.21 1 1.2 108.75 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 2 1.2 96.6 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 3 1.2 81 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 4 1.2 77.07 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 5 1.2 64.57 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 6 1.2 50.21 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 7 1.2 64.58 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 8 1.2 50.54 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 10 1.2 41.56 0 0 0
2 1 37 1 179 1 0 0 0 0 93.21 12 1.2 42.46 0 0 0
3 1 35 1 188 0 0 0 0 1000 94.35 0 0.9 0 0 1 0
3 1 35 1 188 0 0 0 0 0 94.35 1 0.9 9.35 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 2 0.9 8.66 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 3 0.9 8.18 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 4 0.9 6.19 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 5 0.9 7.08 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 6 0.9 4.68 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 7 0.9 5.3 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 8 0.9 4.2 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 10 0.9 3.92 0 0 0
3 1 35 1 188 0 0 0 0 0 94.35 12 0.9 2.75 0 0 0
4 2 67 2 168 0 0 0 0 5000 74.39 0 0.8 0 0 1 0
4 2 67 2 168 0 0 0 0 0 74.39 1 0.8 63.15 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 2 0.8 62.41 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 3 0.8 41.05 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 4 0.8 24.31 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 5 0.8 18.17 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 6 0.8 13.23 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 7 0.8 8.48 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 9 0.8 3.92 0 0 0
4 2 67 2 168 0 0 0 0 0 74.39 11 0.8 1.76 0 0 0
5 2 69 2 165 0 0 0 1 2000 91.85 0 1 0 0 1 0
5 2 69 2 165 0 0 0 1 0 91.85 1 1 21.49 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 2 1 14.87 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 3 1 15.17 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 4 1 13.68 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 5 1 14.83 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 6 1 9.86 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 7 1 8.75 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 9 1 7.77 0 0 0
5 2 69 2 165 0 0 0 1 0 91.85 11 1 4.36 0 0 0
6 2 52 2 157 0 1 1 1 10000 104.3 0 0.8 0 0 1 0
6 2 52 2 157 0 1 1 1 0 104.3 1 0.8 74.53 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 2 0.8 63.02 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 3 0.8 100.46 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 4 0.8 84.92 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 5 0.8 59.01 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 6 0.8 53.87 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 7 0.8 45.15 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 8 0.8 33.88 0 0 0
6 2 52 2 157 0 1 1 1 0 104.3 10 0.8 26.27 0 0 0
7 2 44 2 140 0 1 1 1 10000 90.04 0 0.9 0 0 1 0
7 2 44 2 140 0 1 1 1 0 90.04 1 0.9 184.78 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 2 0.9 142.73 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 3 0.9 86.18 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 4 0.9 65.65 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 5 0.9 55.07 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 6 0.9 37.95 0 0 0
7 2 44 2 140 0 1 1 1 0 90.04 8 0.9 23.25 0 0 0
8 2 50 2 173 1 1 0 0 5000 98.88 0 0.9 0 0 1 0
8 2 50 2 173 1 1 0 0 0 98.88 1 0.9 37.72 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 2 0.9 19.15 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 3 0.9 14.41 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 4 0.9 11.89 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 5 0.9 5.48 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 6 0.9 4.93 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 7 0.9 4.01 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 9 0.9 1.54 0 0 0
8 2 50 2 173 1 1 0 0 0 98.88 11 0.9 0.6 0 0 0
9 2 61 2 160 0 1 0 1 5000 81.42 0 0.9 0 0 1 0
9 2 61 2 160 0 1 0 1 0 81.42 1 0.9 52.58 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 2 0.9 57.71 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 3 0.9 36.23 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 4 0.9 26.13 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 5 0.9 18.07 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 6 0.9 10.83 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 8 0.9 5.49 0 0 0
9 2 61 2 160 0 1 0 1 0 81.42 10 0.9 3.05 0 0 0
10 2 52 2 168 0 1 1 1 5000 87.32 0 1.8 0 0 1 0
10 2 52 2 168 0 1 1 1 0 87.32 1 1.8 61.76 0 0 0
10 2 52 2 168 0 1 1 1 0 87.32 2 1.8 18.4 0 0 0
10 2 52 2 168 0 1 1 1 0 87.32 3 1.8 4.82 0 0 0
10 2 52 2 168 0 1 1 1 0 87.32 6 1.8 0.08 0 0 0
10 2 52 2 168 0 1 1 1 0 87.32 8 1.8 0.01 0 0 0
12 1 59 2 178 0 0 0 1 2000 98.43 0 1.1 0 0 1 0
12 1 59 2 178 0 0 0 1 0 98.43 1 1.1 16.63 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 2 1.1 16.48 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 3 1.1 11.11 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 4 1.1 11.98 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 5 1.1 7.73 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 6 1.1 8.08 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 7 1.1 5.74 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 9 1.1 3.87 0 0 0
12 1 59 2 178 0 0 0 1 0 98.43 11 1.1 2.73 0 0 0
13 1 54 2 159 0 0 0 0 2000 68.04 0 1.3 0 0 1 0
13 1 54 2 159 0 0 0 0 0 68.04 1 1.3 13.98 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 2 1.3 12.08 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 3 1.3 9.14 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 4 1.3 7.21 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 5 1.3 4.76 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 6 1.3 2.5 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 7 1.3 1.79 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 8 1.3 1.32 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 10 1.3 0.62 0 0 0
13 1 54 2 159 0 0 0 0 0 68.04 12 1.3 0.16 0 0 0
14 1 62 2 180 0 0 0 1 2000 81.65 0 1.1 0 0 1 0
14 1 62 2 180 0 0 0 1 0 81.65 1 1.1 27.05 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 2 1.1 19.34 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 3 1.1 13.79 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 4 1.1 10.04 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 5 1.1 7.52 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 6 1.1 3.78 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 7 1.1 3.47 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 8 1.1 3.1 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 10 1.1 1.01 0 0 0
14 1 62 2 180 0 0 0 1 0 81.65 12 1.1 0.6 0 0 0
15 1 63 1 172 0 1 0 1 2000 83.1 0 1.2 0 0 1 0
15 1 63 1 172 0 1 0 1 0 83.1 1 1.2 8.88 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 2 1.2 11.07 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 3 1.2 14.29 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 4 1.2 8.91 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 5 1.2 9.92 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 6 1.2 8.8 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 7 1.2 6.79 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 8 1.2 5.76 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 10 1.2 4 0 0 0
15 1 63 1 172 0 1 0 1 0 83.1 12 1.2 4.02 0 0 0
16 1 63 1 170 1 0 0 1 2000 83.4 0 1.1 0 0 1 0
16 1 63 1 170 1 0 0 1 0 83.4 1 1.1 9.79 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 2 1.1 16 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 3 1.1 15.77 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 4 1.1 17.11 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 5 1.1 16.56 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 6 1.1 11.53 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 7 1.1 12.31 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 8 1.1 8.91 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 10 1.1 7.08 0 0 0
16 1 63 1 170 1 0 0 1 0 83.4 12 1.1 4.96 0 0 0
17 1 63 1 177 1 1 0 0 10000 104.1 0 1 0 0 1 0
17 1 63 1 177 1 1 0 0 0 104.1 1 1 176.18 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 2 1 138.65 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 3 1 112.75 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 4 1 93.39 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 5 1 86.78 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 6 1 66.81 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 7 1 46.65 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 8 1 45.43 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 10 1 31.86 0 0 0
17 1 63 1 177 1 1 0 0 0 104.1 12 1 16.42 0 0 0
18 1 58 2 187 1 1 0 1 5000 136.8 0 1.5 0 0 1 0
18 1 58 2 187 1 1 0 1 0 136.8 1 1.5 56.35 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 2 1.5 47.18 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 3 1.5 44.91 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 4 1.5 41.94 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 5 1.5 29.04 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 6 1.5 17.36 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 7 1.5 22.15 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 8 1.5 18.05 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 10 1.5 13.64 0 0 0
18 1 58 2 187 1 1 0 1 0 136.8 12 1.5 10.16 0 0 0
19 1 66 1 177 1 0 0 1 5000 97.3 0 1.2 0 0 1 0
19 1 66 1 177 1 0 0 1 0 97.3 1 1.2 56.37 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 2 1.2 47.02 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 3 1.2 58.38 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 4 1.2 36.77 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 5 1.2 38.95 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 6 1.2 28.99 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 7 1.2 32.83 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 8 1.2 24.78 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 10 1.2 16.52 0 0 0
19 1 66 1 177 1 0 0 1 0 97.3 12 1.2 12.04 0 0 0
20 1 67 1 181 1 0 0 1 2000 96.1 0 1.3 0 0 1 0
20 1 67 1 181 1 0 0 1 0 96.1 1 1.3 10.88 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 2 1.3 11.89 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 3 1.3 9.42 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 4 1.3 13.67 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 5 1.3 10.97 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 6 1.3 9.21 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 7 1.3 6.33 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 9 1.3 4.95 0 0 0
20 1 67 1 181 1 0 0 1 0 96.1 11 1.3 2.85 0 0 0
21 1 57 1 180 1 1 0 1 1000 85.9 0 1.2 0 0 1 0
21 1 57 1 180 1 1 0 1 0 85.9 1 1.2 2.23 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 3 1.2 3.53 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 4 1.2 4.13 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 5 1.2 3.84 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 6 1.2 2.9 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 7 1.2 2.61 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 8 1.2 2.5 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 10 1.2 1.43 0 0 0
21 1 57 1 180 1 1 0 1 0 85.9 12 1.2 0.66 0 0 0
22 1 56 2 170 0 1 0 1 3500 88.13 0 0.8 0 0 1 0
22 1 56 2 170 0 1 0 1 0 88.13 1 0.8 19.76 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 2 0.8 23.99 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 3 0.8 15.86 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 4 0.8 12.01 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 5 0.8 7.7 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 6 0.8 6.29 0 0 0
22 1 56 2 170 0 1 0 1 0 88.13 7 0.8 4.11 0 0 0
23 2 57 3 168 0 1 0 1 3500 69.08 0 1.1 0 0 1 0
23 2 57 3 168 0 1 0 1 0 69.08 1 1.1 15.43 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 2 1.1 17.58 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 3 1.1 17.85 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 4 1.1 17.46 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 5 1.1 14.53 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 6 1.1 17.52 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 7 1.1 15.93 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 8 1.1 15.72 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 10 1.1 12.62 0 0 0
23 2 57 3 168 0 1 0 1 0 69.08 12 1.1 10.71 0 0 0
24 2 56 1 175 0 0 0 0 3500 74.6 0 0.8 0 0 1 0
24 2 56 1 175 0 0 0 0 0 74.6 1 0.8 15.35 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 2 0.8 16.73 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 3 0.8 29.66 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 4 0.8 29.59 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 5 0.8 24.34 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 6 0.8 19.81 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 7 0.8 25.61 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 8 0.8 12.9 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 10 0.8 14.45 0 0 0
24 2 56 1 175 0 0 0 0 0 74.6 12 0.8 12.65 0 0 0
25 1 61 1 171 0 1 0 1 3500 96.62 0 1 0 0 1 0
25 1 61 1 171 0 1 0 1 0 96.62 1 1 28.33 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 2 1 23.91 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 3 1 22.45 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 4 1 15.55 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 5 1 12.41 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 6 1 8.77 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 7 1 5.83 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 8 1 4.05 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 9 1 3.38 0 0 0
25 1 61 1 171 0 1 0 1 0 96.62 10 1 2.26 0 0 0
26 2 67 1 157 0 0 0 0 3500 66.4 0 0.9 0 0 1 0
26 2 67 1 157 0 0 0 0 0 66.4 1 0.9 8.83 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 2 0.9 16.84 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 3 0.9 25.07 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 4 0.9 19.91 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 5 0.9 20.68 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 6 0.9 22.01 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 7 0.9 19.94 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 8 0.9 15.65 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 10 0.9 14.46 0 0 0
26 2 67 1 157 0 0 0 0 0 66.4 12 0.9 10.65 0 0 0
27 1 56 1 177 0 0 0 0 5000 97.4 0 1 0 0 1 0
27 1 56 1 177 0 0 0 0 0 97.4 1 1 40.74 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 2 1 54.32 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 3 1 37.44 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 4 1 29.8 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 5 1 26.36 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 6 1 17.04 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 7 1 13.14 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 8 1 7.92 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 10 1 4.21 0 0 0
27 1 56 1 177 0 0 0 0 0 97.4 12 1 2.38 0 0 0
28 1 58 1 173 0 1 0 1 10000 78.7 0 1.4 0 0 1 0
28 1 58 1 173 0 1 0 1 0 78.7 1 1.4 84.19 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 2 1.4 86.2 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 3 1.4 74.03 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 4 1.4 58.2 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 5 1.4 47 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 6 1.4 40.57 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 7 1.4 31.51 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 8 1.4 30.41 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 10 1.4 20.17 0 0 0
28 1 58 1 173 0 1 0 1 0 78.7 12 1.4 10.19 0 0 0
29 1 53 1 180 0 1 1 1 10000 87.6 0 1.2 0 0 1 0
29 1 53 1 180 0 1 1 1 0 87.6 1 1.2 22.06 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 3 1.2 40.41 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 4 1.2 34.71 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 5 1.2 26.09 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 6 1.2 28.7 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 7 1.2 30.07 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 8 1.2 19.96 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 10 1.2 10.01 0 0 0
29 1 53 1 180 0 1 1 1 0 87.6 12 1.2 10.61 0 0 0
30 1 46 1 175 0 1 1 1 10000 84.8 0 1.2 0 0 1 0
30 1 46 1 175 0 1 1 1 0 84.8 1 1.2 57.81 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 2 1.2 103.55 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 3 1.2 76 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 4 1.2 72.99 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 5 1.2 56.53 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 6 1.2 60.08 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 7 1.2 57.04 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 8 1.2 37.89 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 10 1.2 38.8 0 0 0
30 1 46 1 175 0 1 1 1 0 84.8 12 1.2 23.21 0 0 0
31 2 30 1 157 0 0 0 0 2000 61.7 0 1.1 0 0 1 0
31 2 30 1 157 0 0 0 0 0 61.7 1 1.1 13.34 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 2 1.1 17.91 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 3 1.1 17.23 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 4 1.1 11.74 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 5 1.1 10.35 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 6 1.1 10.74 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 7 1.1 9.4 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 8 1.1 6.42 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 10 1.1 4.26 0 0 0
31 2 30 1 157 0 0 0 0 0 61.7 12 1.1 3.56 0 0 0
32 2 56 1 174 0 1 0 1 3500 68.72 0 1.1 0 0 1 0
32 2 56 1 174 0 1 0 1 0 68.72 1 1.1 17.32 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 2 1.1 17.54 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 3 1.1 12.74 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 4 1.1 14.73 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 5 1.1 13.02 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 6 1.1 9.25 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 7 1.1 7.85 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 8 1.1 8.4 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 10 1.1 5.16 0 0 0
32 2 56 1 174 0 1 0 1 0 68.72 12 1.1 5.04 0 0 0
33 1 54 1 180 0 0 0 0 10000 76.43 0 1 0 0 1 0
33 1 54 1 180 0 0 0 0 0 76.43 1 1 105.94 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 2 1 120.44 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 3 1 104.12 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 4 1 91.11 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 5 1 84.46 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 6 1 58.59 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 7 1 53.96 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 8 1 43.25 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 10 1 46.03 0 0 0
33 1 54 1 180 0 0 0 0 0 76.43 12 1 29.78 0 0 0
34 1 34 1 170 0 0 0 1 1000 77.34 0 1 0 0 1 0
34 1 34 1 170 0 0 0 1 0 77.34 2 1 8.48 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 3 1 5.39 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 4 1 3.09 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 5 1 3.46 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 6 1 1.79 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 7 1 1.08 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 9 1 0.59 0 0 0
34 1 34 1 170 0 0 0 1 0 77.34 10 1 0.33 0 0 0
35 1 52 1 183 0 1 0 1 5000 89.36 0 1.1 0 0 1 0
35 1 52 1 183 0 1 0 1 0 89.36 1 1.1 27.99 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 2 1.1 42.82 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 3 1.1 25.66 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 4 1.1 24.67 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 5 1.1 18.75 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 6 1.1 14.15 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 7 1.1 11.46 0 0 0
35 1 52 1 183 0 1 0 1 0 89.36 10 1.1 2.88 0 0 0
36 1 47 1 175 0 1 1 1 10000 93.21 0 1.1 0 0 1 0
36 1 47 1 175 0 1 1 1 0 93.21 1 1.1 134.89 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 2 1.1 107.21 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 3 1.1 63.25 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 4 1.1 38.67 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 5 1.1 26.35 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 6 1.1 14.12 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 7 1.1 11.74 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 8 1.1 6.08 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 10 1.1 2.1 0 0 0
36 1 47 1 175 0 1 1 1 0 93.21 12 1.1 0.89 0 0 0
37 1 66 1 155 0 1 1 1 5000 93.44 0 1.4 0 0 1 0
37 1 66 1 155 0 1 1 1 0 93.44 1 1.4 23.32 0 0 0
37 1 66 1 155 0 1 1 1 0 93.44 2 1.4 25.76 0 0 0
37 1 66 1 155 0 1 1 1 0 93.44 3 1.4 36.97 0 0 0
37 1 66 1 155 0 1 1 1 0 93.44 8 1.4 22.21 0 0 0
37 1 66 1 155 0 1 1 1 0 93.44 12 1.4 8.49 0 0 0
38 1 66 2 160 1 0 0 1 5000 62.14 0 1.1 0 0 1 0
38 1 66 2 160 1 0 0 1 0 62.14 1 1.1 70.92 0 0 0
38 1 66 2 160 1 0 0 1 0 62.14 2 1.1 47.75 0 0 0
38 1 66 2 160 1 0 0 1 0 62.14 3 1.1 40.87 0 0 0
38 1 66 2 160 1 0 0 1 0 62.14 4 1.1 21.24 0 0 0
38 1 66 2 160 1 0 0 1 0 62.14 6 1.1 12.55 0 0 0
39 1 51 1 178 0 1 0 1 1000 97.07 0 1 0 0 1 0
39 1 51 1 178 0 1 0 1 0 97.07 1 1 6.32 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 2 1 7.29 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 3 1 5.58 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 4 1 5.72 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 5 1 3.81 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 7 1 3.48 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 8 1 3.17 0 0 0
39 1 51 1 178 0 1 0 1 0 97.07 10 1 1.93 0 0 0
40 1 24 1 181 0 0 0 1 3500 80.29 0 1.4 0 0 1 0
40 1 24 1 181 0 0 0 1 0 80.29 1 1.4 33.86 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 2 1.4 18.36 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 3 1.4 19.47 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 4 1.4 15.85 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 5 1.4 10.68 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 6 1.4 7.84 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 7 1.4 7.81 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 8 1.4 5.84 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 10 1.4 4.6 0 0 0
40 1 24 1 181 0 0 0 1 0 80.29 12 1.4 1.99 0 0 0
41 1 33 1 176 0 0 0 1 3500 80.74 0 1.3 0 0 1 0
41 1 33 1 176 0 0 0 1 0 80.74 1 1.3 45.4 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 2 1.3 44.07 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 3 1.3 37.28 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 4 1.3 41.31 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 5 1.3 37.36 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 6 1.3 24.23 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 7 1.3 22.39 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 8 1.3 15.46 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 10 1.3 15.16 0 0 0
41 1 33 1 176 0 0 0 1 0 80.74 12 1.3 9.55 0 0 0
42 1 41 1 168 0 1 0 1 10000 84.37 0 1.5 0 0 1 0
42 1 41 1 168 0 1 0 1 0 84.37 1 1.5 110.98 0 0 0
42 1 41 1 168 0 1 0 1 0 84.37 2 1.5 72.34 0 0 0
42 1 41 1 168 0 1 0 1 0 84.37 3 1.5 30.91 0 0 0
42 1 41 1 168 0 1 0 1 0 84.37 4 1.5 14 0 0 0
42 1 41 1 168 0 1 0 1 0 84.37 6 1.5 3.13 0 0 0
42 1 41 1 168 0 1 0 1 0 84.37 8 1.5 0.67 0 0 0
43 1 38 1 173 0 0 0 1 1000 67.13 0 1.2 0 0 1 0
43 1 38 1 173 0 0 0 1 0 67.13 1 1.2 4.69 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 2 1.2 5.8 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 3 1.2 5.9 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 4 1.2 5.23 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 5 1.2 4.68 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 6 1.2 3.56 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 7 1.2 2.48 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 8 1.2 2.5 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 10 1.2 2.14 0 0 0
43 1 38 1 173 0 0 0 1 0 67.13 12 1.2 1.67 0 0 0
44 1 54 1 183 1 0 0 0 3500 103.4 0 1.1 0 0 1 0
44 1 54 1 183 1 0 0 0 0 103.4 1 1.1 28.9 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 2 1.1 21.08 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 3 1.1 15.09 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 4 1.1 8.77 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 5 1.1 3.41 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 6 1.1 1.84 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 7 1.1 1.09 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 8 1.1 0.48 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 10 1.1 0.14 0 0 0
44 1 54 1 183 1 0 0 0 0 103.4 12 1.1 0.03 0 0 0
45 1 51 2 170 1 1 0 0 5000 83.14 0 1.2 0 0 1 0
45 1 51 2 170 1 1 0 0 0 83.14 1 1.2 53 0 0 0
45 1 51 2 170 1 1 0 0 0 83.14 4 1.2 17.98 0 0 0
45 1 51 2 170 1 1 0 0 0 83.14 8 1.2 2.75 0 0 0
45 1 51 2 170 1 1 0 0 0 83.14 11 1.2 0.67 0 0 0
46 2 58 2 159 1 1 0 1 10000 69.31 0 1.1 0 0 1 0
46 2 58 2 159 1 1 0 1 0 69.31 1 1.1 161.86 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 2 1.1 157.57 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 3 1.1 116.89 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 4 1.1 102.18 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 5 1.1 69.69 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 6 1.1 48.29 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 7 1.1 47.6 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 8 1.1 38.98 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 9 1.1 21.22 0 0 0
46 2 58 2 159 1 1 0 1 0 69.31 11 1.1 14.56 0 0 0
47 1 56 1 187 1 1 1 1 10000 108.2 0 1 0 0 1 0
47 1 56 1 187 1 1 1 1 0 108.2 1 1 73.72 0 0 0
47 1 56 1 187 1 1 1 1 0 108.2 4 1 62.77 0 0 0
47 1 56 1 187 1 1 1 1 0 108.2 5 1 52.28 0 0 0
47 1 56 1 187 1 1 1 1 0 108.2 8 1 41.83 0 0 0
47 1 56 1 187 1 1 1 1 0 108.2 12 1 30.84 0 0 0
48 1 63 1 178 1 1 0 1 5000 93.8 0 1 0 0 1 0
48 1 63 1 178 1 1 0 1 0 93.8 1 1 119.97 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 2 1 55.31 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 3 1 52.02 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 4 1 49.41 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 5 1 40.56 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 6 1 33.93 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 7 1 23.22 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 8 1 15.22 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 9 1 12.25 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 10 1 13.64 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 11 1 7.72 0 0 0
48 1 63 1 178 1 1 0 1 0 93.8 12 1 9.18 0 0 0
49 2 50 1 157 1 1 0 1 5000 125.4 0 0.7 0 0 1 0
49 2 50 1 157 1 1 0 1 0 125.4 1 0.7 19.09 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 2 0.7 26.46 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 3 0.7 24.47 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 4 0.7 20.43 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 5 0.7 24.08 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 6 0.7 13.59 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 7 0.7 16.84 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 8 0.7 12.95 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 10 0.7 10.71 0 0 0
49 2 50 1 157 1 1 0 1 0 125.4 12 0.7 9.75 0 0 0
50 2 62 2 147 0 1 0 1 5000 51.03 0 0.8 0 0 1 0
50 2 62 2 147 0 1 0 1 0 51.03 1 0.8 65.72 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 2 0.8 42.13 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 3 0.8 20.42 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 4 0.8 11.54 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 5 0.8 4.39 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 6 0.8 1.93 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 7 0.8 1 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 8 0.8 0.36 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 10 0.8 0.08 0 0 0
50 2 62 2 147 0 1 0 1 0 51.03 12 0.8 0.02 0 0 0
51 1 48 2 185 0 1 1 1 5000 96.3 0 1.1 0 0 1 0
51 1 48 2 185 0 1 1 1 0 96.3 1 1.1 42.61 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 2 1.1 47.68 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 3 1.1 47.65 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 4 1.1 44.96 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 5 1.1 36.56 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 6 1.1 32.37 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 8 1.1 19.77 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 10 1.1 17.05 0 0 0
51 1 48 2 185 0 1 1 1 0 96.3 12 1.1 16.78 0 0 0
52 2 57 1 165 0 0 0 1 5000 70.53 0 1 0 0 1 0
52 2 57 1 165 0 0 0 1 0 70.53 1 1 27.81 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 2 1 44.56 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 3 1 27.71 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 4 1 35.69 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 5 1 32.64 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 6 1 20.07 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 7 1 26.51 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 8 1 24.71 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 10 1 18.05 0 0 0
52 2 57 1 165 0 0 0 1 0 70.53 12 1 13.82 0 0 0
53 2 67 1 160 0 0 0 1 1000 83.24 0 1 0 0 1 0
53 2 67 1 160 0 0 0 1 0 83.24 1 1 14.36 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 2 1 14.72 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 3 1 9.02 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 4 1 7.6 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 5 1 6.45 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 6 1 4.86 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 7 1 3.23 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 8 1 2.11 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 10 1 1.16 0 0 0
53 2 67 1 160 0 0 0 1 0 83.24 12 1 0.7 0 0 0
54 2 39 2 169 1 1 0 1 5000 78.25 0 1 0 0 1 0
54 2 39 2 169 1 1 0 1 0 78.25 1 1 15 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 2 1 20.61 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 3 1 18.4 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 4 1 16 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 5 1 15.3 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 6 1 9.47 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 7 1 7.66 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 8 1 4.37 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 10 1 2.9 0 0 0
54 2 39 2 169 1 1 0 1 0 78.25 12 1 0.91 0 0 0
55 2 47 1 168 0 1 0 1 10000 72.12 0 0.7 0 0 1 0
55 2 47 1 168 0 1 0 1 0 72.12 1 0.7 98.31 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 2 0.7 80.18 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 3 0.7 54.06 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 4 0.7 27.03 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 5 0.7 14.27 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 6 0.7 12.56 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 7 0.7 4.39 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 9 0.7 2.05 0 0 0
55 2 47 1 168 0 1 0 1 0 72.12 11 0.7 0.65 0 0 0
56 2 36 2 157 0 1 0 1 1000 88.45 0 0.9 0 0 1 0
56 2 36 2 157 0 1 0 1 0 88.45 1 0.9 14.96 0 0 0
56 2 36 2 157 0 1 0 1 0 88.45 4 0.9 8.72 0 0 0
56 2 36 2 157 0 1 0 1 0 88.45 5 0.9 8.66 0 0 0
56 2 36 2 157 0 1 0 1 0 88.45 8 0.9 4.38 0 0 0
56 2 36 2 157 0 1 0 1 0 88.45 10 0.9 3.03 0 0 0
56 2 36 2 157 0 1 0 1 0 88.45 12 0.9 2.43 0 0 0
57 1 63 1 173 0 1 0 1 5000 73.94 0 0.9 0 0 1 0
57 1 63 1 173 0 1 0 1 0 73.94 1 0.9 5.99 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 2 0.9 13.26 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 3 0.9 13.19 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 4 0.9 14.15 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 5 0.9 16.3 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 6 0.9 14.39 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 7 0.9 12.63 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 8 0.9 14.82 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 9 0.9 13.44 0 0 0
57 1 63 1 173 0 1 0 1 0 73.94 10 0.9 10.27 0 0 0
58 1 61 1 178 0 0 0 1 3500 67.27 0 1.1 0 0 1 0
58 1 61 1 178 0 0 0 1 0 67.27 1 1.1 25.91 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 4 1.1 13 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 5 1.1 8.31 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 6 1.1 4.54 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 7 1.1 4.87 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 8 1.1 2.93 0 0 0
58 1 61 1 178 0 0 0 1 0 67.27 10 1.1 1.9 0 0 0
59 2 53 1 157 0 1 0 1 5000 55.02 0 0.8 0 0 1 0
59 2 53 1 157 0 1 0 1 0 55.02 1 0.8 36.19 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 2 0.8 40.04 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 3 0.8 35.84 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 4 0.8 48.96 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 6 0.8 30.71 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 7 0.8 30.07 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 8 0.8 29.57 0 0 0
59 2 53 1 157 0 1 0 1 0 55.02 12 0.8 15.6 0 0 0
60 1 55 1 173 0 0 0 1 5000 78.7 0 1.1 0 0 1 0
60 1 55 1 173 0 0 0 1 0 78.7 1 1.1 73.05 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 2 1.1 51.52 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 3 1.1 39.96 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 4 1.1 23.43 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 5 1.1 22.59 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 6 1.1 14.64 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 7 1.1 12.32 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 8 1.1 9.58 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 10 1.1 4.23 0 0 0
60 1 55 1 173 0 0 0 1 0 78.7 12 1.1 2.48 0 0 0
61 1 58 1 179 0 0 0 1 1000 94.57 0 1 0 0 1 0
61 1 58 1 179 0 0 0 1 0 94.57 1 1 10.61 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 2 1 8.08 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 4 1 3.32 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 5 1 2.72 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 6 1 1.49 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 7 1 1.26 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 8 1 0.89 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 9 1 0.49 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 10 1 0.38 0 0 0
61 1 58 1 179 0 0 0 1 0 94.57 11 1 0.25 0 0 0
62 1 56 1 179 0 1 0 1 5000 102.3 0 1.2 0 0 1 0
62 1 56 1 179 0 1 0 1 0 102.3 1 1.2 50.88 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 2 1.2 50.86 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 3 1.2 41.68 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 4 1.2 38.77 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 5 1.2 35.61 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 6 1.2 24.9 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 7 1.2 24.82 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 8 1.2 20.89 0 0 0
62 1 56 1 179 0 1 0 1 0 102.3 10 1.2 15.97 0 0 0
63 1 66 1 182 0 0 0 1 3500 94.8 0 1.1 0 0 1 0
63 1 66 1 182 0 0 0 1 0 94.8 1 1.1 39.62 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 2 1.1 34.31 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 3 1.1 25.9 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 4 1.1 29.15 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 5 1.1 18.82 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 7 1.1 10.61 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 8 1.1 7.07 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 10 1.1 4.5 0 0 0
63 1 66 1 182 0 0 0 1 0 94.8 11 1.1 2.73 0 0 0
64 1 48 1 183 0 0 0 1 5000 111.8 0 1.2 0 0 1 0
64 1 48 1 183 0 0 0 1 0 111.8 1 1.2 26.15 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 2 1.2 27.49 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 3 1.2 27.17 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 4 1.2 30.42 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 5 1.2 24.82 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 6 1.2 20.71 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 8 1.2 10.35 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 9 1.2 14.18 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 11 1.2 7.3 0 0 0
64 1 48 1 183 0 0 0 1 0 111.8 12 1.2 4.51 0 0 0
65 1 64 1 180 0 0 0 1 5000 99.79 0 1.1 0 0 1 0
65 1 64 1 180 0 0 0 1 0 99.79 1 1.1 19.94 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 2 1.1 33.94 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 3 1.1 30.16 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 4 1.1 23.47 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 5 1.1 27.24 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 6 1.1 25.67 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 7 1.1 21.15 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 9 1.1 20.4 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 10 1.1 18.13 0 0 0
65 1 64 1 180 0 0 0 1 0 99.79 12 1.1 20.18 0 0 0
")
#data("simprazdata")
#write.table(simprazdata,sep=" ",file="simpraz.dta",quote=F,row.names=F,col.names=T)
#rm(simprazdata,pos=1)
}
writeTab <- function() {
cat(file="xptab1","TABLE NO. 1
ID TIME IPRED IWRES CWRES CL V KA ETA1 ETA2 ETA3 AGE HT WT SECR SEX RACE SMOK HCTZ PROP CON OCC DV PRED RES WRES
1 0 0 0 0 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 0 0 0 0
1 1 69.193 0.036814 -0.064632 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 71.74 86.417 -14.677 -0.10466
1 2 80.181 -0.094424 -0.94112 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 72.61 89.007 -16.397 -0.75889
1 3 75.33 0.16833 1.1911 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 88.01 75.467 12.543 1.2075
1 4 66.916 -0.20602 -1.5154 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 53.13 61.036 -7.9058 -1.5386
1 5 58.398 -0.026852 -0.05963 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 56.83 48.711 8.1189 -0.1152
1 6 50.666 0.025138 0.40992 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 51.94 38.724 13.216 0.35805
1 7 43.871 0.20557 1.8304 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 52.89 30.748 22.142 2.0246
1 9 32.841 -0.17939 -1.0218 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 26.95 19.372 7.5782 -1.3045
1 11 24.575 0.064921 0.83731 13.579 93.64 1.2249 -0.26774 0.19829 -0.16359 55 154 80.97 1 2 2 0 1 1 1 0 26.17 12.202 13.968 1.3377
2 0 0 0 0 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 0 0 0 0
2 1 96.073 0.13195 0.81197 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 108.75 86.417 22.333 0.78856
2 2 92.138 0.048423 -0.086669 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 96.6 89.007 7.5927 0.20562
2 3 84.073 -0.036555 -0.54055 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 81 75.467 5.5326 -0.16109
2 4 76.514 0.0072629 0.0058848 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 77.07 61.036 16.034 0.33678
2 5 69.625 -0.072605 -0.40244 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 64.57 48.711 15.859 -0.42935
2 6 63.356 -0.20749 -1.2486 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 50.21 38.724 11.486 -1.9657
2 7 57.651 0.12019 1.3843 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 64.58 30.748 33.832 1.713
2 8 52.46 -0.036595 0.33237 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 50.54 24.407 26.133 -0.024531
2 10 43.438 -0.043226 0.4972 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 41.56 15.375 26.185 0.46007
2 12 35.967 0.18052 2.3421 8.7284 92.501 3.0141 -0.7097 0.18605 0.73689 37 179 93.21 1.2 1 1 1 0 0 0 0 42.46 9.6845 32.776 5.4087
3 0 0 0 0 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 0 0 0 0
3 1 8.7842 0.064412 0.39278 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 9.35 8.6417 0.70834 0.43295
3 2 8.7557 -0.010932 -0.40336 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 8.66 8.9007 -0.24073 -0.20004
3 3 7.8877 0.037055 0.061309 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 8.18 7.5467 0.63326 0.23779
3 4 7.0253 -0.11889 -0.96332 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 6.19 6.1036 0.086418 -0.95166
3 5 6.2486 0.13306 1.0866 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 7.08 4.8711 2.2089 1.2177
3 6 5.5568 -0.15779 -0.99186 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 4.68 3.8724 0.80764 -1.4247
3 7 4.9416 0.072537 0.85148 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 5.3 3.0748 2.2252 0.85019
3 8 4.3944 -0.044238 0.049046 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 4.2 2.4407 1.7593 -0.23439
3 10 3.4751 0.12801 1.4633 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 3.92 1.5375 2.3825 2.1772
3 12 2.7482 0.00066506 0.55527 11.024 93.942 2.2304 -0.4762 0.20151 0.43577 35 188 94.35 0.9 1 1 0 0 0 0 0 2.75 0.96845 1.7816 1.4402
4 0 0 0 0 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 0 0 0 0
4 1 63.799 -0.010173 0.44757 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 63.15 43.208 19.942 0.44742
4 2 55.019 0.13433 1.2202 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 62.41 44.504 17.906 1.5121
4 3 39.396 0.041987 0.20166 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 41.05 37.734 3.3163 0.27899
4 4 27.031 -0.10065 -1.0776 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 24.31 30.518 -6.2079 -0.95201
4 5 18.339 -0.0092034 -0.47843 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 18.17 24.356 -6.1855 -0.52772
4 6 12.404 0.066622 0.071143 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 13.23 19.362 -6.1318 -0.23497
4 7 8.3822 0.011663 -0.3334 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 8.48 15.374 -6.8942 -0.40566
4 9 3.826 0.024557 -0.17993 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 3.92 9.6859 -5.7659 -0.043349
4 11 1.7462 0.0079027 -0.25069 19.607 49.991 1.6776 0.099584 -0.42932 0.15097 67 168 74.39 0.8 2 2 0 0 0 0 0 1.76 6.1012 -4.3412 0.38238
5 0 0 0 0 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 0 0 0 0
5 1 19.492 0.10248 0.96785 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 21.49 17.283 4.2067 1.1867
5 2 18.528 -0.19743 -1.5134 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 14.87 17.801 -2.9315 -1.4188
5 3 16.141 -0.060132 -0.42243 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 15.17 15.093 0.076512 -0.38579
5 4 13.944 -0.018938 -0.031704 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 13.68 12.207 1.4728 -0.047322
5 5 12.036 0.2321 1.9294 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 14.83 9.7422 5.0878 2.0694
5 6 10.389 -0.050901 -0.17008 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 9.86 7.7447 2.1153 -0.37002
5 7 8.9667 -0.024163 0.056323 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 8.75 6.1497 2.6003 -0.14125
5 9 6.6798 0.16321 1.4828 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 7.77 3.8744 3.8956 1.7438
5 11 4.9761 -0.12382 -0.71336 12.47 84.706 2.4371 -0.35295 0.09802 0.52438 69 165 91.85 1 2 2 0 0 0 1 0 4.36 2.4405 1.9195 -0.76729
6 0 0 0 0 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 0 0 0 0
6 1 71.066 0.048749 0.25708 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 74.53 86.417 -11.887 0.18787
6 2 88.184 -0.28535 -2.1306 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 63.02 89.007 -25.987 -2.0607
6 3 84.934 0.18281 1.5438 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 100.46 75.467 24.993 1.6366
6 4 75.001 0.13224 1.2209 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 84.92 61.036 23.884 1.3909
6 5 63.797 -0.075034 -0.34688 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 59.01 48.711 10.299 -0.43263
6 6 53.316 0.010383 0.26499 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 53.87 38.724 15.146 0.28554
6 7 44.173 0.022122 0.30314 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 45.15 30.748 14.402 0.31129
6 8 36.439 -0.070216 -0.45133 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 33.88 24.407 9.4728 -0.5882
6 10 24.659 0.065321 0.4657 14.395 73.084 0.86833 -0.20941 -0.049554 -0.50761 52 157 104.3 0.8 2 2 0 1 1 1 0 26.27 15.375 10.895 0.43734
7 0 0 0 0 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 0 0 0 0
7 1 163.49 0.1302 1.8578 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 184.78 86.417 98.363 2.2385
7 2 129.36 0.10339 0.96819 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 142.73 89.007 53.723 1.201
7 3 96.217 -0.10431 -0.72471 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 86.18 75.467 10.713 -0.65983
7 4 71.277 -0.078944 -0.53927 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 65.65 61.036 4.6142 -0.27781
7 5 52.787 0.043248 0.4085 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 55.07 48.711 6.3589 0.6249
7 6 39.093 -0.029236 -0.11275 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 37.95 38.724 -0.7736 -0.032028
7 8 21.441 0.08439 0.7694 14.093 46.925 2.9834 -0.23062 -0.49263 0.72663 44 140 90.04 0.9 2 2 0 1 1 1 0 23.25 24.407 -1.1572 0.31745
8 0 0 0 0 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 0 0 0 0
8 1 34.26 0.101 -0.14372 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 37.72 43.208 -5.4883 0.35818
8 2 23.971 -0.20112 -2.5728 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 19.15 44.504 -25.354 -1.6326
8 3 16.11 -0.1055 -1.5138 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 14.41 37.734 -23.324 -1.123
8 4 10.808 0.10012 0.34578 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 11.89 30.518 -18.628 -0.41616
8 5 7.2505 -0.24419 -2.0502 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 5.48 24.356 -18.876 -1.0534
8 6 4.864 0.013561 0.012393 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 4.93 19.362 -14.432 -0.42656
8 7 3.263 0.22891 1.6775 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 4.01 15.374 -11.364 -0.041559
8 9 1.4685 0.048684 0.26851 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 1.54 9.6859 -8.1459 -0.093338
8 11 0.66089 -0.092132 -0.85236 42.15 105.58 3.5462 0.86495 0.31834 0.89946 50 173 98.88 0.9 2 2 1 1 0 0 0 0.6 6.1012 -5.5012 0.018256
9 0 0 0 0 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 0 0 0 0
9 1 55.324 -0.049604 -0.0014771 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 52.58 43.208 9.3717 -0.044004
9 2 49.276 0.17117 1.26 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 57.71 44.504 13.206 1.4433
9 3 36.235 -0.00013393 -0.32564 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 36.23 37.734 -1.5037 -0.24112
9 4 25.457 0.02645 -0.23908 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 26.13 30.518 -4.3879 -0.28108
9 5 17.661 0.023164 -0.24129 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 18.07 24.356 -6.2855 -0.39395
9 6 12.208 -0.11291 -1.17 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 10.83 19.362 -8.5318 -0.93881
9 8 5.82 -0.056694 -0.50093 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 5.49 12.204 -6.7136 -0.32287
9 10 2.7731 0.099863 0.82323 21.33 57.54 1.6074 0.18382 -0.28869 0.10819 61 160 81.42 0.9 2 2 0 1 0 1 0 3.05 7.6874 -4.6374 0.47335
10 0 0 0 0 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 0 0 0 0
10 1 56.258 0.097797 -0.40766 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 61.76 43.208 18.552 1.9491
10 2 17.428 0.055796 -2.5277 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 18.4 44.504 -26.104 -2.2177
10 3 4.9485 -0.025964 -1.8592 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 4.82 37.734 -32.914 -2.3911
10 6 0.1103 -0.27472 -0.40417 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 0.08 19.362 -19.282 -0.59368
10 8 0.0087302 0.14545 2.4362 44.279 34.914 3.5597 0.91423 -0.78827 0.90326 52 168 87.32 1.8 2 2 0 1 1 1 0 0.01 12.204 -12.194 0.15934
12 0 0 0 0 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 0 0 0 0
12 1 16.198 0.026669 0.041568 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 16.63 17.283 -0.65332 0.05277
12 2 15.599 0.056483 0.10904 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 16.48 17.801 -1.3215 0.062575
12 3 13.092 -0.15138 -1.4208 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 11.11 15.093 -3.9835 -1.2067
12 4 10.749 0.11453 0.67923 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 11.98 12.207 -0.22716 0.55165
12 5 8.7913 -0.12072 -1.0203 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 7.73 9.7422 -2.0122 -0.83406
12 6 7.1853 0.12451 0.89666 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 8.08 7.7447 0.33528 0.73228
12 7 5.872 -0.022481 -0.17281 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 5.74 6.1497 -0.40966 -0.12474
12 9 3.9214 -0.013119 -0.063403 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 3.87 3.8744 -0.0043587 -0.025436
12 11 2.6188 0.04246 0.35116 18.695 92.607 1.9254 0.051956 0.18719 0.28872 59 178 98.43 1.1 1 2 0 0 0 1 0 2.73 2.4405 0.28953 0.28459
13 0 0 0 0 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 0 0 0 0
13 1 13.355 0.046786 -0.33884 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 13.98 17.283 -3.3033 -0.22478
13 2 12.928 -0.065582 -1.0392 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 12.08 17.801 -5.7215 -0.63982
13 3 9.7203 -0.059697 -0.90908 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 9.14 15.093 -5.9535 -0.61478
13 4 6.7047 0.07536 0.14479 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 7.21 12.207 -4.9972 -0.16638
13 5 4.4567 0.068053 0.092608 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 4.76 9.7422 -4.9822 -0.34387
13 6 2.9115 -0.14133 -1.5011 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 2.5 7.7447 -5.2447 -0.93137
13 7 1.886 -0.050882 -0.83497 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 1.79 6.1497 -4.3597 -0.6245
13 8 1.2165 0.08505 0.16766 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 1.32 4.8814 -3.5614 -0.2851
13 10 0.50351 0.23136 1.2465 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 0.62 3.075 -2.455 0.12675
13 12 0.20789 -0.23037 -2.1245 34.673 78.32 1.1217 0.66968 0.019628 -0.25153 54 159 68.04 1.3 1 2 0 0 0 0 0 0.16 1.9369 -1.7769 0.19744
14 0 0 0 0 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 0 0 0 0
14 1 25.038 0.08036 1.1038 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 27.05 17.283 9.7667 1.3163
14 2 19.718 -0.019169 -0.1943 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 19.34 17.801 1.5385 -0.20323
14 3 14.053 -0.01869 -0.35064 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 13.79 15.093 -1.3035 -0.27732
14 4 9.9046 0.013668 -0.1362 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 10.04 12.207 -2.1672 -0.11491
14 5 6.9719 0.078621 0.36998 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 7.52 9.7422 -2.2222 0.14978
14 6 4.9067 -0.22963 -1.9321 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 3.78 7.7447 -3.9647 -1.2185
14 7 3.4532 0.0048506 -0.12578 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 3.47 6.1497 -2.6797 -0.2328
14 8 2.4303 0.27555 1.9526 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 3.1 4.8814 -1.7814 0.60454
14 10 1.2037 -0.16095 -1.2921 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 1.01 3.075 -2.065 -0.36266
14 12 0.59621 0.0063547 0.037434 20.27 57.701 2.48 0.13286 -0.2859 0.54182 62 180 81.65 1.1 1 2 0 0 0 1 0 0.6 1.9369 -1.3369 0.19247
15 0 0 0 0 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 0 0 0 0
15 1 9.2441 -0.039389 -0.9602 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 8.88 17.283 -8.4033 -0.76309
15 2 11.725 -0.055844 -1.1138 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 11.07 17.801 -6.7315 -0.93745
15 3 11.639 0.22775 1.1714 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 14.29 15.093 -0.80349 0.77297
15 4 10.663 -0.16442 -1.6265 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 8.91 12.207 -3.2972 -1.3204
15 5 9.4555 0.049129 0.15252 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 9.92 9.7422 0.17779 0.19822
15 6 8.2647 0.064765 0.41888 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 8.8 7.7447 1.0553 0.46686
15 7 7.1767 -0.053888 -0.34849 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 6.79 6.1497 0.64034 -0.25555
15 8 6.2131 -0.072925 -0.38045 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 5.76 4.8814 0.87856 -0.28711
15 10 4.6404 -0.138 -0.70211 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 4 3.075 0.92505 -0.55263
15 12 3.4608 0.16158 1.67 17.392 118.44 0.90406 -0.020267 0.43321 -0.46728 63 172 83.1 1.2 1 1 0 1 0 1 0 4.02 1.9369 2.0831 2.1753
16 0 0 0 0 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 0 0 0 0
16 1 10.618 -0.07796 -1.3419 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 9.79 17.283 -7.4933 -0.7232
16 2 15.114 0.058591 -0.12685 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 16 17.801 -1.8015 -0.20988
16 3 16.3 -0.032503 -0.50437 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 15.77 15.093 0.67651 -0.56435
16 4 15.778 0.084399 0.65615 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 17.11 12.207 4.9028 0.78632
16 5 14.454 0.14572 1.3152 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 16.56 9.7422 6.8178 1.7317
16 6 12.824 -0.10093 -0.43961 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 11.53 7.7447 3.7853 -0.74092
16 7 11.156 0.10349 1.1475 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 12.31 6.1497 6.1603 1.5476
16 8 9.5804 -0.069975 -0.17708 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 8.91 4.8814 4.0286 -0.48247
16 10 6.9067 0.025086 0.42631 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 7.08 3.075 4.005 0.45306
16 12 4.8984 0.012575 0.17456 12.654 70.52 0.53142 -0.33827 -0.085275 -0.99863 63 170 83.4 1.1 1 1 1 0 0 1 0 4.96 1.9369 3.0231 0.16488
17 0 0 0 0 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 0 0 0 0
17 1 159.08 0.10746 1.7129 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 176.18 86.417 89.763 2.3032
17 2 142.4 -0.026341 0.32532 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 138.65 89.007 49.643 0.27595
17 3 117.07 -0.036901 0.13158 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 112.75 75.467 37.283 0.20541
17 4 95.486 -0.02195 0.18219 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 93.39 61.036 32.354 0.3705
17 5 77.821 0.11513 1.1642 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 86.78 48.711 38.069 1.7808
17 6 63.419 0.05347 0.64493 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 66.81 38.724 28.086 0.94805
17 7 51.682 -0.097366 -0.54632 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 46.65 30.748 15.902 -0.80267
17 8 42.117 0.078656 0.7392 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 45.43 24.407 21.023 0.88122
17 10 27.97 0.13906 1.1194 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 31.86 15.375 16.485 1.1844
17 12 18.575 -0.11604 -0.86228 10.286 50.262 2.5232 -0.54547 -0.42393 0.55911 63 177 104.1 1 1 1 1 1 0 0 0 16.42 9.6845 6.7355 -1.2682
18 0 0 0 0 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 0 0 0 0
18 1 52.403 0.075311 0.72633 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 56.35 43.208 13.142 0.81678
18 2 49.435 -0.045611 -0.47678 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 47.18 44.504 2.6764 -0.49041
18 3 42.292 0.06191 0.40132 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 44.91 37.734 7.1763 0.46323
18 4 35.799 0.17153 1.3563 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 41.94 30.518 11.422 1.5409
18 5 30.267 -0.040529 -0.13071 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 29.04 24.356 4.6845 -0.10866
18 6 25.585 -0.32149 -2.1582 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 17.36 19.362 -2.0018 -2.4648
18 7 21.628 0.02414 0.53511 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 22.15 15.374 6.7758 0.61812
18 8 18.282 -0.012716 0.31563 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 18.05 12.204 5.8464 0.35718
18 10 13.064 0.044092 0.81309 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 13.64 7.6874 5.9526 0.97913
18 12 9.335 0.088372 1.1591 12.916 76.863 2.3225 -0.3178 0.00085212 0.47621 58 187 136.8 1.5 1 2 1 1 0 1 0 10.16 4.8422 5.3178 1.5056
19 0 0 0 0 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 0 0 0 0
19 1 52.559 0.072516 0.76543 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 56.37 43.208 13.162 0.95268
19 2 56.065 -0.16134 -0.90235 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 47.02 44.504 2.5164 -0.95875
19 3 50.272 0.16128 1.5843 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 58.38 37.734 20.646 2.0735
19 4 43.456 -0.15385 -0.78352 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 36.77 30.518 6.2521 -1.1225
19 5 37.236 0.046037 0.72311 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 38.95 24.356 14.594 0.79995
19 6 31.837 -0.08943 -0.3239 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 28.99 19.362 9.6282 -0.76221
19 7 27.207 0.20668 1.8825 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 32.83 15.374 17.456 2.4129
19 8 23.247 0.065957 0.77573 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 24.78 12.204 12.576 0.83367
19 10 16.971 -0.026555 -0.021789 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 16.52 7.6874 8.8326 -0.13776
19 12 12.389 -0.028155 -0.13583 10.697 67.987 1.5497 -0.50627 -0.12186 0.071634 66 177 97.3 1.2 1 1 1 0 0 1 0 12.04 4.8422 7.1978 0.089378
20 0 0 0 0 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 0 0 0 0
20 1 9.9678 0.091519 0.20135 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 10.88 17.283 -6.4033 -0.30566
20 2 13.099 -0.092299 -1.0564 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 11.89 17.801 -5.9115 -0.91293
20 3 13.113 -0.28162 -2.2839 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 9.42 15.093 -5.6735 -1.8347
20 4 11.842 0.15432 1.1607 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 13.67 12.207 1.4628 1.2351
20 5 10.167 0.078928 0.65618 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 10.97 9.7422 1.2278 0.811
20 6 8.489 0.084934 0.69922 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 9.21 7.7447 1.4653 0.80048
20 7 6.9724 -0.09213 -0.68983 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 6.33 6.1497 0.18034 -0.60324
20 9 4.5823 0.080241 0.45165 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 4.95 3.8744 1.0756 0.21005
20 11 2.9624 -0.03795 -0.60782 19.285 86.198 0.66436 0.08303 0.11548 -0.77536 67 181 96.1 1.3 1 1 1 0 0 1 0 2.85 2.4405 0.40953 -0.8834
21 0 0 0 0 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 0 0 0 0
21 1 2.5587 -0.12846 -1.8527 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 2.23 8.6417 -6.4117 -1.3363
21 3 3.9986 -0.11719 -1.9728 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 3.53 7.5467 -4.0167 -1.5215
21 4 3.8485 0.073141 -0.36714 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 4.13 6.1036 -1.9736 -0.35491
21 5 3.4729 0.1057 0.063667 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 3.84 4.8711 -1.0311 0.17075
21 6 3.0089 -0.03619 -0.84869 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 2.9 3.8724 -0.97236 -0.31258
21 7 2.5347 0.029706 -0.22688 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 2.61 3.0748 -0.46483 0.1279
21 8 2.0919 0.1951 1.11 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 2.5 2.4407 0.05928 0.96638
21 10 1.364 0.048414 0.090333 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 1.43 1.5375 -0.10748 0.03258
21 12 0.8541 -0.22726 -1.9483 29.942 96.832 0.34333 0.52299 0.23181 -1.4355 57 180 85.9 1.2 1 1 1 1 0 1 0 0.66 0.96845 -0.30845 -1.387
22 0 0 0 0 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 0 0 0 0
22 1 21.425 -0.077719 -1.1746 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 19.76 30.246 -10.486 -0.7882
22 2 21.267 0.12806 0.29417 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 23.99 31.153 -7.1625 0.14107
22 3 16.61 -0.04515 -1.019 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 15.86 26.414 -10.554 -0.75533
22 4 12.021 -0.00092238 -0.64037 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 12.01 21.363 -9.3525 -0.57866
22 5 8.4441 -0.088118 -1.2237 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 7.7 17.049 -9.3489 -0.84649
22 6 5.8572 0.073894 0.090724 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 6.29 13.553 -7.2633 -0.24963
22 7 4.0406 0.017175 -0.25591 34.239 91.155 1.185 0.65709 0.17139 -0.19664 56 170 88.13 0.8 1 2 0 1 0 1 0 4.11 10.762 -6.6519 -0.28444
23 0 0 0 0 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 0 0 0 0
23 1 14.522 0.062535 -0.24086 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 15.43 30.246 -14.816 -0.54914
23 2 18.514 -0.050452 -1.2076 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 17.58 31.153 -13.573 -0.68755
23 3 18.962 -0.058653 -1.1808 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 17.85 26.414 -8.5636 -0.61799
23 4 18.257 -0.04368 -0.91078 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 17.46 21.363 -3.9025 -0.56835
23 5 17.216 -0.15601 -1.5863 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 14.53 17.049 -2.5189 -1.4462
23 6 16.113 0.087317 0.42626 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 17.52 13.553 3.9667 0.27997
23 7 15.04 0.059171 0.37385 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 15.93 10.762 5.1681 0.15942
23 8 14.025 0.12089 0.98726 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 15.72 8.5425 7.1775 0.9871
23 10 12.184 0.035777 0.59187 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 12.62 5.3812 7.2388 1.0645
23 12 10.582 0.01205 0.60485 10.711 151.96 1.0701 -0.50501 0.68246 -0.29865 57 168 69.08 1.1 2 3 0 1 0 1 0 10.71 3.3896 7.3204 2.3721
24 0 0 0 0 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 0 0 0 0
24 1 15.286 0.0041836 -0.62099 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 15.35 30.246 -14.896 -0.38078
24 2 22.651 -0.26139 -2.583 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 16.73 31.153 -14.423 -1.9738
24 3 25.459 0.165 0.89281 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 29.66 26.414 3.2464 0.76662
24 4 25.717 0.15061 1.0648 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 29.59 21.363 8.2275 1.2045
24 5 24.609 -0.010938 0.091851 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 24.34 17.049 7.2911 0.076003
24 6 22.832 -0.13234 -0.62816 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 19.81 13.553 6.2567 -1.0711
24 7 20.785 0.23215 2.276 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 25.61 10.762 14.848 3.3746
24 8 18.694 -0.30994 -1.7252 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 12.9 8.5425 4.3575 -3.2514
24 10 14.808 -0.024145 0.53011 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 14.45 5.3812 9.0688 0.82837
24 12 11.558 0.094509 1.4235 11.016 84.57 0.50433 -0.47696 0.096414 -1.0509 56 175 74.6 0.8 2 1 0 0 0 0 0 12.65 3.3896 9.2604 3.2902
25 0 0 0 0 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 0 0 0 0
25 1 27.108 0.045074 0.062087 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 28.33 30.246 -1.9158 0.059699
25 2 26.713 -0.10494 -1.0418 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 23.91 31.153 -7.2425 -0.82566
25 3 21.158 0.061049 0.18656 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 22.45 26.414 -3.9636 0.13293
25 4 15.759 -0.013279 -0.42687 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 15.55 21.363 -5.8125 -0.36554
25 5 11.498 0.079363 0.22884 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 12.41 17.049 -4.6389 0.015907
25 6 8.3268 0.053231 0.0056508 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 8.77 13.553 -4.7833 -0.1556
25 7 6.0144 -0.030653 -0.63268 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 5.83 10.762 -4.9319 -0.45801
25 8 4.3399 -0.066798 -0.89231 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 4.05 8.5425 -4.4925 -0.49874
25 9 3.1305 0.079697 0.24096 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 3.38 6.7801 -3.4001 -0.019112
25 10 2.2578 0.00095507 -0.32484 25.561 78.202 1.3308 0.3648 0.018126 -0.080614 61 171 96.62 1 1 1 0 1 0 1 0 2.26 5.3812 -3.1212 -0.1289
26 0 0 0 0 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 0 0 0 0
26 1 10.933 -0.19237 -2.3438 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 8.83 30.246 -21.416 -1.0485
26 2 17.159 -0.018601 -1.1484 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 16.84 31.153 -14.313 -1.0352
26 3 20.26 0.23743 0.95609 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 25.07 26.414 -1.3436 0.47871
26 4 21.327 -0.066453 -1.0793 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 19.91 21.363 -1.4525 -1.0219
26 5 21.111 -0.020411 -0.45536 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 20.68 17.049 3.6311 -0.41992
26 6 20.12 0.093937 0.65715 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 22.01 13.553 8.4567 0.94118
26 7 18.697 0.066492 0.65103 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 19.94 10.762 9.1781 0.9748
26 8 17.068 -0.083069 -0.33027 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 15.65 8.5425 7.1075 -0.52165
26 10 13.724 0.053655 0.86037 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 14.46 5.3812 9.0788 1.5548
26 12 10.703 -0.0049923 0.42307 12.968 85.947 0.34318 -0.31378 0.11256 -1.4359 67 157 66.4 0.9 2 1 0 0 0 0 0 10.65 3.3896 7.2604 1.2194
27 0 0 0 0 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 0 0 0 0
27 1 43.322 -0.059603 -0.67606 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 40.74 43.208 -2.4683 -0.5567
27 2 47.499 0.1436 1.1242 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 54.32 44.504 9.8164 1.2218
27 3 40.227 -0.069291 -0.41888 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 37.44 37.734 -0.29372 -0.37531
27 4 31.112 -0.042162 -0.29649 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 29.8 30.518 -0.71791 -0.25469
27 5 23.106 0.14081 0.93692 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 26.36 24.356 2.0045 0.80361
27 6 16.823 0.012891 -0.18216 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 17.04 19.362 -2.3218 -0.1913
27 7 12.124 0.083804 0.2425 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 13.14 15.374 -2.2342 0.048293
27 8 8.6906 -0.088675 -1.1212 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 7.92 12.204 -4.2836 -0.77634
27 10 4.4333 -0.050362 -0.81843 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 4.21 7.6874 -3.4774 -0.48029
27 12 2.2534 0.056204 0.075791 19.905 58.701 0.9571 0.11469 -0.26872 -0.41027 56 177 97.4 1 1 1 0 0 0 0 0 2.38 4.8422 -2.4622 -0.0035763
28 0 0 0 0 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 0 0 0 0
28 1 82.497 0.020518 -0.0042123 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 84.19 86.417 -2.2266 -0.0087439
28 2 84.503 0.020086 -0.016928 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 86.2 89.007 -2.8073 -0.015087
28 3 72.533 0.020632 0.021114 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 74.03 75.467 -1.4374 0.025091
28 4 59.932 -0.028907 -0.31221 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 58.2 61.036 -2.8358 -0.28023
28 5 49.06 -0.041983 -0.37872 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 47 48.711 -1.7111 -0.34016
28 6 40.065 0.012614 0.054478 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 40.57 38.724 1.8464 0.053999
28 7 32.699 -0.036365 -0.30664 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 31.51 30.748 0.76168 -0.26431
28 8 26.684 0.13965 1.0269 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 30.41 24.407 6.0028 0.88148
28 10 17.767 0.13523 0.98635 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 20.17 15.375 4.7952 0.79859
28 12 11.83 -0.13865 -1.0902 17.21 84.631 1.5687 -0.030799 0.097126 0.083819 58 173 78.7 1.4 1 1 0 1 0 1 0 10.19 9.6845 0.50551 -0.77558
29 0 0 0 0 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 0 0 0 0
29 1 23.035 -0.042346 -1.6466 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 22.06 86.417 -64.357 -1.4038
29 3 36.649 0.10262 -0.54209 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 40.41 75.467 -35.057 -0.77187
29 4 35.703 -0.027824 -1.2294 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 34.71 61.036 -26.326 -0.78813
29 5 32.679 -0.20164 -2.2282 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 26.09 48.711 -22.621 -1.1968
29 6 28.777 -0.0026812 -0.43391 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 28.7 38.724 -10.024 0.013747
29 7 24.689 0.21794 1.4808 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 30.07 30.748 -0.67832 1.2974
29 8 20.793 -0.04007 -0.27172 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 19.96 24.407 -4.4472 0.081953
29 10 14.201 -0.29513 -1.9231 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 10.01 15.375 -5.3648 -1.1756
29 12 9.3842 0.13063 1.4557 30.478 127.08 0.40332 0.54072 0.50365 -1.2744 53 180 87.6 1.2 1 1 0 1 1 1 0 10.61 9.6845 0.92551 0.62989
30 0 0 0 0 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 0 0 0 0
30 1 67.041 -0.13769 -1.3959 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 57.81 86.417 -28.607 -1.0171
30 2 83.337 0.24255 1.62 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 103.55 89.007 14.543 1.5038
30 3 81.768 -0.070546 -0.5672 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 76 75.467 0.53256 -0.52349
30 4 74.513 -0.020446 -0.045599 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 72.99 61.036 11.954 -0.042819
30 5 66.006 -0.14356 -0.87616 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 56.53 48.711 7.8189 -1.158
30 6 57.792 0.039596 0.57833 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 60.08 38.724 21.356 0.58925
30 7 50.351 0.13285 1.3292 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 57.04 30.748 26.292 1.5879
30 8 43.775 -0.13445 -0.66524 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 37.89 24.407 13.483 -1.1351
30 10 33.016 0.1752 1.6968 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 38.8 15.375 23.425 2.4769
30 12 24.88 -0.067135 -0.14878 12.163 85.935 0.98068 -0.37785 0.11242 -0.38594 46 175 84.8 1.2 1 1 0 1 1 1 0 23.21 9.6845 13.526 0.15975
31 0 0 0 0 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 0 0 0 0
31 1 13.951 -0.043782 -0.75289 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 13.34 17.283 -3.9433 -0.59817
31 2 16.571 0.080816 0.37808 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 17.91 17.801 0.10855 0.3276
31 3 15.57 0.10664 0.74387 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 17.23 15.093 2.1365 0.74397
31 4 13.608 -0.13727 -0.99211 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 11.74 12.207 -0.46716 -1.0323
31 5 11.573 -0.10568 -0.69112 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 10.35 9.7422 0.60779 -0.75571
31 6 9.7344 0.1033 0.92165 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 10.74 7.7447 2.9953 0.9828
31 7 8.1504 0.15332 1.3131 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 9.4 6.1497 3.2503 1.4048
31 8 6.811 -0.057401 -0.27956 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 6.42 4.8814 1.5386 -0.33037
31 10 4.747 -0.10258 -0.63756 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 4.26 3.075 1.185 -0.64779
31 12 3.3061 0.076789 0.68937 15.109 83.503 1.0404 -0.16099 0.083716 -0.32683 30 157 61.7 1.1 2 1 0 0 0 0 0 3.56 1.9369 1.6231 0.84381
32 0 0 0 0 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 0 0 0 0
32 1 16.89 0.025433 -0.60485 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 17.32 30.246 -12.926 -0.50287
32 2 17.248 0.016928 -0.89339 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 17.54 31.153 -13.613 -0.72191
32 3 15.402 -0.17284 -2.192 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 12.74 26.414 -13.674 -1.4279
32 4 13.47 0.093527 0.038483 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 14.73 21.363 -6.6325 -0.10769
32 5 11.739 0.10912 0.36482 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 13.02 17.049 -4.0289 0.16554
32 6 10.224 -0.095282 -0.99892 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 9.25 13.553 -4.3033 -0.66201
32 7 8.9039 -0.11836 -1.0185 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 7.85 10.762 -2.9119 -0.64996
32 8 7.7539 0.083324 0.63662 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 8.4 8.5425 -0.14252 0.55234
32 10 5.8803 -0.1225 -0.73011 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 5.16 5.3812 -0.22117 -0.2945
32 12 4.4595 0.13018 1.2982 22.273 161.06 1.8949 0.2271 0.74059 0.27276 56 174 68.72 1.1 2 1 0 1 0 1 0 5.04 3.3896 1.6504 1.509
33 0 0 0 0 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 0 0 0 0
33 1 104.97 0.009229 0.17992 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 105.94 86.417 19.523 0.2723
33 2 110.96 0.085435 0.65142 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 120.44 89.007 31.433 0.92096
33 3 100.28 0.038245 0.34694 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 104.12 75.467 28.653 0.52264
33 4 88.03 0.034989 0.43044 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 91.11 61.036 30.074 0.54588
33 5 76.805 0.099661 1.0321 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 84.46 48.711 35.749 1.316
33 6 66.926 -0.12456 -0.56434 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 58.59 38.724 19.866 -1.1113
33 7 58.301 -0.074464 -0.10166 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 53.96 30.748 23.212 -0.47337
33 8 50.785 -0.14837 -0.59329 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 43.25 24.407 18.843 -1.2681
33 10 38.534 0.19454 2.0928 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 46.03 15.375 30.655 3.498
33 12 29.238 0.018546 0.80486 9.8142 71.098 1.6821 -0.59245 -0.077108 0.15361 54 180 76.43 1 1 1 0 0 0 0 0 29.78 9.6845 20.096 1.8245
34 0 0 0 0 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 0 0 0 0
34 2 8.056 0.052634 0.17397 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 8.48 8.9007 -0.42073 0.31395
34 3 5.8506 -0.078729 -0.73935 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 5.39 7.5467 -2.1567 -0.61276
34 4 4.0098 -0.22938 -1.9093 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 3.09 6.1036 -3.0136 -1.4096
34 5 2.6972 0.28283 1.8805 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 3.46 4.8711 -1.4111 0.62606
34 6 1.8027 -0.0070462 -0.40939 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 1.79 3.8724 -2.0824 -0.49897
34 7 1.2022 -0.10166 -1.2036 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 1.08 3.0748 -1.9948 -0.67305
34 9 0.53374 0.10542 0.29326 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 0.59 1.9372 -1.3472 0.0034805
34 10 0.35555 -0.071856 -1.0502 27.237 67.039 1.4591 0.4283 -0.1359 0.011414 34 170 77.34 1 1 1 0 0 0 1 0 0.33 1.5375 -1.2075 -0.066464
35 0 0 0 0 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 0 0 0 0
35 1 30.587 -0.084912 -1.2655 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 27.99 43.208 -15.218 -0.97925
35 2 35.888 0.19317 1.0618 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 42.82 44.504 -1.6836 0.86691
35 3 31.81 -0.19333 -1.6674 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 25.66 37.734 -12.074 -1.2151
35 4 25.24 -0.0226 -0.30112 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 24.67 30.518 -5.8479 -0.13315
35 5 18.906 -0.0082363 -0.23895 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 18.75 24.356 -5.6055 -0.15238
35 6 13.685 0.033996 -0.055101 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 14.15 19.362 -5.2118 -0.11957
35 7 9.6916 0.18246 0.88941 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 11.46 15.374 -3.9142 0.27518
35 10 3.2064 -0.1018 -1.6228 26.102 65.982 0.69312 0.38575 -0.15179 -0.73298 52 183 89.36 1.1 1 1 0 1 0 1 0 2.88 7.6874 -4.8074 -0.87327
36 0 0 0 0 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 0 0 0 0
36 1 130.23 0.035805 0.77244 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 134.89 86.417 48.473 1.006
36 2 100.26 0.069354 0.56696 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 107.21 89.007 18.203 0.74098
36 3 65.01 -0.027069 -0.51794 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 63.25 75.467 -12.217 -0.41929
36 4 40.676 -0.04932 -0.87035 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 38.67 61.036 -22.366 -0.7827
36 5 25.238 0.044073 -0.23503 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 26.35 48.711 -22.361 -0.538
36 6 15.627 -0.096435 -1.3136 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 14.12 38.724 -24.604 -0.94514
36 7 9.6713 0.2139 1.0438 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 11.74 30.748 -19.008 -0.13923
36 8 5.9847 0.015922 -0.42729 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 6.08 24.407 -18.327 -0.32327
36 10 2.2916 -0.083591 -1.0714 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 2.1 15.375 -13.275 0.12922
36 12 0.87743 0.014327 -0.18771 23.108 48.141 1.89 0.26389 -0.46703 0.27015 47 175 93.21 1.1 1 1 0 1 1 1 0 0.89 9.6845 -8.7945 0.74818
37 0 0 0 0 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 0 0 0 0
37 1 22.057 0.057282 -0.20782 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 23.32 43.208 -19.888 -0.46085
37 2 31.667 -0.18653 -1.9498 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 25.76 44.504 -18.744 -1.5352
37 3 34.285 0.078307 0.31516 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 36.97 37.734 -0.76372 0.36346
37 8 19.366 0.14685 1.3638 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 22.21 12.204 10.006 1.7239
37 12 9.1165 -0.068725 -0.65874 15.989 75.886 0.46892 -0.1044 -0.011938 -1.1237 66 155 93.44 1.4 1 1 0 1 1 1 0 8.49 4.8422 3.6478 -1.1485
38 0 0 0 0 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 0 0 0 0
38 1 65.378 0.084771 1.2398 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 70.92 43.208 27.712 1.5131
38 2 50.928 -0.06241 -0.51061 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 47.75 44.504 3.2464 -0.5589
38 3 35.807 0.14138 0.80403 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 40.87 37.734 3.1363 0.7627
38 4 24.883 -0.14639 -1.4329 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 21.24 30.518 -9.2779 -1.1218
38 6 11.979 0.047651 0.082904 19.983 54.656 2.4626 0.1186 -0.34011 0.53479 66 160 62.14 1.1 1 2 1 0 0 1 0 12.55 19.362 -6.8118 -0.093915
39 0 0 0 0 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 0 0 0 0
39 1 6.3145 0.00087858 -0.46855 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 6.32 8.6417 -2.3217 -0.42192
39 2 6.8335 0.066807 0.016756 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 7.29 8.9007 -1.6107 -0.048601
39 3 6.1532 -0.093156 -1.0872 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 5.58 7.5467 -1.9667 -0.87159
39 4 5.3149 0.076212 0.32471 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 5.72 6.1036 -0.38358 0.26075
39 5 4.5416 -0.16108 -1.3518 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 3.81 4.8711 -1.0611 -1.1438
39 7 3.2943 0.05637 0.46374 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 3.48 3.0748 0.40517 0.43342
39 8 2.804 0.13052 1.0776 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 3.17 2.4407 0.72928 1.019
39 10 2.0312 -0.049827 -0.2315 17.788 110.33 1.4649 0.002242 0.36232 0.015385 51 178 97.07 1 1 1 0 1 0 1 0 1.93 1.5375 0.39252 -0.034015
40 0 0 0 0 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 0 0 0 0
40 1 29.012 0.1671 0.91597 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 33.86 30.246 3.6142 0.9144
40 2 23.845 -0.23003 -2.336 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 18.36 31.153 -12.793 -1.8667
40 3 18.905 0.02989 -0.19343 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 19.47 26.414 -6.9436 -0.2196
40 4 14.968 0.058919 0.2017 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 15.85 21.363 -5.5125 0.12838
40 5 11.85 -0.098769 -0.84781 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 10.68 17.049 -6.3689 -0.51569
40 6 9.3822 -0.16437 -1.2338 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 7.84 13.553 -5.7133 -0.73973
40 7 7.428 0.051428 0.47817 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 7.81 10.762 -2.9519 0.24226
40 8 5.8808 -0.0069455 0.088658 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 5.84 8.5425 -2.7025 -0.020674
40 10 3.6862 0.24791 2.0591 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 4.6 5.3812 -0.78117 0.82918
40 12 2.3105 -0.13873 -0.87306 22.991 98.438 3.5003 0.25881 0.24826 0.88642 24 181 80.29 1.4 1 1 0 0 0 1 0 1.99 3.3896 -1.3996 -0.55768
41 0 0 0 0 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 0 0 0 0
41 1 42.425 0.07013 0.82671 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 45.4 30.246 15.154 1.1902
41 2 46.534 -0.052953 0.08916 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 44.07 31.153 12.917 0.17488
41 3 42.051 -0.11346 -0.31044 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 37.28 26.414 10.866 -0.57616
41 4 36.263 0.13918 1.5993 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 41.31 21.363 19.947 2.2912
41 5 30.864 0.21047 2.1101 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 37.36 17.049 20.311 3.0955
41 6 26.169 -0.074097 -0.083042 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 24.23 13.553 10.677 -0.57839
41 7 22.163 0.010232 0.50993 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 22.39 10.762 11.628 0.42658
41 8 18.764 -0.1761 -0.9463 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 15.46 8.5425 6.9175 -2.0041
41 10 13.447 0.12735 1.2584 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 15.16 5.3812 9.7788 2.0242
41 12 9.6366 -0.0089838 0.14241 9.3156 55.911 1.385 -0.64459 -0.3174 -0.040757 33 176 80.74 1.3 1 1 0 0 0 1 0 9.55 3.3896 6.1604 0.50509
42 0 0 0 0 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 0 0 0 0
42 1 111.85 -0.0077447 0.040727 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 110.98 86.417 24.563 0.83778
42 2 64.951 0.11376 -0.32425 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 72.34 89.007 -16.667 -0.1692
42 3 31.46 -0.017498 -1.6388 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 30.91 75.467 -44.557 -1.4801
42 4 14.636 -0.043427 -1.5594 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 14 61.036 -47.036 -1.5545
42 6 3.0945 0.011466 -0.37315 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 3.13 38.724 -35.594 -0.75353
42 8 0.65147 0.028437 0.030147 37.266 47.824 2.104 0.74181 -0.47365 0.37743 41 168 84.37 1.5 1 1 0 1 0 1 0 0.67 24.407 -23.737 0.26485
43 0 0 0 0 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 0 0 0 0
43 1 4.8318 -0.029349 -0.92316 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 4.69 8.6417 -3.9517 -0.73637
43 2 5.7721 0.0048286 -0.7521 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 5.8 8.9007 -3.1007 -0.68968
43 3 5.5047 0.071813 -0.13728 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 5.9 7.5467 -1.6467 -0.20736
43 4 4.9146 0.064187 -0.026981 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 5.23 6.1036 -0.87358 -0.040734
43 5 4.2865 0.091789 0.36311 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 4.68 4.8711 -0.19111 0.32682
43 6 3.7062 -0.039441 -0.45566 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 3.56 3.8724 -0.31236 -0.31008
43 7 3.1936 -0.22345 -1.6905 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 2.48 3.0748 -0.59483 -1.3559
43 8 2.7484 -0.090374 -0.54712 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 2.5 2.4407 0.05928 -0.35711
43 10 2.033 0.052632 0.74239 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 2.14 1.5375 0.60252 0.89509
43 12 1.5033 0.11092 1.3101 19.034 126.07 1.0944 0.069941 0.4957 -0.27622 38 173 67.13 1.2 1 1 0 0 0 1 0 1.67 0.96845 0.70155 1.6255
44 0 0 0 0 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 0 0 0 0
44 1 29.118 -0.0074969 -0.39423 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 28.9 30.246 -1.3458 0.07159
44 2 22.868 -0.078172 -1.292 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 21.08 31.153 -10.073 -0.61229
44 3 13.778 0.095262 -0.23298 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 15.09 26.414 -11.324 -0.33481
44 4 7.5363 0.1637 0.18808 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 8.77 21.363 -12.593 -0.61694
44 5 3.9402 -0.13456 -1.9837 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 3.41 17.049 -13.639 -1.3182
44 6 2.0122 -0.085575 -1.3889 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 1.84 13.553 -11.713 -1.0482
44 7 1.0145 0.074461 0.067997 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 1.09 10.762 -9.6719 -0.64268
44 8 0.50775 -0.054661 -0.7355 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 0.48 8.5425 -8.0625 -0.36252
44 10 0.12585 0.11245 0.59701 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 0.14 5.3812 -5.2412 0.36631
44 12 0.031006 -0.032431 -0.53686 40.086 57.104 1.2388 0.81476 -0.2963 -0.1523 54 183 103.4 1.1 1 1 1 0 0 0 0 0.03 3.3896 -3.3596 0.92899
45 0 0 0 0 27.758 59.022 1.7103 0.44725 -0.26326 0.17026 51 170 83.14 1.2 1 2 1 1 0 0 0 0 0 0 0
45 1 51.88 0.021598 0.29266 27.758 59.022 1.7103 0.44725 -0.26326 0.17026 51 170 83.14 1.2 1 2 1 1 0 0 0 53 43.208 9.7917 0.48391
45 4 17.683 0.016803 -0.90724 27.758 59.022 1.7103 0.44725 -0.26326 0.17026 51 170 83.14 1.2 1 2 1 1 0 0 0 17.98 30.518 -12.538 -0.97096
45 8 2.7139 0.013314 -0.69663 27.758 59.022 1.7103 0.44725 -0.26326 0.17026 51 170 83.14 1.2 1 2 1 1 0 0 0 2.75 12.204 -9.4536 -0.69102
45 11 0.662 0.012079 -0.3429 27.758 59.022 1.7103 0.44725 -0.26326 0.17026 51 170 83.14 1.2 1 2 1 1 0 0 0 0.67 6.1012 -5.4312 0.18093
46 0 0 0 0 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 0 0 0 0
46 1 155.17 0.043118 1.0758 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 161.86 86.417 75.443 1.3233
46 2 148.42 0.061672 1.2032 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 157.57 89.007 68.563 1.6001
46 3 119.59 -0.022587 0.38414 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 116.89 75.467 41.423 0.44874
46 4 92.993 0.09879 1.1092 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 102.18 61.036 41.144 1.5771
46 5 71.708 -0.02814 -0.016067 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 69.69 48.711 20.979 0.029125
46 6 55.183 -0.12491 -0.87664 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 48.29 38.724 9.5664 -1.0206
46 7 42.445 0.12145 0.89345 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 47.6 30.748 16.852 1.0753
46 8 32.644 0.19411 1.3792 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 38.98 24.407 14.573 1.4718
46 9 25.105 -0.15474 -1.2994 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 21.22 19.372 1.8482 -1.2219
46 11 14.848 -0.019389 -0.29839 11.674 44.455 1.6743 -0.41893 -0.5467 0.14899 58 159 69.31 1.1 2 2 1 1 0 1 0 14.56 12.202 2.3577 -0.26327
47 0 0 0 0 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 0 0 0 0
47 1 70.883 0.04003 -0.21059 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 73.72 86.417 -12.697 -0.12092
47 4 62.328 0.0070931 -0.3373 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 62.77 61.036 1.7342 -0.14199
47 5 56.48 -0.074364 -0.72454 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 52.28 48.711 3.5689 -0.70447
47 8 41.969 -0.0033161 0.36407 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 41.83 24.407 17.423 0.19481
47 12 28.244 0.091917 1.5126 11.253 113.65 1.9601 -0.45564 0.39195 0.30658 56 187 108.2 1 1 1 1 1 1 1 0 30.84 9.6845 21.156 2.9455
48 0 0 0 0 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 0 0 0 0
48 1 91.965 0.30452 3.3693 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 119.97 43.208 76.762 4.9656
48 2 74.907 -0.26162 -1.4145 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 55.31 44.504 10.806 -2.7221
48 3 59.571 -0.12675 -0.46176 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 52.02 37.734 14.286 -0.36738
48 4 47.346 0.04359 0.79343 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 49.41 30.518 18.892 1.7875
48 5 37.63 0.077869 1.0297 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 40.56 24.356 16.204 2.0446
48 6 29.907 0.1345 1.4411 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 33.93 19.362 14.568 2.3457
48 7 23.77 -0.023129 0.23451 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 23.22 15.374 7.8458 0.46965
48 8 18.892 -0.19436 -1.0742 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 15.22 12.204 3.0164 -1.3597
48 9 15.015 -0.18414 -1.0108 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 12.25 9.6859 2.5641 -1.4216
48 10 11.933 0.14301 1.4484 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 13.64 7.6874 5.9526 1.0879
48 11 9.4844 -0.18603 -1.0597 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 7.72 6.1012 1.6188 -1.6641
48 12 7.538 0.21783 1.9742 10.28 44.757 3.9249 -0.54605 -0.53992 1.0009 63 178 93.8 1 1 1 1 1 0 1 0 9.18 4.8422 4.3378 1.1273
49 0 0 0 0 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 0 0 0 0
49 1 19.858 -0.038661 -1.1673 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 19.09 43.208 -24.118 -0.91699
49 2 24.671 0.072531 -0.3769 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 26.46 44.504 -18.044 -0.49753
49 3 24.37 0.0041092 -0.75043 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 24.47 37.734 -13.264 -0.59118
49 4 22.474 -0.090953 -1.2758 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 20.43 30.518 -10.088 -0.89483
49 5 20.214 0.19125 1.0555 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 24.08 24.356 -0.27553 0.84064
49 6 18.006 -0.24524 -2.0661 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 13.59 19.362 -5.7718 -1.6002
49 7 15.977 0.054027 0.35755 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 16.84 15.374 1.4658 0.40266
49 8 14.155 -0.085109 -0.55881 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 12.95 12.204 0.7464 -0.36749
49 10 11.094 -0.034575 0.029225 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 10.71 7.6874 3.0226 0.34774
49 12 8.6901 0.12196 1.3404 18.413 150.76 1.0291 0.036796 0.67452 -0.33777 50 157 125.4 0.7 2 1 1 1 0 1 0 9.75 4.8422 4.9078 2.1237
50 0 0 0 0 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 0 0 0 0
50 1 64.334 0.021547 0.47761 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 65.72 43.208 22.512 1.2342
50 2 40.817 0.032168 -0.29339 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 42.13 44.504 -2.3736 0.047346
50 3 20.617 -0.0095633 -1.2297 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 20.42 37.734 -17.314 -1.0224
50 4 9.7311 0.18589 -0.050894 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 11.54 30.518 -18.978 -0.88576
50 5 4.4821 -0.020538 -1.5527 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 4.39 24.356 -19.966 -1.2817
50 6 2.0451 -0.05628 -1.4799 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 1.93 19.362 -17.432 -1.0146
50 7 0.92971 0.0756 -0.028513 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 1 15.374 -14.374 -0.55654
50 8 0.42203 -0.14699 -1.2748 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 0.36 12.204 -11.844 -0.19676
50 10 0.086844 -0.078808 -0.19622 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 0.08 7.6874 -7.6074 0.58305
50 12 0.017862 0.11968 1.2797 31.166 39.413 1.7095 0.56306 -0.66706 0.16978 62 147 51.03 0.8 2 2 0 1 0 1 0 0.02 4.8422 -4.8222 1.153
51 0 0 0 0 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 0 0 0 0
51 1 41.926 0.016316 -0.052739 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 42.61 43.208 -0.59831 0.057734
51 2 48.138 -0.0095153 -0.23855 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 47.68 44.504 3.1764 -0.11163
51 3 45.308 0.051693 0.32564 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 47.65 37.734 9.9163 0.44199
51 4 40.582 0.10787 0.88095 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 44.96 30.518 14.442 1.0462
51 5 35.829 0.020405 0.35171 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 36.56 24.356 12.204 0.28686
51 6 31.494 0.027807 0.5304 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 32.37 19.362 13.008 0.46519
51 8 24.259 -0.18506 -0.87912 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 19.77 12.204 7.5664 -1.6853
51 10 18.673 -0.086927 0.004544 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 17.05 7.6874 9.3626 -0.089808
51 12 14.372 0.16752 2.0196 10.521 80.379 1.3062 -0.52289 0.045589 -0.09933 48 185 96.3 1.1 1 2 0 1 1 1 0 16.78 4.8422 11.938 4.0157
52 0 0 0 0 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 0 0 0 0
52 1 29.898 -0.069827 -0.98192 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 27.81 43.208 -15.398 -0.77681
52 2 37.118 0.20049 1.1901 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 44.56 44.504 0.05637 1.0472
52 3 36.741 -0.2458 -2.0019 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 27.71 37.734 -10.024 -1.6992
52 4 34.017 0.049183 0.39343 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 35.69 30.518 5.1721 0.50046
52 5 30.753 0.061365 0.61588 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 32.64 24.356 8.2845 0.64794
52 6 27.552 -0.27155 -1.8036 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 20.07 19.362 0.7082 -2.4367
52 7 24.597 0.077774 0.91206 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 26.51 15.374 11.136 0.91045
52 8 21.929 0.12681 1.3331 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 24.71 12.204 12.506 1.5632
52 10 17.407 0.036912 0.69738 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 18.05 7.6874 10.363 1.0647
52 12 13.812 0.00054611 0.40869 11.746 101.52 1.0476 -0.4128 0.27905 -0.31988 57 165 70.53 1 2 1 0 0 0 1 0 13.82 4.8422 8.9778 1.3942
53 0 0 0 0 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 0 0 0 0
53 1 13.954 0.029075 0.76368 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 14.36 8.6417 5.7183 0.88273
53 2 13.293 0.10737 1.4841 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 14.72 8.9007 5.8193 1.9432
53 3 10.429 -0.13514 -0.52822 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 9.02 7.5467 1.4733 -0.73631
53 4 7.8078 -0.026608 0.034805 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 7.6 6.1036 1.4964 0.094219
53 5 5.7685 0.11813 0.88532 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 6.45 4.8711 1.5789 1.028
53 6 4.2456 0.14472 0.89283 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 4.86 3.8724 0.98764 0.90276
53 7 3.1211 0.034878 -0.072182 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 3.23 3.0748 0.15517 -0.05445
53 8 2.2937 -0.080107 -1.021 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 2.11 2.4407 -0.33072 -0.78514
53 10 1.2385 -0.06341 -0.93106 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 1.16 1.5375 -0.37748 -0.58548
53 12 0.66873 0.046761 -0.051008 14.31 46.439 1.5242 -0.2153 -0.50303 0.055049 67 160 83.24 1 2 1 0 0 0 1 0 0.7 0.96845 -0.26845 -0.026616
54 0 0 0 0 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 0 0 0 0
54 1 16.696 -0.10158 -1.538 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 15 43.208 -28.208 -1.0821
54 2 20.886 -0.013198 -1.0871 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 20.61 44.504 -23.894 -0.95479
54 3 19.596 -0.061036 -1.4116 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 18.4 37.734 -19.334 -0.93684
54 4 16.344 -0.021058 -1.0055 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 16 30.518 -14.518 -0.58044
54 5 12.781 0.19712 0.7455 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 15.3 24.356 -9.0555 0.33649
54 6 9.5949 -0.013021 -0.76683 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 9.47 19.362 -9.8918 -0.37099
54 7 7.0036 0.093723 0.097576 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 7.66 15.374 -7.7142 -0.064523
54 8 5.0081 -0.12741 -1.5299 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 4.37 12.204 -7.8336 -0.6603
54 10 2.4512 0.1831 0.91602 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 2.9 7.6874 -4.7874 -0.070088
54 12 1.152 -0.21007 -1.9179 41.226 90.404 0.48268 0.84279 0.16312 -1.0948 39 169 78.25 1 2 2 1 1 0 1 0 0.91 4.8422 -3.9322 -0.55164
55 0 0 0 0 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 0 0 0 0
55 1 98.934 -0.0063036 -0.051249 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 98.31 86.417 11.893 0.23794
55 2 77.626 0.0329 -0.16284 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 80.18 89.007 -8.8273 0.085764
55 3 49.121 0.10056 0.080936 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 54.06 75.467 -21.407 -0.094394
55 4 29.293 -0.077255 -1.3093 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 27.03 61.036 -34.006 -1.1052
55 5 17.132 -0.16705 -1.8756 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 14.27 48.711 -34.441 -1.3095
55 6 9.9522 0.26203 1.5476 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 12.56 38.724 -26.164 -0.34688
55 7 5.7677 -0.23886 -2.0685 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 4.39 30.748 -26.358 -0.83137
55 9 1.9333 0.060356 0.41203 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 2.05 19.372 -17.322 0.12404
55 11 0.64769 0.0035692 0.014354 31.516 57.635 1.5806 0.57423 -0.28705 0.091398 47 168 72.12 0.7 2 1 0 1 0 1 0 0.65 12.202 -11.552 0.73948
56 0 0 0 0 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 0 0 0 0
56 1 13.86 0.07937 1.2736 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 14.96 8.6417 6.3183 1.6119
56 4 9.2232 -0.054558 -0.030028 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 8.72 6.1036 2.6164 -0.030142
56 5 7.7254 0.12097 1.3176 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 8.66 4.8711 3.7889 1.8568
56 8 4.5377 -0.034762 0.14923 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 4.38 2.4407 1.9393 0.02635
56 10 3.1826 -0.047938 0.022892 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 3.03 1.5375 1.4925 -0.12526
56 12 2.2321 0.088658 1.0122 10.241 57.74 2.3185 -0.54985 -0.28522 0.47449 36 157 88.45 0.9 2 2 0 1 0 1 0 2.43 0.96845 1.4616 1.3828
57 0 0 0 0 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 0 0 0 0
57 1 6.9227 -0.13473 -1.9686 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 5.99 43.208 -37.218 -1.2801
57 2 11.293 0.17418 0.02493 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 13.26 44.504 -31.244 -1.0617
57 3 13.817 -0.045355 -1.688 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 13.19 37.734 -24.544 -1.3239
57 4 15.026 -0.058309 -1.681 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 14.15 30.518 -16.368 -1.0914
57 5 15.32 0.063948 -0.57015 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 16.3 24.356 -8.0555 -0.27575
57 6 14.995 -0.040379 -1.1387 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 14.39 19.362 -4.9718 -0.44399
57 7 14.27 -0.11492 -1.4757 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 12.63 15.374 -2.7442 -0.61941
57 8 13.302 0.11408 0.47274 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 14.82 12.204 2.6164 1.0388
57 9 12.207 0.10101 0.56827 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 13.44 9.6859 3.7541 1.2499
57 10 11.063 -0.071712 -0.57104 24.453 122.69 0.20826 0.32048 0.46847 -1.9354 63 173 73.94 0.9 1 1 0 1 0 1 0 10.27 7.6874 2.5826 0.23467
58 0 0 0 0 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 0 0 0 0
58 1 25.711 0.0077392 -0.52934 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 25.91 30.246 -4.3358 -0.31093
58 4 11.812 0.10057 -0.14975 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 13 21.363 -8.3625 -0.40013
58 5 8.5492 -0.027977 -0.79564 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 8.31 17.049 -8.7389 -0.71563
58 6 6.1835 -0.26579 -2.2875 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 4.54 13.553 -9.0133 -1.2258
58 7 4.4719 0.089028 0.65405 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 4.87 10.762 -5.8919 -0.0065646
58 8 3.234 -0.093995 -0.53679 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 2.93 8.5425 -5.6125 -0.26766
58 10 1.6913 0.12338 1.3084 31.161 96.146 2.0525 0.56289 0.2247 0.35264 61 178 67.27 1.1 1 1 0 0 0 1 0 1.9 5.3812 -3.4812 0.45902
59 0 0 0 0 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 0 0 0 0
59 1 33.55 0.078676 0.24571 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 36.19 43.208 -7.0183 0.087441
59 2 43.409 -0.077621 -0.72811 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 40.04 44.504 -4.4636 -0.48629
59 3 43.977 -0.18503 -1.3119 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 35.84 37.734 -1.8937 -1.2469
59 4 41.13 0.19036 1.7016 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 48.96 30.518 18.442 2.1969
59 6 33.242 -0.076159 -0.13002 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 30.71 19.362 11.348 -0.64824
59 7 29.481 0.019978 0.63302 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 30.07 15.374 14.696 0.38181
59 8 26.068 0.13434 1.5092 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 29.57 12.204 17.366 1.8318
59 12 15.805 -0.012985 0.29449 10.252 81.606 0.88693 -0.54877 0.060736 -0.48642 53 157 55.02 0.8 2 1 0 1 0 1 0 15.6 4.8422 10.758 0.87419
60 0 0 0 0 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 0 0 0 0
60 1 65.817 0.1099 1.3867 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 73.05 43.208 29.842 1.603
60 2 52.331 -0.015504 -0.11814 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 51.52 44.504 7.0164 -0.19234
60 3 38.758 0.031012 0.13663 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 39.96 37.734 2.2263 0.23536
60 4 28.55 -0.17933 -1.464 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 23.43 30.518 -7.0879 -1.1412
60 5 21.021 0.074619 0.4641 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 22.59 24.356 -1.7655 0.46111
60 6 15.478 -0.054116 -0.50451 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 14.64 19.362 -4.7218 -0.3316
60 7 11.396 0.081105 0.51746 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 12.32 15.374 -3.0542 0.26559
60 8 8.3904 0.14178 0.96932 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 9.58 12.204 -2.6236 0.4183
60 10 4.5484 -0.070011 -0.65437 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 4.23 7.6874 -3.4574 -0.40335
60 12 2.4657 0.0057951 -0.095081 17.665 57.7 2.833 -0.0047027 -0.28592 0.67493 55 173 78.7 1.1 1 1 0 0 0 1 0 2.48 4.8422 -2.3622 -0.14452
61 0 0 0 0 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 0 0 0 0
61 1 10.173 0.042983 0.39558 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 10.61 8.6417 1.9683 0.56282
61 2 7.8553 0.0286 -0.31271 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 8.08 8.9007 -0.82073 -0.2251
61 4 3.6987 -0.1024 -1.3165 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 3.32 6.1036 -2.7836 -1.0066
61 5 2.5157 0.081193 0.18395 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 2.72 4.8711 -2.1511 -0.25076
61 6 1.7107 -0.129 -1.3038 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 1.49 3.8724 -2.3824 -0.85046
61 7 1.1632 0.083215 0.38056 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 1.26 3.0748 -1.8148 -0.17939
61 8 0.79094 0.12525 0.75252 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 0.89 2.4407 -1.5507 -0.0099744
61 9 0.53781 -0.088893 -0.83357 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 0.49 1.9372 -1.4472 -0.24132
61 10 0.36569 0.039134 0.15552 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 0.38 1.5375 -1.1575 0.096285
61 11 0.24865 0.0054093 -0.087711 26.588 68.93 2.3835 0.40416 -0.10808 0.50213 58 179 94.57 1 1 1 0 0 0 1 0 0.25 1.2202 -0.97023 0.20726
62 0 0 0 0 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 0 0 0 0
62 1 48.825 0.042082 0.38354 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 50.88 43.208 7.6717 0.46762
62 2 49.427 0.028999 0.13628 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 50.86 44.504 6.3564 0.23936
62 3 43.616 -0.044391 -0.37604 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 41.68 37.734 3.9463 -0.35678
62 4 37.655 0.029611 0.27649 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 38.77 30.518 8.2521 0.31782
62 5 32.384 0.099605 0.89461 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 35.61 24.356 11.254 1.012
62 6 27.833 -0.10536 -0.5843 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 24.9 19.362 5.5382 -0.84881
62 7 23.918 0.03773 0.55242 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 24.82 15.374 9.4458 0.57698
62 8 20.553 0.016402 0.42908 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 20.89 12.204 8.6864 0.45776
62 10 15.177 0.052263 0.73677 11.93 78.686 1.8773 -0.39721 0.024295 0.26342 56 179 102.3 1.2 1 1 0 1 0 1 0 15.97 7.6874 8.2826 1.0815
63 0 0 0 0 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 0 0 0 0
63 1 36.355 0.089813 0.7464 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 39.62 30.246 9.3742 0.79999
63 2 37.855 -0.093635 -0.29394 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 34.31 31.153 3.1575 -0.30342
63 3 31.309 -0.17276 -0.86927 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 25.9 26.414 -0.5136 -0.93294
63 4 24.159 0.2066 1.8465 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 29.15 21.363 7.7875 2.0214
63 5 18.174 0.035573 0.3308 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 18.82 17.049 1.7711 0.37394
63 7 10.041 0.056623 0.092125 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 10.61 10.762 -0.15191 0.040888
63 8 7.4372 -0.049368 -0.83804 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 7.07 8.5425 -1.4725 -0.65804
63 10 4.0733 0.10476 0.21042 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 4.5 5.3812 -0.88117 -0.074768
63 11 3.0138 -0.094157 -1.3027 16.987 56.372 1.1992 -0.043846 -0.30921 -0.18473 66 182 94.8 1.1 1 1 0 0 0 1 0 2.73 4.2708 -1.5408 -0.79538
64 0 0 0 0 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 0 0 0 0
64 1 23.523 0.11166 0.12184 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 26.15 43.208 -17.058 -0.37981
64 2 31.116 -0.11653 -1.4177 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 27.49 44.504 -17.014 -1.1551
64 3 31.287 -0.13158 -1.263 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 27.17 37.734 -10.564 -0.95383
64 4 28.326 0.073933 0.50581 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 30.42 30.518 -0.09791 0.6314
64 5 24.338 0.019816 0.2278 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 24.82 24.356 0.46447 0.43468
64 6 20.305 0.019944 0.28571 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 20.71 19.362 1.3482 0.45596
64 8 13.495 -0.23305 -1.6602 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 10.35 12.204 -1.8536 -1.3981
64 9 10.865 0.30509 2.3606 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 14.18 9.6859 4.4941 1.8678
64 11 6.9591 0.048992 0.32082 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 7.3 6.1012 1.1988 -0.047073
64 12 5.5504 -0.18745 -1.5037 20.352 88.502 0.63827 0.13691 0.14186 -0.81541 48 183 111.8 1.2 1 1 0 0 0 1 0 4.51 4.8422 -0.33225 -1.4288
65 0 0 0 0 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 0 0 0 0
65 1 22.273 -0.10476 -1.4684 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 19.94 43.208 -23.268 -1.0476
65 2 28.523 0.18992 0.6221 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 33.94 44.504 -10.564 0.40245
65 3 29.321 0.028608 -0.5076 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 30.16 37.734 -7.5737 -0.18064
65 4 28.322 -0.17131 -1.8497 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 23.47 30.518 -7.0479 -1.4358
65 5 26.784 0.017023 -0.22955 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 27.24 24.356 2.8845 -0.19065
65 6 25.138 0.021166 -0.0012876 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 25.67 19.362 6.3082 -0.12218
65 7 23.527 -0.10105 -0.73737 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 21.15 15.374 5.7758 -1.1615
65 9 20.559 -0.0077409 0.30669 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 20.4 9.6859 10.714 0.35509
65 10 19.212 -0.056329 0.086922 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 18.13 7.6874 10.443 0.29468
65 12 16.775 0.20297 2.3031 9.5706 141.07 1.0608 -0.61758 0.60809 -0.30738 64 180 99.79 1.1 1 1 0 0 0 1 0 20.18 4.8422 15.338 5.9987
"
)
#data("xptab1")
#cat("TABLE NO. 1\n",file="xptab1")
#cat(names(xptab1),file="xptab1",append=T)
#cat("\n",file="xptab1",append=T)
#write.table(xptab1,sep=" ",file="xptab1",append=T,quote=F,row.names=F,col.names=F)
#rm(xptab1,pos=1)
}
writeExt <- function() {
cat(file="run1.ext"," TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION
ITERATION THETA1 THETA2 THETA3 SIGMA(1,1) OMEGA(1,1) OMEGA(2,1) OMEGA(2,2) OMEGA(3,1) OMEGA(3,2) OMEGA(3,3) OBJ
0 18.7 87.3 2.13 0.0231046 0.128 0 0.142 0 0 1.82 1934.14785559591
1 16.8148 72.6252 2.083 0.0126826 0.160664 0 0.149731 0 0 1.51568 1923.70325075889
2 16.9495 73.2307 2.05859 0.0184253 0.166834 0 0.149006 0 0 1.4402 1899.85237046683
3 18.4026 80.7013 1.85358 0.0182676 0.222467 0 0.142799 0 0 0.917776 1890.66304696867
4 17.9049 76.5891 1.64892 0.0181099 0.254935 0 0.139153 0 0 0.639403 1885.75479711981
5 17.1666 80.222 1.41973 0.0181011 0.227412 0 0.138093 0 0 0.525486 1884.41372762353
6 17.9265 78.9975 1.35571 0.0181095 0.211068 0 0.14052 0 0 0.500335 1883.89273761533
7 17.8964 79.06 1.37145 0.0181037 0.207343 0 0.142404 0 0 0.490887 1883.84808484012
8 17.7293 78.2516 1.38609 0.0179329 0.210006 0 0.15096 0 0 0.528111 1883.3535752913
9 17.6299 77.0015 1.42104 0.0177301 0.206074 0 0.139223 0 0 0.568591 1882.84023590007
10 17.5286 76.6146 1.42608 0.0175907 0.206282 0 0.139413 0 0 0.57689 1882.82787864752
11 17.5286 76.6146 1.42608 0.0175836 0.206282 0 0.139413 0 0 0.57689 1882.82787864752
12 17.7222 76.732 1.43993 0.0174915 0.206303 0 0.139799 0 0 0.586448 1882.75522657785
13 17.7481 76.7973 1.44256 0.0174662 0.206217 0 0.139895 0 0 0.585529 1882.75345663931
14 17.7481 76.7973 1.44256 0.0174662 0.206217 0 0.139895 0 0 0.585529 1882.75345663931
-1000000000 17.7481 76.7973 1.44256 0.0174697 0.206217 0 0.139895 0 0 0.585529 1882.75345663931
-1000000001 1.04869 3.96763 0.15611 0.0011367 0.0261889 1e+10 0.0267082 1e+10 1e+10 0.169681 0
-1000000002 0.485426 0.646933 0.753416 0.982995 1.21987 1.33922 1.57214 0 0 0 0
-1000000003 3.23868 0.485426 1.57214 0 0 0 0 0 0 0 0
"
)
#data("run1ext")
#cat(" TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION
#ITERATION THETA1 THETA2 THETA3 SIGMA(1,1) OMEGA(1,1) OMEGA(2,1) OMEGA(2,2) OMEGA(3,1) OMEGA(3,2) OMEGA(3,3) OBJ\n",file="run1.ext")
#write.table(run1ext,sep=" ",file="run1.ext",append=T,quote=F,row.names=F,col.names=F)
#rm(run1ext,pos=1)
}
# TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION
# ITERATION THETA1 THETA2 THETA3 SIGMA(1,1) OMEGA(1,1) OMEGA(2,1) OMEGA(2,2) OMEGA(3,1) OMEGA(3,2) OMEGA(3,3) OBJ
writeLst <- function() {
cat(file="run1.lst","Sun Oct 9 19:17:21 CEST 2011
ifort
$PROB Simpraz model
;; 1. Based on: First run [nodOFV]
;; First run with a one compartment model and first order absorption
;; 2. Structural model:
;; One compartment model with first order absorption
;; 3. Covariate model:
;; No covariates
;; 4. Inter-individual variability:
;; ETAs on CL, V and KA
;; 5. Residual variability:
;; Proportional
;; 6. Estimation:
;; FOCE INTER
$INPUT ID SEX AGE RACE HT SMOK HCTZ PROP CON AMT WT TIME SECR
DV RATE EVID OCC
$DATA simpraz.dta IGNORE=@
$SUBROUTINE ADVAN2 TRANS2
$PK
TVCL = THETA(1)
TVV = THETA(2)
TVKA = THETA(3)
CL = TVCL*EXP(ETA(1))
V = TVV *EXP(ETA(2))
KA = TVKA*EXP(ETA(3))
S2=V
$ERROR
IPRED = F
IRES = DV - F
W = F
IF(W.EQ.0) W = 1
IWRES = IRES/W
Y = IPRED + W*EPS(1)
$THETA
(0,18.7) ; CL (L/h)
(0,87.3) ; V (L)
(0,2.13) ; KA (1/h)
$OMEGA
0.128 ; omCL
0.142 ; omV
1.82 ; omKA
$SIGMA
0.0231 ; Prop error
$EST NOABORT METHOD=1 INTER PRINT=1
$COV PRINT=E
$TABLE ID TIME IPRED IWRES CWRES
CL V KA ETA1 ETA2 ETA3
AGE HT WT SECR
SEX RACE SMOK HCTZ PROP CON OCC
NOPRINT ONEHEADER FILE=xptab1
WARNINGS AND ERRORS (IF ANY) FOR PROBLEM 1
(WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION.
CREATING MUMODEL ROUTINE...
License Registered to: Exprimo NV
Expiration Date: 14 SEP 2012
Current Date: 9 OCT 2011
Days until program expires : 340
1NONLINEAR MIXED EFFECTS MODEL PROGRAM (NONMEM) VERSION 7.1.0
ORIGINALLY DEVELOPED BY STUART BEAL, LEWIS SHEINER, AND ALISON BOECKMANN
CURRENT DEVELOPERS ARE ROBERT BAUER, ICON DEVELOPMENT SOLUTIONS,
AND ALISON BOECKMANN. IMPLEMENTATION, EFFICIENCY, AND STANDARDIZATION
PERFORMED BY NOUS INFOSYSTEMS.
PROBLEM NO.: 1
Simpraz model
0DATA CHECKOUT RUN: NO
DATA SET LOCATED ON UNIT NO.: 2
THIS UNIT TO BE REWOUND: NO
NO. OF DATA RECS IN DATA SET: 640
NO. OF DATA ITEMS IN DATA SET: 18
ID DATA ITEM IS DATA ITEM NO.: 1
DEP VARIABLE IS DATA ITEM NO.: 14
MDV DATA ITEM IS DATA ITEM NO.: 18
0INDICES PASSED TO SUBROUTINE PRED:
16 12 10 15 0 0 0 0 0
0 0
0LABELS FOR DATA ITEMS:
ID SEX AGE RACE HT SMOK HCTZ PROP CON AMT WT TIME SECR DV RATE EVID OCC MDV
0(NONBLANK) LABELS FOR PRED-DEFINED ITEMS:
CL V KA IPRE IWRE
0FORMAT FOR DATA:
(E3.0,E2.0,E3.0,E2.0,E4.0,4E2.0,2E6.0,E3.0,E4.0,E7.0,3E2.0,1F2.0)
TOT. NO. OF OBS RECS: 576
TOT. NO. OF INDIVIDUALS: 64
0LENGTH OF THETA: 3
0DEFAULT THETA BOUNDARY TEST OMITTED: NO
0OMEGA HAS SIMPLE DIAGONAL FORM WITH DIMENSION: 3
0DEFAULT OMEGA BOUNDARY TEST OMITTED: NO
0SIGMA HAS SIMPLE DIAGONAL FORM WITH DIMENSION: 1
0DEFAULT SIGMA BOUNDARY TEST OMITTED: NO
0INITIAL ESTIMATE OF THETA:
LOWER BOUND INITIAL EST UPPER BOUND
0.0000E+00 0.1870E+02 0.1000E+07
0.0000E+00 0.8730E+02 0.1000E+07
0.0000E+00 0.2130E+01 0.1000E+07
0INITIAL ESTIMATE OF OMEGA:
0.1280E+00
0.0000E+00 0.1420E+00
0.0000E+00 0.0000E+00 0.1820E+01
0INITIAL ESTIMATE OF SIGMA:
0.2310E-01
0ESTIMATION STEP OMITTED: NO
CONDITIONAL ESTIMATES USED: YES
CENTERED ETA: NO
EPS-ETA INTERACTION: YES
LAPLACIAN OBJ. FUNC.: NO
NO. OF FUNCT. EVALS. ALLOWED: 360
NO. OF SIG. FIGURES REQUIRED: 3
INTERMEDIATE PRINTOUT: YES
ESTIMATE OUTPUT TO MSF: NO
ABORT WITH PRED EXIT CODE 1: NO
IND. OBJ. FUNC. VALUES SORTED: NO
0COVARIANCE STEP OMITTED: NO
EIGENVLS. PRINTED: YES
SPECIAL COMPUTATION: NO
COMPRESSED FORMAT: NO
0TABLES STEP OMITTED: NO
NO. OF TABLES: 1
0-- TABLE 1 --
PRINTED: NO
HEADER: YES
FILE TO BE FORWARDED: NO
0USER-CHOSEN ITEMS:
ID TIME IPRED IWRES CWRES CL V KA ETA1 ETA2 ETA3 AGE HT WT SECR SEX RACE SMOK
HCTZ PROP CON OCC
THE FOLLOWING LABELS ARE EQUIVALENT
PRED=PREDI
RES=RESI
WRES=WRESI
1DOUBLE PRECISION PREDPP VERSION 7.1.0
ONE COMPARTMENT MODEL WITH FIRST-ORDER ABSORPTION (ADVAN2)
0MAXIMUM NO. OF BASIC PK PARAMETERS: 3
0BASIC PK PARAMETERS (AFTER TRANSLATION):
ELIMINATION RATE (K) IS BASIC PK PARAMETER NO.: 1
ABSORPTION RATE (KA) IS BASIC PK PARAMETER NO.: 3
TRANSLATOR WILL CONVERT PARAMETERS
CLEARANCE (CL) AND VOLUME (V) TO K (TRANS2)
0COMPARTMENT ATTRIBUTES
COMPT. NO. FUNCTION INITIAL ON/OFF DOSE DEFAULT DEFAULT
STATUS ALLOWED ALLOWED FOR DOSE FOR OBS.
1 DEPOT OFF YES YES YES NO
2 CENTRAL ON NO YES NO YES
3 OUTPUT OFF YES NO NO NO
1
ADDITIONAL PK PARAMETERS - ASSIGNMENT OF ROWS IN GG
COMPT. NO. INDICES
SCALE BIOAVAIL. ZERO-ORDER ZERO-ORDER ABSORB
FRACTION RATE DURATION LAG
1 * * * * *
2 4 * * * *
3 * - - - -
- PARAMETER IS NOT ALLOWED FOR THIS MODEL
* PARAMETER IS NOT SUPPLIED BY PK SUBROUTINE;
WILL DEFAULT TO ONE IF APPLICABLE
0DATA ITEM INDICES USED BY PRED ARE:
EVENT ID DATA ITEM IS DATA ITEM NO.: 16
TIME DATA ITEM IS DATA ITEM NO.: 12
DOSE AMOUNT DATA ITEM IS DATA ITEM NO.: 10
DOSE RATE DATA ITEM IS DATA ITEM NO.: 15
0PK SUBROUTINE CALLED WITH EVERY EVENT RECORD.
PK SUBROUTINE NOT CALLED AT NONEVENT (ADDITIONAL OR LAGGED) DOSE TIMES.
0ERROR SUBROUTINE CALLED WITH EVERY EVENT RECORD.
1
#METH: First Order Conditional Estimation with Interaction
MONITORING OF SEARCH:
0ITERATION NO.: 0 OBJECTIVE VALUE: 1934.14785559591 NO. OF FUNC. EVALS.: 6
CUMULATIVE NO. OF FUNC. EVALS.: 6
PARAMETER: 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01
GRADIENT: 6.5022E+01 1.1261E+02 1.3652E+01 -6.9534E+01 -1.6219E+01 5.5978E+01 1.8356E+02
0ITERATION NO.: 1 OBJECTIVE VALUE: 1923.70325075889 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 13
PARAMETER: -6.2664E-03 -8.4038E-02 7.7688E-02 2.1364E-01 1.2651E-01 8.5138E-03 -2.0000E-01
GRADIENT: -1.2724E+01 -1.3237E+01 1.8799E+01 -3.0046E+01 3.8710E+00 4.0724E+01 -2.9791E+02
0ITERATION NO.: 2 OBJECTIVE VALUE: 1899.85237046683 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 20
PARAMETER: 1.7137E-03 -7.5736E-02 6.5897E-02 2.3249E-01 1.2408E-01 -1.7028E-02 -1.3154E-02
GRADIENT: -1.3973E+01 -1.6776E+01 1.7423E+01 -2.3244E+01 3.5247E+00 3.7366E+01 4.6643E+01
0ITERATION NO.: 3 OBJECTIVE VALUE: 1890.66304696867 NO. OF FUNC. EVALS.:10
CUMULATIVE NO. OF FUNC. EVALS.: 30
PARAMETER: 8.3970E-02 2.1405E-02 -3.9001E-02 3.7637E-01 1.0280E-01 -2.4232E-01 -1.7453E-02
GRADIENT: 3.2964E+01 4.7376E+01 2.3632E+01 8.1454E+00 1.0004E-01 2.0086E+01 3.3806E+01
0ITERATION NO.: 4 OBJECTIVE VALUE: 1885.75479711981 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 37
PARAMETER: 5.6551E-02 -3.0896E-02 -1.5600E-01 4.4449E-01 8.9873E-02 -4.2303E-01 -2.1788E-02
GRADIENT: 1.5210E+01 -6.1085E-01 2.0623E+01 2.3389E+01 -1.0150E+00 6.9499E-01 2.9375E+01
0ITERATION NO.: 5 OBJECTIVE VALUE: 1884.41372762353 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 44
PARAMETER: 1.4439E-02 1.5448E-02 -3.0566E-01 3.8737E-01 8.6050E-02 -5.2113E-01 -2.2030E-02
GRADIENT: -9.3667E+00 3.7344E+01 -2.0295E+00 1.0027E+01 -4.5124E+00 -4.3621E+00 2.5094E+01
0ITERATION NO.: 6 OBJECTIVE VALUE: 1883.89273761533 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 51
PARAMETER: 5.7757E-02 6.5886E-05 -3.5180E-01 3.5007E-01 9.4762E-02 -5.4566E-01 -2.1798E-02
GRADIENT: 1.4259E+01 2.4904E+01 -9.4935E+00 2.2601E+00 -1.1557E+00 -7.5028E+00 2.4382E+01
0ITERATION NO.: 7 OBJECTIVE VALUE: 1883.84808484012 NO. OF FUNC. EVALS.: 8
CUMULATIVE NO. OF FUNC. EVALS.: 59
PARAMETER: 5.6074E-02 8.5652E-04 -3.4025E-01 3.4117E-01 1.0142E-01 -5.5519E-01 -2.1957E-02
GRADIENT: 1.3534E+01 2.4501E+01 -7.2871E+00 1.2409E-01 -2.3582E-01 -8.7672E+00 2.3990E+01
0ITERATION NO.: 8 OBJECTIVE VALUE: 1883.35357529130 NO. OF FUNC. EVALS.: 8
CUMULATIVE NO. OF FUNC. EVALS.: 67
PARAMETER: 4.6693E-02 -9.4217E-03 -3.2964E-01 3.4755E-01 1.3059E-01 -5.1864E-01 -2.6699E-02
GRADIENT: 8.6482E+00 1.6435E+01 -5.9177E+00 1.9289E+00 6.2091E+00 -4.1343E+00 1.8676E+01
0ITERATION NO.: 9 OBJECTIVE VALUE: 1882.84023590007 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 74
PARAMETER: 4.1073E-02 -2.5526E-02 -3.0473E-01 3.3810E-01 9.0126E-02 -4.8171E-01 -3.2384E-02
GRADIENT: 5.4469E+00 6.6298E+00 -1.2150E+00 -1.8173E-01 -6.4254E-01 -1.3516E+00 1.1441E+01
0ITERATION NO.: 10 OBJECTIVE VALUE: 1882.82787864752 NO. OF FUNC. EVALS.: 7
CUMULATIVE NO. OF FUNC. EVALS.: 81
PARAMETER: 3.5313E-02 -3.0562E-02 -3.0119E-01 3.3861E-01 9.0808E-02 -4.7447E-01 -3.6332E-02
GRADIENT: 2.2140E+00 3.0353E+00 -7.0031E-01 -6.0453E-02 -3.5587E-01 -8.2821E-01 5.7532E+00
0ITERATION NO.: 11 OBJECTIVE VALUE: 1882.82787864752 NO. OF FUNC. EVALS.:12
CUMULATIVE NO. OF FUNC. EVALS.: 93
PARAMETER: 3.5313E-02 -3.0562E-02 -3.0119E-01 3.3861E-01 9.0808E-02 -4.7447E-01 -3.6332E-02
GRADIENT: -7.7981E+00 -2.1031E+00 -1.8360E+00 -6.0453E-02 -3.5587E-01 -8.2821E-01 5.6385E+00
0ITERATION NO.: 12 OBJECTIVE VALUE: 1882.75522657785 NO. OF FUNC. EVALS.:13
CUMULATIVE NO. OF FUNC. EVALS.: 106
PARAMETER: 4.6293E-02 -2.9032E-02 -2.9153E-01 3.3866E-01 9.2190E-02 -4.6625E-01 -3.8958E-02
GRADIENT: -9.2314E-01 -6.4563E-01 -2.9440E-01 6.0926E-02 -5.7781E-03 1.0360E-01 1.3233E+00
0ITERATION NO.: 13 OBJECTIVE VALUE: 1882.75345663931 NO. OF FUNC. EVALS.:11
CUMULATIVE NO. OF FUNC. EVALS.: 117
PARAMETER: 4.7755E-02 -2.8181E-02 -2.8970E-01 3.3845E-01 9.2533E-02 -4.6704E-01 -3.9682E-02
GRADIENT: 3.6958E-03 -2.5536E-02 1.9604E-02 6.6066E-04 3.6072E-03 1.2488E-03 7.9552E-02
0ITERATION NO.: 14 OBJECTIVE VALUE: 1882.75345663931 NO. OF FUNC. EVALS.: 8
CUMULATIVE NO. OF FUNC. EVALS.: 125
PARAMETER: 4.7755E-02 -2.8181E-02 -2.8970E-01 3.3845E-01 9.2533E-02 -4.6704E-01 -3.9682E-02
GRADIENT: 3.6958E-03 -2.5536E-02 1.9604E-02 6.6066E-04 3.6072E-03 1.2488E-03 7.9552E-02
Elapsed estimation time in seconds: 1.45
#TERM:
0MINIMIZATION SUCCESSFUL
NO. OF FUNCTION EVALUATIONS USED: 125
NO. OF SIG. DIGITS IN FINAL EST.: 3.4
ETABAR IS THE ARITHMETIC MEAN OF THE ETA-ESTIMATES,
AND THE P-VALUE IS GIVEN FOR THE NULL HYPOTHESIS THAT THE TRUE MEAN IS 0.
ETABAR: 7.5792E-03 -7.8643E-03 -7.3866E-02
SE: 5.5890E-02 4.3281E-02 7.8359E-02
P VAL.: 8.9213E-01 8.5582E-01 3.4585E-01
ETAshrink(%): 7.6098E-01 6.6939E+00 1.7430E+01
EPSshrink(%): 1.4530E+01
#TERE:
Elapsed covariance time in seconds: 1.45
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
#OBJT:************** MINIMUM VALUE OF OBJECTIVE FUNCTION ********************
******************** ********************
************************************************************************************************************************
#OBJV:******************************************** 1882.753 **************************************************
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** FINAL PARAMETER ESTIMATE ********************
******************** ********************
************************************************************************************************************************
THETA - VECTOR OF FIXED EFFECTS PARAMETERS *********
TH 1 TH 2 TH 3
1.77E+01 7.68E+01 1.44E+00
OMEGA - COV MATRIX FOR RANDOM EFFECTS - ETAS ********
ETA1 ETA2 ETA3
ETA1
+ 2.06E-01
ETA2
+ 0.00E+00 1.40E-01
ETA3
+ 0.00E+00 0.00E+00 5.86E-01
SIGMA - COV MATRIX FOR RANDOM EFFECTS - EPSILONS ****
EPS1
EPS1
+ 1.75E-02
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** STANDARD ERROR OF ESTIMATE ********************
******************** ********************
************************************************************************************************************************
THETA - VECTOR OF FIXED EFFECTS PARAMETERS *********
TH 1 TH 2 TH 3
1.05E+00 3.97E+00 1.56E-01
OMEGA - COV MATRIX FOR RANDOM EFFECTS - ETAS ********
ETA1 ETA2 ETA3
ETA1
+ 2.62E-02
ETA2
+ ......... 2.67E-02
ETA3
+ ......... ......... 1.70E-01
SIGMA - COV MATRIX FOR RANDOM EFFECTS - EPSILONS ****
EPS1
EPS1
+ 1.14E-03
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** COVARIANCE MATRIX OF ESTIMATE ********************
******************** ********************
************************************************************************************************************************
TH 1 TH 2 TH 3 OM11 OM12 OM13 OM22 OM23 OM33 SG11
TH 1
+ 1.10E+00
TH 2
+ -5.35E-01 1.57E+01
TH 3
+ -2.77E-02 -1.01E-01 2.44E-02
OM11
+ 6.96E-03 -5.01E-03 5.42E-04 6.86E-04
OM12
+ ......... ......... ......... ......... .........
OM13
+ ......... ......... ......... ......... ......... .........
OM22
+ 8.25E-04 2.61E-02 8.89E-04 9.46E-05 ......... ......... 7.13E-04
OM23
+ ......... ......... ......... ......... ......... ......... ......... .........
OM33
+ 2.14E-02 -1.63E-01 -1.89E-03 3.23E-04 ......... ......... -7.79E-04 ......... 2.88E-02
SG11
+ 9.34E-05 2.55E-04 -1.41E-05 3.95E-06 ......... ......... -3.01E-06 ......... 3.54E-05 1.29E-06
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** CORRELATION MATRIX OF ESTIMATE ********************
******************** ********************
************************************************************************************************************************
TH 1 TH 2 TH 3 OM11 OM12 OM13 OM22 OM23 OM33 SG11
TH 1
+ 1.00E+00
TH 2
+ -1.29E-01 1.00E+00
TH 3
+ -1.69E-01 -1.62E-01 1.00E+00
OM11
+ 2.54E-01 -4.82E-02 1.33E-01 1.00E+00
OM12
+ ......... ......... ......... ......... .........
OM13
+ ......... ......... ......... ......... ......... .........
OM22
+ 2.95E-02 2.46E-01 2.13E-01 1.35E-01 ......... ......... 1.00E+00
OM23
+ ......... ......... ......... ......... ......... ......... ......... .........
OM33
+ 1.21E-01 -2.41E-01 -7.15E-02 7.27E-02 ......... ......... -1.72E-01 ......... 1.00E+00
SG11
+ 7.84E-02 5.65E-02 -7.92E-02 1.33E-01 ......... ......... -9.93E-02 ......... 1.84E-01 1.00E+00
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** INVERSE COVARIANCE MATRIX OF ESTIMATE ********************
******************** ********************
************************************************************************************************************************
TH 1 TH 2 TH 3 OM11 OM12 OM13 OM22 OM23 OM33 SG11
TH 1
+ 1.06E+00
TH 2
+ 4.76E-02 7.84E-02
TH 3
+ 1.75E+00 5.06E-01 4.91E+01
OM11
+ -1.08E+01 1.44E-01 -4.56E+01 1.67E+03
OM12
+ ......... ......... ......... ......... .........
OM13
+ ......... ......... ......... ......... ......... .........
OM22
+ -4.24E+00 -3.29E+00 -7.15E+01 -1.91E+02 ......... ......... 1.68E+03
OM23
+ ......... ......... ......... ......... ......... ......... ......... .........
OM33
+ -3.56E-01 3.90E-01 3.12E+00 -1.19E+01 ......... ......... 2.26E+01 ......... 3.94E+01
SG11
+ -3.39E+01 -3.22E+01 1.95E+02 -4.95E+03 ......... ......... 4.06E+03 ......... -1.01E+03 8.37E+05
1
************************************************************************************************************************
******************** ********************
******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ********************
******************** EIGENVALUES OF COR MATRIX OF ESTIMATE ********************
******************** ********************
************************************************************************************************************************
1 2 3 4 5 6 7
4.85E-01 6.47E-01 7.53E-01 9.83E-01 1.22E+00 1.34E+00 1.57E+00
Sun Oct 9 19:17:24 CEST 2011
"
)
}
if(!overwrite && any(file.exists("run1.mod","simpraz.dta","run1.lst","run1.ext","xptab1"))){
cat("One of:\n",
"run1.mod, simpraz.dta, run1.lst, run1.ext, xptab1\n",
"already exist in\n",
getwd(),"\nNo files will be created.\n",sep="")
return()
}
writeMod()
writeDta()
writeTab()
writeLst()
writeExt()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/simprazExample.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
struct.gof.menu <- function() {
choices <- c("Return to the previous menu",
"Basic goodness of fit plots",
"Predictions vs independent variable")
pick <- menu(choices,title="\nStructural model diagnostics menu")
qx <- 0
switch(pick,
return(),
print(basic.gof(get(".cur.db"))),
print(dv.preds.vs.idv(get(".cur.db")))
)
Recall()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/struct.gof.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
structural.diagnostics.menu <-
function() {
choices <- c("Return to previous menu ->",
"PRED vs dependent variable|independent variable",
"IPRED vs dependent variable|independent variable",
"Weighted residuals vs independent variable",
"Weighted residuals vs independent variable (BW)",
"Weighted residuals vs PRED",
"Weighted residuals vs PRED (BW)",
"DV vs PRED|covariates",
"DV VS IPRED|covariates"
)
title="\nSTRUCTURAL DIAGNOSTICS MENU\n \\main\\goodness of fit plots\\Structural model diagnostics"
pick <- menu(choices,title=title)
if(is.null(check.vars(c("cwres"),eval(parse(text=".cur.db")),silent=TRUE))) {
wres <- "wres"
}else{
wres <- "cwres"
}
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
print(dv.vs.pred.by.idv(eval(parse(text=".cur.db")))),
print(dv.vs.ipred.by.idv(eval(parse(text=".cur.db")))),
##print(wres.vs.idv(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".vs.idv(.cur.db)",sep="")))),
##print(wres.vs.idv.bw(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".vs.idv.bw(.cur.db)",sep="")))),
##print(wres.vs.pred(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".vs.pred(.cur.db)",sep="")))),
##print(wres.vs.pred.bw(eval(parse(text=".cur.db")))),
print(eval(parse(text=paste(wres,".vs.pred.bw(.cur.db)",sep="")))),
print(dv.vs.pred.by.cov(eval(parse(text=".cur.db")))),
print(dv.vs.ipred.by.cov(eval(parse(text=".cur.db"))))
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/structural.diagnostics.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Tabulate the population parameter estimates
#'
#' This function provides a summary of the model's parameter estimates and
#' precision.
#'
#'
#' @param object An xpose.data object.
#' @param prompt Ask before printing.
#' @param outfile file to output to (NULL means screen).
#' @param dir Which directory is the NONMEM output file located. \code{""} means
#' the current working directory \code{getwd()}.
#' @return A table summarizing the parameters and their precision.
#' @author Niclas Jonsson, Andrew Hooker & Justin Wilkins
#' @keywords methods
#' @examples
#'
#' od = setwd(tempdir()) # move to a temp directory
#' (cur.files <- dir()) # current files in temp directory
#'
#' simprazExample(overwrite=TRUE) # write files
#' (new.files <- dir()[!(dir() %in% cur.files)]) # what files are new here?
#' xpdb <- xpose.data(1) # read in files to xpose database
#'
#' tabulate.parameters(xpdb)
#'
#' file.remove(new.files) # remove these files
#' setwd(od) # restore working directory
#'
#' @export tabulate.parameters
#' @family data functions
tabulate.parameters <- function(object,prompt=FALSE,outfile=NULL,dir="")
{
if(prompt==TRUE){
listfile=paste("run",object@Runno,".lst",sep="")
## Get the name of the list file to use
cat("Type the name of the output file (0=cancel, return=",
listfile,")\n",sep="")
ans <- readline()
lstfile <- NULL
if(ans==0) {
return()
} else if (ans=="") {
if(is.readable.file(listfile)) {
lstfile <- listfile
}
} else {
if(is.readable.file(ans)) {
lstfile <- listfile
}
}
} else {
lstfile = paste(dir,"run",object@Runno,".lst",sep="")
}
if(is.null(lstfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return()
}
parameter.list <- create.parameter.list(lstfile)
#attach(parameter.list,warn.conflicts=F)
## Set up matrix
if(any(parameter.list$separval!="" & parameter.list$separval!=0)) {
ret.mat <- matrix(0,
nrow=length(parameter.list$parval),
ncol=3,
dimnames=list(c(),c("Parameter","Value","RSE"))
)
ret.mat[,1] <- parameter.list$parnam
ret.mat[,2] <- parameter.list$parval
ret.mat[,3] <- parameter.list$separval
} else {
ret.mat <- matrix(0,
nrow=length(parameter.list$parval),
ncol=2,
dimnames=list(c(),c("Parameter","Value"))
)
ret.mat[,1] <- parameter.list$parnam
ret.mat[,2] <- parameter.list$parval
}
class(ret.mat) <- "char.matrix"
if(prompt==TRUE){
cat("Would you like to export the table(s) as a text file? n(y)\n")
ans <- readline()
} else {
if (is.null(outfile)){
ans = "n"
} else {
ans = "y"
}
}
if(ans != "y") {
Hmisc::print.char.matrix(ret.mat,col.names=TRUE)
}
else {
if(prompt==TRUE || is.null(outfile)){
cat("Please type a filename (excluding the .txt extension):\n"
)
ans <- readline()
} else {
ans <- outfile
}
print(ret.mat, file = paste(ans, ".txt", sep = ""))
}
#detach(parameter.list)
return(cat(""))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/tabulate.parameters.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @rdname check.vars
test.xpose.data <- function(object) {
# if(is.null(object@Data)) return("The object contains no Data")
if(!is.null(SData(object))) {
sdata <- SData(object)
data <- Data(object)
if((ncol(data)+1) != ncol(sdata)) {
return("The Data and the SData do not have the same number of columns!")
}
## Check columns
nams <- names(data)
snams<- names(sdata)
## All columns in Data should be in SData
for(n in nams) {
if(any(n==snams)) {
} else {
return(paste(n," does not seem to be present in SData!"))
}
}
## All columns (except iter) should be in Data
for(n in snams) {
if(n == "iter") next
if(any(n==nams)) {
} else {
return(paste(n," does not seem to be present in Data!"))
}
}
## We also need to check that the class definitions are the same
for(n in nams) {
if(class(data[,n]) != class(sdata[,n]))
return(paste(n," does not have the same class definition in Data and SData!"))
}
## Check that SData is an even multiple of Data
dnro <- dim(data)[1]
snro <- dim(sdata)[1]
# cat(snro)
if(regexpr("\\.",as.character(snro/snro)) !=-1) {
return("The lengths of Data and SData do not match!")
}
}
return(TRUE)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/test.xpose.data.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
vpc.npc.menu <- function() {
choices <- c("Return to previous menu ->",
"Numerical predictive check plot",
"Visual predictive check (VPC) plot",
"Categorical VPC plot",
"Categorical and continuous VPC plot",
"* Settings"
)
title="\nVISUAL AND NUMERICAL PREDICTIVE CHECK PLOTS MENU\n \\main\\Visual and numerical predictive check plots"
pick <- menu(choices,title=title)
run.npc.coverage <- function(){
cat("\nPlease type the name of the npc results file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
npc.info <- as.character(ans)
cat("\nRunning command:\n",
" npc.coverage(npc.info=\"",npc.info,"\")\n",sep="")
print(npc.coverage(npc.info=npc.info))
}
run.xpose.VPC <- function(){
cat("\nPlease type the name of the vpc results file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpc.info <- as.character(ans)
cat("\nPlease type the name of the vpctab file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpctab <- as.character(ans)
cat("\nRunning command:\n",
" xpose.VPC(vpc.info=\"",vpc.info,"\", vpctab=\"",vpctab,"\")\n",sep="")
print(xpose.VPC(vpc.info=vpc.info,vpctab=vpctab))
}
run.xpose.VPC.categorical <- function(){
cat("\nPlease type the name of the vpc results file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpc.info <- as.character(ans)
cat("\nPlease type the name of the vpctab file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpctab <- as.character(ans)
cat("\nRunning command:\n",
" xpose.VPC.categorical(vpc.info=\"",vpc.info,"\", vpctab=\"",vpctab,"\")\n",sep="")
print(xpose.VPC.categorical(vpc.info=vpc.info,vpctab=vpctab))
}
run.xpose.VPC.both <- function(){
cat("\nPlease type the name of the vpc results file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpc.info <- as.character(ans)
cat("\nPlease type the name of the vpctab file from PsN\n",
"Relative or full paths to the file may be used:\n")
ans <- readline()
vpctab <- as.character(ans)
cat("\nRunning command:\n",
" xpose.VPC.both(vpc.info=\"",vpc.info,"\", vpctab=\"",vpctab,"\")\n",sep="")
print(xpose.VPC.both(vpc.info=vpc.info,vpctab=vpctab))
}
qx <- 0
switch(pick+1,
qx <- 2,
qx <- 1,
run.npc.coverage(),
run.xpose.VPC(),
run.xpose.VPC.categorical(),
run.xpose.VPC.both(),
cat("Not yet implemented, please use command line for this feature!\n",
"See '?xpose.VPC' or '?npc.coverage'\n")
)
if(qx == 2) {
return(invisible(2))
} else {
if(qx == 1) {
return(invisible(0))
} else {
Recall()
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/vpc.npc.menu.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 28/11/2005
#' Histogram of weighted residuals (WRES), for Xpose 4
#'
#' This is a histogram of the distribution of weighted residuals (WRES) in the
#' dataset, a specific function in Xpose 4. It is a wrapper encapsulating
#' arguments to the \code{xpose.plot.histogram} function.
#'
#' Displays a histogram of the weighted residuals (WRES).
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{\link{xpose.plot.histogram}}.
#' @return Returns a histogram of weighted residuals (WRES).
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.histogram}},
#' \code{\link{xpose.panel.histogram}}, \code{\link[lattice]{histogram}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.dist.hist(xpdb)
#'
#'
#' @export
#' @family specific functions
"wres.dist.hist" <-
function(object,
...) {
if(is.null(xvardef("wres",object))) {
cat("WRES is not set in the database!\n")
return()
}
xplot <- xpose.plot.histogram(xvardef("wres",object),
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.dist.hist.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 28/11/2005
#' Quantile-quantile plot of weighted residuals (WRES), for Xpose 4
#'
#' This is a QQ plot of the distribution of weighted residuals (WRES) in the
#' dataset, a specific function in Xpose 4. It is a wrapper encapsulating
#' arguments to the \code{xpose.plot.qq} function.
#'
#' Displays a QQ plot of the weighted residuals (WRES).
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{link{xpose.plot.qq}}.
#' @return Returns a QQ plot of weighted residuals (WRES).
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.qq}}, \code{\link{xpose.panel.qq}},
#' \code{\link[lattice]{qqmath}}, \code{\link{xpose.prefs-class}},
#' \code{\link{compute.cwres}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.dist.qq(xpdb)
#'
#' @export wres.dist.qq
#' @family specific functions
"wres.dist.qq" <-
function(object,
...) {
if(is.null(xvardef("wres",object))) {
cat("WRES is not set in the database!\n")
return()
}
xplot <- xpose.plot.qq(xvardef("wres",object),
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.dist.qq.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Weighted residuals (WRES) plotted against covariates, for Xpose 4
#'
#' This creates a stack of plots of weighted residuals (WRES) plotted against
#' covariates, and is a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} and
#' \code{xpose.plot.histogram} functions. Most of the options take their
#' default values from xpose.data object but may be overridden by supplying
#' them as arguments.
#'
#' Weighted residuals (WRES) are plotted against each covariate present, as
#' specified in \code{object@Prefs@Xvardef$covariates}, creating a stack of
#' plots.
#'
#' A wide array of extra options controlling xyplots and histograms are
#' available. See \code{\link{xpose.plot.default}} and
#' \code{\link{xpose.plot.histogram}} for details.
#'
#' @param object An xpose.data object.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param type 1-character string giving the type of plot desired. The
#' following values are possible, for details, see 'plot': '"p"' for points,
#' '"l"' for lines, '"o"' for over-plotted points and lines, '"b"', '"c"') for
#' (empty if '"c"') points joined by lines, '"s"' and '"S"' for stair steps and
#' '"h"' for histogram-like vertical lines. Finally, '"n"' does not produce
#' any points or lines.
#' @param main The title of the plot. If \code{"Default"} then a default title
#' is plotted. Otherwise the value should be a string like \code{"my title"} or
#' \code{NULL} for no plot title.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}} or
#' \code{link{xpose.plot.histogram}}.
#' @return Returns a stack of xyplots and histograms of CWRES versus
#' covariates.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.plot.histogram}}, \code{\link[lattice]{xyplot}},
#' \code{\link[lattice]{histogram}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## Here we load the example xpose database
#' data(simpraz.xpdb)
#' xpdb <- simpraz.xpdb
#'
#' ## A vanilla plot
#' wres.vs.cov(xpdb)
#'
#' ## Custom colours and symbols, IDs
#' wres.vs.cov(xpdb, cex=0.6, pch=3, col=1, ids=TRUE)
#' }
#'
#' @export wres.vs.cov
"wres.vs.cov" <-
function(object,
#xlb = NULL,
ylb = "WRES",
#onlyfirst=FALSE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
# abline=c(0,1),
smooth=TRUE,
#abllwd=2,
type="p",
#mirror=FALSE,
#seed = NULL,
#prompt = TRUE,
main="Default",
...) {
## check for arguments in function
if(is.null(check.vars(c("covariates","wres"),
object,silent=FALSE))) {
return()
}
## create list for plots
number.of.plots <- 0
for (i in xvardef("covariates", object)) {
number.of.plots <- number.of.plots + 1
}
plotList <- vector("list",number.of.plots)
plot.num <- 0 # initialize plot number
## loop (covs)
for (j in xvardef("covariates", object)) {
xplot <- xpose.plot.default(j,
xvardef("wres",object),
object,
main=NULL,
#xlb = xlb,
ylb = ylb,
#abline=abline,
#abllwd=abllwd,
smooth=smooth,
type=type,
#subset=subset,
pass.plot.list=TRUE,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
default.plot.title <- paste(xlabel(xvardef("wres",object),object),
" vs ",
"Covariates",
sep="")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
...)
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.vs.cov.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Population weighted residuals (WRES) plotted against the independent
#' variable (IDV) for Xpose 4
#'
#' This is a plot of population weighted residuals (WRES) vs the independent
#' variable (IDV), a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} function. Most of
#' the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' Weighted residuals (WRES) are plotted against the independent variable, as
#' specified in \code{object@Prefs@Xvardef$idv}.
#'
#' A wide array of extra options controlling xyplots are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param abline Vector of arguments to the \code{\link[lattice]{panel.abline}}
#' function. No abline is drawn if \code{NULL}.
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns an xyplot of WRES vs IDV.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}},
#' \code{\link{xpose.panel.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @examples
#'
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.vs.idv(xpdb)
#'
#' ## A conditioning plot
#' wres.vs.idv(xpdb, by="HCTZ")
#'
#' @export wres.vs.idv
#' @family specific functions
"wres.vs.idv" <-
function(object,
abline=c(0,0),
smooth=TRUE,
...) {
if(is.null(check.vars(c("idv","wres"),
object,silent=FALSE))) {
return()
}
xplot <- xpose.plot.default(xvardef("idv",object),
xvardef("wres",object),
smooth = smooth,
abline=abline,
object,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.vs.idv.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 20/10/2005
#' Box-and-whisker plot of weighted residuals vs the independent variable for
#' Xpose 4
#'
#' This creates a box and whisker plot of weighted residuals (WRES) vs the
#' independent variable (IDV), and is a specific function in Xpose 4. It is a
#' wrapper encapsulating arguments to the \code{xpose.plot.bw} function. Most
#' of the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' This creates a box and whisker plot of weighted residuals (WRES) vs the
#' independent variable (IDV), and is a specific function in Xpose 4. It is a
#' wrapper encapsulating arguments to the \code{xpose.plot.bw} function. Most
#' of the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' A wide array of extra options controlling bwplots are available. See
#' \code{\link{xpose.plot.bw}} and \code{\link{xpose.panel.bw}} for details.
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{link{xpose.plot.bw}}.
#' @return Returns a stack of box-and-whisker plots of WRES vs IDV.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.bw}}, \code{\link{xpose.panel.bw}},
#' \code{\link[lattice]{bwplot}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.vs.idv.bw(xpdb)
#'
#' @export wres.vs.idv.bw
#' @family specific functions
"wres.vs.idv.bw" <-
function(object,
#main = NULL,
#xlb = NULL,
#ylb = NULL,
#onlyfirst=FALSE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
#mirror=FALSE,
#seed = NULL,
#bins = 10,
#samp = NULL,
...) {
## check for arguments in function
if(is.null(check.vars(c("wres","idv"),
object,silent=FALSE))) {
return()
}
xplot <- xpose.plot.bw(xvardef("wres",object),
xvardef("idv",object),
#xlb = xlb,
#ylb = ylb,
#scales=list(cex=0.5,tck=0.5),
#aspect="fill",
object,#main=list(main,cex=0.7),
#main = main,
#bins=bins,
#ids=FALSE,
binvar = xvardef("idv",object),
#xvar = xvardef("wres",object),
#subset=subset,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.vs.idv.bw.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Population weighted residuals (WRES) plotted against population predictions
#' (PRED) for Xpose 4
#'
#' This is a plot of population weighted residuals (WRES) vs population
#' predictions (PRED), a specific function in Xpose 4. It is a wrapper
#' encapsulating arguments to the \code{xpose.plot.default} function. Most of
#' the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' A wide array of extra options controlling xyplots are available. See
#' \code{\link{xpose.plot.default}} and \code{\link{xpose.panel.default}} for
#' details.
#'
#' @param object An xpose.data object.
#' @param smooth Logical value indicating whether an x-y smooth should be
#' superimposed. The default is TRUE.
#' @param abline Vector of arguments to the \code{\link[lattice]{panel.abline}}
#' function. No abline is drawn if \code{NULL}.
#' @param \dots Other arguments passed to \code{link{xpose.plot.default}}.
#' @return Returns an xyplot of WRES vs PRED.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link{xpose.prefs-class}}, \code{\link{compute.cwres}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.vs.pred(xpdb)
#'
#' ## A conditioning plot
#' wres.vs.pred(xpdb, by="HCTZ")
#'
#' @export wres.vs.pred
#' @family specific functions
"wres.vs.pred" <-
function(object,
smooth = TRUE,
abline=c(0,0),
...) {
if(is.null(check.vars(c("pred","wres"),
object,silent=FALSE))) {
return()
}
xplot <- xpose.plot.default(xvardef("pred",object),
xvardef("wres",object),
object,
smooth = smooth,
abline=abline,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.vs.pred.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 20/10/2005
#' Box-and-whisker plot of weighted residuals vs population predictions for
#' Xpose 4
#'
#' This creates a box and whisker plot of weighted residuals (WRES) vs
#' population predictions (PRED), and is a specific function in Xpose 4. It is
#' a wrapper encapsulating arguments to the \code{xpose.plot.bw} function. Most
#' of the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' This creates a box and whisker plot of weighted residuals (WRES) vs
#' population predictions (PRED), and is a specific function in Xpose 4. It is
#' a wrapper encapsulating arguments to the \code{xpose.plot.bw} function. Most
#' of the options take their default values from xpose.data object but may be
#' overridden by supplying them as arguments.
#'
#' A wide array of extra options controlling bwplots are available. See
#' \code{\link{xpose.plot.bw}} and \code{\link{xpose.panel.bw}} for details.
#'
#' @param object An xpose.data object.
#' @param \dots Other arguments passed to \code{link{xpose.plot.bw}}.
#' @return Returns a box-and-whisker plot of WRES vs PRED.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.bw}}, \code{\link{xpose.panel.bw}},
#' \code{\link[lattice]{bwplot}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#' ## Here we load the example xpose database
#' xpdb <- simpraz.xpdb
#'
#' wres.vs.pred.bw(xpdb)
#'
#'
#' @export wres.vs.pred.bw
#' @family specific functions
"wres.vs.pred.bw" <-
function(object,
#main = NULL,
#xlb = NULL,
#ylb = NULL,
#onlyfirst=FALSE,
#inclZeroWRES=FALSE,
#subset=xsubset(object),
#mirror=FALSE,
#seed = NULL,
#bins = 10,
#samp = NULL,
...) {
## check for arguments in function
if(is.null(check.vars(c("wres","pred"),
object,silent=FALSE))) {
return()
}
xplot <- xpose.plot.bw(xvardef("wres",object),
xvardef("pred",object),
#xlb = xlb,
#ylb = ylb,
#scales=list(cex=0.5,tck=0.5),
#aspect="fill",
object,#main=list(main,cex=0.7),
#main = main,
#bins=bins,
#ids=FALSE,
binvar = xvardef("idv",object),
#xvar = xvardef("wres",object),
#subset=subset,
...)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/wres.vs.pred.bw.R |
#' Extract and set labels for Xpose data items.
#'
#' This function extracts and sets label definitions in Xpose data objects.
#'
#' \code{x} should be a string exactly matching the name of a column in the
#' data.frame in the Data slot of an xpose.data object. The name of columns
#' defined through xpose variable definitions (see \code{\link{xpose.data}})
#' can be extracted using the \code{xvardef} function and to be used in the
#' \code{xlabel} function, e.g. \code{xlabel(xvardef("dv",object),object)},
#' which would give the label for the \code{dv} variable.
#'
#' @param x Name of the variable to assign a label to.
#' @param object An \code{xpose.data} object.
#' @param value A two element vector of which the first element is the name of
#' the variable and the second the label
#' @return The label of the specified column.
#' @author Niclas Jonsson
#' @seealso \code{\link{xpose.prefs-class}}, \code{\link{xvardef}}
#' @keywords methods
#' @examples
#'
#' xpdb <- simpraz.xpdb
#'
#' ## Display label for dependent variable in the Xpose data object
#' xlabel("DV", xpdb)
#'
#' ## Set label for dependent variable
#' xlabel(xpdb) <- c("DV", "Concentration (mg/L)")
#' xlabel("DV", xpdb) # how has this chnaged?
#' @export
#' @family data functions
xlabel <- function(x,object) {
if(length(x)==1) {
return(object@Prefs@Labels[[x]])
} else {
return(unlist(object@Prefs@Labels[x]))
}
}
#' @describeIn xlabel sets label definitions in Xpose data objects. assigned value should be a two-element vector
#' of which the first element is the name of
#' the variable and the second the label
#' @export
"xlabel<-" <- function(object,value) {
## value is a two element vector of which the first element is the
## name of the variable and the second the label
object@Prefs@Labels[value[1]] <- value[2]
return(object)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xlabel.R |
#' GAM functions for Xpose 4
#'
#' These are functions for summarizing and plotting the results of
#' the generalized additive model within Xpose
#'
#' @family GAM functions
#'
#' @param object An xpose.data object.
#' @param title A text string indicating plot title. If \code{NULL}, left
#' blank.
#' @param xlb A text string indicating x-axis legend. If \code{NULL}, left
#' blank.
#' @param ylb A text string indicating y-axis legend. If \code{NULL}, left
#' blank.
#' @param gam.object A GAM object (see \code{\link[gam]{gam}}.
#' @param plot.ids Logical, specifies whether or not ID numbers should be
#' displayed.
#' @param idscex ID label size.
#' @param ptscex Point size.
#' @param recur If dispersion should be used in the GAM object.
#' @param prompt Specifies whether or not the user should be prompted to press
#' RETURN between plot pages. Default is TRUE.
#' @param gamobj A GAM object to use in the plot. IF null then the user is
#' asked to choose from a list of GAM objects in memory.
#' @param \dots Other arguments passed to the GAM functions.
#' @return Plots or summaries.
#' @author Niclas Jonsson & Andrew Hooker
#' @seealso \code{\link[gam]{gam}}, \code{\link[lattice]{dotplot}}
#' @name GAM_summary_and_plot
NULL
#' @describeIn GAM_summary_and_plot An Akaike plot of the results.
#' @export
xp.akaike.plot <-
function(gamobj=NULL,
title = "Default",
xlb = "Akaike value",
ylb="Models",
...) {
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
##eval(parse(text=paste("current.gam","$steppit",sep="")))
##if(is.null(current.gam$steppit)) {
if(is.null(eval(parse(text=paste("current.gam","$steppit",sep=""))))) {
cat("This plot is not applicable without stepwise covariate selection.\n")
return()
}
keep <- eval(parse(text=paste("current.gam","$keep",sep=""))) #current.gam$keep
aic <- apply(keep, 2, function(x)
return(x$AIC))
df.resid <- apply(keep, 2, function(x)
return(x$df.resid))
term <- apply(keep, 2, function(x)
return(x$term))
pdata <- data.frame(aic, df.resid, term)
aic.ord <- order(pdata$aic)
pdata <- pdata[aic.ord, ]
##
## Select the 30 models with lowest AIC
##
if(dim(pdata)[1] > 30){
pdata1 <- pdata[1:30, ]
pdata2 <- pdata[1:30, ]
} else {
pdata1 <- pdata
pdata2 <- pdata
}
pdata1$term <- unclass(pdata1$term)
pdata1$term <- reorder(as.factor(pdata1$term), pdata1$aic)
names(pdata1$term) <- pdata2$term
if(!is.null(title) && title == "Default") {
title <- paste("AIC values from stepwise GAM search on ",
eval(parse(text=paste("current.gam","$pars",sep=""))),
#current.gam$pars,
" (Run ",
eval(parse(text=paste("current.gam","$runno",sep=""))),
#current.gam$runno,
")",sep="")
}
xplot <- dotplot(term~aic,
pdata1,
main=title,
xlab=xlb,
ylab=ylb,
scales=list(cex=0.7,
tck=-0.01,
y=list(labels=pdata2$term,cex=0.6 )
),
...
)
#print(xplot)
return(xplot)
#invisible()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.akaike.plot.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
"xp.check.scope" <-
function(object,
covnam=xvardef("covariates", object),
nmods=object@[email protected]$nmods,
smoother1=object@[email protected]$smoother1,
smoother2=object@[email protected]$smoother2,
smoother3=object@[email protected]$smoother3,
smoother4=object@[email protected]$smoother4,
arg1=object@[email protected]$arg1,
arg2=object@[email protected]$arg2,
arg3=object@[email protected]$arg3,
arg4=object@[email protected]$arg4,
excl1=object@[email protected]$excl1,
excl2=object@[email protected]$excl2,
excl3=object@[email protected]$excl3,
excl4=object@[email protected]$excl4,
extra=object@[email protected]$extra,
...)
{
scp <- xp.scope3(object,
covnam=covnam,
nmods=nmods,
smoother1=smoother1,
smoother2=smoother2,
smoother3=smoother3,
smoother4=smoother4,
arg1=arg1,
arg2=arg2,
arg3=arg3,
arg4=arg4,
excl1=excl1,
excl2=excl2,
excl3=excl3,
excl4=excl4,
extra=extra)
return(scp)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.check.scope.R |
#' @describeIn GAM_summary_and_plot Individual parameters to GAM fit.
#' @export
xp.cook <- function(gam.object)
{
##assign(pos = 1, "data", gam.object$data)
fit.s <- summary.glm(gam.object)
fit.infl <- lm.influence(gam.object)
R <- gam.object$R
I <- t(R) %*% R
Iinv <- fit.s$cov.unscaled
ass <- gam.object$assign
names(ass) <- names(gam.object$coefficients)
D <- matrix(0, length(gam.object$residuals), length(ass))
dimnames(D) <- list(names(gam.object$residuals), names(gam.object$coefficients))
Dcoef <- scale(fit.infl$coefficients, center = gam.object$coefficients, scale= F)
for(subname in names(ass)) {
sub <- ass[[subname]]
Dcoefi <- Dcoef[, sub, drop = F] %*% t(R[, sub, drop = F])
denom <- I[sub, sub, drop = F] %*% Iinv[sub, sub, drop = F]
denom <- sum(diag(denom)) * fit.s$dispersion
D[, subname] <- apply(Dcoefi^2, 1, sum)/denom
}
##remove("data",fr=0)
D
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.cook.R |
xp.gam <-
function(object,
parnam=xvardef("parms", object),
covnams = xvardef("covariates", object),
wts.col=NULL,
ask.for.input=TRUE,
overwrite=TRUE, # should be false for classic
...){
## begin function definition
ask.for.par <- function(...){
cat("\nEnter name of parameter to use for this GAM search (0 to exit):")
ans <- readline()
if(ans == 0) return(NULL)
if(length(ans) > 1) {
cat("\nYou have specified more than one parameter.\n")
cat("The GAM can be run on only one parameter at a time.\n")
ans <- Recall(...)
} else {
ans.exists <- check.vars(ans,object)
#cat("The name you typed doesn't match any of\n")
#cat("the names in the current database\n")
if(is.null(ans.exists)) ans <- Recall(...)
}
return(ans)
}
get.par <- function(nams, get.input=FALSE,...){
ans <- NULL
if(length(nams)==0) {
cat("\nNo parameter is defined for this GAM search\n")
if(get.input){
ans <- ask.for.par()
} else {
cat("\nType '?xp.gam' for more information.\n")
}
}
if(length(nams)>1) {
cat("\nThere is more than one parameter defined\n")
cat("for this GAM search. The parameters defined are:\n\n")
cat(nams, fill = 60)
cat("\nThe GAM can be run on only one parameter at a time.\n")
if(get.input) {
ans <- ask.for.par()
} else {
cat("\nType '?xp.gam' for more information.\n")
}
}
if(length(nams)==1) {
ans <- nams
}
return(ans)
}
ask.for.wts <- function(...){
cat("\nWeight column to use (0 to exit, NULL for no weight):")
ans <- readline()
if(ans == "NULL") return("NULL")
if(ans == 0) return(NULL)
if(length(ans) > 1) {
cat("\nYou have specified more than one weight.\n")
cat("Only one weight is allowed.\n")
ans <- Recall(...)
} else {
if(is.na(pmatch(ans,names([email protected])))){
cat(paste("\n","-----------Variable(s) not defined!-------------\n",
ans, "is not defined in the current database\n",
"and must be defined for this command to work!\n",
"------------------------------------------------\n"))
ans <- Recall(...)
}
return(ans)
}
}
get.wts <- function(nams, get.input=FALSE,...){
ans <- NULL
if(length(nams)==0) {
cat("\nNo weights are defined for this GAM search\n")
if(get.input){
ans <- ask.for.wts()
} else {
cat("\nType '?xp.gam' and '?xpose.gam' for more information.\n")
}
}
if(length(nams)>1) {
cat("\nPlease specify a the weights for the parameter.\n")
cat("The weights come from columns in the data contained\n")
cat("in the Data.firstonly section of the xpose data object.\n")
cat("These values usualy come from the .phi file of a NONMEM run.\n")
cat("Possible weight values (column names) are:\n\n")
cat(nams, fill = 60)
cat("\nOnly one weight can be specified.\n")
if(get.input) {
ans <- ask.for.wts()
} else {
cat("\nType '?xp.gam' and '?xpose.gam' for more information.\n")
}
}
if(length(nams)==1) {
ans <- nams
}
return(ans)
}
## end function definition
pars <- get.par(parnam,get.input=ask.for.input,...)
if(is.null(pars)) {
return(invisible())
}
## check for weighting
if(object@[email protected]$wts & ask.for.input){
wts <- get.wts(names([email protected]),get.input=ask.for.input,...)
if(is.null(wts)) {
return(invisible())
}
if(wts=="NULL") wts <- NULL
wts.col <- wts
}
##
## Check if we have an existing GAM objects
##
if(exists(paste("gam.xpose.", pars, ".",
object@Runno, sep = ""),
where = 1)
& !overwrite) {
if(ask.for.input){
cat("\nThere is already a gam object associated with the current\n")
cat("run number and parameter. It will be overwritten if you proceed.\n")
cat("Proceed? n(y): ")
ans <- readline()
cat("\n")
if(ans != "y") return()
} else {
cat("\nThere is already a gam object associated with the current\n")
cat("run number and parameter. It will NOT be overwritten.\n")
return()
}
}
##
## Run the GAM
##
gamobj1 <- xpose.gam(object,parnam=pars,covnams=covnams,wts.col=wts.col,...)
## add things to gam object
gamobj1$pars <- pars
gamobj1$runno <- object@Runno
##
## Save the gam object
##
c1 <- call("assign",pos = 1, paste("gam.xpose.", pars, ".", object@Runno,
sep= ""), gamobj1, immediate = T)
eval(c1)
if(exists("current.gam",where=1)){
remove(pos=1,"current.gam")
}
c2 <- call("assign",pos = 1, "current.gam", gamobj1,immediate=T)
eval(c2)
##
## Return
##
return(invisible(gamobj1))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.gam.R |
#' Default function for calculating dispersion in \code{\link{xpose.gam}}.
#'
#' @inheritParams xpose.gam
#' @param gamdata the data used for a GAM
#'
#' @return a list including the dispersion
#' @export
#' @family GAM functions
#' @importFrom splines ns
#'
xp.get.disp <-function(gamdata,
parnam,
covnams,
family="gaussian",
...)
{
##
## Run the null gam
##
form <- as.formula(paste(parnam,"~1"))
gam.null <- gam(form,data=gamdata)
## check that categorical covariates have more than one factor
for(cov in covnams){
if(is.factor(gamdata[, cov]) && nlevels(gamdata[,cov])==1){
covnams=covnams[covnams!=cov]
}
}
sel=rep(FALSE,times=length(covnams))
names(sel)=covnams
sel2=rep(FALSE,times=length(covnams))
names(sel2)=covnams
for(i in covnams) {
##
## Run the gam with the covariate entering linearly
##
form <- as.formula(paste(parnam,"~",i))
gam1 <- gam(form,data=gamdata)
##
## If we are dealing with a continous covariate
## run the gam on the non-linear function as well
## and comapre it to the linear fit
if(!is.factor(gamdata[, i])) {
form <- as.formula(paste(parnam," ~ ns(",i,", df=2)"))
gam2 <- gam(form,data=gamdata)
p <- anova(gam1, gam2, test = "F")$Pr[2]
##
## If the non-linear was the better one, compare it to the null
## gam else compare the ninear to the null gam
##
if(p < 0.05) {
p <- anova(gam.null, gam2, test = "F")$Pr[2]
if(p < 0.05){
sel2[i] <- T
}
} else {
p <- anova(gam.null, gam1, test = "F")$Pr[2]
if(p < 0.05){
sel[i] <- T
}
}
##
## If we are delaing with a factor, comapre it to the null gam
##
} else {
p <- anova(gam.null, gam1, test = "F")$Pr[2]
if(p < 0.05){
sel[i] <- T
}
}
}
##
## Assemble the formula to use in the dispersion getting gam
##
form <- NULL
if(any(sel)) {
form <- paste(names(sel)[sel], collapse = "+")
}
if(any(sel2)) {
ncov <- names(sel2)[sel2]
for(i in 1:length(ncov))
ncov[i] <- paste("ns(",ncov[i],",df=2)",sep="")
if(!any(is.null(form)))
form <- paste(form,"+",paste(ncov,collapse="+"))
else
form <- paste(ncov,collapse="+")
}
if(is.null(form))
gamform <- as.formula(paste(parnam,"~ 1"))
else
gamform <- as.formula(paste(parnam,"~",form))
##
## Run the dispersion getting GAM
##
if(family == "gaussian") {
gam3 <- gam(gamform,data=gamdata)
} else {
gam3 <- gam(gamform,data=gamdata,family=quasi(link=identity,variance="mu^2"))
}
disp <- summary(gam3)$dispersion
ret.list <- list(covs = form,
formula = gamform,
dispersion = disp)
return(ret.list)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.get.disp.R |
#' @describeIn GAM_summary_and_plot Individual influence on GAM fit.
#' @export
"xp.ind.inf.fit" <-
function(gamobj=NULL,
plot.ids=TRUE,
idscex=0.7,
ptscex=0.7,
title = "Default",
recur = FALSE,
xlb = NULL,
ylb = NULL,
...){
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
sd <- sqrt(eval(parse(text=paste("current.gam","$deviance",sep="")))/eval(parse(text=paste("current.gam","$df.residual",sep=""))))
#sd <- sqrt(current.gam$deviance/current.gam$df.residual)
#pear <- residuals(current.gam,type="pearson")/sd
#h <- lm.influence(current.gam)$hat
#p <- current.gam$rank
pear <- residuals(eval(parse(text="current.gam")),type="pearson")/sd
h <- lm.influence(eval(parse(text="current.gam")))$hat
p <- eval(parse(text=paste("current.gam","$rank",sep="")))
rp <- pear/sqrt(1-h)
#for (i in 1:length(rp)){
# if(is.na(rp[i])){
# rp[i] <- pear[i]
# }
#}
cook <- (h*rp^2)/((1-h)*p)
#for (i in 1:length(cook)){
# if(is.na(cook[i])){
# cook[i] <- h[i]*rp[i]^2
# }
#}
#n <- p + current.gam$df.residual
n <- p + eval(parse(text=paste("current.gam","$df.residual",sep="")))
cooky <- 8/(n-2*p)
## hy <- (2*p)/(n-2*p)
hy <- (2*p)/n
leve <- h/(1-h)
#for (i in 1:length(leve)){
# if(!is.finite(leve[i])){
# leve[i] <- h[i]
# }
#}
if(is.null(xlb))
xlb <- "Leverage (h/(1-h))"
if(is.null(ylb))
ylb <- "Cooks distance"
if(!is.null(title) && title == "Default") {
title <- paste("Individual influence on the GAM fit for ",
eval(parse(text=paste("current.gam","$pars",sep=""))),
" (run ",
#current.gam$runno,
eval(parse(text="current.gam$runno")),
")",sep="")
}
## Get the idlabs
if(any(is.null(eval(parse(text="current.gam$data$ID"))))){
ids <- "n"
} else {
ids <- eval(parse(text="current.gam$data$ID"))
}
## inform about NaN and INF values
for (i in 1:length(cook)){
if(is.na(cook[i])||!is.finite(cook[i])||
is.na(leve[i])||!is.finite(leve[i])){
cat("\nFor ID ",ids[i], ":\n", sep="")
cat(" Cook distance is ", cook[i],"\n",sep="")
cat(" Leverage is ", leve[i],"\n",sep="")
cat(" => the point is not included in the plot\n")
}
}
xplot <- xyplot(cook~leve,
ylab=ylb,
xlab=xlb,
main=title,
aspect="fill",
cooky=cooky,
hy=hy,
scales = list(cex=0.7,tck=-0.01),
ids = eval(parse(text="current.gam$data[,1]")),
panel=
function(x,y,ids,...) {
if(!any(ids == "n")&& plot.ids==TRUE) {
addid(x,y,ids=ids,
idsmode=TRUE,
idsext =0.05,
idscex = idscex,
idsdir = "both")
} else {
panel.xyplot(x,y,cex=ptscex,col="black")
}
}
)
return(xplot)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.ind.inf.fit.R |
#' @describeIn GAM_summary_and_plot Individual influence on GAM terms.
#' @export
"xp.ind.inf.terms" <-
function(gamobj=NULL,
xlb = NULL,
ylb = NULL,
plot.ids=TRUE,
idscex=0.7,
ptscex=0.7,
prompt=TRUE,
...){
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
if(length(names(coefficients(eval(parse(text="current.gam")))))==0){
cat("\nNo covariates found for this parameter\n")
return()
}
## if (length([email protected])==0){
## cat("\nNo covariates found for this parameter\n")
## return()
## }
##assign(fr=0,"form",current.gam$Start.mod)
##cook <- data.frame(xp.cook(current.gam))
cook <- data.frame(dfbetas(eval(parse(text="current.gam")))^2)
cook <- cook[,-1]
xvals <- seq(length = length(cook[, 1]))
## get range for plots
ylm <- range(cook)
## add 10% to range
ylmm <- diff(ylm)*0.05
ylm[1]= ylm[1]-ylmm
##if (ylm[1]<0) ylm[1]=0
ylm[2]= ylm[2]+ylmm
## Get the idlabs
if(any(is.null(eval(parse(text="current.gam$data$ID"))))){
ids <- "n"
} else {
ids <- eval(parse(text="current.gam$data$ID"))
}
## create enpty list for plots
plotList <- vector("list",length(cook[1,]))
## Loop over the terms
for(i in 1:length(cook[1,])) {
title <- NULL
if(is.null(xlb)){
xlbb <- "Index number (ID)"
} else {
xlbb <- xlb
}
if(is.null(ylb)) {
ylbb <- paste(names(cook)[i])
} else {
ylbb <- ylb
}
xplot <- xyplot(cook[,i]~xvals,
ylab=ylbb,
xlab=xlbb,
ylim=ylm,
main=title,
aspect="fill",#1,
##scales = list(cex=0.7,tck=-0.01),
ids = ids,
panel=
function(x,y,ids,...) {
if(!any(ids == "n")&& plot.ids==TRUE) {
addid(x,y,ids=ids,
idsmode=TRUE,
idsext =0.05,
idscex = idscex,
idsdir = "both")
} else {
panel.xyplot(x,y,cex=ptscex,col="black",...)
}
}
)
plotList[[i]] <- xplot
}
plotTitle <- paste("Inidividual influence (Cooks distance) on each GAM term\n",
"for ",
eval(parse(text="current.gam$pars")),
" (Run ",
eval(parse(text="current.gam$runno")), ")",
sep="")
obj <- xpose.multiple.plot(plotList,plotTitle,prompt,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.ind.inf.terms.R |
#' @describeIn GAM_summary_and_plot Studentized residuals.
#' @export
"xp.ind.stud.res" <-
function(gamobj=NULL,
title = "Default",
recur = FALSE,
xlb = NULL,
ylb = NULL){
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
if(eval(parse(text="current.gam$family$family")) == "gaussian"){
sd <- sqrt(eval(parse(text="current.gam$deviance"))/eval(parse(text="current.gam$df.residual")))
} else {
sd <- 1
}
dev <- residuals(eval(parse(text="current.gam")), type = "deviance")/sd
pear <- residuals(eval(parse(text="current.gam")), type = "pearson")/sd
h <- lm.influence(eval(parse(text="current.gam")))$hat
rp <- pear/sqrt(1 - h)
#for (i in 1:length(rp)){
# if(is.na(rp[i])){
# rp[i] <- pear[i]
# }
#}
sgn <- function(x)
ifelse(x > 0, 1, ifelse(x < 0, -1, 0))
res <- sgn(dev) * sqrt(dev^2 + h * rp^2)
pdata <- data.frame(cbind(eval(parse(text="current.gam$data[,1]")),res))
names(pdata) <- c("ID","studres")
studres.ord <- order(pdata$studres)
pdata <- pdata[studres.ord, ]
pdata$ID <- reorder(as.factor(pdata$ID),pdata$studres)
if(is.null(xlb))
xlb <- "Studentized residual"
if(is.null(ylb))
ylb <- "ID"
if(!is.null(title) && title == "Default") {
title <- paste("Studentized residual of the GAM fit for ", eval(parse(text="current.gam$pars"))," (Run ",
eval(parse(text="current.gam$runno")), ")",sep="")
}
# xplot <- dotchart(pdata$studres,labels=as.character(pdata$ID),
# main = title, xlab = xlb,ylab=ylb,cex=0.6)
xplot <- dotplot(ID~studres,
pdata,
main=title,
xlab=xlb,
ylab=ylb,
scales=list(
tck=-0.01,
y=list(cex=0.6 )
)
)
#print(xplot)
return(xplot)
#invisible()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.ind.stud.res.R |
#' @describeIn GAM_summary_and_plot GAM residuals of base model vs. covariates.
#' @export
"xp.plot" <-
function(gamobj=NULL,
plot.ids=TRUE,
idscex=0.7,
ptscex=0.7,
prompt=TRUE,
##main=NULL,
##object,
##main = NULL,
##xlb = NULL,
##ylb = NULL,
##onlyfirst=TRUE,
##inclZeroWRES=FALSE,
##subset=xsubset(object),
## abline=c(0,1),
##smooth=TRUE,
##abllwd=2,
...) {
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
#current.gam$terms
if(length(attr(eval(parse(text="current.gam$terms")),"factors"))==0){
##if (length(current.gam$terms)==0){
cat("\nNo covariates found for this parameter\n")
return()
}
#assign(pos=1,"gamdata",current.gam$data)
#assign(pos=1,"form",current.gam$form)
final.gam <- gam(eval(parse(text="current.gam$form")),
weights=eval(parse(text="current.gam$weights")),
data=eval(parse(text="current.gam$data")))
#pre.obj <- preplot.gam(final.gam)
## HERE is the problem browser()
pre.obj <- preplot(final.gam)
## Significant terms
trms <- names(pre.obj)
numplots <- length(trms)
## Partial residuals
parts <- predict(eval(parse(text="current.gam")),type="terms") +
residuals(eval(parse(text="current.gam")),type="pearson")
ylm <- range(parts)
## add 10% to range
ylmm <- diff(ylm)*0.05
ylm[1]= ylm[1]-ylmm
ylm[2]= ylm[2]+ylmm
## plot using the gam.plot function
##ylmm <- diff(range(parts))
##plot(final.gam,residuals=TRUE,rugplot=FALSE,scale=ylmm)
## Get the idlabs
if(any(is.null(eval(parse(text="current.gam$data$ID"))))){
ids <- "n"
} else {
ids <- eval(parse(text="current.gam$data$ID"))
}
## create enpty list for plots
plotList <- vector("list",length(trms))
## Loop over the terms
for(i in 1:length(trms)) {
##for testing
##i=3
pres <- parts[,trms[i]]
x <- pre.obj[trms[i]][[1]]$x
y <- pre.obj[trms[i]][[1]]$y
## for testing
##idscex=0.7
##ptscex=0.7
##plot.ids = TRUE
##main=NULL
##main <- paste("GAM results for \n", trms[i], " on ", current.gam$pars, " (Run ",
## current.gam$runno, ")",sep="")
main <- NULL
if(!is.factor(x)) {
xplot <- xyplot(y~x,res=pres,ids=ids,
ylim=ylm,
xlab= list(pre.obj[trms[i]][[1]]$xlab,cex=1),
ylab= list("Residuals",cex=1),
scales=list(cex=1,tck=-0.01),
main=main,
panel =
function(x,y,res,ids,...) {
xord <- order(x)
panel.xyplot(x[xord],y[xord],type="l",...)
if(!any(ids == "n")&& plot.ids==TRUE) {
addid(x,res,ids=ids,
idsmode=TRUE,
idsext =0.05,
idscex = idscex,
idsdir = "both")
} else {
panel.xyplot(x,res,cex=ptscex,col="black")
}
}
)
} else {
xplot <-bwplot(y~x,ylim=ylm,res=pres,ids=ids,
scales=list(cex=1,tck=-0.01),
xlab= list(pre.obj[trms[i]][[1]]$xlab,cex=1),
ylab= list("Residuals",cex=1),
main=main,
panel=
function(x,y,res,ids,...) {
if(!any(ids == "n")&& plot.ids==TRUE) {
addid(jitter(as.numeric(x)),res,ids=ids,
idsmode=TRUE,
idsext =0.05,
idscex = idscex,
idsdir = "both")
panel.bwplot(x,y,...)
} else {
panel.xyplot(jitter(as.numeric(x)),res,cex=ptscex,col="black")
panel.bwplot(x,y,...)
}
}
)
}
plotList[[i]] <- xplot
}
plotTitle <- paste("GAM results for covariates on ", eval(parse(text="current.gam$pars")),
" (Run ",
eval(parse(text="current.gam$runno")), ")",
sep="")
obj <- xpose.multiple.plot(plotList,plotTitle,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.plot.R |
#' Define a scope for the gam. Used as default input to the \code{scope} argument in
#' \code{xpose.gam}
#'
#' @inheritParams xpose.gam
#' @param covnam Covariate names to test.
#'
#' @examples
#'
#' xp.scope3(simpraz.xpdb)
#'
#' @export
#' @family GAM functions
xp.scope3 <-
function(object,
covnam=xvardef("covariates", object),
nmods = 3,
smoother1 = 0,
arg1 = NULL,
smoother2 = 1,
arg2 = NULL,
smoother3 = "ns",
arg3 = "df=2",
smoother4 = "ns",
arg4 = "df=3",
excl1 = NULL,
excl2 = NULL,
excl3 = NULL,
excl4 = NULL,
extra = NULL,
subset=xsubset(object),
...)
{
##Get data
data <- Data(object,subset=subset)
if(any(is.null(data))) return("The subset expression is invalid.")
## parnam <- xvardef("parms", object)
## covnams <- xvardef("covariates", object)
step.list <- as.list(covnam)
names(step.list) <- covnam
if(is.null(extra)) extra <- list() ## Set up the smoother lists
for(cov in covnam) {
## Check that the covariate is not excluded completely
if(!is.na(match(cov, excl1)) && !is.na(match(cov, excl2)) && !
is.na(match(cov, excl3)) && !is.na(match(cov, excl4)))
{
stop("A covariate cannot be excluded from all levels in the GAM scope.\n")
}
## check that categorical covariates have more than one factor
if(is.factor(data[, cov]) && nlevels(data[,cov])==1){
step.list=step.list[names(step.list)!=cov]
} else
{ # create the scope
tmp.scope <- character(0)
for(i in 1:nmods) {
excl <- eval(parse(text = paste("excl", i, sep = "")))
if(!is.na(match(cov, excl)))
next
if(is.factor(data[, cov]) && i == 1) {
tmp.scope <- c(tmp.scope, "1")
next
} else if(is.factor(data[, cov]) && i == 2) {
tmp.scope <- c(tmp.scope, cov)
next
} else if(is.factor(data[, cov]) && i > 2) {
next
}
## Check if we have any specific covariate settings for smoother
if(!is.null(extra[[cov]][[paste("sm", i, sep = "")]]))
{
sm <- extra[[cov]][[paste("sm", i, sep = "")]]
} else {
sm <- eval(parse(text = paste("smoother", i,
sep = "")))
}
if(sm == 0) {
tmp.scope <- c(tmp.scope, "1")
} else if(sm == 1) {
tmp.scope <- c(tmp.scope, cov)
} else {
## Check if we have any specific settings for arg
if(!is.null(extra[[cov]][[paste("arg", i, sep
= "")]])) {
if(extra[[cov]][[paste("arg", i, sep = "")]] ==
"") {
arg <- NULL
} else {
arg <- extra[[cov]][[paste("arg", i, sep =
"")]]
}
} else {
arg <- eval(parse(text = paste("arg", i, sep
= "")))
}
if(is.na(pmatch("I((",sm)))
tmp.scope <- c(tmp.scope, paste(sm, "(", cov,
if(is.null(arg)) ")" else paste(",", arg, ")",
sep = "")))
else
tmp.scope <- c(tmp.scope,sm)
}
}
tmp.scope <- eval(parse(text = paste("~", paste(tmp.scope, collapse = "+"
))))
step.list[[cov]] <- tmp.scope
}
}
step.list
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.scope3.R |
#' @describeIn GAM_summary_and_plot Summarize GAM.
#' @export
"xp.summary" <-
function(gamobj=NULL) {
if(is.null(gamobj)){
gamobj <- check.gamobj()
if(is.null(gamobj)){
return()
} else {
}
} else {
c1 <- call("assign",pos=1, "current.gam", gamobj,immediate=T)
eval(c1)
}
cat("\nSUMMARY")
print(summary(eval(parse(text="current.gam"))))
cat("\nPATH TO FINAL MODEL\n")
print(eval(parse(text="current.gam$anova")))
cat("\nCOEFFICIENTS\n")
print(coefficients(eval(parse(text="current.gam"))))
cat("\nPRERUN RESULTS\n")
cat("Dispersion:",eval(parse(text="current.gam$dispersion")),"\n")
cat("\nDATA\n")
cat("Subset expression:",eval(parse(text="current.gam$subset")),"\n")
cat("Only first value of covariate considered\n")
cat("for each individual:",eval(parse(text="current.gam$onlyfirst")),"\n")
cat("Covariates normalized to median:",eval(parse(text="current.gam$medianNorm")),"\n")
return(invisible())
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xp.summary.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
xpPage <- function(x) {
## Specify plot annotation. Is added to lattice graphs by providing
## the argument page=xpPage .
mylab <- paste("Device:",names(dev.cur()),
" Top function:",sys.calls()[[1]],getwd(),Sys.Date(),sep=" ")
panel.text(x=0.5,y=0.02,lab=mylab,just="left",cex=0.5,col="darkgray")
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpPage.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Visual Predictive Check (VPC) using XPOSE
#'
#' This Function is used to create a VPC in xpose using the output from the
#' \code{vpc} command in Pearl Speaks NONMEM (PsN). The function reads in the
#' output files created by PsN and creates a plot from the data. The dependent
#' variable, independent variable and conditioning variable are automatically
#' determined from the PsN files.
#'
#' @inheritParams xpose.panel.default
#'
#' @param vpc.info The results file from the \code{vpc} command in PsN. for
#' example \file{vpc_results.csv}, or if the file is in a separate directory
#' \file{./vpc_dir1/vpc_results.csv}.
#' @param vpctab The \file{vpctab} from the \code{vpc} command in PsN. For
#' example \file{vpctab5}, or if the file is in a separate directory
#' \file{./vpc_dir1/vpctab5}. Can be \code{NULL}. The default looks in the
#' current working directory and takes the first file that starts with
#' \file{vpctab} that it finds. Note that this default can result in the
#' wrong files being read if there are multiple \file{vpctab} files in the
#' directory. One of \code{object} or \code{vpctab} is required. If both are
#' present then the information from the \code{vpctab} will over-ride the
#' xpose data object \code{object} (i.e. the values from the vpctab will
#' replace any matching values in the \code{object\@Data} portion of the xpose
#' data object).
#' @param object An xpose data object. Created from \code{\link{xpose.data}}.
#' One of \code{object} or \code{vpctab} is required. If both are present
#' then the information from the \code{vpctab} will over-ride the xpose data
#' object \code{object} (i.e. the values from the vpctab will replace any
#' matching values in the \code{object\@Data} portion of the xpose data
#' object).
#' @param ids A logical value indicating whether text ID labels should be used
#' as plotting symbols (the variable used for these symbols indicated by the
#' \code{idlab} xpose data variable). Can be \code{FALSE} or \code{TRUE}.
#' @param type Character string describing the way the points in the plot will
#' be displayed. For more details, see \code{\link[graphics]{plot}}. Use
#' \code{type="n"} if you don't want observations in the plot.
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables. For example \code{by = c("SEX","WT")}. Because the
#' function automatically determines the conditioning variable from the PsN
#' input file specified in \code{vpc.info}, the \code{by} command can control
#' if separate plots are created for each condition (\code{by=NULL}), or if a
#' conditioning plot should be created (\code{by="WT"} for example). If the
#' \code{vpc.info} file has a conditioning variable then \code{by} must match
#' that variable. If there is no conditioning variable in \code{vpc.info}
#' then the \code{PI} for each conditioned plot will be the \code{PI} for the
#' entire data set (not only for the conditioning subset).
#' @param PI Either "lines", "area" or "both" specifying whether prediction
#' intervals (as lines, a shaded area or both) should be added to the plot.
#' \code{NULL} means no prediction interval.
#' @param PI.ci Plot the confidence interval for the simulated data's
#' percentiles for each bin (for each simulated data set compute the
#' percentiles for each bin, then, from all of the percentiles from all of the
#' simulated datasets compute the 95\% CI of these percentiles). Values can be
#' \code{"both"}, \code{"area"} or \code{"lines"}. These CIs can be used to
#' asses the \code{PI.real} values for model misspecification. Note that with
#' few observations per bin the CIs will be approximate because the
#' percentiles in each bin will be approximate. For example, the 95th
#' percentile of 4 data points will always be the largest of the 4 data
#' points.
#' @param PI.real Plot the percentiles of the real data in the various bins.
#' values can be NULL or TRUE. Note that for a bin with few actual
#' observations the percentiles will be approximate. For example, the 95th
#' percentile of 4 data points will always be the largest of the 4 data
#' points.
# @param PI.ci.med.arcol The color of the median \code{PI.ci}.
#' @param force.x.continuous Logical value indicating whether x-values should be
#' converted to continuous variables, even if they are defined as factors.
#' @param funy String of function to apply to Y data. For example "abs"
#' @param logy Logical value indicating whether the y-axis should be
#' logarithmic, base 10.
#' @param ylb Label for the y-axis
#' @param subset A string giving the subset expression to be applied to the data
#' before plotting. See \code{\link{xsubset}}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' \code{"Default"} creates a default title.
#' @param main.sub Used for names above each plot when using multiple plots.
#' Should be a vector \code{c("Group 1","Group 2")}
#' @param main.sub.cex The size of the \code{main.sub} titles.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot.
#' @param verbose Should warning messages and other diagnostic information be
#' passed to screen? (TRUE or FALSE)
#' @param \dots Other arguments passed to \code{\link{xpose.panel.default}},
#' \code{\link{xpose.plot.default}} and others. Please see these functions for
#' more descriptions of what you can do.
#' @return A plot or a list of plots.
#' @section Additional arguments:
#'
#' Below are some of the additional arguments that can control the look and
#' feel of the VPC. See
#' \code{\link{xpose.panel.default}} for all potential options.
#'
#' \strong{Additional graphical elements available in the VPC plots.\cr}
#'
#' \describe{
#'
#' \item{ PI.mirror = NULL, TRUE or AN.INTEGER.VALUE}{Plot the percentiles of
#' one simulated data set in each bin. \code{TRUE} takes the first mirror from
#' \file{vpc_results.csv} and \code{AN.INTEGER.VALUE} can be \code{1, 2,
#' \dots{} n} where \code{n} is the number of mirror's output in the
#' \file{vpc_results.csv} file.}
#' \item{ PI.limits = c(0.025, 0.975)}{A vector of two
#' values that describe the limits of the prediction interval that should be
#' displayed. These limits should be found in the \file{vpc_results.csv}
#' file. These limits are also used as the percentages for the \code{PI.real,
#' PI.mirror} and \code{PI.ci}. However, the confidence interval in
#' \code{PI.ci} is always the one defined in the \file{vpc_results.csv} file.}
#' }
#'
#' \strong{Additional options to control the look and feel of the \code{PI}.
#' See See \code{\link[grid]{grid.polygon}} and \code{\link[graphics]{plot}}
#' for more details.\cr}
#'
#' \describe{ \item{ PI.arcol}{The color of the \code{PI} area} \item{
#' PI.up.lty}{The upper line type. can be "dotted" or "dashed", etc.} \item{
#' PI.up.type}{The upper type used for plotting. Defaults to a line.} \item{
#' PI.up.col}{The upper line color} \item{ PI.up.lwd}{The upper line width}
#' \item{ PI.down.lty}{The lower line type. can be "dotted" or "dashed", etc.}
#' \item{ PI.down.type}{The lower type used for plotting. Defaults to a line.}
#' \item{ PI.down.col}{The lower line color} \item{ PI.down.lwd}{The lower
#' line width} \item{ PI.med.lty}{The median line type. can be "dotted" or
#' "dashed", etc.} \item{ PI.med.type}{The median type used for plotting.
#' Defaults to a line.} \item{ PI.med.col}{The median line color} \item{
#' PI.med.lwd}{The median line width} }
#'
#' \strong{Additional options to control the look and feel of the
#' \code{PI.ci}. See See \code{\link[grid]{grid.polygon}} and
#' \code{\link[graphics]{plot}} for more details.\cr}
#'
#' \describe{ \item{ PI.ci.up.arcol}{The color of the upper \code{PI.ci}.}
#' \item{ PI.ci.med.arcol}{The color of the median \code{PI.ci}.} \item{
#' PI.ci.down.arcol}{The color of the lower \code{PI.ci}.} \item{
#' PI.ci.up.lty}{The upper line type. can be "dotted" or "dashed", etc.}
#' \item{ PI.ci.up.type}{The upper type used for plotting. Defaults to a
#' line.} \item{ PI.ci.up.col}{The upper line color} \item{ PI.ci.up.lwd}{The
#' upper line width} \item{ PI.ci.down.lty}{The lower line type. can be
#' "dotted" or "dashed", etc.} \item{ PI.ci.down.type}{The lower type used for
#' plotting. Defaults to a line.} \item{ PI.ci.down.col}{The lower line
#' color} \item{ PI.ci.down.lwd}{The lower line width} \item{
#' PI.ci.med.lty}{The median line type. can be "dotted" or "dashed", etc.}
#' \item{ PI.ci.med.type}{The median type used for plotting. Defaults to a
#' line.} \item{ PI.ci.med.col}{The median line color} \item{
#' PI.ci.med.lwd}{The median line width} \item{PI.ci.area.smooth}{Should the
#' "area" for \code{PI.ci} be smoothed to match the "lines" argument? Allowed
#' values are \code{TRUE/FALSE}. The "area" is set by default to show the bins
#' used in the \code{PI.ci} computation. By smoothing, information is lost
#' and, in general, the confidence intervals will be smaller than they are in
#' reality.} }
#'
#' \strong{Additional options to control the look and feel of the
#' \code{PI.real}. See See \code{\link[grid]{grid.polygon}} and
#' \code{\link[graphics]{plot}} for more details.\cr}
#'
#' \describe{ \item{ PI.real.up.lty}{The upper line type. can be "dotted" or
#' "dashed", etc.} \item{ PI.real.up.type}{The upper type used for plotting.
#' Defaults to a line.} \item{ PI.real.up.col}{The upper line color} \item{
#' PI.real.up.lwd}{The upper line width} \item{ PI.real.down.lty}{The lower
#' line type. can be "dotted" or "dashed", etc.} \item{ PI.real.down.type}{The
#' lower type used for plotting. Defaults to a line.} \item{
#' PI.real.down.col}{The lower line color} \item{ PI.real.down.lwd}{The lower
#' line width} \item{ PI.real.med.lty}{The median line type. can be "dotted"
#' or "dashed", etc.} \item{ PI.real.med.type}{The median type used for
#' plotting. Defaults to a line.} \item{ PI.real.med.col}{The median line
#' color} \item{ PI.real.med.lwd}{The median line width} }
#'
#' \strong{Additional options to control the look and feel of the
#' \code{PI.mirror}. See See \code{\link[graphics]{plot}} for more
#' details.\cr}
#'
#' \describe{ \item{PI.mirror.up.lty}{The upper line type. can be "dotted" or
#' "dashed", etc.} \item{ PI.mirror.up.type}{The upper type used for plotting.
#' Defaults to a line.} \item{ PI.mirror.up.col}{The upper line color} \item{
#' PI.mirror.up.lwd}{The upper line width} \item{ PI.mirror.down.lty}{The
#' lower line type. can be "dotted" or "dashed", etc.} \item{
#' PI.mirror.down.type}{The lower type used for plotting. Defaults to a
#' line.} \item{ PI.mirror.down.col}{The lower line color} \item{
#' PI.mirror.down.lwd}{The lower line width} \item{ PI.mirror.med.lty}{The
#' median line type. can be "dotted" or "dashed", etc.} \item{
#' PI.mirror.med.type}{The median type used for plotting. Defaults to a
#' line.} \item{ PI.mirror.med.col}{The median line color} \item{
#' PI.mirror.med.lwd}{The median line width} }
#' @author Andrew Hooker
#' @seealso \code{\link{read.vpctab}} \code{\link{read.npc.vpc.results}}
#' \code{\link{xpose.panel.default}} \code{\link{xpose.plot.default}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' library(xpose4)
#'
#' xpose.VPC()
#'
#' ## to be more clear about which files should be read in
#' vpc.file <- "vpc_results.csv"
#' vpctab <- "vpctab5"
#' xpose.VPC(vpc.info=vpc.file,vpctab=vpctab)
#'
#' ## with lines and a shaded area for the prediction intervals
#' xpose.VPC(vpc.file,vpctab=vpctab,PI="both")
#'
#' ## with the percentages of the real data
#' xpose.VPC(vpc.file,vpctab=vpctab,PI.real=T)
#'
#' ## with mirrors (if supplied in 'vpc.file')
#' xpose.VPC(vpc.file,vpctab=vpctab,PI.real=T,PI.mirror=5)
#'
#' ## with CIs
#' xpose.VPC(vpc.file,vpctab=vpctab,PI.real=T,PI.ci="area")
#' xpose.VPC(vpc.file,vpctab=vpctab,PI.real=T,PI.ci="area",PI=NULL)
#'
#' ## stratification (if 'vpc.file' is stratified)
#' cond.var <- "WT"
#' xpose.VPC(vpc.file,vpctab=vpctab)
#' xpose.VPC(vpc.file,vpctab=vpctab,by=cond.var)
#' xpose.VPC(vpctab=vpctab,vpc.info=vpc.file,PI="both",by=cond.var,type="n")
#'
#' ## with no data points in the plot
#' xpose.VPC(vpc.file,vpctab=vpctab,by=cond.var,PI.real=T,PI.ci="area",PI=NULL,type="n")
#'
#' ## with different DV and IDV, just read in new files and plot
#' vpc.file <- "vpc_results.csv"
#' vpctab <- "vpctab5"
#' cond.var <- "WT"
#' xpose.VPC(vpctab=vpctab,vpc.info=vpc.file,PI="both",by=cond.var)
#' xpose.VPC(vpctab=vpctab,vpc.info=vpc.file,PI="both")
#'
#' ## to use an xpose data object instead of vpctab
#' ##
#' ## In this example
#' ## we expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' runnumber <- 5
#' xpdb <- xpose.data(runnumber)
#' xpose.VPC(vpc.file,object=xpdb)
#'
#' ## to read files in a directory different than the current working directory
#' vpc.file <- "./vpc_strat_WT_4_mirror_5/vpc_results.csv"
#' vpctab <- "./vpc_strat_WT_4_mirror_5/vpctab5"
#' xpose.VPC(vpc.info=vpc.file,vpctab=vpctab)
#'
#' ## to rearrange order of factors in VPC plot
#' xpdb@Data$SEX <- factor(xpdb@Data$SEX,levels=c("2","1"))
#' xpose.VPC(by="SEX",object=xpdb)
#'
#' }
#'
#'
#' @export xpose.VPC
#' @family PsN functions
#' @family specific functions
xpose.VPC <-
function(vpc.info="vpc_results.csv", #name of PSN file to use
vpctab = dir(pattern="^vpctab")[1],
object = NULL,
ids=FALSE,
type="p",
by=NULL,
PI=NULL,#"area",
PI.ci="area",
PI.ci.area.smooth = FALSE,
PI.real=TRUE,
#PI.ci.med.arcol="red",
subset=NULL,
main="Default",
main.sub=NULL, # used for names above each plot when using multiple plots
#Should be a vector c("","")
main.sub.cex=0.85, # size of main.sub
inclZeroWRES=FALSE,
force.x.continuous=FALSE,
#strip="Default",
#dont.plot=F,
funy=NULL,
logy=FALSE,
ylb = "Default",
verbose=FALSE,
PI.x.median = TRUE,
PI.rug = "Default",
PI.identify.outliers = TRUE,
...) {
## for testing
##vpctab="./vpc_strat_WT_4_mirror_5/vpctab5"
##vpctab="./vpc_strat_SEX_mirror_5/vpctab5"
##object <- xpdb
##inclZeroWRES <- FALSE
## Make sure we have the necessary variables defined
if(is.null(object) & is.null(vpctab)){
cat(paste("Both the arguments object and vpctab are NULL\n"))
cat(paste("At least one of these must be defined\n"))
return(NULL)
}
if(!is.null(vpctab)){
tmp <- FALSE
if(is.null(object)) tmp <- TRUE
object <- read.vpctab(vpctab=vpctab,
object=object,
inclZeroWRES=inclZeroWRES,
verbose=verbose,
...)
if(tmp==TRUE) inclZeroWRES=TRUE
}
file.info <- read.npc.vpc.results(vpc.results=vpc.info,verbose=verbose,...)
num.tables <- file.info$num.tables
dv.var <- file.info$dv.var
idv.var <- file.info$idv.var
##bin.table <- file.info$result.tables
tmp <- c()
if(is.null(object@Data[[dv.var]])) tmp <- c(tmp,dv.var)
if(is.null(object@Data[[idv.var]])) tmp <- c(tmp,idv.var)
if (!is.null(tmp)){
cat("\n-----------Variable(s) not defined!-------------\n",
tmp, "is/are not defined in the current database\n",
"and must be defined for this command to work!\n",
"------------------------------------------------\n")
return(NULL)
}
if(is.factor(object@Data[[dv.var]])){
change.cat.cont(object) <- c(dv.var)
}
if(force.x.continuous){
if(is.factor(object@Data[[idv.var]])){
change.cat.cont(object) <- c(idv.var)
}
}
## decide on the conditioning
if (is.null(by) && num.tables!=1){
## get conditioning veriable name
# for future use to automatically start conditioning
#for (i in 1:num.tables){
# tmp.strata <- strata.names[i]
# strata.loc <- regexpr(strata.start.pat,strata.line)+7
# strata.names <- c(strata.names,substring(strata.line,strata.loc))
#}
## use subsetting to get things working
if(!is.null(subset)){ # this can be fixed below
if(verbose) cat(paste("Overwriting the subset expression to handle multiple STRATA\n"))
}
plotList <- vector("list",num.tables)
plot.num <- 0 # initialize plot number
## this can be updated as in npc.coverage.R
for (i in 1:num.tables){
##subset <- file.info$result.tables[[num.tables+1]][i] # this can be fixed to aviod overwriting subsets
subset <- file.info$strata.names[i] # this can be fixed to aviod overwriting subsets
final.bin.table <- file.info$result.tables[[i]]
if(!is.null(main.sub)){
sub.main=main.sub[i]
} else {
sub.main=subset
}
if(!is.character(ylb)){
} else if(ylb != "Default"){
} else {
tmp.label <- xpose.create.label(dv.var,
object,
funy,
logy,...)
if(file.info$pred.corr && !file.info$var.corr){
tmp.label <- paste(tmp.label,"\n(Pred Corr)")
}
if(file.info$pred.corr && file.info$var.corr){
tmp.label <- paste(tmp.label,"\n(Pred and Var Corr)")
}
ylb=tmp.label
}
## make the VPC
xplot <- xpose.plot.default(idv.var,#xvardef("idv",object),
dv.var,#xvardef("dv",object),
object,
ids=ids,
type=type,
subset=subset,
PI=PI,
PI.ci=PI.ci,
PI.real=PI.real,
#PI.ci.med.arcol=PI.ci.med.arcol,
PI.bin.table=final.bin.table,
pass.plot.list=TRUE,
main=sub.main,
main.cex=main.sub.cex,
inclZeroWRES=inclZeroWRES,
ylb = ylb,
funy=funy,
logy=logy,
PI.ci.area.smooth=PI.ci.area.smooth,
PI.x.median = PI.x.median,
PI.rug = PI.rug,
PI.identify.outliers = PI.identify.outliers,
...)
plot.num <- plot.num+1
plotList[[plot.num]] <- xplot
}
default.plot.title <- "Visual Predictive Check\n"
if(file.info$pred.corr && !file.info$var.corr){
default.plot.title <- "Visual Predictive Check\n (Prediction Corrected)\n"
}
if(file.info$pred.corr && file.info$var.corr){
default.plot.title <- "Visual Predictive Check\n (Prediction and Variance Corrected)\n"
}
default.plot.title <- paste(default.plot.title,
xpose.create.title(idv.var,dv.var,object,
no.runno=T,...),sep="")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
#subset=subset,
...)
# if(!dont.plot){
# xpose.multiple.plot.default(plotList,plotTitle=plotTitle,...)
# }
obj <- xpose.multiple.plot(plotList,plotTitle,...)
# return(invisible(plotList))
return(obj)
} else { ## either plot stratification with by or only one strata
## check structure of stratification variable
if(!is.null(by) && num.tables!=1){
if(all(is.null(file.info$by.interval))){
## categorical variable
if(!is.factor(object@Data[[by]])) change.cat.cont(object) <- by
} else {
## continuous variable
if(is.factor(object@Data[[by]])) change.cat.cont(object) <- by
}
}
default.plot.title <- "Visual Predictive Check\n"
if(file.info$pred.corr && !file.info$var.corr){
default.plot.title <- "Visual Predictive Check\n (Prediction Corrected)\n"
}
if(file.info$pred.corr && file.info$var.corr){
default.plot.title <- "Visual Predictive Check\n (Prediction and Variance Corrected)\n"
}
default.plot.title <- paste(default.plot.title,
xpose.create.title(idv.var,dv.var,object,
no.runno=T,subset=subset,...),sep="")
plotTitle <- xpose.multiple.plot.title(object=object,
plot.text = default.plot.title,
main=main,
subset=subset,
...)
if(!is.character(ylb)){
} else if(ylb != "Default"){
} else {
tmp.label <- xpose.create.label(dv.var,
object,
funy,
logy,...)
if(file.info$pred.corr && !file.info$var.corr){
tmp.label <- paste(tmp.label,"\n(Pred Corr)")
}
if(file.info$pred.corr && file.info$var.corr){
tmp.label <- paste(tmp.label,"\n(Pred and Var Corr)")
}
ylb=tmp.label
}
## make the VPC
xplot <- xpose.plot.default(idv.var,#xvardef("idv",object),
dv.var,#xvardef("dv",object),
object,
ids=ids,
type=type,
by=by,
subset=subset,
PI=PI,
PI.ci=PI.ci,
PI.real=PI.real,
#PI.ci.med.arcol=PI.ci.med.arcol,
PI.bin.table=file.info$result.tables,
#force.by.factor=TRUE,
main=plotTitle,
by.interval=file.info$by.interval,
inclZeroWRES=inclZeroWRES,
ylb = ylb,#tmp.label,
funy=funy,
logy=logy,
PI.ci.area.smooth=PI.ci.area.smooth,
PI.x.median = PI.x.median,
PI.rug = PI.rug,
PI.identify.outliers = PI.identify.outliers,
...)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.VPC.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Xpose Visual Predictive Check (VPC) for both continuous and Limit of
#' Quantification data.
#'
#' Xpose Visual Predictive Check (VPC) for both continuous and Below or Above
#' Limit of Quantification (BLQ or ALQ) data.
#'
#'
#' @param vpc.info Name of PSN file to use. File will come from \code{VPC}
#' command in PsN.
#' @param vpctab Name of vpctab file produced from PsN.
#' @param object Xpose data object.
#' @param subset Subset of data to look at.
#' @param main Title for plot.
#' @param main.sub Used for names above each plot when using multiple plots.
#' Should be a vector, e.g. \code{c("title 1","title 2")}.
#' @param inclZeroWRES Include WRES=0 rows in the computations for these plots?
#' @param cont.logy Should the continuous plot y-axis be on the log scale?
#' @param hline Horizontal line marking the limits of quantification. If they
#' are defined, they must be a vector of values.
#' @param add.args.cont Additional arguments to the continuous plot.
#' \code{\link{xpose.VPC}}.
#' @param add.args.cat Additional arguments to the categorical plot.
#' \code{\link{xpose.VPC.categorical}}.
#' @param \dots Additional arguments to both plots.
#' @author Andrew C. Hooker
#' @seealso \code{\link{xpose.VPC}}, \code{\link{xpose.VPC.categorical}}.
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' library(xpose4)
#'
#' ## move to the directory where results from PsN
#' ## are found
#' cur.dir <- getwd()
#' setwd(paste(cur.dir,"/vpc_cont_LLOQ/",sep=""))
#'
#' xpose.VPC()
#' xpose.VPC.categorical(censored=T)
#'
#' xpose.VPC.both()
#'
#' xpose.VPC.both(subset="DV>1.75")
#'
#' xpose.VPC.both(add.args.cont=list(ylim=c(0,80)))
#'
#' xpose.VPC.both(add.args.cont = list(ylim = c(0.01, 80)), xlim = c(0,
#' 40), add.args.cat = list(ylim = c(0, 0.4)), cont.logy = T)
#'
#' xpose.VPC.both(cont.logy=T)
#' }
#'
#' @export xpose.VPC.both
#' @family PsN functions
#' @family specific functions
"xpose.VPC.both" <-
function(vpc.info="vpc_results.csv", #name of PSN file to use
vpctab = dir(pattern="^vpctab")[1],
object = NULL,
#ids=NULL,
#type="p",
#by=NULL,
#PI="area",
subset=NULL,
main="Default",
main.sub=NULL, #used for names above each plot
#when using multiple plots
#Should be a vector c("","")
##main.sub.cex=0.85, # size of main.sub
inclZeroWRES=FALSE,
##plot.cont.table=TRUE,
#plot.cat.table=TRUE,
#force.x.continuous=FALSE,
#real.col=4,
#median.line=FALSE,
#median.col="darkgrey",
#ci.lines=FALSE,
#ci.col="blue",
#ci.lines.col="darkblue",
#xlb="Default",
#ylb="Proportion of Total",
#force.x.continuous=FALSE,
#level.to.plot=NULL,
#max.plots.per.page=1,
#strip="Default",
#rug=TRUE,
#rug.col="orange",
cont.logy=F,
hline="default",
add.args.cont=list(),
add.args.cat=list(),
...) {
## Make sure we have the necessary variables defined
if(is.null(object) & is.null(vpctab)){
cat(paste("Both the arguments object and vpctab are NULL\n"))
cat(paste("At least one of these must be defined\n"))
return(NULL)
}
if(!is.null(vpctab)){
tmp <- FALSE
if(is.null(object)) tmp <- TRUE
object.2 <- read.vpctab(vpctab=vpctab,
object=object,
inclZeroWRES=inclZeroWRES,
...)
if(tmp==TRUE) inclZeroWRES=TRUE
}
file.info <- read.npc.vpc.results(vpc.results=vpc.info,...)
num.tables <- file.info$num.tables
dv.var <- file.info$dv.var
idv.var <- file.info$idv.var
arg.list.1 <- list(vpc.info=vpc.info,
vpctab = vpctab,
object = object,
subset=subset,
main=NULL,
main.sub=main.sub,
#aspect="fill",
#xlb=NULL,
censored=T,
...)
arg.list <- c(arg.list.1,add.args.cat)
cat.plots.tmp <- do.call(xpose.VPC.categorical,arg.list,quote=F)
## cat.plots.tmp <-
## xpose.VPC.categorical(vpc.info=vpc.info,
## vpctab = vpctab,
## object = object,
## subset=subset,
## main=NULL,
## main.sub=NULL,
## #xlb=NULL,
## censored=T,
## ...)
cat.plots <- cat.plots.tmp@plotList
if(!is.na(match(hline,"default"))) {
hline=c(file.info$lloq,file.info$uloq)
if(cont.logy) hline=log10(hline)
}
if(num.tables==1) {
cont.plots <- vector("list",1)
arg.list.1 <- list(vpc.info=vpc.info,
vpctab = vpctab,
object = object,
subset=subset,
main=NULL,
aspect="fill",
xlb=NULL,
hline=hline,
logy=cont.logy,
...)
arg.list <- c(arg.list.1,add.args.cont)
cont.plots[[1]] <- do.call(xpose.VPC,arg.list,quote=F)
## cont.plots[[1]] <-
## xpose.VPC(vpc.info=vpc.info,
## vpctab = vpctab,
## object = object,
## subset=subset,
## main=NULL,
## aspect="fill",
## xlb=NULL,
## hline=c(file.info$lloq,file.info$uloq),
## add.args.cont,
## ...)
} else {
arg.list.1 <- list(vpc.info=vpc.info,
vpctab = vpctab,
object = object,
subset=subset,
##main=NULL,
aspect="fill",
xlb=NULL,
hline=hline,
logy=cont.logy,
...)
arg.list <- c(arg.list.1,add.args.cont)
cont.plots.tmp <- do.call(xpose.VPC,arg.list,quote=F)
## cont.plots.tmp <-
## xpose.VPC(vpc.info=vpc.info,
## vpctab = vpctab,
## object = object,
## subset=subset,
## aspect="fill",
## xlb=NULL,
## hline=c(file.info$lloq,file.info$uloq),
## ...)
cont.plots <- cont.plots.tmp@plotList
}
plotList <- vector("list",num.tables*2)
j=0
for(i in 1:num.tables){
plotList[[i+j]] <- cont.plots[[i]]
plotList[[i+j+1]] <- cat.plots[[i]]
j=j+1
}
if(main=="Default"){
no.runno <- FALSE
text2 <- NULL
if(object.2@Runno=="0"){
no.runno <- TRUE
text2 <- paste("\n(",file.info$model.file,")",sep="")
}
main <- xpose.create.title.text(NULL,dv.var,
"VPC for",
text2=text2,
no.runno=no.runno,
object.2,subset=subset,...)
}
#print(cont.plots[[i]],position=c(0,0.2,1,1),more=TRUE)
# print(cat.plots[[i]],position=c(0,0,1,0.33),more=TRUE)
obj <- xpose.multiple.plot(plotList,plotTitle=main,bql.layout=T,...)
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.VPC.both.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Xpose visual predictive check for categorical data.
#'
#' Xpose visual predictive check for categorical data (binary, ordered
#' categorical and count data).
#'
#'
#' @param vpc.info Name of PSN file to use. File will come from \code{VPC}
#' command in PsN.
#' @param vpctab Name of vpctab file produced from PsN.
#' @param object Xpose data object.
#' @param subset Subset of data to look at.
#' @param main Title for plot.
#' @param main.sub Used for names above each plot when using multiple plots.
#' Should be a vector, e.g. \code{c("title 1","title 2")}.
#' @param main.sub.cex Size of \code{main.sub}
#' @param real.col Color of real line.
#' @param real.lty Real line type.
#' @param real.cex Size of real line.
#' @param real.lwd Width of real line.
#' @param median.line Dray a median line?
#' @param median.col Color of median line.
#' @param median.lty median line type.
#' @param ci.lines Lines marking confidence interval?
#' @param ci.col Color of CI area.
#' @param ci.lines.col Color of CI lines.
#' @param ci.lines.lty Type of CI lines.
#' @param xlb X-axis label. If other than "default"" passed directly to
#' \code{\link{xyplot}}.
#' @param ylb Y-axis label. Passed directly to \code{\link{xyplot}}.
#' @param force.x.continuous For the x variable to be continuous.
#' @param level.to.plot Which levels of the variable to plot. Smallest level is
#' 1, largest is number_of_levels. For example, with 4 levels, the largest
#' level would be 4, the smallest would be 1.
#' @param max.plots.per.page The number of plots per page.
#' @param rug Should there be markings on the plot showing where the intervals
#' for the VPC are?
#' @param rug.col Color of the rug.
#' @param censored Is this censored data? Censored data can be both below and
#' above the limit of quantification.
#' @param \dots Additional information passed to function.
#' @author Andrew C. Hooker
#' @seealso \code{\link{xpose.VPC.both}}.
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' library(xpose4)
#'
#' ## move to the directory where results from PsN
#' ## are found
#' cur.dir <- getwd()
#' setwd(paste(cur.dir,"/binary/vpc_36",sep=""))
#'
#' xpose.VPC.categorical(level.to.plot=1,max.plots.per.page=4)
#' xpose.VPC.categorical(level.to.plot=1,max.plots.per.page=4,by="DOSE")
#'
#' ## ordered categorical plots
#' setwd(paste(cur.dir,"/ordered_cat/vpc_45",sep=""))
#' xpose.VPC.categorical()
#'
#'
#' ## count
#' setwd(paste(cur.dir,"/count/vpc65b",sep=""))
#' xpose.VPC.categorical()
#'
#' setwd(paste(cur.dir,"/count/vpc65a",sep=""))
#' xpose.VPC.categorical()
#'
#' }
#'
#' @export xpose.VPC.categorical
#' @family specific functions
#' @family PsN functions
"xpose.VPC.categorical" <-
function(vpc.info="vpc_results.csv", #name of PSN file to use
vpctab = dir(pattern="^vpctab")[1],
object = NULL,
#ids=NULL,
#type="p",
#by=NULL,
#PI="area",
subset=NULL,
main="Default",
main.sub="Default", # used for names above each plot when using multiple plots
#Should be a vector c("","")
main.sub.cex=0.85, # size of main.sub
#inclZeroWRES=FALSE,
#plot.cont.table=TRUE,
#plot.cat.table=TRUE,
#force.x.continuous=FALSE,
real.col=4,
real.lty="b",
real.cex=1,
real.lwd=1,
median.line=FALSE,
median.col="darkgrey",
median.lty=1,
ci.lines=FALSE,
ci.col="blue",
ci.lines.col="darkblue",
ci.lines.lty=3,
xlb="Default",
ylb="Proportion of Total",
force.x.continuous=FALSE,
level.to.plot=NULL,
max.plots.per.page=1,
#strip="Default",
rug=TRUE,
rug.col="orange",
censored=FALSE,
...) {
## Make sure we have the necessary variables defined
if(is.null(object) & is.null(vpctab)){
cat(paste("Both the arguments object and vpctab are NULL\n"))
cat(paste("At least one of these must be defined\n"))
return(NULL)
}
if(!is.null(vpctab)){
tmp <- FALSE
if(is.null(object)) tmp <- TRUE
object <- read.vpctab(vpctab=vpctab,
object=object,
inclZeroWRES=inclZeroWRES,
...)
if(tmp==TRUE) inclZeroWRES=TRUE
}
file.info <- read.npc.vpc.results(vpc.results=vpc.info,...)
##num.tables <- file.info$num.tables
dv.var <- file.info$dv.var
idv.var <- file.info$idv.var
##bin.table <- file.info$result.tables
tmp <- c()
if(is.null(object@Data[[dv.var]])) tmp <- c(tmp,dv.var)
if(is.null(object@Data[[idv.var]])) tmp <- c(tmp,idv.var)
if (!is.null(tmp)){
cat("\n-----------Variable(s) not defined!-------------\n",
tmp, "is/are not defined in the current database\n",
"and must be defined for this command to work!\n",
"------------------------------------------------\n")
return(NULL)
}
## check if the tables are present
tables.exist <- FALSE
if(censored){
if(!is.null(file.info$num.tables.cen)) tables.exist <- TRUE
} else {
if(!is.null(file.info$num.tables.cat)) tables.exist <- TRUE
}
if(!tables.exist){
cat("\n-----------Tables do not exist!-------------\n",
"There are no tables that correspond to the categorical plots\n",
"you would like to make. Please rerun the vpc calculations.\n",
"------------------------------------------------\n")
return(NULL)
}
if(force.x.continuous){
if(is.factor(object@Data[[idv.var]])){
change.cat.cont(object) <- c(idv.var)
}
}
## make the plots
level.names <- c()
if(censored){
num.tables <- file.info$num.tables.cen
plotList <- vector("list",num.tables)
result.tables <- file.info$result.tables.cen
n.levs <- 0
if(!is.na(file.info$lloq)){
level.names <- c(level.names,"LLOQ")
n.levs <- n.levs+1
}
if(!is.na(file.info$uloq)) {
level.names <- c(level.names,"ULOQ")
n.levs <- n.levs+1
}
} else {
num.tables <- file.info$num.tables.cat
plotList <- vector("list",num.tables)
result.tables <- file.info$result.tables.cat
n.levs <- length(file.info$cat.boundaries)+1
for(LEVS in 1:n.levs){
if(LEVS==1){
tmp.lev=paste(dv.var,"<=",file.info$cat.boundaries[[LEVS]],sep=" ")
} else {
if(LEVS==n.levs){
tmp.lev=paste(file.info$cat.boundaries[[LEVS-1]],"<",dv.var,sep=" ")
} else {
tmp.lev=paste(file.info$cat.boundaries[[LEVS-1]],"<",
dv.var,"<=",file.info$cat.boundaries[[LEVS]],sep=" ")
}
}
level.names <- c(level.names,tmp.lev)
}
}
plot.num <- 0 # initialize plot number
for (i in 1:num.tables){
if(num.tables==1){
tmp.table <- result.tables
} else {
tmp.table <- result.tables[[i]]
}
## Set up the data frame for a VPC
tmp.table.2 <- rbind(tmp.table)
tmp.table.2$idv <- rowMeans(tmp.table.2[c("upper","lower")], na.rm = TRUE, dims = 1)
num.col.new <- 6
n.idv.levs <- length(tmp.table.2[,"idv"])
num.row.new <- n.levs*n.idv.levs
ret.new <- data.frame(matrix(nrow = num.row.new,
ncol = num.col.new))
names(ret.new) <- c("idv","real","lower","median","upper","by.var")
tab.names <- names(tmp.table.2)
real.index <- grep("Real.",tab.names)
lower.index <- grep(".from",tab.names)
upper.index <- grep(".to",tab.names)
median.index <- grep("Sim.",tab.names)
idv.index <- grep("idv",tab.names)
## Here is the problem when we have intervals of IDV
## tab.names <- names(tmp.table)
## real.index <- grep("Real.",tab.names)
## lower.index <- grep(".from",tab.names)
## upper.index <- grep(".to",tab.names)
## median.index <- grep("Sim.",tab.names)
## PPI <- tmp.table[c(lower.index[[1]],
## upper.index[[i]],
## median.index[[1]])]
## names(PPI) <- c("upper","lower","median")
## PPI$Xupper <- tmp.table$upper
## PPI$Xlower <- tmp.table$lower
## get.polygon.regions(PPI,NULL)
for(LEVS in 1:n.levs){
ret.new[(1+(LEVS-1)*n.idv.levs):(n.idv.levs*LEVS),1:5]<-
tmp.table.2[,c(idv.index,
real.index[[LEVS]],
lower.index[[LEVS]],
median.index[[LEVS]],
upper.index[[LEVS]]
)]
ret.new[(1+(LEVS-1)*n.idv.levs):(n.idv.levs*LEVS),"by.var"] <-
level.names[LEVS]
}
## check if x should be categorical
if(length(unique(ret.new$idv))<= object@[email protected]) {
if(!is.factor(ret.new$idv)){
cat("\n Inferring that ",idv.var," is categorical\n",sep="")
##cat(" Transforming ",idv.var," from continuous to categorical\n",sep="")
tmp.levs <- unique(ret.new[,"idv"])
tmp.levs <- tmp.levs[order(tmp.levs)]
ret.new$idv <- factor(ret.new$idv,levels=tmp.levs,ordered=T)
}
}
## categorize the by.var
ret.new$by.var <- factor(ret.new$by.var,levels=level.names,ordered=T)
## subset the by.var levels
if(!is.null(level.to.plot)){
ret.new <- ret.new[ret.new["by.var"]==level.names[level.to.plot],]
panel.level <- level.names[level.to.plot]
}
## set up formula
if (n.levs==1){
formel <- paste("real~idv|by.var",sep="")
} else {
formel <- paste("real~idv|by.var",sep="")
}
## set up labels
if(xlb[1]=="Default"){
xlb <- idv.var
}
strata <- file.info$strata.names[i] # this can be fixed to aviod overwriting subsets
if(is.null(main.sub)){
sub.main=NULL
} else {
if(main.sub[1]=="Default"){
sub.main=strata
} else {
sub.main=main.sub[i]
}
}
## if(!is.null(main.sub)){
## sub.main=main.sub[i]
## } else {
## sub.main=strata
## }
## make plot
plot.num <- plot.num+1
plotList[[plot.num]] <-
xyplot(formula(formel),
data=ret.new,
type=real.lty,
data2=ret.new,
prepanel = function(x,y,subscripts,data2=data2,...) {
## if(!is.null(cat.level.to.plot)){
## tmp.data <- ret.new[ret.new$by.var==panel.level,]
## } else {
## tmp.data <- ret.new[ret.new$by.var==level.names[panel.number()],]
## }
tmp.data <- data2[subscripts,]
if(is.factor(x)){#length(levs <- unique(x)) < object@[email protected]) {
xlim <- levels(x)
} else {
xlim <- range(c(x,tmp.table.2$lower,tmp.table.2$upper),na.rm=T)
#xlim <- range(x)
}
ylim <- range(c(y,tmp.data$lower,tmp.data$upper))
list(xlim=xlim,ylim=ylim)
},
xlab=xlb,ylab=ylb,
main=sub.main,
#strip=strip,
...,
panel=function(x,y,subscripts,data2=data2,...){
if(!is.null(level.to.plot)){
##tmp.data <- ret.new[ret.new$by.var==panel.level,]
tmp.data <- data2[data2$by.var==panel.level,]
} else {
##tmp.data <- ret.new[ret.new$by.var==level.names[panel.number()],]
tmp.data <- data2[data2$by.var==level.names[panel.number()],]
}
grid.polygon(c(tmp.data$idv,rev(tmp.data$idv)),
c(tmp.data$upper,rev(tmp.data$lower)),
default.units="native",
gp=gpar(fill=ci.col,alpha=0.3,col=NULL,lty=0)
)
panel.xyplot(x,y,col=real.col,cex=real.cex,lwd=real.lwd,...)
if(median.line){
panel.lines(tmp.data$idv,tmp.data$median,type="b",
col=median.col,
lty=median.lty)
}
if(ci.lines){
panel.lines(tmp.data$idv,tmp.data$lower,type="b",
col=ci.lines.col,
lty=ci.lines.lty)
panel.lines(tmp.data$idv,tmp.data$upper,type="b",
col=ci.lines.col,
lty=ci.lines.lty)
}
if(rug){
panel.rug(x=c(tmp.table.2$lower,tmp.table.2$upper),y=NULL,
col=rug.col, lwd=3)
}
}
)
}
if(!is.null(main)){
if(main=="Default"){
no.runno <- FALSE
text2 <- NULL
if(object@Runno=="0"){
no.runno <- TRUE
text2 <- paste("\n(",file.info$model.file,")",sep="")
}
if(censored) {
main <- xpose.create.title.text(NULL,dv.var,
"Categorical VPC for Censored",
text2=text2,
no.runno=no.runno,
object,subset=subset,...)
} else {
main <- xpose.create.title.text(NULL,dv.var,
"Categorical VPC for",
text2=text2,
no.runno=no.runno,
object,subset=subset,...)
}
}
}
obj <- xpose.multiple.plot(plotList,plotTitle=main,
max.plots.per.page=max.plots.per.page,...)
return(obj)
## if(!dont.plot){
## xpose.multiple.plot.default(plotList,plotTitle=main,
## ...)
## }
## return(invisible(plotList))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.VPC.categorical.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Function to ask the user for the name of a file
#'
#' Asks the user for the name of a file.
#'
#' Function checks if the file exists, if it does then the filename is returned
#' from the function.
#'
#' @aliases xpose.ask.for.filename xpose.ask.for.mod xpose.ask.for.lst
#' @param object An \code{\link{xpose.data}} object.
#' @param listfile A NONMEM output file
#' @param modfile A NONMEM model file
#' @param \dots Additional arguments passed to the function
#' @return The name of the file if it exists, otherwise nothing is returned.
#' @author Niclas Jonsson, Justin Wilkins, Mats Karlsson and Andrew Hooker
#' @keywords internal
# @export xpose.ask.for.filename
xpose.ask.for.filename <-
function(object,
listfile=paste("run",object@Runno,".lst",sep=""),
modfile=paste("run",object@Runno,".mod",sep=""),
...) {
cat("Type the name of the output file (0=cancel, return=",listfile,")\n",sep="")
ans <- readline()
lstfile <- NULL
if(ans==0) {
return()
} else if (ans=="") {
if(is.readable.file(listfile)) {
lstfile <- listfile
}
} else {
if(is.readable.file(ans)) {
lstfile <- ans
}
}
if(is.null(lstfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return()
}
}
xpose.ask.for.lst <-
function(object,
listfile=paste("run",object@Runno,".lst",sep=""),
...) {
cat("Type the name of the output file (0=cancel, return=",
listfile,")\n",sep="")
ans <- readline()
lstfile <- NULL
if(ans==0) {
return(NULL)
} else if (ans=="") {
if(is.readable.file(listfile)) {
lstfile <- listfile
}
} else {
if(is.readable.file(ans)) {
lstfile <- ans
}
}
if(is.null(lstfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return(NULL)
} else {
return(lstfile)
}
}
xpose.ask.for.mod <-
function(object,
modfile=paste("run",object@Runno,".mod",sep=""),
...) {
cat("Type the name of the model file (0=cancel, return=",
modfile,")\n",sep="")
ans <- readline()
cmdfile <- NULL
if(ans==0) {
return(NULL)
} else if (ans=="") {
if(is.readable.file(modfile)) {
cmdfile <- modfile
}
} else {
if(is.readable.file(ans)) {
cmdfile <- ans
}
}
if(is.null(cmdfile)) {
cat("The specified file couldn't be found in the current directory.\n")
return(NULL)
} else {
return(cmdfile)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.ask.for.filename.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @rdname check.vars
"xpose.bin" <- function (data,
y,
bins=10) {
## substitute for equal count algorithm in trellis
## bin a continuous variable for a bwplot
if (length(unique(data[[y]])) >= bins) {
for (i in 1:length(names(data))) {
if (names(data)[i] == y) {
y.data <- data[i]
mxr <- max(data[i])
mnr <- min(data[i])
}
#if (names(data)[i] == x) {
# x.data <- data[i]
#}
}
mdif <- mxr - mnr
mit <- mdif/(bins)
curr <- mnr
binlist <- c()
for (i in 1:bins) {
binlist <- c(binlist, curr)
curr <- curr + mit
if (i == bins) {
binlist <- c(binlist, curr)
}
}
#colnames(x.data) <- c("x")
colnames(y.data) <- c("y")
## now assign all the bits of data
bwdata <- cut(y.data$y, binlist, include.lowest = T)
} else {
# categorical
for (i in 1:length(names(data))) {
if (names(data)[i] == y) {
y.data <- data[i]
}
}
binlist <- c()
for (i in 1:length(unique(y))) {
binlist <- c(binlist, y[i])
if (i == bins) {
binlist <- c(binlist, y[i])
}
}
#colnames(x.data) <- c("x")
colnames(y.data) <- c("y")
## now assign all the bits of data
bwdata <- y.data$y
}
return(bwdata)
} | /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.bin.R |
#' @describeIn compute.cwres This function is a wrapper around
#' the function \code{compute.cwres}. It computes the CWRES for the model file
#' associated with the Xpose data object input to the function. If possible it
#' also computes the CWRES for any simulated data associated with the current
#' Xpose data object. If you have problems with this function try using
#' \code{compute.cwres} and then rereading your dataset into Xpose.
#'
#' @export
"xpose.calculate.cwres" <-
function(object,
cwres.table.prefix="cwtab",
tab.suffix="",
sim.suffix="sim",
est.tab.suffix=".est",
deriv.tab.suffix=".deriv",
old.file.convention=FALSE,
id="ALL",
printToOutfile=TRUE,
onlyNonZero=FALSE,
classic=FALSE,
...) {
cwres <- compute.cwres(run.number=object@Runno,
tab.prefix=cwres.table.prefix,
est.tab.suffix=est.tab.suffix,
deriv.tab.suffix=deriv.tab.suffix,
old.file.convention=old.file.convention,
id=id,
printToOutfile=printToOutfile,
onlyNonZero=onlyNonZero,
sim.suffix="",
...)
if (!is.null(cwres)){
object@Data$CWRES=as.vector(cwres)
object@Prefs@Xvardef$cwres="CWRES"
}
## simulation CWRES
if(!is.null(object@Nsim)){
if(object@Nsim==1){
cwres.sim <- compute.cwres(run.number=object@Runno,
tab.prefix=cwres.table.prefix,
est.tab.suffix=est.tab.suffix,
deriv.tab.suffix=deriv.tab.suffix,
old.file.convention=old.file.convention,
id=id,
printToOutfile=printToOutfile,
onlyNonZero=onlyNonZero,
sim.suffix=sim.suffix,
...)
if (!is.null(cwres.sim)){
object@SData$CWRES=as.vector(cwres.sim)
object@Prefs@Xvardef$cwres="CWRES"
} else {
cat("Table file needed to compute CWRES not present\n")
cat("For simulated data\n\n")
cat("CWRES not calculated for simulated data\n\n")
#cat("Simulated data will be dropped from xpose object.\n\n")
}
} else {
cat("CWRES cannot be calculated for table files\n")
cat("with multiple simulations in a single file\n\n")
cat("CWRES not calculated for simulated data\n\n")
#cat("Simulated data will be dropped from xpose object.\n\n")
}
}
if (classic==TRUE) {
#.cur.db <- object
c1<-call("assign",pos = 1, ".cur.db",object)
eval(c1)
}
invisible(object)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.calculate.cwres.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Functions to create labels for plots
#'
#' Functions to create labels for plots
#'
#'
#' @param x Column name for x-variable
#' @param y Column name for y variable
#' @param object Xpose data object
#' @param subset Subset used for plot
#' @param fun Function applied to data
#' @param funx Function applied to x data
#' @param funy Function applied to y data
#' @param no.runno should we include a run number in the label
#' @param \dots additional arguments passed to the function.
#' @return Plot titles and labels.
#' @author Andrew Hooker
#' @keywords internal
xpose.create.title <- function(x,y,object,subset=NULL,funx=NULL,funy=NULL,
no.runno=FALSE,...){
vs.label <- " vs. "
x.name <- xlabel(x,object)
if(length(x) > 1) {
x.name <- NULL
for(xx in x){
if (is.null(x.name)){
x.name <- paste(xlabel(xx,object))
} else {
x.name <- paste(x.name,"/",xlabel(xx,object))
}
}
vs.label <- paste(vs.label,"\n")
##x.name <- paste(x.name,"\n")
} # end length>1
y.name <- xlabel(y,object)
if(length(y) > 1) {
y.name <- NULL
for(yy in y){
if (is.null(y.name)){
y.name <- paste(xlabel(yy,object))
} else {
y.name <- paste(y.name,"/",xlabel(yy,object))
}
}
vs.label <- paste("\n",vs.label)
}# end length>1
main.runno <- ifelse(!no.runno,
paste(" (Run ",object@Runno,")",sep=""),
"")
if(is.null(x.name)) vs.label <- NULL
if(!is.null(funx)) {
if(is.null(x.name)) {
main.xname <- x.name
} else {
main.xname <- paste(funx,"(",x.name,")",sep="")
if (funx=="abs"){main.xname <- paste("|",x.name,"|",sep="")}
}
} else {
main.xname <- x.name
}
if(!is.null(funy)) {
main.yname <- paste(funy,"(",y.name,")",sep="")
if (funy=="abs"){main.yname <- paste("|",y.name,"|",sep="")}
} else {
main.yname <- y.name
}
main <- paste(main.yname, vs.label, main.xname, main.runno, sep="")
if (!is.null(subset)){
main <- paste(main,"\n[",subset,"]",sep="")
}
return(main)
}
#' Create Xpose title text for plots.
#'
#' Create Xpose title text for plots.
#'
#'
#' @param x The x-axis variable name.
#' @param y The y-axis variable name.
#' @param text Initial text in title.
#' @param object Xpose data object \code{\link{xpose.data}}.
#' @param subset Subset definition.
#' @param text2 Text at the end of the title.
#' @param \dots Additional options passed to function.
#' @author Andrew C. Hooker
#' @keywords internal
xpose.create.title.text <- function(x,y,text,object,subset,text2=NULL,...){
main <- xpose.create.title(x,y,object,subset=subset,...)
main <- paste(text,main,text2)
return(main)
}
xpose.create.title.hist <- function(x,object,subset,...){
main <- paste("Distribution of ",xlabel(x,object),
" (Run ",object@Runno,")",sep="")
if (!is.null(subset)){
main <- paste(main,"\n[",subset,"]",sep="")
}
return(main)
}
#' @describeIn xpose.create.title Create label values
xpose.create.label <- function(x,object,fun,logx,
autocorr.x=FALSE,
autocorr.y=FALSE,...){
x.label <- ifelse((length(x)>1),"Value",xlabel(x,object))
tot.x.label <- x.label
#if(logx) tot.x.label <- paste("log(",tot.x.label,")",sep="")
if(!is.null(fun)) {
tot.x.label <- paste(fun,"(",x.label,")",sep="")
if (fun=="abs"){
tot.x.label <- paste("|",x.label,"|",sep="")
}
}
if(autocorr.x) tot.x.label <- paste(tot.x.label,"(i)",sep="")
if(autocorr.y) tot.x.label <- paste(tot.x.label,"(i+1)",sep="")
return(tot.x.label)
}
xpose.multiple.plot.title <-
function(object,
plot.text,
subset=xsubset(object),
main="Default",
no.runno=FALSE,
...){
if (is.null(main)){
plotTitle <- NULL
} else {
if(!is.na(match(main,"Default"))) {
plotTitle <- paste(plot.text," (Run ",object@Runno, ")", sep="")
if (no.runno) plotTitle <- paste(plot.text, sep="")
if (!is.null(subset)){
plotTitle <- paste(plotTitle,"\n[",subset,"]",sep="")
}
} else {
plotTitle <- main
}
}
return(plotTitle)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.create.title.R |
#' Create an Xpose data object
#'
#' Creates an \code{xpose.data} object.
#'
#' Xpose expects, by default, to find at least one the the following NONMEM
#' tables in the working directory to be able to create an Xpose data object
#' (using a run number of '5' as an example):
#'
#' sdtab5: The 'standard' parameters, including IWRE, IPRE, TIME, and the NONMEM
#' default items (DV, PRED, RES and WRES) that are added when NOAPPEND is not
#' present in the \code{$TABLE} record.
#'
#' \code{$TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab5}
#'
#' patab5: The empirical Bayes estimates of individual model parameter values,
#' or posthoc estimates. These are model parameters, such as CL, V2, ETA1, etc.
#'
#' \code{$TABLE ID CL V2 KA K F1 ETA1 ETA2 ETA3 NOPRINT NOAPPEND ONEHEADER
#' FILE=patab5 }
#'
#' catab5: Categorical covariates, e.g. SEX, RACE.
#'
#' \code{$TABLE ID SEX HIV GRP NOPRINT NOAPPEND ONEHEADER FILE=catab5 }
#'
#' cotab5: Continuous covariates, e.g. WT, AGE.
#'
#' \code{$TABLE ID WT AGE BSA HT GGT HB NOPRINT NOAPPEND ONEHEADER FILE=cotab5}
#'
#' mutab5, mytab5, extra5, xptab5: Additional variables of any kind. These might
#' be useful if there are more covariates than can be accommodated in the
#' covariates tables, for example, or if you have other variables that should be
#' added, e.g. CMAX, AUC.
#'
#' The default names for table files can be changed by changing the default
#' values to the function. The files that Xpose looks for by default are:
#'
#' \code{ paste(table.names, runno, tab.suffix, sep="") }
#'
#' The default CWRES table file name is called:
#'
#' \code{paste(cwres.name,runno,cwres.suffix,tab.suffix,sep="")}
#'
#' If there are simulation files present then Xpose looks for the files to be
#' named:
#'
#' \code{paste(table.names, runno, sim.suffix, tab.suffix, sep="")}
#' \code{paste(cwres.name,runno,sim.suffix,cwres.suffix,tab.suffix,sep="") }
#'
#'
#' This is basically a wrapper function for the \code{read.nm.tables},
#' \code{Data} and \code{SData} functions. See them for further information.
#'
#' Also reads in the .phi file associated with the run (Individual OFVs,
#' parameters, and variances of those parameters.)
#'
#' @param runno Run number of the table files to read.
#' @param tab.suffix Suffix to be appended to the table file names for the
#' "real" data.
#' @param sim.suffix Suffix to be appended to the table file names for any
#' simulated data.
#' @param cwres.suffix Suffix to be appended to the table file names for any
#' CWRES data.
#' @param directory Where the files are located.
#' @param quiet A logical value indicating if more diagnostic messages should be
#' printed when running this function.
#' @param table.names Default text that Xpose looks for when searching for table
#' files.
#' @param cwres.name default text that xpose looks for when searching for CWRES
#' table files.
#' @param mod.prefix Start of model file name.
#' @param mod.suffix End of model file name.
#' @param phi.suffix End of .phi file name.
#' @param phi.file The name of the .phi file. If not \code{NULL} then supersedes
#' \code{paste(mod.prefix,runno,phi.suffix,sep="")}.
#' @param nm7 \code{T/F} if table files are for NONMEM 7/6, NULL for undefined.
#' @param \dots Extra arguments passed to function.
#' @return An \code{xpose.data} object. Default values for this object are
#' created from a file called 'xpose.ini'. This file can be found in the root
#' directory of the 'xpose4' package:
#'
#' \code{system.file("xpose.ini",package="xpose4")}.
#'
#'
#' It can be modified to fit the users
#' wants and placed in the home folder of the user or the working directory,
#' to override default settings.
#' @author Niclas Jonsson, Andrew Hooker
#' @seealso \code{\link{xpose.data-class}}, \code{\link{Data}},
#' \code{\link{SData}}, \code{\link{read.nm.tables}},
#' \code{\link{compute.cwres}}
#' @keywords methods
#' @examples
#' # Here we create files from an example NONMEM run
#'
#' od = setwd(tempdir()) # move to a temp directory
#' (cur.files <- dir()) # current files in temp directory
#'
#' simprazExample(overwrite=TRUE) # write files
#' (new.files <- dir()[!(dir() %in% cur.files)]) # what files are new here?
#'
#' xpdb <- xpose.data(1)
#'
#'
#' file.remove(new.files) # remove these files
#' setwd(od) # restore working directory
#'
#'
#' \dontrun{
#'
#' # We expect to find the required NONMEM run and table files for run
#' # 5 in the current working directory, and that the table files have
#' # a suffix of '.dat', e.g. sdtab5.dat
#' xpdb5 <- xpose.data(5, tab.suffix = ".dat")
#' }
#'
#' @export xpose.data
#' @family data functions
xpose.data <-function(runno,
tab.suffix="",
sim.suffix="sim",
cwres.suffix="",
directory=".",
quiet=TRUE,
table.names=c("sdtab","mutab","patab","catab",
"cotab","mytab","extra","xptab","cwtab"),
cwres.name=c("cwtab"),
mod.prefix="run",
mod.suffix=".mod",
phi.suffix=".phi",
phi.file=NULL,
##vpc.name="vpctab",
nm7=NULL, # T/F if table files are for NM7, NULL for undefined
...) {
##options(warn=-1) # suppress warnings
## make table lists
match.pos <- match(cwres.name,table.names)
if (!is.na(match.pos)) table.names <- table.names[-match.pos]
## Create the table file names to process
myfun <- function(x,directory,runno,cwres.suffix,sim.suffix,tab.suffix) {
filename <- paste0(x,runno,cwres.suffix,sim.suffix,tab.suffix)
file.path(directory, filename)
}
tab.files <- sapply(table.names,myfun,directory,runno,cwres.suffix="",sim.suffix="",tab.suffix)
cwres.files <- sapply(cwres.name,myfun,directory,runno,cwres.suffix,sim.suffix="",tab.suffix)
sim.files <- sapply(table.names,myfun,directory,runno,cwres.suffix="",sim.suffix,tab.suffix)
cwres.sim.files <- sapply(cwres.name,myfun,directory,runno,cwres.suffix,sim.suffix,tab.suffix)
tab.files <- c(tab.files,cwres.files)
sim.files <- c(sim.files,cwres.sim.files)
## Read the table files.
cat("\nLooking for NONMEM table files.\n")
tmp <- read.nm.tables(table.files=tab.files,
quiet=quiet,...)
## Fail if we can't find any.
if(is.null(tmp)) {
cat("Table files not read!\n")
return(NULL)
}
## check if NM.version is > 6
if(is.null(nm7)){
if(any(!is.na(match(c("IPRED","IWRES"),names(tmp))))){
nm7 <- T
} else {
nm7 <- F
}
}
## check that classes are present
if (!isClass("xpose.data") || !isClass("xpose.prefs")) {
createXposeClasses(nm7=nm7)
}
#createXposeClasses(nm7=nm7)
## Create the object
xpobj <- new("xpose.data",
Runno=runno,
Doc=NULL,
Data = NULL #read.nm.tables(runno,tab.suffix=tab.suffix,
#quiet=TRUE)
)
if(!nm7) xvardef(xpobj) <- c("iwres","IWRE")
if(!nm7) xvardef(xpobj) <- c("ipred","IPRE")
## read local options
if (is.readable.file("xpose.ini")) { ## read options in current directory
xpobj <- xpose.read(xpobj, file="xpose.ini")
} else if (is.readable.file(file.path(path.expand("~"),"xpose.ini"))) { ## read local options
xpobj <- xpose.read(xpobj, file=file.path(path.expand("~"),"xpose.ini"))
} else if (is.readable.file(system.file("xpose.ini",package="xpose4"))) { ## read global options
xpobj <- xpose.read(xpobj, file=system.file("xpose.ini",package="xpose4"))
} else{
cat("Cannot find a valid xpose.ini file!\n")
}
#cat("test\n")
## read tmp data into xpose object
Data(xpobj) <- tmp
cat("Table files read.\n")
## read phi file
ind.data <- NULL
nsim.phi <- NULL
if(nm7){
phi.data <- read.phi(phi.file=phi.file,
phi.prefix=mod.prefix,
runno=runno,
phi.suffix=phi.suffix,
##sim.suffix="sim",
quiet=quiet,
nm7=nm7,
directory=directory,
...)
# browser() Elins bug
if(!is.null(phi.data)){
## check that phi file has right size
if(dim(phi.data)[1]==dim(unique(xpobj@Data[xvardef("id",xpobj)]))[1]){
[email protected] <- phi.data
}else{
## get the first unique ID values data from phi file
first.phi.data <- phi.data[!duplicated(phi.data[,xvardef("id",xpobj)]),]
sim.phi.data <- phi.data[duplicated(phi.data[,xvardef("id",xpobj)]),]
[email protected] <- first.phi.data
nsim.phi.nrows <- dim(sim.phi.data)[1]
first.phi.nrows <- dim(first.phi.data)[1]
if(regexpr("\\.",as.character(nsim.phi.nrows/first.phi.nrows)) !=-1) {
cat("The length of the Phi data and the Phi simulated data do not match!\n")
return(xpobj)
}
nsim.phi <- nsim.phi.nrows/first.phi.nrows
}
}
}
## is.readable loop
## check orig files + sim is.readable output & sim must match
## error handling for simulations!
cat("\nLooking for NONMEM simulation table files.\n")
gosim <- TRUE
simct <- FALSE
## check if there are any simulation files
for(i in 1:length(sim.files)) {
if (is.readable.file(sim.files[i])) {
simct <- TRUE
}
}
if (simct){
for(i in 1:length(tab.files)) {
if ((is.readable.file(tab.files[i])) && (!is.readable.file(sim.files[i]))) {
err.mess <- paste(sim.files[i],"not found!")
gosim <- FALSE
break
}
}
} else {
gosim <- FALSE
}
if (gosim==FALSE) {
if (!simct) {
#cat(" Files are either not present or not named correctly\n")
#cat(" (e.g. sdtab1a instead of sdtab1sim)\n")
} else {
cat(" There is not the same number of normal and \n")
cat(" simulation table files for the current run number:\n")
cat(paste(" ",err.mess,"\n",sep=""))
}
cat("No simulated table files read.\n\n")
}
if (gosim==TRUE) {
simtmp <- read.nm.tables(sim.files,
#runno,
#tab.suffix=paste(sim.suffix,tab.suffix,sep=""),
#cwres.suffix=paste(sim.suffix,cwres.suffix,sep=""),
quiet=quiet,...)
if(!is.null(tmp)) {
SData(xpobj) <- simtmp
cat("Simulation table files read.\n")
} else {
cat("There was a problem reading the simulation tables!\n")
cat("Simulation tables not read!\n")
return(NULL)
}
if(!is.null(nsim.phi)){
## check that there are the same number of simulations in the phi file and the table files
if(!(xpobj@Nsim == nsim.phi)){
cat("\nThere are not the same number of simulations\n",
"in the table files and the phi file.\n",
"Something is wrong with the phi file.\n",
"It will not be used.\n",sep="")
[email protected] <- NULL
} else {
[email protected] <- sim.phi.data
}
}
}
## read options
if (is.readable.file("xpose.ini")) { ## read options in current directory
xpobj <- xpose.read(xpobj, file="xpose.ini")
} else if (is.readable.file(file.path(path.expand("~"),"xpose.ini"))) { ## read local options
xpobj <- xpose.read(xpobj, file=file.path(path.expand("~"),"xpose.ini"))
} else if (is.readable.file(system.file("xpose.ini",package="xpose4"))) { ## read global options
xpobj <- xpose.read(xpobj, file=system.file("xpose.ini",package="xpose4"))
} else{
cat("Cannot find a valid xpose.ini file!\n")
}
## clean up
if(file.exists(".sdtab.names.tmp")) file.remove(".sdtab.names.tmp")
if(file.exists(".catab.names.tmp")) file.remove(".catab.names.tmp")
if(file.exists(".cotab.names.tmp")) file.remove(".cotab.names.tmp")
if(file.exists(".patab.names.tmp")) file.remove(".patab.names.tmp")
tmp.obj <- read.vpctab(object=xpobj,
#inclZeroWRES=inclZeroWRES,
tab.suffix=tab.suffix,
...)
if(!is.null(tmp.obj)) xpobj <- tmp.obj
if(is.null(check.vars(c("idv"),xpobj))) {
cat("\n*********PLEASE NOTE: idv NOT IDENTIFIED************\n")
cat("The independent variable (idv) has not been identified\n")
cat("in the table files! Please use the command line function\n")
cat("'change.xvardef' (use '?change.xvardef' for help) or the classic\n")
cat("menu system (select: Preferences/Manage variables/Change idv)\n")
cat("to identify the name of the idv\n")
cat("****************************************************\n")
}
return(xpobj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.data.R |
#' Create a new graphical device for an Xpose plot.
#'
#' The function uses the code from dev.new(). This is a function to make
#' dev.new() back compatible with older versions of R (before 2.8.0).
#'
#'
#' @param \dots Additional arguments to a new graphical device. see
#' \code{\link[grDevices]{dev.new}}.
#' @author Andrew Hooker
#' @seealso \code{\link[grDevices]{dev.new}}.
#' @keywords internal
# @export xpose.dev.new
xpose.dev.new <- function (...)
{
if(getRversion()>="2.8.0"){
dev.new(...)
} else {
dev <- getOption("device")
if (!is.character(dev) && !is.function(dev))
stop("invalid setting for 'getOption(\"device\")'")
if (is.character(dev)) {
dev <- if (exists(dev, .GlobalEnv))
get(dev, .GlobalEnv)
else if (exists(dev, asNamespace("grDevices")))
get(dev, asNamespace("grDevices"))
else stop(gettextf("device '%s' not found", dev), domain = NA)
}
a <- list(...)
a2 <- names(formals(dev))
a <- a[names(a) %in% a2]
if (identical(dev, pdf)) {
if (is.null(a[["file"]]) && file.exists("Rplots.pdf")) {
fe <- file.exists(tmp <- paste("Rplots", 1:999, ".pdf",
sep = ""))
if (all(fe))
stop("no suitable unused file name for pdf()")
message(gettextf("dev.new(): using pdf(file=\"%s\")",
tmp[!fe][1]), domain = NA)
a$file <- tmp[!fe][1]
}
}
else if (identical(dev, postscript)) {
if (is.null(a[["file"]]) && file.exists("Rplots.ps")) {
fe <- file.exists(tmp <- paste("Rplots", 1:999, ".ps",
sep = ""))
if (all(fe))
stop("no suitable unused file name for postscript()")
message(gettextf("dev.new(): using postscript(file=\"%s\")",
tmp[!fe][1]), domain = NA)
a$file <- tmp[!fe][1]
}
}
else if (!is.null(a[["width"]]) && !is.null(a[["height"]]) &&
(identical(dev, png) || identical(dev, jpeg) || identical(dev,
bmp) || identical(dev, tiff))) {
if (is.null(a[["units"]]) && is.null(a[["res"]])) {
a$units <- "in"
a$res <- 72
}
}
do.call(dev, a)
}
}
#<environment: namespace:grDevices>
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.dev.new.R |
#' Stepwise GAM search for covariates on a parameter (Xpose 4)
#'
#' Function takes an Xpose object and performs a generalized additive model
#' (GAM) stepwise search for influential covariates on a single model parameter.
#'
#'
#' @param object An xpose.data object.
#' @param parnam ONE (and only one) model parameter name.
#' @param covnams Covariate names to test on parameter.
#' @param trace TRUE if you want GAM output to screen.
#' @param scope Scope of the GAM search.
#' @param disp If dispersion should be used in the GAM object.
#' @param start.mod Starting model.
#' @param family Assumption for the parameter distribution.
#' @param wts.data Weights on the least squares fitting of parameter vs.
#' covariate. Often one can use the variances of the individual parameter
#' values as weights. This data frame must have column with name ID and any
#' subset variable as well as the variable defined by the \code{wts.col}.
#' @param wts.col Which column in the \code{wts.data} to use.
#' @param steppit TRUE for stepwise search, false for no search.
#' @param subset Subset on data.
#' @param onlyfirst TRUE if only the first row of each individual's data is to
#' be used.
#' @param medianNorm Normalize to the median of parameter and covariates.
#' @param nmods Number of models to examine.
#' @param smoother1 Smoother for each model.
#' @param smoother2 Smoother for each model.
#' @param smoother3 Smoother for each model.
#' @param smoother4 Smoother for each model.
#' @param arg1 Argument for model 1.
#' @param arg2 Argument for model 2.
#' @param arg3 Argument for model 3.
#' @param arg4 Argument for model 4.
#' @param excl1 Covariate exclusion from model 1.
#' @param excl2 Covariate exclusion from model 2.
#' @param excl3 Covariate exclusion from model 3.
#' @param excl4 Covariate exclusion from model 4.
#' @param extra Extra exclusion criteria.
#' @param \dots Used to pass arguments to more basic functions.
#' @return Returned is a \code{\link[gam]{step.Gam}} object. In this object
#' the step-wise-selected model is returned, with up to two additional
#' components. There is an "anova" component
#' corresponding to the steps taken in the search, as well as a
#' "keep" component if the "keep=" argument was supplied in the call.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link[gam]{step.gam}}
#' @examples
#' ## Run a GAM using the example xpose database
#' gam_ka <- xpose.gam(simpraz.xpdb, parnam="KA")
#'
#' ## Summarize GAM
#' xp.summary(gam_ka)
#'
#' ## GAM residuals of base model vs. covariates
#' xp.plot(gam_ka)
#'
#' ## An Akaike plot of the results
#' xp.akaike.plot(gam_ka)
#'
#' ## Studentized residuals
#' xp.ind.stud.res(gam_ka)
#'
#' ## Individual influence on GAM fit
#' xp.ind.inf.fit(gam_ka)
#'
#' ## Individual influence on GAM terms
#' xp.ind.inf.terms(gam_ka)
#'
#' ## Individual parameters to GAM fit
#' xp.cook(gam_ka)
#'
#' @export xpose.gam
#' @family GAM functions
xpose.gam <-
function(object,
parnam = xvardef("parms", object)[1],
covnams = xvardef("covariates", object),
trace = TRUE,
scope = NULL,
disp = object@[email protected]$disp,
start.mod=object@[email protected]$start.mod,
family="gaussian",
wts.data [email protected],
wts.col= NULL,#object@[email protected]$wts,
## must have ID and any subset variable
## well as a variable defined by wts.col
steppit=object@[email protected]$steppit,
subset=xsubset(object),
onlyfirst=object@[email protected]$onlyfirst,
medianNorm=object@[email protected]$medianNorm,
## for the scope function
nmods=object@[email protected]$nmods,
smoother1=object@[email protected]$smoother1,
smoother2=object@[email protected]$smoother2,
smoother3=object@[email protected]$smoother3,
smoother4=object@[email protected]$smoother4,
arg1=object@[email protected]$arg1,
arg2=object@[email protected]$arg2,
arg3=object@[email protected]$arg3,
arg4=object@[email protected]$arg4,
excl1=object@[email protected]$excl1,
excl2=object@[email protected]$excl2,
excl3=object@[email protected]$excl3,
excl4=object@[email protected]$excl4,
extra=object@[email protected]$extra,
...) {
##
## Check the data
##
for (i in xvardef("parms", object)) {
if(is.null(i)) {
cat("Parameters are not properly set in the database!\n")
return()
}
}
for (i in xvardef("covariates", object)) {
if(is.null(i)) {
cat("Covariates are not properly set in the database!\n")
return()
}
}
if(length(parnam)>1) {
cat(
"You have specified more than on parameter but you can only\n"
)
cat(
"run the GAM on one parameter at a time.\n"
)
return()
}
##Get data
gamdata <- Data(object,subset=subset,onlyfirst=onlyfirst,...)
if(any(is.null(gamdata))) return("The subset expression is invalid.")
## subset weights
if(!is.null(wts.col)){
if(!is.null(subset)){
wts.data <- subset(wts.data,eval(parse(text=subset)))
}
##check that ids are equal
if(!all(gamdata$ID==wts.data$ID)){
cat("Weights and data set do not have same ID values.\n")
return()
}
## add other weighting options
#browser()
#str(wts.data)
#se*wpop/(wpop-se)
## assign weight column
wts <- wts.data[,wts.col]
} else {
wts <- NULL
}
##
## Normalize to median if requested
##
if(medianNorm==TRUE) {
for(i in covnams) {
if(is.factor(gamdata[,i])) {
next
} else {
gamdata[,i] <- gamdata[,i] - median(gamdata[, i])
}
}
for(i in parnam) {
if(is.factor(gamdata[,i])) {
next
} else {
gamdata[,i] <- gamdata[,i] - median(gamdata[, i])
}
}
}
## Check the length of the wts
if(!is.null(wts)) {
if(length(wts) != length(gamdata[[1]])) {
cat("Weights and data have unequal length!\n")
return()
} else {
## looks good
}
}
c1 <- call("assign","wts",wts,pos=1)
eval(c1)
c2 <- call("assign","gamdata",gamdata,pos=1)
eval(c2)
c3 <- call("assign","covnams",covnams,pos=1)
eval(c3)
##
## Set starting model
##
if(is.null(start.mod)) {
form <- as.formula(paste(parnam,"~1"))
} else {
form <- start.mod
}
##
## Check to see if the dispersion should be estimated
##
if(!is.null(disp)) {
disp1 <- xp.get.disp(gamdata=gamdata,parnam=parnam,covnams=covnams,family=family)
disp2 <- disp1$dispersion
}
##
## Nonice way to get the proportional error model (doesn't work right now)
##
if(!any(is.null(wts))) {
##if(family=="quasi")
## bam.start <- gam(form,data=gamdata,weights=wts,
## family=quasi(link=identity,var="mu^2"))
#else
bam.start <- gam(form,weights=wts,data=gamdata)
} else {
##if(family=="quasi")
##bam.start <- gam(form,data=gamdata,family=quasi(link=identity,var="mu^2"))
##else
bam.start <- gam(form,data=gamdata)
}
##
## Set the keep function
##
"bam.keep.old.gam" <-
function(object, AIC){
list(df.resid = object$df.resid,
deviance = object$deviance,
term = as.character(object$formula)[3],
labs = labels(object),
AIC = AIC)
}
"bam.keep" <-
function(object){
list(df.resid = object$df.resid,
deviance = object$deviance,
term = as.character(object$formula)[3],
labs = labels(object),
AIC = object$aic)
}
##
## Set the scope
##
if(any(is.null(scope))){
#scope <- xp.check.scope(object,covnams=covnams)
scope <-xp.scope3(object,
covnam=covnams,
nmods=nmods,
smoother1=smoother1,
smoother2=smoother2,
smoother3=smoother3,
smoother4=smoother4,
arg1=arg1,
arg2=arg2,
arg3=arg3,
arg4=arg4,
excl1=excl1,
excl2=excl2,
excl3=excl3,
excl4=excl4,
extra=extra)
}
##
## Run the GAM
##
if(!is.null(steppit)){
if(is.null(disp)){
if(packageVersion("gam") >= "1.15"){
nose1.parm <- step.Gam(bam.start, trace = trace, scope, keep = bam.keep)
} else if(packageVersion("gam") >= "1.9.1"){
nose1.parm <- do.call("step.gam", list(bam.start, trace = trace, scope, keep = bam.keep))
} else {
nose1.parm <- do.call("step.gam", list(bam.start, trace = trace, scope, keep = bam.keep.old.gam))
}
} else {
if(packageVersion("gam") >= "1.15"){
nose1.parm <- step.Gam(bam.start, trace = trace, scope, keep = bam.keep,scale=disp2)
} else if(packageVersion("gam") >= "1.9.1"){
nose1.parm <- do.call("step.gam",list(bam.start, trace = trace, scope, keep = bam.keep,scale=disp2))
} else {
nose1.parm <- do.call("step.gam",list(bam.start, trace = trace, scope, keep = bam.keep.old.gam,scale=disp2))
}
}
} else {
nose1.parm <- bam.start
}
## add to gam object
if(!is.null(disp)) {
nose1.parm$dispersion <- disp2
} else {
nose1.parm$dispersion <- disp
}
if(!is.null(steppit)){
nose1.parm$steppit <- steppit
}
nose1.parm$subset <- subset
nose1.parm$onlyfirst <- onlyfirst
nose1.parm$medianNorm <- medianNorm
nose1.parm$pars <- parnam
nose1.parm$runno <- object@Runno
remove("gamdata",pos=1)
remove("wts",pos=1)
remove("covnams",pos=1)
return(nose1.parm)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.gam.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Displays the Xpose license and citation information
#'
#' This function displays a copy of Xpose's end user license agreement (EULA).
#'
#'
#' @return The EULA.
#' @author Andrew Hooker
#' @keywords methods
#' @examples
#'
#' xpose.license.citation()
#'
#' @export xpose.license.citation
"xpose.license.citation" <- function() {
cat("\nThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
A copy of the GNU Lesser General Public License can be found in the R
installation directory (",R.home(component="share"),")under licenses.
If not, see <http://www.gnu.org/licenses/>.\n\n",sep="")
print(citation(package="xpose4"))
return(cat(""))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.license.citation.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' @describeIn xpose.yscale.components.log10 Make log tic marks
#' @export
xpose.logTicks <- function (lim, loc = c(1, 5)) {
ii <- floor(log10(range(lim))) + c(-1, 2)
main <- 10^(ii[1]:ii[2])
r <- as.numeric(outer(loc, main, "*"))
r[lim[1] <= r & r <= lim[2]]
}
#' Functions to create nice looking axes when using Log scales.
#'
#' The functions are used to create standard tic marks and axis labels when the
#' axes are on the log scale.
#'
#' These functions create log scales that look like they should (not the
#' default R scales). These functions are used as input to the
#' \code{\link[lattice:axis.default]{xscale.components}} argument in a lattice
#' plot.
#'
#' @aliases xpose.yscale.components.log10 xpose.xscale.components.log10
#' xpose.logTicks
#' @param lim Limits
#' @param loc Locations
#' @param \dots Additional arguments passed to the function.
#' @author Andrew Hooker
#' @seealso \code{\link{xpose.plot.default}}
#' \code{\link[lattice:axis.default]{xscale.components}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' xpdb5 <- xpose.data(5)
#' xpose.plot.default("PRED","DV",xpdb,logy=T,logx=T)
#' xpose.plot.default("PRED","DV",xpdb,logy=T,logx=T,
#' yscale.components = xpose.yscale.components.log10,
#' xscale.components = xpose.xscale.components.log10)
#'
#' ## both give the same result
#' }
#'
#' @export
xpose.yscale.components.log10 <- function(lim, ...) {
ans <- yscale.components.default(lim = lim, ...)
tick.at <- xpose.logTicks(10^lim, loc = 1:9)
tick.at.major <- xpose.logTicks(10^lim, loc = 1)
major <- tick.at %in% tick.at.major
ans$left$ticks$at <- log(tick.at, 10)
ans$left$ticks$tck <- ifelse(major, 1.5, 0.75)
ans$left$labels$at <- log(tick.at, 10)
ans$left$labels$labels <- as.character(tick.at)
ans$left$labels$labels[!major] <- ""
ans$left$labels$check.overlap <- FALSE
ans
}
#' @describeIn xpose.yscale.components.log10 Make log scale on x-axis
#' @export
xpose.xscale.components.log10 <- function(lim, ...) {
ans <- xscale.components.default(lim = lim, ...)
tick.at <- xpose.logTicks(10^lim, loc = 1:9)
tick.at.major <- xpose.logTicks(10^lim, loc = 1)
major <- tick.at %in% tick.at.major
ans$bottom$ticks$at <- log(tick.at, 10)
ans$bottom$ticks$tck <- ifelse(major, 1.5, 0.75)
ans$bottom$labels$at <- log(tick.at, 10)
ans$bottom$labels$labels <- as.character(tick.at)
ans$bottom$labels$labels[!major] <- ""
ans$bottom$labels$check.overlap <- FALSE
ans
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.log.axes.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Create and object with class "xpose.multiple.plot".
#'
#' Create and object with class "xpose.multiple.plot".
#'
#'
#' @param plotList A list of lattice plots.
#' @param plotTitle Main title for plots.
#' @param nm7 \code{TRUE} if we are using NONMEM 7
#' @param prompt When printing should we prompt for each new page in plot?
#' @param new.first.window \code{TRUE} or \code{FALSE}.
#' @param max.plots.per.page A number. Max value is 9.
#' @param title Title properties.
#' @param mirror Are there mirror plots in plot list?
#' @param bql.layout Should we use layout optimized for plots with BQL (below
#' limit of quantification) measurements?
#' @param \dots Additional options passed to function.
#' @return An object of class "xpose.multiple.plot".
#' @author Niclas Jonsson and Andrew C. Hooker
#' @seealso \code{\link{print.xpose.multiple.plot}},
#' \code{\link{xpose.multiple.plot.default}}
#' @export
#' @family generic functions
xpose.multiple.plot <-
function(plotList,
plotTitle=NULL,
nm7 = TRUE,
prompt=FALSE,
new.first.window=FALSE,
max.plots.per.page=4,
title = list(
title.x = unit(0.5, "npc"),
title.y = unit(0.5, "npc"),
title.gp= gpar(cex=1.2,fontface="bold"),#,font=2),
title.just = c("center","center")
),
mirror=FALSE,
bql.layout=FALSE,
...) {
## Initialize the classes
#createXposeClasses(nm7=nm7)
#if (!isClass("xpose.data") || !isClass("xpose.prefs")) {
# createXposeClasses()
#}
obj <- new("xpose.multiple.plot",
plotList = plotList,
plotTitle = plotTitle,
max.plots.per.page=max.plots.per.page,
prompt=prompt,
new.first.window=new.first.window,
title=title,
mirror=mirror,
bql.layout=bql.layout)#,
# ...)
## prompt=prompt,
## new.first.window=new.first.window,
## max.plots.per.page=max.plots.per.page,
## title.x=title.x,
## title.y=title.y,
## title.just=title.just,
## title.gp=title.gp,
## mirror=mirror,
## bql.layout=bql.layout
## )
return(obj)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.multiple.plot.R |
#' Xpose 4 generic function for plotting multiple lattice objects on one page
#'
#' Function takes a list of \pkg{lattice} plot objects and prints them in a
#' multiple plot layout with a title.
#'
#' \strong{Additional arguments:} \describe{ \item{title.x}{Where the title
#' should be placed in the title \pkg{grid} region} \item{title.y}{Where the
#' title should be placed in the title \pkg{grid} region} \item{title.just}{how
#' the title should be justified} \item{title.gp}{The par parameters for the
#' title (see \pkg{grid})} }
#'
#' @param plotList A list of lattice plot objects such that plot object i can
#' be called with \code{plotList[[i]]}
#' @param plotTitle The title used for the multiple plot layout
#' @param prompt If more than one page is needed do you want a prompt at the
#' command line before the next page is printed
#' @param new.first.window Should the first page of this plot be in the already
#' opened window or should a new window be created
#' @param max.plots.per.page Maximum number of plots per page in the multiple
#' layout
#' @param title Look of title using \pkg{grid}.
#' @param mirror if the list contains mirror plots
#' @param bql.layout should we use layout optimized for BQL measurements?
#' @param page.numbers Should we add page numbers to multiple page plots?
#' @param \dots Other arguments passed to the code in this function
#' @return returns nothing
#' @author Andrew Hooker
#' @seealso \pkg{grid}, \code{\link{basic.gof}}, \code{\link{parm.vs.parm}},
#' \code{\link{parm.vs.cov}},
#' @export
#' @importFrom grDevices dev.cur
#' @importFrom grDevices dev.off
xpose.multiple.plot.default <-
function(plotList,
plotTitle=NULL,
prompt=FALSE,
new.first.window=FALSE,
max.plots.per.page=4, # absolute max is 9
#title.size=0.1, # title size
title = list(
title.x = unit(0.5, "npc"),
title.y = unit(0.5, "npc"),
title.gp= gpar(cex=1.2,fontface="bold"),#,font=2),
title.just = c("center","center")
),
# title.x=unit(0.5, "npc"), # title placement
# title.y=unit(0.5, "npc"), # title placement
# title.just=c("center","center"), # title placement
# title.gp=gpar(cex=1.2,fontface="bold"), # title fontsize
mirror=FALSE,
##record=TRUE,
##main=NULL,
##object,
##main = NULL,
##xlb = NULL,
##ylb = NULL,
##onlyfirst=TRUE,
##inclZeroWRES=FALSE,
##subset=xsubset(object),
## abline=c(0,1),
##smooth=TRUE,
##abllwd=2,
bql.layout=FALSE,
page.numbers=TRUE,
...) {
## Extract title graphical parameters
title.x <- title$title.x
title.y <- title$title.y
title.gp <- title$title.gp
title.just <- title$title.just
## flatten plotList if we have lists of lists
if (mirror) {
if(length(plotList[[1]])==2 | length(plotList[[1]])==4) {
plotList <- unlist(plotList,recursive=FALSE)
}
}
## plots per page
absolute.max.plots.per.page = 9
if (max.plots.per.page > absolute.max.plots.per.page) {
max.plots.per.page = absolute.max.plots.per.page
}
if(bql.layout) max.plots.per.page=2
## split the pages and find the number of pages needed
## should use n2mfrow() here!
tot.pages <- ceiling(length(plotList)/max.plots.per.page)
if (max.plots.per.page==1) splt = c(1,1)
if (max.plots.per.page==2) {
if (length(plotList)==1) splt = c(1,1)
if (length(plotList) > 1) splt = c(2,1)
}
if (max.plots.per.page==3 ||
max.plots.per.page==4) {
if (length(plotList)==1) splt = c(1,1)
if (length(plotList)==2) splt = c(2,1)
if (length(plotList)>2) splt = c(2,2)
}
if (max.plots.per.page==5 ||
max.plots.per.page==6) {
if (length(plotList)==1) splt = c(1,1)
if (length(plotList)==2) splt = c(2,1)
if (length(plotList)==3) splt = c(2,2)
if (length(plotList)==4) splt = c(2,2)
if (length(plotList)>4) splt = c(3,2)
}
if (max.plots.per.page==7 ||
max.plots.per.page==8 ||
max.plots.per.page==9) {
if (length(plotList)==1) splt = c(1,1)
if (length(plotList)==2) splt = c(2,1)
if (length(plotList)==3) splt = c(2,2)
if (length(plotList)==4) splt = c(2,2)
if (length(plotList)==5) splt = c(3,2)
if (length(plotList)==6) splt = c(3,2)
if (length(plotList) >6) splt = c(3,3)
}
if(mirror) { # beginning of Mirror stuff
## Decide the layout of the graphs
if(!is.logical(mirror)) {
if(mirror != 1 && mirror !=3) {
cat("The mirror should either be logical, 1 or 3!\n")
invisible()
return()
}
} else {
mirror <- 1
}
tot.pages <- ceiling(length(plotList)/(mirror+1))
max.plots.per.page = mirror+1
if(mirror==1) {
splt <- c(1,2)
} else {
splt <- c(2,3)
}
} # end of Mirror stuff
## Start recording (may not work in X11)
##if(dev.cur()==1) {
## get(getOption("device"))(record=TRUE)
##} else {
## dev.off()
## get(getOption("device"))(record=TRUE)
##}
##if ((theme=="windows") || (theme=="x11") || (theme=="pdf") || (theme=="postscript")) {
## theme = theme
##} else {
## theme = "windows"
##}
## set up the title
if (!is.null(plotTitle)){
plot.title <- textGrob(plotTitle,
x=title.x,
y=title.y,
just=title.just,
gp=title.gp)
plot.height <- grobHeight(plot.title)
}
## Loop over the terms
j <- 1
page.num <- 1
for(i in 1:length(plotList)) {
if (j==(max.plots.per.page + 1)) {
j <- 1
page.num <- page.num+1
if (prompt == TRUE) {
cat("Next plot: page", page.num, "of", tot.pages,
"- Press RETURN to continue...\n", sep=" ")
readline()
}
}
if (j==1){
devcur <- names(dev.cur())
if(dev.cur() == 1 | new.first.window==TRUE) { # if a device is not open
if(tot.pages==1){
xpose.dev.new(...)
grid.newpage()
#trellis.device(new=FALSE,...)#, theme = canonical.theme(theme))
##trellis.par.set(theme = col.whitebg())
} else { # turn on recording if there are more than one page to print
xpose.dev.new(record=TRUE,...) # record only passed to windows
grid.newpage()
#trellis.device(new=FALSE,...)#, theme = canonical.theme(theme))
##trellis.par.set(theme = col.whitebg())
}
} else { # if another graphics device is open
seen <- 0
if (devcur == "windows") {
seen <- 1
if (tot.pages==1 | i!=1){
grid.newpage()
#plot.new()
#trellis.device(new=FALSE)#, theme = canonical.theme(theme))
##trellis.par.set(theme = col.whitebg())
} else {
##options(graphics.record=FALSE)
##grid.newpage(recording=TRUE)
##dev.control("enable")
dev.off()
xpose.dev.new(record=TRUE,...)
grid.newpage()
#trellis.device(new=FALSE,...)#, theme = canonical.theme(theme))
##trellis.par.set(theme = col.whitebg())
}
}
## if ((devcur == "x11") | (devcur == "X11") | (devcur=="quartz")) {
## seen <- 1
## if (tot.pages==1 | i!=1){
## grid.newpage()
## ##trellis.device(new=FALSE,...)#, theme = canonical.theme(theme))
## ##trellis.par.set(theme = col.whitebg())
## } else {
## ##grid.newpage(recording=TRUE)
## ##dev.control("enable")
## ##dev.off()
## get(getOption("device"))()
## grid.newpage()
## trellis.device(new=FALSE,...)#, theme = canonical.theme(theme))
## ##trellis.par.set(theme = col.whitebg())
## }
## }
if (seen!=1) {
grid.newpage()
}
}
if (is.null(plotTitle)){
if (tot.pages>1){
lvp <- viewport(y=0,height=unit(1, "npc") - unit(.025, "npc"),
just="bottom", name="lvp")
tvp <- viewport(y=1, height=unit(.025, "npc"),
just="top", name="tvp")
} else {
lvp <- viewport(y=0,height=unit(1, "npc"),
just="bottom", name="lvp")
}
} else {
if(length(plotList)>1 | any(class(plotList[[i]])=="grob")){
lvp <- viewport(y=0,
height=unit(1, "npc") - plot.height*1.1,
just="bottom", name="lvp")
## lvp <- viewport(y=0,height=unit(1, "npc") - unit(title.size, "npc"),
## just="bottom", name="lvp")
#tvp <- viewport(y=1, height=unit(title.size, "npc"),
# just="top", name="tvp",
# gp=gpar(cex=1.2,fontface="bold")
# )
## find how many \n there are in the string
## tvp <- viewport(y=1, height=grobHeight(grid.text(plotTitle)),
## #stringHeight(plotTitle),
## just="top", name="tvp",
## gp=gpar(cex=1.2,fontface="bold")
## )
tvp <- viewport(y=1, height=plot.height*1.1,
#stringHeight(plotTitle),
just="top", name="tvp"#,
#gp=gpar(cex=1.2,fontface="bold")
)
#grid.show.viewport(lvp)
#browser()
#pushViewport(lvp)
#grid.rect()
#upViewport()
#pushViewport(tvp)
#grid.rect()
#upViewport()
#for(jj in 1:length(plotList)){
# plotList[[jj]] <- update(plotList[[jj]],main$cex <- 0.5)
#}
} else {
lvp <- viewport(y=0,height=unit(1, "npc"),
just="bottom", name="lvp")
plotList[[i]] <- update(plotList[[i]],main=plotTitle)
plotTitle <- NULL
}
}
}
mre=TRUE
if (i==length(plotList)) mre=FALSE
pushViewport(lvp)
if(any(class(plotList[[i]])=="grob")){
grid.draw(plotList[[i]])
} else {
if (mirror){
if (j==1){
if(mirror==1) {
print(plotList[[i]],split=c(1,1,splt),more=mre,newpage=FALSE)
} else {
print(plotList[[i]],split=c(1,2,splt),more=mre,newpage=FALSE)
}
} else {
if(mirror==1) {
print(plotList[[i]],split=c(1,j,splt),more=mre,newpage=FALSE)
} else {
print(plotList[[i]],split=c(2,j-1,splt),more=mre,newpage=FALSE)
}
}
} else {
if(bql.layout){
if(j==1) print(plotList[[i]],position=c(0,0.25,1,1),more=mre,newpage=FALSE)
if(j==2) print(plotList[[i]],position=c(0,0,1,0.33),more=mre,newpage=FALSE)
} else {
if (j==1) print(plotList[[i]],split=c(1,1,splt),more=mre,newpage=FALSE)
if (j==2) print(plotList[[i]],split=c(2,1,splt),more=mre,newpage=FALSE)
if (j==3) print(plotList[[i]],split=c(1,2,splt),more=mre,newpage=FALSE)
if (j==4) print(plotList[[i]],split=c(2,2,splt),more=mre,newpage=FALSE)
if (j==5) print(plotList[[i]],split=c(3,1,splt),more=mre,newpage=FALSE)
if (j==6) print(plotList[[i]],split=c(3,2,splt),more=mre,newpage=FALSE)
if (j==7) print(plotList[[i]],split=c(1,3,splt),more=mre,newpage=FALSE)
if (j==8) print(plotList[[i]],split=c(2,3,splt),more=mre,newpage=FALSE)
if (j==9) print(plotList[[i]],split=c(3,3,splt),more=mre,newpage=FALSE)
}
}
}
upViewport()
if (j==max.plots.per.page || i==length(plotList)){
if (!is.null(plotTitle) || tot.pages >1 ){
pushViewport(tvp)
}
if (!is.null(plotTitle)){
grid.draw(plot.title)
}
if (tot.pages > 1){
if(page.numbers){
plot.page.num <- paste("page", page.num, "of", tot.pages, sep=" ")
grid.text(plot.page.num, x=unit(.98, "npc"),
y=unit(.98, "npc"),
just=c("right","top"),
gp=gpar(cex=0.8))
}
}
if (!is.null(plotTitle) || tot.pages >1 ){
upViewport()
}
}
j <- j+1
}
invisible()
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.multiple.plot.default.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Default box-and-whisker panel function for Xpose 4
#'
#' This is the box-and-whisker panel function for Xpose 4. This is not intended
#' to be used outside the \code{xpose.plot.bw} function. Most of the arguments
#' take their default values from xpose.data object but this can be overridden
#' by supplying them as arguments to \code{xpose.plot.bw}.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param y Name(s) of the y-variable.
#' @param object An xpose.data object.
#' @param subscripts The standard Trellis subscripts argument (see
#' \code{\link[lattice]{xyplot}}).
#' @param groups Name of the variable used for superpose plots.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param xvarnam Character string with the name of the x-variable.
#' @param yvarnam Character string with the name of the y-variable.
#' @param type Character value indicating the type of display to use:
#' "l"=lines, "p"=points, "b"=both points and lines.
#' @param col Colour of lines and plot symbols.
#' @param pch Plot character to use.
#' @param cex Size of the plot characters.
#' @param lty Line type.
#' @param fill Fill colour.
#' @param ids Character value with the name of the variable to label data
#' points with.
#' @param idsmode Determines the way text labels are added to plots.
#' \code{NULL} means that only extreme points are labelled. Non-\code{NULL}
#' means all data points are labelled. (See \code{link{xpose.plot.default}})
#' @param idsext See \code{link{xpose.plot.bw}}
#' @param idscex Size of text labels.
#' @param idsdir A value of "both" (the default) means that both high and low
#' extreme points are labelled while "up" and "down" labels the high and low
#' extreme points respectively. See \code{\link{xpose.plot.bw}}
#' @param bwhoriz logical value indicating whether box and whiskers should be
#' horizontal or not. The default is FALSE.
#' @param bwratio Ratio of box height to inter-box space. The default is 1.5.
#' An argument for \code{\link[lattice]{panel.bwplot}}.
#' @param bwvarwid Logical. If TRUE, widths of boxplots are proportional to the
#' number of points used in creating it. The default is FALSE. An argument for
#' \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotpch Graphical parameter controlling the dot plotting character
#' 'bwdotpch="|"' is treated specially, by replacing the dot with a line. The
#' default is 16. An argument for \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotcol Graphical parameter controlling the dot colour - an integer
#' or string. See 'col'. The default is black. An argument for
#' \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotcex The amount by which plotting text and symbols should be
#' scaled relative to the default. 'NULL' and 'NA' are equivalent to '1.0'. An
#' argument for \code{\link[lattice]{panel.bwplot}}.
#' @param bwreccol The colour to use for the box rectangle - an integer or
#' string. The default is blue. See \code{\link[lattice]{trellis.par.get}} and
#' "box.rectangle".
#' @param bwrecfill The colour to use for filling the box rectangle - an
#' integer or string. The default is transparent (none). See
#' \code{\link[lattice]{trellis.par.get}} and "box.rectangle".
#' @param bwreclty The line type for the box rectangle - an integer or string.
#' The default is solid. See \code{\link[lattice]{trellis.par.get}} and
#' "box.rectangle".
#' @param bwreclwd The width of the lines for the box rectangle - an integer.
#' The default is 1. See \code{\link[lattice]{trellis.par.get}} and
#' "box.rectangle".
#' @param bwumbcol The colour to use for the umbrellas - an integer or string.
#' The default is blue. See \code{\link[lattice]{trellis.par.get}} and
#' "box.umbrella".
#' @param bwumblty The line type for the umbrellas - an integer or string. The
#' default is solid.See \code{\link[lattice]{trellis.par.get}} and
#' "box.umbrella".
#' @param bwumblwd the width of the lines for the umbrellas - an integer. The
#' default is 1. See \code{\link[lattice]{trellis.par.get}} and "box.umbrella".
#' @param bwoutcol The colour to use for the outliers - an integer or string.
#' The default is blue. See \code{\link[lattice]{trellis.par.get}} and
#' "box.symbol".
#' @param bwoutcex The amount by which outlier points should be scaled relative
#' to the default. 'NULL' and 'NA' are equivalent to '1.0'. The default is 0.8.
#' See \code{\link[lattice]{trellis.par.get}} and "box.symbol".
#' @param bwoutpch The plotting character, or symbol, to use for outlier
#' points. Specified as an integer. See R help on 'points'. The default is an
#' open circle. See \code{\link[lattice]{trellis.par.get}} and "box.symbol".
#' @param grid logical value indicating whether a visual reference grid should
#' be added to the graph. (Could use arguments for line type, color etc).
#' @param logy Logical value indicating whether the y-axis should be
#' logarithmic.
#' @param logx Logical value indicating whether the x-axis should be
#' logarithmic.
#' @param force.x.continuous Logical value indicating whether x-values should
#' be taken as continuous, even if categorical.
#' @param binvar Variable to be used for binning.
#' @param bins The number of bins to be used. The default is 10.
#' @param \dots Other arguments that may be needed in the function.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.data-class}}, Cross-references above.
#' @keywords methods
#' @export xpose.panel.bw
"xpose.panel.bw" <-
function(x, y, object,
subscripts,
groups = NULL,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL,
xvarnam = NULL,
yvarnam = NULL,
## Basic plot characteristics
type = object@[email protected]$type,
col = object@[email protected]$col,
pch = object@[email protected]$pch,
cex = object@[email protected]$cex,
lty = object@[email protected]$lty,
fill = object@[email protected]$col,
## Text label setting
ids = NULL,
idsmode=object@[email protected]$idsmode,
idsext =object@[email protected]$idsext,
idscex= object@[email protected]$idscex,
idsdir= object@[email protected]$idsdir,
## BW settings
bwhoriz=object@[email protected]$bwhoriz,
bwratio=object@[email protected]$bwratio,
bwvarwid=object@[email protected]$bwvarwid,
bwdotpch= object@[email protected]$bwdotpch,
bwdotcol= object@[email protected]$bwdotcol,
bwdotcex=object@[email protected]$bwdotcex,
bwreccol =object@[email protected]$bwreccol,
bwrecfill= object@[email protected]$bwrecfill,
bwreclty= object@[email protected]$bwreclty,
bwreclwd=object@[email protected]$bwreclwd,
bwumbcol =object@[email protected]$bwumbcol,
bwumblty= object@[email protected]$bwumblty,
bwumblwd= object@[email protected]$bwumblwd,
bwoutcol =object@[email protected]$bwoutcol,
bwoutcex= object@[email protected]$bwoutcex,
bwoutpch= object@[email protected]$bwoutpch,
## Layout parameters
grid = object@[email protected]$grid,
logy = FALSE,
logx = FALSE,
## Force x variables to be continuous
force.x.continuous = TRUE,
## bins
binvar = NULL,
bins = 10,
#xvar = NULL,
...
) {
#cat(x,"\n")
#cat(str(x))
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst)
}
## if lengths disagree, re-read x
if (length(x) != nrow(data)) {
#cat(length(x))
#cat(nrow(data))
for (i in 1:length(names(data))) {
if (names(data)[i] == xvarnam) {
#if (names(data)[i] == binvar) {
x <- as.vector(as.matrix(data[i]))
}
}
#cat(length(x))
#cat(nrow(data))
}
#cat(str(x))
if(force.x.continuous != FALSE) {
if(length(unique(data[subscripts,xvarnam])) <= object@[email protected]) x <- as.factor(x)
}
## Stuff common to both xy and bw
if(grid != "F") {
panel.grid(h = -1, v = -1)
}
y.bw <- xpose.bin(data, binvar, bins)
bwhoriz <- bwhoriz
## Plot the data
if(!is.factor(x) && !bwhoriz) {
trellis.par.set(list(box.rectangle = list(col = bwreccol, fill = bwrecfill, lty = bwreclty, lwd = bwreclwd)))
trellis.par.set(list(box.umbrella = list(col = bwumbcol, lty = bwumblty, lwd = bwumblwd)))
trellis.par.set(list(box.dot = list(col = bwdotcol, cex = bwdotcex, pch = bwdotpch)))
trellis.par.set(list(plot.symbol = list(col = bwoutcol, cex = bwoutcex, pch = bwoutpch)))
try(
if(any(is.null(groups))) {
#cat(length(x))
#cat(length(xpdb5@Data$TIME[xpdb5@Data$WRES!=0]))
#cat(length(y.bw))
panel.bwplot(x, y.bw,
col =bwdotcol,
pch =bwdotpch,
lty =bwreclty,
type =type,
cex = bwdotcex,
varwidth = bwvarwid,
box.ratio = bwratio,
fill = bwrecfill
)
} else {
ord <- order(x)
panel.superpose(x[ord],
y.bw[ord],
subscripts[ord],
col =bwdotcol,
pch =bwdotpch,
cex =bwdotcex,
lty =bwreclty,
type =type,
groups=groups,
varwidth = bwvarwid,
box.ratio = bwratio,
fill = bwrecfill
)
} )
if (ids) {
## Add id-numbers as plot symbols
if(!any(is.null(ids))) {
ids <- ids[subscripts]
addid(x,y,ids=ids,
idsmode=idsmode,
idsext =idsext,
idscex = idscex,
idsdir = idsdir)
}
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.panel.bw.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Default panel function for Xpose 4
#'
#' This is the panel function for Xpose 4. This is not intended to be ised
#' outside the \code{xpose.plot.default} function. Most of the arguments take
#' their default values from xpose.data object but this can be overridden by
#' supplying them as argument to \code{xpose.plot.default}.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param y Name(s) of the y-variable.
#' @param object An xpose.data object.
#' @param subscripts The standard Trellis subscripts argument (see
#' \code{\link[lattice]{xyplot}})
#' @param groups Name of the variable used for superpose plots.
#' @param grp.col Logical value indicating whether or not to use colour
#' highlighting when groups are specified. NULL means no highlighting, while
#' TRUE will identify group members by colour.
#' @param iplot Is this an individual plots matrix? Internal use only.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param xvarnam Character string with the name of the x-variable.
#' @param yvarnam Character string with the name of the y-variable.
#' @param type 1-character string giving the type of plot desired. The
#' following values are possible, for details, see 'plot': '"p"' for points,
#' '"l"' for lines, '"o"' for over-plotted points and lines, '"b"', '"c"') for
#' (empty if '"c"') points joined by lines, '"s"' and '"S"' for stair steps and
#' '"h"' for histogram-like vertical lines. Finally, '"n"' does not produce
#' any points or lines.
#' @param col The color for lines and points. Specified as an integer or a text
#' string. A full list is obtained by the R command \code{colours()}. The
#' default is blue (col=4).
#' @param pch The plotting character, or symbol, to use. Specified as an
#' integer. See R help on \code{\link{points}}. The default is an open circle.
#' @param cex The amount by which plotting text and symbols should be scaled
#' relative to the default. 'NULL' and 'NA' are equivalent to '1.0'.
#' @param lty The line type. Line types can either be specified as an integer
#' (0=blank, 1=solid, 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or
#' as one of the character strings '"blank"', '"solid"', '"dashed"',
#' '"dotted"', '"dotdash"', '"longdash"', or '"twodash"', where '"blank"' uses
#' 'invisible lines' (i.e., doesn't draw them).
#' @param lwd the width for lines. Specified as an integer. The default is 1.
#' @param fill fill for areas in plot
#' @param ids Logical value specifying whether to label data points.
#' @param idsmode Determines the way text labels are added to plots.
#' \code{NULL} means that only extreme points are labelled. Non-\code{NULL}
#' means all data points are labelled. (See \code{link{xpose.plot.default}})
#' @param idsext specifies the extent of the extremes to be used in labelling
#' points. The default is 0.05 (only the most extreme 5\% of points are
#' labelled).
#' @param idscex the amount by which labels should be scaled relative to the
#' default. 'NULL' and 'NA' are equivalent to '1.0'.
#' @param idsdir a string indicating the directions of the extremes to include
#' in labelling. Possible values are "up", "down" and "both".
#' @param abline Vector of arguments to the \code{\link[lattice]{panel.abline}}
#' function. No abline is drawn if \code{NULL}.
#' @param abllwd Line width of any abline.
#' @param abllty Line type of any abline.
#' @param ablcol Line colour of any abline.
#' @param lmline logical variable specifying whether a linear regression line
#' should be superimposed over an \code{\link[lattice]{xyplot}}. \code{NULL} ~
#' FALSE. (\code{y~x})
#' @param lmlwd Line width of the lmline.
#' @param lmlty Line type of the lmline.
#' @param lmcol Line colour of the lmline.
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param smlwd Line width of the x-y smooth.
#' @param smlty Line type of the x-y smooth.
#' @param smcol Line color of the x-y smooth.
#' @param smspan The smoothness parameter for the x-y smooth. The default is
#' 0.667. An argument to \code{\link[lattice]{panel.loess}}.
#' @param smdegr The degree of the polynomials to be used for the x-y smooth,
#' up to 2. The default is 1. An argument to
#' \code{\link[lattice]{panel.loess}}.
#' @param smooth.for.groups Should a smooth for each group be drawn?
#' @param suline A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If non-\code{NULL} then this should be the vector
#' (the same length as y) of data points to be used for the smoothed superposed
#' line.
#' @param sulwd Line width of the superposed smooth.
#' @param sulty Line type of the superposed smooth.
#' @param sucol Line color of the superposed smooth.
#' @param suspan The smoothness parameter. The default is 0.667. An argument to
#' \code{\link[lattice]{panel.loess}}.
#' @param sudegr The degree of the polynomials to be used, up to 2. The default
#' is 1. An argument to \code{\link[lattice]{panel.loess}}.
#' @param grid logical value indicating whether a visual reference grid should
#' be added to the graph. (Could use arguments for line type, color etc).
#' @param logy Logical value indicating whether the y-axis should be
#' logarithmic.
#' @param logx Logical value indicating whether the y-axis should be
#' logarithmic.
#' @param force.x.continuous Logical value indicating whether x-values should
#' be taken as continuous, even if categorical.
#' @param bwhoriz logical value indicating whether box and whiskers should be
#' horizontal or not. The default is FALSE.
#' @param bwratio Ratio of box height to inter-box space. The default is 1.5.
#' An argument for \code{\link[lattice]{panel.bwplot}}.
#' @param bwvarwid Logical. If TRUE, widths of boxplots are proportional to the
#' number of points used in creating it. The default is FALSE. An argument for
#' \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotpch Graphical parameter controlling the dot plotting character
#' in boxplots. 'bwdotpch="|"' is treated specially, by replacing the dot with
#' a line. The default is 16. An argument for
#' \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotcol Graphical parameter controlling the dot colour in boxplots -
#' an integer or string. See 'col'. The default is black. An argument for
#' \code{\link[lattice]{panel.bwplot}}.
#' @param bwdotcex The amount by which plotting text and symbols should be
#' scaled relative to the default in boxplots. 'NULL' and 'NA' are equivalent
#' to '1.0'. An argument for \code{\link[lattice]{panel.bwplot}}.
#' @param bwreccol The colour to use for the box rectangle in boxplots - an
#' integer or string. The default is blue. See
#' \code{\link[lattice]{trellis.par.get}} and "box.rectangle".
#' @param bwrecfill The colour to use for filling the box rectangle in boxplots
#' - an integer or string. The default is transparent (none). See
#' \code{\link[lattice]{trellis.par.get}} and "box.rectangle".
#' @param bwreclty The line type for the box rectangle in boxplots - an integer
#' or string. The default is solid. See \code{\link[lattice]{trellis.par.get}}
#' and "box.rectangle".
#' @param bwreclwd The width of the lines for the box rectangle in boxplots -
#' an integer. The default is 1. See \code{\link[lattice]{trellis.par.get}} and
#' "box.rectangle".
#' @param bwumbcol The colour to use for the umbrellas in boxplots - an integer
#' or string. The default is blue. See \code{\link[lattice]{trellis.par.get}}
#' and "box.umbrella".
#' @param bwumblty The line type for the umbrellas in boxplots - an integer or
#' string. The default is solid.See \code{\link[lattice]{trellis.par.get}} and
#' "box.umbrella".
#' @param bwumblwd the width of the lines for the umbrellas in boxplots - an
#' integer. The default is 1. See \code{\link[lattice]{trellis.par.get}} and
#' "box.umbrella".
#' @param bwoutcol The colour to use for the outliers in boxplots - an integer
#' or string. The default is blue. See \code{\link[lattice]{trellis.par.get}}
#' and "box.symbol".
#' @param bwoutcex The amount by which outlier points should be scaled relative
#' to the default in boxplots. 'NULL' and 'NA' are equivalent to '1.0'. The
#' default is 0.8. See \code{\link[lattice]{trellis.par.get}} and "box.symbol".
#' @param bwoutpch The plotting character, or symbol, to use for outlier points
#' in boxplots. Specified as an integer. See R help on 'points'. The default
#' is an open circle. See \code{\link[lattice]{trellis.par.get}} and
#' "box.symbol".
#' @param PI Either "lines", "area" or "both" specifying whether prediction
#' intervals (as lines, as a shaded area or both) should be computed from the
#' data in \code{SData} and added to the display. \code{NULL} means no
#' prediction interval.
#' @param PI.subset The subset to be used for the PI.
#' @param PI.bin.table The table used to create VPC plots. Has a specific
#' format created by \code{\link{read.npc.vpc.results}}
#' @param PI.real Plot the percentiles of the real data in the various bins.
#' values can be NULL or TRUE. Note that for a bin with few actual
#' observations the percentiles will be approximate. For example, the 95th
#' percentile of 4 data points will always be the largest of the 4 data points.
#' @param PI.mirror Plot the percentiles of one simulated data set in each bin.
#' values allowed are \code{NULL}, \code{TRUE} or \code{AN.INTEGER.VALUE}.
#' \code{TRUE} takes the first mirror from \code{PI.bin.table} and
#' \code{AN.INTEGER.VALUE} can be \code{1, 2, \dots{} n} where \code{n} is the
#' number of mirror's output in the \code{PI.bin.table}. Used mainly by
#' \code{\link{xpose.VPC}}.
#' @param PI.ci Plot the prediction interval of the simulated data's
#' percentiles for each bin. Values can be \code{"both", "area" or "lines"}
#' This can be thought of as a prediction interval about the \code{PI.real} or
#' a confidence interval about the \code{PI}. However, note that with
#' increasing number of simulations the CI will not go towards zero because the
#' interval is also dependent on the size of the data set.
#' @param PPI The plot prediction interval. Has a specific format that must be
#' followed. See \code{\link{setup.PPI}}.
#' @param PI.mean Should the mean be plotted in the VPCs? TRUE or FALSE.
#' @param PI.delta.mean Should the delta mean be plotted in the VPCs? TRUE or
#' FALSE.
#' @param PI.limits A vector of two values that describe the limits of the
#' prediction interval that should be displayed. For example \code{c(0.025,
#' 0.975)}. These limits should be found in the \file{PI.bin.table} table.
#' These limits are also used as the percentages for the \code{PI.real,
#' PI.mirror} and \code{PI.ci}. However, the confidence interval in
#' \code{PI.ci} is always the one defined in the \code{PI.bin.table}.
#' @param PI.arcol The color of the \code{PI} area
#' @param PI.x.median Should the x-location of percentile lines in a bin be
#' marked at the median of the x-values? (\code{TRUE} or \code{FALSE})
#' @param PI.rug Should there be markings on the plot showing where the binning intervals
#' for the VPC are
#' (or the locations of the independent variable used for each VPC calculation if binning is not used)?
#' @param PI.rug.col Color of the PI.rug.
#' @param PI.rug.lwd Linw width of the PI.rug.
#' @param PI.identify.outliers Should outlying percentiles of the real data be highlighted? (TRUE of FALSE)
#' @param PI.outliers.col Color of PI.identify.outliers points
#' @param PI.outliers.pch pch of PI.identify.outliers points
#' @param PI.outliers.cex cex of PI.identify.outliers points
#' @param PI.up.lty The upper line type. can be "dotted" or "dashed", etc.
#' @param PI.up.type The upper type used for plotting. Defaults to a line.
#' @param PI.up.col The upper line color
#' @param PI.up.lwd The upper line width
#' @param PI.down.lty The lower line type. can be "dotted" or "dashed", etc.
#' @param PI.down.type The lower type used for plotting. Defaults to a line.
#' @param PI.down.col The lower line color
#' @param PI.down.lwd The lower line width
#' @param PI.med.lty The median line type. can be "dotted" or "dashed", etc.
#' @param PI.med.type The median type used for plotting. Defaults to a line.
#' @param PI.med.col The median line color
#' @param PI.med.lwd The median line width
#' @param PI.mean.lty The mean line type. can be "dotted" or "dashed", etc.
#' @param PI.mean.type The mean type used for plotting. Defaults to a line.
#' @param PI.mean.col The mean line color
#' @param PI.mean.lwd The mean line width
#' @param PI.delta.mean.lty The delta.mean line type. can be "dotted" or
#' "dashed", etc.
#' @param PI.delta.mean.type The delta.mean type used for plotting. Defaults
#' to a line.
#' @param PI.delta.mean.col The delta.mean line color
#' @param PI.delta.mean.lwd The delta.mean line width
#' @param PI.ci.up.arcol The color of the upper \code{PI.ci}.
#' @param PI.ci.med.arcol The color of the median \code{PI.ci}.
#' @param PI.ci.down.arcol The color of the lower \code{PI.ci}.
#' @param PI.ci.up.lty The upper line type. can be "dotted" or "dashed", etc.
#' @param PI.ci.up.type The upper type used for plotting. Defaults to a line.
#' @param PI.ci.up.col The upper line color
#' @param PI.ci.up.lwd The upper line width
#' @param PI.ci.down.lty The lower line type. can be "dotted" or "dashed", etc.
#' @param PI.ci.down.type The lower type used for plotting. Defaults to a
#' line.
#' @param PI.ci.down.col The lower line color
#' @param PI.ci.down.lwd The lower line width
#' @param PI.ci.med.lty The median line type. can be "dotted" or "dashed", etc.
#' @param PI.ci.med.type The median type used for plotting. Defaults to a
#' line.
#' @param PI.ci.med.col The median line color
#' @param PI.ci.med.lwd The median line width
#' @param PI.ci.mean.arcol The color of the mean \code{PI.ci}.
#' @param PI.ci.mean.lty The mean line type. can be "dotted" or "dashed", etc.
#' @param PI.ci.mean.type The mean type used for plotting. Defaults to a line.
#' @param PI.ci.mean.col The mean line color
#' @param PI.ci.mean.lwd The mean line width
#' @param PI.ci.delta.mean.arcol The color of the delta.mean \code{PI.ci}.
#' @param PI.ci.delta.mean.lty The delta.mean line type. can be "dotted" or
#' "dashed", etc.
#' @param PI.ci.delta.mean.type The delta.mean type used for plotting.
#' Defaults to a line.
#' @param PI.ci.delta.mean.col The delta.mean line color
#' @param PI.ci.delta.mean.lwd The delta.mean line width
#' @param PI.real.up.lty The upper line type. can be "dotted" or "dashed", etc.
#' @param PI.real.up.type The upper type used for plotting. Defaults to a
#' line.
#' @param PI.real.up.col The upper line color
#' @param PI.real.up.lwd The upper line width
#' @param PI.real.down.lty The lower line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.real.down.type The lower type used for plotting. Defaults to a
#' line.
#' @param PI.real.down.col The lower line color
#' @param PI.real.down.lwd The lower line width
#' @param PI.real.med.lty The median line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.real.med.type The median type used for plotting. Defaults to a
#' line.
#' @param PI.real.med.col The median line color
#' @param PI.real.med.lwd The median line width
#' @param PI.real.mean.lty The mean line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.real.mean.type The mean type used for plotting. Defaults to a
#' line.
#' @param PI.real.mean.col The mean line color
#' @param PI.real.mean.lwd The mean line width
#' @param PI.real.delta.mean.lty The delta.mean line type. can be "dotted" or
#' "dashed", etc.
#' @param PI.real.delta.mean.type The delta.mean type used for plotting.
#' Defaults to a line.
#' @param PI.real.delta.mean.col The delta.mean line color
#' @param PI.real.delta.mean.lwd The delta.mean line width
#' @param PI.mirror.up.lty The upper line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.mirror.up.type The upper type used for plotting. Defaults to a
#' line.
#' @param PI.mirror.up.col The upper line color
#' @param PI.mirror.up.lwd The upper line width
#' @param PI.mirror.down.lty The lower line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.mirror.down.type The lower type used for plotting. Defaults to a
#' line.
#' @param PI.mirror.down.col The lower line color
#' @param PI.mirror.down.lwd The lower line width
#' @param PI.mirror.med.lty The median line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.mirror.med.type The median type used for plotting. Defaults to a
#' line.
#' @param PI.mirror.med.col The median line color
#' @param PI.mirror.med.lwd The median line width
#' @param PI.mirror.mean.lty The mean line type. can be "dotted" or "dashed",
#' etc.
#' @param PI.mirror.mean.type The mean type used for plotting. Defaults to a
#' line.
#' @param PI.mirror.mean.col The mean line color
#' @param PI.mirror.mean.lwd The mean line width
#' @param PI.mirror.delta.mean.lty The delta.mean line type. can be "dotted" or
#' "dashed", etc.
#' @param PI.mirror.delta.mean.type The delta.mean type used for plotting.
#' Defaults to a line.
#' @param PI.mirror.delta.mean.col The delta.mean line color
#' @param PI.mirror.delta.mean.lwd The delta.mean line width
#' @param PI.ci.area.smooth Should the "area" for \code{PI.ci} be smoothed to
#' match the "lines" argument? Allowed values are \code{TRUE/FALSE}. The "area"
#' is set by default to show the bins used in the \code{PI.ci} computation. By
#' smoothing, information is lost and, in general, the confidence intervals
#' will be smaller than they are in reality.
#' @param autocorr Is this an autocorrelation plot? Values can be
#' \code{TRUE/FALSE}.
#' @param vline Add a vertical line to the plot at the values specified.
#' @param vllwd Width (lwd) of vertical line
#' @param vllty Line type (lty) for vertical line
#' @param vlcol Color (col) of vertical line
#' @param hline Add a horizontal line to the plot at the values specified.
#' @param hllwd Width (lwd) of horizontal line
#' @param hllty Line type (lty) for horizontal line
#' @param hlcol Color (col) of horizontal line
#' @param pch.ip.sp If there is a panel with just one observation then this
#' specifies the type of points for the DV, IPRED and PRED respectively.
#' @param cex.ip.sp If there is a panel with just one observation then this
#' specifies the size of the points for the DV, IPRED and PRED respectively.
#' @param \dots Other arguments that may be needed in the function.
#' @author E. Niclas Jonsson, Mats Karlsson, Justin Wilkins and Andrew Hooker
#' @seealso \code{xpose.data-class}, Cross-references above.
#' @keywords methods
#' @export xpose.panel.default
"xpose.panel.default" <-
function(x, y,object,
subscripts,
groups = object@Prefs@Xvardef$id,
grp.col = NULL,
iplot = NULL,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL,
xvarnam = NULL,
yvarnam = NULL,
##xp.xlim = NULL,
##xp.ylim = NULL,
###############################
## Prediction interval settings
###############################
PI = NULL,
PI.subset=NULL,
PI.bin.table=NULL,
PI.real=NULL, # can be NULL/TRUE
PI.mirror=NULL,
PI.ci = NULL,
PPI = NULL,
PI.mean = FALSE, # Should the mean y be plotted in the VPCs
PI.delta.mean = FALSE, # Should the delta mean be plotted in the VPCs
PI.x.median = TRUE,
PI.rug = "Default",
PI.rug.col = "orange",
PI.rug.lwd = 3,
PI.identify.outliers = TRUE,
PI.outliers.col = "red",
PI.outliers.pch = 8,
PI.outliers.cex = 1,
PI.limits= c(0.025, 0.975),#object@[email protected]$PI.limits,
PI.arcol = "lightgreen",#object@[email protected]$PI.arcol,
PI.up.lty = 2,#object@[email protected]$PI.up.lty,
PI.up.type = "l",#object@[email protected]$PI.up.type,
PI.up.col = "black",#object@[email protected]$PI.up.col,
PI.up.lwd = 2,#object@[email protected]$PI.up.lwd,
PI.down.lty = 2,#object@[email protected]$PI.down.lty,
PI.down.type = "l",#object@[email protected]$PI.down.type,
PI.down.col = "black",#object@[email protected]$PI.down.col,
PI.down.lwd = 2,#object@[email protected]$PI.down.lwd,
PI.med.lty = 1,#object@[email protected]$PI.med.lty,
PI.med.type = "l",#object@[email protected]$PI.med.type,
PI.med.col = "black",#object@[email protected]$PI.med.col,
PI.med.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.mean.lty = 3,#object@[email protected]$PI.med.lty,
PI.mean.type = "l",#object@[email protected]$PI.med.type,
PI.mean.col = "black",#object@[email protected]$PI.med.col,
PI.mean.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.delta.mean.lty = 3,#object@[email protected]$PI.med.lty,
PI.delta.mean.type = "l",#object@[email protected]$PI.med.type,
PI.delta.mean.col = "black",#object@[email protected]$PI.med.col,
PI.delta.mean.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.real.up.lty = 2,#object@[email protected]$PI.real.up.lty,
PI.real.up.type = "l",#object@[email protected]$PI.real.up.type,
PI.real.up.col = "red",#object@[email protected]$PI.real.up.col,
PI.real.up.lwd = 2,#object@[email protected]$PI.real.up.lwd,
PI.real.down.lty = 2,#object@[email protected]$PI.real.down.lty,
PI.real.down.type = "l",#object@[email protected]$PI.real.down.type,
PI.real.down.col = "red",#object@[email protected]$PI.real.down.col,
PI.real.down.lwd = 2,#object@[email protected]$PI.real.down.lwd,
PI.real.med.lty = 1,#object@[email protected]$PI.real.med.lty,
PI.real.med.type = "l",#object@[email protected]$PI.real.med.type,
PI.real.med.col = "red",#object@[email protected]$PI.real.med.col,
PI.real.med.lwd = 2,#object@[email protected]$PI.real.med.lwd,
PI.real.mean.lty = 3,#object@[email protected]$PI.real.med.lty,
PI.real.mean.type = "l",#object@[email protected]$PI.real.med.type,
PI.real.mean.col = "red",#object@[email protected]$PI.real.med.col,
PI.real.mean.lwd = 2,#object@[email protected]$PI.real.med.lwd,
PI.real.delta.mean.lty = 3,#object@[email protected]$PI.real.med.lty,
PI.real.delta.mean.type = "l",#object@[email protected]$PI.real.med.type,
PI.real.delta.mean.col = "red",#object@[email protected]$PI.real.med.col,
PI.real.delta.mean.lwd = 2,#object@[email protected]$PI.real.med.lwd,
PI.mirror.up.lty = 2,#object@[email protected]$PI.mirror.up.lty,
PI.mirror.up.type = "l",#object@[email protected]$PI.mirror.up.type,
PI.mirror.up.col = "darkgreen",#object@[email protected]$PI.mirror.up.col,
PI.mirror.up.lwd = 1,#object@[email protected]$PI.mirror.up.lwd,
PI.mirror.down.lty = 2,#object@[email protected]$PI.mirror.down.lty,
PI.mirror.down.type = "l",#object@[email protected]$PI.mirror.down.type,
PI.mirror.down.col = "darkgreen",#object@[email protected]$PI.mirror.down.col,
PI.mirror.down.lwd = 1,#object@[email protected]$PI.mirror.down.lwd,
PI.mirror.med.lty = 1,#object@[email protected]$PI.mirror.med.lty,
PI.mirror.med.type = "l",#object@[email protected]$PI.mirror.med.type,
PI.mirror.med.col = "darkgreen",#object@[email protected]$PI.mirror.med.col,
PI.mirror.med.lwd = 1,#object@[email protected]$PI.mirror.med.lwd,
PI.mirror.mean.lty = 3,#object@[email protected]$PI.mirror.med.lty,
PI.mirror.mean.type = "l",#object@[email protected]$PI.mirror.med.type,
PI.mirror.mean.col = "darkgreen",#object@[email protected]$PI.mirror.med.col,
PI.mirror.mean.lwd = 1,#object@[email protected]$PI.mirror.med.lwd,
PI.mirror.delta.mean.lty = 3,#object@[email protected]$PI.mirror.med.lty,
PI.mirror.delta.mean.type = "l",#object@[email protected]$PI.mirror.med.type,
PI.mirror.delta.mean.col = "darkgreen",#object@[email protected]$PI.mirror.med.col,
PI.mirror.delta.mean.lwd = 1,#object@[email protected]$PI.mirror.med.lwd,
PI.ci.up.arcol = "blue",
PI.ci.up.lty = 3,#object@[email protected]$PIuplty,
PI.ci.up.type = "l",#object@[email protected]$PIuptyp,
PI.ci.up.col = "darkorange",#object@[email protected]$PI.up.col,
PI.ci.up.lwd = 2,#object@[email protected]$PI.up.lwd,
PI.ci.down.arcol = "blue",
PI.ci.down.lty = 3,#object@[email protected]$PIdolty,
PI.ci.down.type = "l",#object@[email protected]$PIdotyp,
PI.ci.down.col = "darkorange",#object@[email protected]$PI.down.col,
PI.ci.down.lwd = 2,#object@[email protected]$PI.down.lwd,
PI.ci.med.arcol = "red",
PI.ci.med.lty = 4,#object@[email protected]$PImelty,
PI.ci.med.type = "l",#object@[email protected]$PImetyp,
PI.ci.med.col = "darkorange",#object@[email protected]$PI.med.col,
PI.ci.med.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.ci.mean.arcol = "purple",
PI.ci.mean.lty = 4,#object@[email protected]$PImelty,
PI.ci.mean.type = "l",#object@[email protected]$PImetyp,
PI.ci.mean.col = "darkorange",#object@[email protected]$PI.med.col,
PI.ci.mean.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.ci.delta.mean.arcol = "purple",
PI.ci.delta.mean.lty = 4,#object@[email protected]$PImelty,
PI.ci.delta.mean.type = "l",#object@[email protected]$PImetyp,
PI.ci.delta.mean.col = "darkorange",#object@[email protected]$PI.med.col,
PI.ci.delta.mean.lwd = 2,#object@[email protected]$PI.med.lwd,
PI.ci.area.smooth=FALSE,
###############################
## end of PI settings
###############################
## Basic plot characteristics
type = object@[email protected]$type,
col = object@[email protected]$col,
pch = object@[email protected]$pch,
cex = object@[email protected]$cex,
lty = object@[email protected]$lty,
lwd = object@[email protected]$lwd,
fill = object@[email protected]$fill,
## Text label setting
ids = NULL,
idsmode=object@[email protected]$idsmode,
idsext =object@[email protected]$idsext,
idscex= object@[email protected]$idscex,
idsdir= object@[email protected]$idsdir,
## abline settings
abline= object@[email protected]$abline,
abllwd= object@[email protected]$abllwd,
abllty= object@[email protected]$abllty,
ablcol= object@[email protected]$ablcol,
smooth= object@[email protected]$smooth,
smlwd = object@[email protected]$smlwd,
smlty = object@[email protected]$smlty,
smcol = object@[email protected]$smcol,
smspan= object@[email protected]$smspan,
smdegr= object@[email protected]$smdegr,
smooth.for.groups=NULL,
lmline= object@[email protected]$lmline,
lmlwd = object@[email protected]$lmlwd ,
lmlty = object@[email protected]$lmlty ,
lmcol = object@[email protected]$lmcol ,
suline = object@[email protected]$suline,
sulwd = object@[email protected]$sulwd ,
sulty = object@[email protected]$sulty ,
sucol = object@[email protected]$sucol ,
suspan = object@[email protected]$suspan,
sudegr = object@[email protected]$sudegr,
## Layout parameters
grid = object@[email protected]$grid,
logy = FALSE,
logx = FALSE,
## Force x variables to be continuous
force.x.continuous = FALSE,
## Categorcal x-variable
bwhoriz = object@[email protected]$bwhoriz,
bwratio = object@[email protected]$bwratio,
bwvarwid = object@[email protected]$bwvarwid,
bwdotpch = object@[email protected]$bwdotpch,
bwdotcol = object@[email protected]$bwdotcol,
bwdotcex = object@[email protected]$bwdotcex,
bwreccol = object@[email protected]$bwreccol,
bwrecfill= object@[email protected]$bwrecfill,
bwreclty = object@[email protected]$bwreclty,
bwreclwd = object@[email protected]$bwreclwd,
bwumbcol = object@[email protected]$bwumbcol,
bwumblty = object@[email protected]$bwumblty,
bwumblwd = object@[email protected]$bwumblwd,
bwoutcol = object@[email protected]$bwoutcol,
bwoutcex = object@[email protected]$bwoutcex,
bwoutpch = object@[email protected]$bwoutpch,
autocorr=FALSE,
## vline settings
vline= NULL,#object@[email protected]$abline,
vllwd= 3,#object@[email protected]$abllwd,
vllty= 2,#object@[email protected]$abllty,
vlcol= "grey",#object@[email protected]$ablcol,
## hline settings
hline= NULL,#object@[email protected]$abline,
hllwd= 3,#object@[email protected]$abllwd,
hllty= 1,#object@[email protected]$abllty,
hlcol= "grey",#object@[email protected]$ablcol,
#data,
pch.ip.sp=pch, # ind.plots single point per individual
cex.ip.sp=cex, # ind.plots single point per individual
...
) {
## data should already be passed to the function at this point
## this should be changed so that we just use the data passed form the
## plotting function
## if(!is.null(samp)) {
## data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,samp=samp)
## } else {
## data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst)
## }
#if(force.x.continuous == FALSE) {
# if(length(unique(data[subscripts,xvarnam])) <= object@[email protected]) x <- as.factor(x)
#}
## Compute and plot prediction areas if requested.
## This needs to be performed here for the area to appear at
## the bottom of the rest.
if(!is.null(PI) |
!is.null(PI.real) |
!is.null(PI.mirror) |
!is.null(PI.ci)
){
if(is.null(PI.bin.table)){
if(is.null(PPI)){
PPI <- computePI(xvarnam,yvarnam,object,logy=logy,logx=logx,limits=PI.limits,
onlyfirst=onlyfirst,inclZeroWRES=inclZeroWRES,PI.subset,subscripts)
}
} else {
if(!is.null(dim(PI.bin.table))){ # there is only one table and no conditioning
tmp.table <- PI.bin.table
} else { # There is a stratification variable
tmp.table <- find.right.table(object,inclZeroWRES,onlyfirst,samp,PI.subset,
subscripts=subscripts,PI.bin.table,
panel.number=panel.number(),...)
if (is.null(tmp.table)){
cat(paste("No strata in VPC file found to\n"))
cat(paste(" match conditioning variables\n"))
cat(paste("\n"))
return()
}
}
## now set up PPI table
PPI <- setup.PPI(PI.limits,PI.mirror,tmp.table,...)
}
XU <- PPI$Xupper
XL <- PPI$Xlower
YU <- PPI$upper
YL <- PPI$lower
if(length(grep("mean",names(PPI)))!=0) Ymean <- PPI$mean
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.mean <- PPI$delta.mean
Ymed <- PPI$median
YUU <- PPI$upper.ci.upper
YUL <- PPI$upper.ci.lower
YLU <- PPI$lower.ci.upper
YLL <- PPI$lower.ci.lower
YMU <- PPI$median.ci.upper
YML <- PPI$median.ci.lower
if(length(grep("mean",names(PPI)))!=0){
YmeanU <- PPI$mean.ci.upper
YmeanL <- PPI$mean.ci.lower
}
if(length(grep("delta.mean",names(PPI)))!=0){
Ydelta.meanU <- PPI$delta.mean.ci.upper
Ydelta.meanL <- PPI$delta.mean.ci.lower
}
YUR <- PPI$real.upper
YLR <- PPI$real.lower
YmedR <- PPI$real.median
if(length(grep("mean",names(PPI)))!=0) YmeanR <- PPI$real.mean
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.meanR <- PPI$real.delta.mean
if (!is.null(PI.mirror)) {
YUM <- PPI[grep("mirror.*upper",names(PPI))]
YLM <- PPI[grep("mirror.*lower",names(PPI))]
YmedM <- PPI[grep("mirror.*median",names(PPI))]
if(length(grep("mean",names(PPI)))!=0) YmeanM <- PPI[grep("mirror.*mean",names(PPI))]
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.meanM <- PPI[grep("mirror.*delta.mean",names(PPI))]
#YUM <- PPI[mir.names.upper]
#YLM <- PPI[mir.names.lower]
#YmedM <- PPI[mir.names.median]
}
}
if((!is.null(PI) && (PI=="area" | PI=="both")) |
(!is.null(PI.ci) && (PI.ci=="area" | PI.ci=="both"))) {
poly <- get.polygon.regions(PPI,PI.mirror,...)
if (!is.null(PI) && (PI=="area" | PI=="both")){
pi.x.recs <- poly$x.recs
pi.y.recs <- poly$y.recs
if(logx) {
tmp <- is.nan(pi.x.recs)
pi.x.recs <- log10(pi.x.recs)
tmp2 <- is.nan(pi.x.recs)
if(any(tmp!=tmp2)){
cat(paste("The prediction interval on the x-axis goes below zero.",
"This means that taking the log of this prediction",
"interval gives non-real numbers.",
"The plot will not be created.\n",sep="\n"))
return(NULL)
}
}
if(logy) {
tmp <- is.nan(pi.y.recs)
pi.y.recs <- log10(pi.y.recs)
tmp2 <- is.nan(pi.y.recs)
if(any(tmp!=tmp2)){
cat(paste("The prediction interval on the y-axis goes below zero.",
"This means that taking the log of this prediction",
"interval gives non-real numbers.",
"The plot will not be created.\n",sep="\n"))
return(NULL)
}
}
grid.polygon(pi.x.recs,pi.y.recs,
default.units="native",
gp=gpar(fill=PI.arcol,col=NULL,lty=0))
}
if (!is.null(PI.ci) && (PI.ci=="area" | PI.ci=="both")){
if(PI.ci.area.smooth){
if(all(is.na(XL))){
XM <- XU
} else {
XM <- (XL+XU)/2
if(PI.x.median){
XM <- mapply(function(xl,xu,x) median(x[x<=xu & x>xl]),XL,XU,MoreArgs=list(x))
XM[1] <- median(x[x<=XU[1] & x>=XL[1]])
}
XM <- c(XL[1],XM,XU[length(XU)])
}
xrecs <- c(XM,rev(XM))
y.up.recs <- c(PPI$upper.ci.upper[1],
PPI$upper.ci.upper,
PPI$upper.ci.upper[dim(PPI)[1]],
PPI$upper.ci.lower[dim(PPI)[1]],
rev(PPI$upper.ci.lower),
PPI$upper.ci.lower[1]
)
y.down.recs <- c(PPI$lower.ci.upper[1],
PPI$lower.ci.upper,
PPI$lower.ci.upper[dim(PPI)[1]],
PPI$lower.ci.lower[dim(PPI)[1]],
rev(PPI$lower.ci.lower),
PPI$lower.ci.lower[1]
)
y.med.recs <- c(PPI$median.ci.upper[1],
PPI$median.ci.upper,
PPI$median.ci.upper[dim(PPI)[1]],
PPI$median.ci.lower[dim(PPI)[1]],
rev(PPI$median.ci.lower),
PPI$median.ci.lower[1]
)
if(length(grep("mean",names(PPI)))!=0){
y.mean.recs <- c(PPI$mean.ci.upper[1],
PPI$mean.ci.upper,
PPI$mean.ci.upper[dim(PPI)[1]],
PPI$mean.ci.lower[dim(PPI)[1]],
rev(PPI$mean.ci.lower),
PPI$mean.ci.lower[1]
)
}
if(length(grep("delta.mean",names(PPI)))!=0){
y.delta.mean.recs <- c(PPI$delta.mean.ci.upper[1],
PPI$delta.mean.ci.upper,
PPI$delta.mean.ci.upper[dim(PPI)[1]],
PPI$delta.mean.ci.lower[dim(PPI)[1]],
rev(PPI$delta.mean.ci.lower),
PPI$delta.mean.ci.lower[1]
)
}
} else {
xrecs <- poly$x.recs
y.up.recs <- poly$y.up.recs
y.down.recs <- poly$y.down.recs
y.med.recs <- poly$y.med.recs
if(length(grep("mean",names(PPI)))!=0){
y.mean.recs <- poly$y.mean.recs
}
if(length(grep("delta.mean",names(PPI)))!=0){
y.delta.mean.recs <- poly$y.delta.mean.recs
}
}
if (logx){
tmp <- is.nan(xrecs)
xrecs <- log10(xrecs)
tmp2 <- is.nan(xrecs)
if(any(tmp!=tmp2)){
cat(paste("The PI.ci on the x-axis goes below zero.",
"This means that taking the log of this prediction",
"interval gives non-real numbers.",
"The plot will not be created.\n",sep="\n"))
return(NULL)
}
}
if(logy){
tmp <- is.nan(c(y.up.recs,y.down.recs,y.med.recs))
if(length(grep("mean",names(PPI)))!=0) tmp <- is.nan(c(y.up.recs,y.down.recs,y.med.recs,y.mean.recs))
if(length(grep("delta.mean",names(PPI)))!=0) tmp <- is.nan(c(y.up.recs,y.down.recs,y.med.recs,y.delta.mean.recs))
y.up.recs <- log10(y.up.recs)
y.down.recs <- log10(y.down.recs)
y.med.recs <- log10(y.med.recs)
if(length(grep("mean",names(PPI)))!=0) y.mean.recs <- log10(y.mean.recs)
if(length(grep("delta.mean",names(PPI)))!=0) y.delta.mean.recs <- log10(y.delta.mean.recs)
tmp2 <- is.nan(c(y.up.recs,y.down.recs,y.med.recs))
if(length(grep("mean",names(PPI)))!=0) tmp2 <- is.nan(c(y.up.recs,y.down.recs,y.med.recs, y.mean.recs))
if(length(grep("delta.mean",names(PPI)))!=0) tmp2 <- is.nan(c(y.up.recs,y.down.recs,y.med.recs, y.delta.mean.recs))
if(any(tmp!=tmp2)){
cat(paste("The PI.ci on the y-axis goes below zero.",
"This means that taking the log of this prediction",
"interval gives non-real numbers.",
"The plot will not be created.\n",sep="\n"))
return(NULL)
}
}
grid.polygon(xrecs,y.up.recs,
default.units="native",
gp=gpar(fill=PI.ci.up.arcol,alpha=0.3,col=NULL,lty=0)
)
grid.polygon(xrecs,y.down.recs,
default.units="native",
gp=gpar(fill=PI.ci.down.arcol,alpha=0.3,col=NULL,lty=0)
)
grid.polygon(xrecs,y.med.recs,
default.units="native",
gp=gpar(fill=PI.ci.med.arcol,alpha=0.3,col=NULL,lty=0)
)
if(PI.mean){
if(length(grep("mean",names(PPI)))!=0){
grid.polygon(xrecs,y.mean.recs,
default.units="native",
gp=gpar(fill=PI.ci.mean.arcol,alpha=0.3,col=NULL,lty=0)
)
}
}
if(PI.delta.mean){
if(length(grep("delta.mean",names(PPI)))!=0){
grid.polygon(xrecs,y.delta.mean.recs,
default.units="native",
gp=gpar(fill=PI.ci.delta.mean.arcol,alpha=0.3,col=NULL,lty=0)
)
}
}
## grid.polygon(poly$x.recs,poly$y.up.recs,
## default.units="native",
## gp=gpar(fill=PI.ci.up.arcol,alpha=0.3,col=NULL,lty=0)
## )
## grid.polygon(poly$x.recs,poly$y.down.recs,
## default.units="native",
## gp=gpar(fill=PI.ci.down.arcol,alpha=0.3,col=NULL,lty=0)
## )
## grid.polygon(poly$x.recs,poly$y.med.recs,
## default.units="native",
## gp=gpar(fill=PI.ci.med.arcol,alpha=0.3,col=NULL,lty=0)
## )
}
} # end of make polygon
## Stuff common to both xy and bw
if(grid != FALSE) {
panel.grid(h = -1, v = -1)
}
## Line of "identity"
if(!is.null(abline)) {
panel.abline(abline,col=ablcol,lwd=abllwd,lty=abllty)
}
## vertical Line
if(!is.null(vline)) {
panel.abline(v=vline,col=vlcol,lwd=vllwd,lty=vllty)
}
## Horizontal Line
if(!is.null(hline)) {
panel.abline(h=hline,col=hlcol,lwd=hllwd,lty=hllty)
}
## for autocorrelation
if(autocorr){
auto.ids <- unique(groups)
auto.n <- 0
xplt1 <- 0
xplt2 <- 0
xgrps <- 0
for(i in 1:length(auto.ids)) {
seli <- groups == auto.ids[i]
nobs <- length(x[seli])
xplt <- matrix(x[seli], 1, nobs)
if(nobs > 1) {
for(j in 1:(nobs - 1)) {
auto.n <- auto.n + 1
xplt1[auto.n] <- xplt[1, j]
xplt2[auto.n] <- xplt[1, j + 1]
xgrps[auto.n] <- auto.ids[i]
}
}
}
x <- xplt1
y <- xplt2
groups <- xgrps
}
## Plot the data
if(!is.factor(x) && !bwhoriz) {
if(any(is.null(groups))) {
panel.xyplot(x,y,
col =col,
pch =pch,
lty =lty,
type =type,
cex = cex,
lwd = lwd,
fill = fill
)
} else {
ord <- order(x)
if((any(!is.null(iplot))) || (is.null(grp.col))) {
if(length(x)==3){
# pch[2]=pch.ip.sp[2]
# pch[3]=pch.ip.sp[3]
# pch[1]=pch.ip.sp[1]
# cex[3]=cex.ip.sp[3]
# cex[2]=cex.ip.sp[2]
# cex[1]=cex.ip.sp[1]
pch=pch.ip.sp
cex=cex.ip.sp
}
panel.superpose(x[ord],
y[ord],
subscripts[ord],
col =col,
pch =pch,
cex = cex,
lty =lty,
type =type,
lwd = lwd,
groups=groups,
fill = fill
)
} else {
panel.superpose(x[ord],
y[ord],
subscripts[ord],
#col =col,
pch =pch,
cex = cex,
lty =lty,
type =type,
lwd = lwd,
groups=groups,
fill=fill
)
}
}
## Add a loess smooth?
if(!any(is.null(smooth))) {
if(!is.factor(y)){
if(!any(is.null(smooth.for.groups)) && !any(is.null(groups))) {
panel.superpose(x,y,subscripts,groups=groups,
span = smspan,
degree= smdegr,
col = smcol,
lwd = smlwd,
lty = smlty,
panel.groups="panel.loess")
} else {
panel.loess(x,y,
span = smspan, # can change this to 0.75 to match R
degree= smdegr,
col = smcol,
lwd = smlwd,
lty = smlty
)
}
} else { # y is a factor
## panel.linejoin(x, y, fun = median, horizontal = TRUE,
## lwd=smlwd, lty=smlty, col=smcol,
## col.line=smcol, type=smlty,
## ...)
}
}
## Add a lm line?
if(!any(is.null(lmline))) {
panel.abline(lm(y~x),
col = lmcol,
lwd = lmlwd,
lty = lmlty
)
}
## Add a superpose smooth?
if(!any(is.null(suline))) {
ys <- suline[subscripts]
xs <- x
if(logy) ys <- log10(ys)
if(logx) xs <- log10(xs)
panel.loess(xs,ys,
span = suspan,
degree= sudegr,
col = sucol,
lwd = sulwd,
lty = sulty
)
}
## Add id-numbers as plot symbols
if(!any(is.null(ids))) {
if (!is.factor(y)){
ids <- ids[subscripts]
addid(x,y,ids=ids,
idsmode=idsmode,
idsext =idsext,
idscex = idscex,
idsdir = idsdir)
}
}
## Compute and plot prediction intervals if requested.
## This needs to be performed here for the lines to appear on
## top of the rest.
if(!is.null(PI) && (PI=="lines" | PI=="both")) {
if(all(is.na(XL))){
XM <- XU
} else {
XM <- (XL+XU)/2
if(PI.x.median){
XM <- mapply(function(xl,xu,x) median(x[x<=xu & x>xl]),XL,XU,MoreArgs=list(x))
XM[1] <- median(x[x<=XU[1] & x>=XL[1]])
}
}
if(logx) XM <- log10(XM)
if(logy){
YU <- log10(YU)
YL <- log10(YL)
Ymed <- log10(Ymed)
if(length(grep("mean",names(PPI)))!=0) Ymean <- log10(Ymean)
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.mean <- log10(Ydelta.mean)
}
panel.lines(XM,YU,type=PI.up.type,lty=PI.up.lty,col=PI.up.col,lwd=PI.up.lwd)
panel.lines(XM,YL,type=PI.down.type,lty=PI.down.lty,col=PI.down.col,lwd=PI.down.lwd)
panel.lines(XM,Ymed,type=PI.med.type,lty=PI.med.lty,col=PI.med.col,lwd=PI.med.lwd)
if(PI.mean){
if(length(grep("mean",names(PPI)))!=0){
panel.lines(XM,Ymean,type=PI.mean.type,lty=PI.mean.lty,col=PI.mean.col,lwd=PI.mean.lwd)
}
}
if(PI.delta.mean){
if(length(grep("delta.mean",names(PPI)))!=0){
panel.lines(XM,Ydelta.mean,type=PI.delta.mean.type,lty=PI.delta.mean.lty,col=PI.delta.mean.col,lwd=PI.delta.mean.lwd)
}
}
}
if(!is.null(PI.real)) {
if(all(is.na(XL))){
XM <- XU
} else {
XM <- (XL+XU)/2
if(PI.x.median){
XM <- mapply(function(xl,xu,x) median(x[x<=xu & x>xl]),XL,XU,MoreArgs=list(x))
XM[1] <- median(x[x<=XU[1] & x>=XL[1]])
}
}
if(logx) XM <- log10(XM)
if(logy){
YUR <- log10(YUR)
YLR <- log10(YLR)
YmedR <- log10(YmedR)
if(length(grep("mean",names(PPI)))!=0) YmeanR <- log10(YmeanR)
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.meanR <- log10(Ydelta.meanR)
}
panel.lines(XM,YUR,type=PI.real.up.type,lty=PI.real.up.lty,col=PI.real.up.col,lwd=PI.real.up.lwd)
panel.lines(XM,YLR,type=PI.real.down.type,lty=PI.real.down.lty,col=PI.real.down.col,lwd=PI.real.down.lwd)
panel.lines(XM,YmedR,type=PI.real.med.type,lty=PI.real.med.lty,col=PI.real.med.col,lwd=PI.real.med.lwd)
if(PI.identify.outliers){
if(logy){
out_select_med <- YmedR > log10(PPI$median.ci.upper) | YmedR < log10(PPI$median.ci.lower)
} else {
out_select_med <- YmedR > PPI$median.ci.upper | YmedR < PPI$median.ci.lower
}
panel.points(XM[out_select_med],YmedR[out_select_med],col=PI.outliers.col,pch=PI.outliers.pch,cex=PI.outliers.cex)
if(logy){
out_select_up <- YUR > log10(PPI$upper.ci.upper) | YUR < log10(PPI$upper.ci.lower)
} else {
out_select_up <- YUR > PPI$upper.ci.upper | YUR < PPI$upper.ci.lower
}
panel.points(XM[out_select_up],YUR[out_select_up],col=PI.outliers.col,pch=PI.outliers.pch,cex=PI.outliers.cex)
if(logy){
out_select_down <- YLR > log10(PPI$lower.ci.upper) | YLR < log10(PPI$lower.ci.lower)
} else {
out_select_down <- YLR > PPI$lower.ci.upper | YLR < PPI$lower.ci.lower
}
panel.points(XM[out_select_down],YLR[out_select_down],col=PI.outliers.col,pch=PI.outliers.pch,cex=PI.outliers.cex)
}
if(PI.mean){
if(length(grep("mean",names(PPI)))!=0){
panel.lines(XM,YmeanR,type=PI.real.mean.type,lty=PI.real.mean.lty,col=PI.real.mean.col,lwd=PI.real.mean.lwd)
if(PI.identify.outliers){
if(logy){
out_select_mean <- YmeanR > log10(PPI$mean.ci.upper) | YmeanR < log10(PPI$mean.ci.lower)
} else {
out_select_mean <- YmeanR > PPI$mean.ci.upper | YmeanR < PPI$mean.ci.lower
}
panel.points(XM[out_select_mean],YmeanR[out_select_mean],col=PI.outliers.col,pch=PI.outliers.pch,cex=PI.outliers.cex)
}
}
}
if(PI.delta.mean){
if(length(grep("delta.mean",names(PPI)))!=0){
panel.lines(XM,Ydelta.meanR,type=PI.real.delta.mean.type,lty=PI.real.delta.mean.lty,col=PI.real.delta.mean.col,lwd=PI.real.delta.mean.lwd)
if(PI.identify.outliers){
if(logy){
out_select_dmean <- Ydelta.meanR > log10(PPI$delta.mean.ci.upper) | log10(Ydelta.meanR < PPI$delta.mean.ci.lower)
} else {
out_select_dmean <- Ydelta.meanR > PPI$delta.mean.ci.upper | Ydelta.meanR < PPI$delta.mean.ci.lower
}
panel.points(XM[out_select_dmean],YmeanR[out_select_dmean],col=PI.outliers.col,pch=PI.outliers.pch,cex=PI.outliers.cex)
}
}
}
}
if(!is.null(PI.ci) && (PI.ci=="lines" | PI.ci=="both")) {
if(all(is.na(XL))){
XM <- XU
} else {
XM <- (XL+XU)/2
if(PI.x.median){
XM <- mapply(function(xl,xu,x) median(x[x<=xu & x>xl]),XL,XU,MoreArgs=list(x))
XM[1] <- median(x[x<=XU[1] & x>=XL[1]])
}
}
upper.ci.upper <- PPI$upper.ci.upper
upper.ci.lower <- PPI$upper.ci.lower
lower.ci.upper <- PPI$lower.ci.upper
lower.ci.lower <- PPI$lower.ci.lower
median.ci.upper <- PPI$median.ci.upper
median.ci.lower <- PPI$median.ci.lower
if(length(grep("mean",names(PPI)))!=0){
mean.ci.upper <- PPI$mean.ci.upper
mean.ci.lower <- PPI$mean.ci.lower
}
if(length(grep("delta.mean",names(PPI)))!=0){
delta.mean.ci.upper <- PPI$delta.mean.ci.upper
delta.mean.ci.lower <- PPI$delta.mean.ci.lower
}
if(logx) XM <- log10(XM)
if(logy){
upper.ci.upper <- log10(upper.ci.upper)
upper.ci.lower <- log10(upper.ci.lower)
lower.ci.upper <- log10(lower.ci.upper)
lower.ci.lower <- log10(lower.ci.lower)
median.ci.upper <- log10(median.ci.upper)
median.ci.lower <- log10(median.ci.lower)
if(length(grep("mean",names(PPI)))!=0){
mean.ci.upper <- log10(mean.ci.upper)
mean.ci.lower <- log10(mean.ci.lower)
}
if(length(grep("delta.mean",names(PPI)))!=0){
delta.mean.ci.upper <- log10(delta.mean.ci.upper)
delta.mean.ci.lower <- log10(delta.mean.ci.lower)
}
}
panel.lines(XM,upper.ci.upper,type=PI.ci.up.type,lty=PI.ci.up.lty,col=PI.ci.up.col,lwd=PI.ci.up.lwd)
panel.lines(XM,upper.ci.lower,type=PI.ci.up.type,lty=PI.ci.up.lty,col=PI.ci.up.col,lwd=PI.ci.up.lwd)
panel.lines(XM,lower.ci.upper,type=PI.ci.down.type,lty=PI.ci.down.lty,col=PI.ci.down.col,lwd=PI.ci.down.lwd)
panel.lines(XM,lower.ci.lower,type=PI.ci.down.type,lty=PI.ci.down.lty,col=PI.ci.down.col,lwd=PI.ci.down.lwd)
panel.lines(XM,median.ci.upper,type=PI.ci.med.type,lty=PI.ci.med.lty,col=PI.ci.med.col,lwd=PI.ci.med.lwd)
panel.lines(XM,median.ci.lower,type=PI.ci.med.type,lty=PI.ci.med.lty,col=PI.ci.med.col,lwd=PI.ci.med.lwd)
if(PI.mean){
if(length(grep("mean",names(PPI)))!=0){
panel.lines(XM,mean.ci.upper,type=PI.ci.mean.type,lty=PI.ci.mean.lty,col=PI.ci.mean.col,lwd=PI.ci.mean.lwd)
panel.lines(XM,mean.ci.lower,type=PI.ci.mean.type,lty=PI.ci.mean.lty,col=PI.ci.mean.col,lwd=PI.ci.mean.lwd)
}
}
if(PI.delta.mean){
if(length(grep("delta.mean",names(PPI)))!=0){
panel.lines(XM,delta.mean.ci.upper,type=PI.ci.delta.mean.type,lty=PI.ci.delta.mean.lty,col=PI.ci.delta.mean.col,lwd=PI.ci.delta.mean.lwd)
panel.lines(XM,delta.mean.ci.lower,type=PI.ci.delta.mean.type,lty=PI.ci.delta.mean.lty,col=PI.ci.delta.mean.col,lwd=PI.ci.delta.mean.lwd)
}
}
}
if(!is.null(PI.mirror)) {
if(all(is.na(XL))){
XM <- XU
} else {
XM <- (XL+XU)/2
if(PI.x.median){
XM <- mapply(function(xl,xu,x) median(x[x<=xu & x>xl]),XL,XU,MoreArgs=list(x))
XM[1] <- median(x[x<=XU[1] & x>=XL[1]])
}
}
if(logx) XM <- log10(XM)
if(logy){
YUM <- log10(YUM)
YLM <- log10(YLM)
YmedM <- log10(YmedM)
if(length(grep("mean",names(PPI)))!=0) YmeanM <- log10(YmeanM)
if(length(grep("delta.mean",names(PPI)))!=0) Ydelta.meanM <- log10(Ydelta.meanM)
}
for(jj in 1:PI.mirror){
panel.lines(XM,YUM[[jj]],type=PI.mirror.up.type,lty=PI.mirror.up.lty,col=PI.mirror.up.col,lwd=PI.mirror.up.lwd)
panel.lines(XM,YLM[[jj]],type=PI.mirror.down.type,lty=PI.mirror.down.lty,col=PI.mirror.down.col,lwd=PI.mirror.down.lwd)
panel.lines(XM,YmedM[[jj]],type=PI.mirror.med.type,lty=PI.mirror.med.lty,col=PI.mirror.med.col,lwd=PI.mirror.med.lwd)
if(PI.mean){
if(length(grep("mean",names(PPI)))!=0){
panel.lines(XM,YmeanM[[jj]],type=PI.mirror.mean.type,lty=PI.mirror.mean.lty,col=PI.mirror.mean.col,lwd=PI.mirror.mean.lwd)
}
}
if(PI.delta.mean){
if(length(grep("delta.mean",names(PPI)))!=0){
panel.lines(XM,Ydelta.meanM[[jj]],type=PI.mirror.delta.mean.type,lty=PI.mirror.delta.mean.lty,col=PI.mirror.delta.mean.col,lwd=PI.mirror.delta.mean.lwd)
}
}
}
}
} else {
oumbset <- trellis.par.get("box.umbrella")
on.exit(trellis.par.set("box.umbrella",oumbset),add=T)
umbset <- oumbset
umbset$col <- bwumbcol
umbset$lty <- bwumblty
umbset$lwd <- bwumblwd
trellis.par.set("box.umbrella",umbset)
orecset <- trellis.par.get("box.rectangle")
on.exit(trellis.par.set("box.rectangle",orecset),add=T)
recset <- orecset
recset$col <- bwreccol
recset$lty <- bwreclty
recset$lwd <- bwreclwd
recset$fill<- bwrecfill
trellis.par.set("box.rectangle",recset)
ooutset <- trellis.par.get("plot.symbol")
on.exit(trellis.par.set("plot.symbol",ooutset),add=T)
outset <- ooutset
outset$col <- bwoutcol
outset$pch <- bwoutpch
outset$cex <- bwoutcex
trellis.par.set("plot.symbol",outset)
panel.bwplot(x,y,
horizontal=bwhoriz,
col=bwdotcol,
pch=bwdotpch,
cex=bwdotcex,
ratio=bwratio,
varwidth=bwvarwid)
}
if(PI.rug=="Default"){
PI.rug <- ifelse(PI.ci.area.smooth==TRUE, TRUE, FALSE)
if(is.null(type)){
if(all(is.na(XL))) PI.rug <- TRUE
} else {
if(type=="n" && all(is.na(XL))) PI.rug <- TRUE
}
}
if((!is.null(PI) |
!is.null(PI.real) |
!is.null(PI.mirror) |
!is.null(PI.ci)) && PI.rug
){
panel.rug(x=c(XU,XL),y=NULL,
col=PI.rug.col, lwd=PI.rug.lwd)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.panel.default.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Default histogram panel function for Xpose 4
#'
#' This is the histogram panel function for Xpose 4. This is not intended to be
#' ised outside the \code{xpose.plot.histogram} function. Most of the arguments
#' take their default values from xpose.data object but this can be overridden
#' by supplying them as argument to \code{xpose.plot.histogram}.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param object An xpose.data object.
#' @param breaks The breakpoints for the histogram.
#' @param dens Density plot on top of histogram?
#' @param hidlty Density line type.
#' @param hidcol Color of density line.
#' @param hidlwd Width of density line.
#' @param hiborder Colour of the bar borders.
#' @param hilty Line type for the bar borders.
#' @param hicol Fill colour for the bars.
#' @param hilwd Width for the bar borders.
#' @param math.dens Should a density line be drawn. Values are \code{NULL} or
#' \code{TRUE}.
#' @param vline \code{NULL} or a vector of locations for the vertical lines to
#' be drawn. For example, \code{vline=c(50,60)} will draw two vertical lines.
#' The function \code{\link[lattice:panel.functions]{panel.abline}} is used.
#' @param vllwd Line width of the vertical lines defined with \code{vline}. Can
#' be a vector or a single value, for example \code{vllwd=2} or
#' \code{vllwd=c(2,3)}.
#' @param vllty Line type of the vertical lines defined with \code{vline}. Can
#' be a vector or a single value, for example \code{vllty=1} or
#' \code{vllty=c(1,2)}.
#' @param vlcol Line color of the vertical lines defined with \code{vline}. Can
#' be a vector or a single value, for example \code{vlcol="red"} or
#' \code{vllty=c("red","blue")}.
#' @param hline \code{NULL} or a vector of locations for the horizontal lines
#' to be drawn. For example, \code{hline=c(50,60)} will draw two horizontal
#' lines. The function \code{\link[lattice:panel.functions]{panel.abline}} is
#' used.
#' @param hllwd Line width of the horizontal lines defined with \code{hline}.
#' Can be a vector or a single value, for example \code{hllwd=2} or
#' \code{hllwd=c(2,3)}.
#' @param hllty Line type of the horizontal lines defined with \code{hline}.
#' Can be a vector or a single value, for example \code{hllty=1} or
#' \code{hllty=c(1,2)}.
#' @param hlcol Line color of the horizontal lines defined with \code{hline}.
#' Can be a vector or a single value, for example \code{hlcol="red"} or
#' \code{hllty=c("red","blue")}.
#' @param bins.per.panel.equal Allow for different bins in different panels for
#' continuous data? TRUE or FALSE.
#' @param showMean Should the mean of the data in the histogram be shown?
#' @param meanllwd Line width of mean line.
#' @param meanllty The line type for the mean
#' @param meanlcol Color for the mean line
#' @param showMedian Should the median of the data for the histogram be shown
#' as a vertical line?
#' @param medianllwd line width of median line.
#' @param medianllty line type of median line.
#' @param medianlcol color of median line.
#' @param showPCTS Should percentiles of the data for the histogram be shown?
#' @param PCTS A vector of percentiles to show. Can be any length.
#' @param PCTSllwd line width of percentiles. Can be a vector of same length
#' as \code{PCTS}.
#' @param PCTSllty Line type of the percentiles. Can be a vector of same
#' length as \code{PCTS}.
#' @param PCTSlcol Color of the percentiles. Can be a vector of same length as
#' \code{PCTS}.
#' @param vdline vertical line different for each histogram. Must be a vector.
#' @param vdllwd line widths
#' @param vdllty line types
#' @param vdlcol line colors
#' @param \dots Other arguments that may be needed in the function.
#' @param groups used to pass the conditioning variable into this function.
#' @author Andrew Hooker, Mats Karlsson, Justin Wilkins & E. Niclas Jonsson
#' @seealso \code{xpose.data-class}, Cross-references above.
#' @keywords methods
#' @export xpose.panel.histogram
xpose.panel.histogram <- function(x,
object,
##data,
##subscripts,
##inclZeroWRES = FALSE,
##onlyfirst = FALSE,
##samp = NULL,
##xvarnam=NULL,
breaks=NULL,
dens=TRUE, # density plot on top of histogram?
hidlty = object@[email protected]$hidlty,
hidcol = object@[email protected]$hidcol,
hidlwd = object@[email protected]$hidlwd,
hiborder = object@[email protected]$hiborder,
hilty = object@[email protected]$hilty,
hicol = object@[email protected]$hicol,
hilwd = object@[email protected]$hilwd,
math.dens=NULL,
## vline settings
vline= NULL,#object@[email protected]$abline,
vllwd= 3,#object@[email protected]$abllwd,
vllty= 1,#object@[email protected]$abllty,
vlcol= "grey",#object@[email protected]$ablcol,
## hline settings
hline= NULL,#object@[email protected]$abline,
hllwd= 3,#object@[email protected]$abllwd,
hllty= 1,#object@[email protected]$abllty,
hlcol= "grey",#object@[email protected]$ablcol,
## allow for different bins in different panels for continuous data
bins.per.panel.equal = TRUE,
showMean = FALSE,
meanllwd= 3,#object@[email protected]$abllwd,
meanllty= 1,#object@[email protected]$abllty,
meanlcol= "orange",#object@[email protected]$ablcol,
showMedian = FALSE,
medianllwd= 3,#object@[email protected]$abllwd,
medianllty= 1,#object@[email protected]$abllty,
medianlcol= "black",#object@[email protected]$ablcol,
showPCTS = FALSE,
PCTS = c(0.025,0.975), # vector of percentiles to plot, can be any length
PCTSllwd= 2,#object@[email protected]$abllwd,
PCTSllty= hidlty,#object@[email protected]$abllty,
PCTSlcol= "black",#object@[email protected]$ablcol,
## vline settings different for each histogram
vdline= NULL,#object@[email protected]$abline,
vdllwd= 3,#object@[email protected]$abllwd,
vdllty= 1,#object@[email protected]$abllty,
vdlcol= "red",#object@[email protected]$ablcol,
...,
groups) {
## if(!is.null(samp)) {
## data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,samp=samp)
## } else {
## data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst)
## }
if(length(unique(x)) <= object@[email protected]){
x <- as.factor(x)
}
if(is.factor(x)) {
nint <- length(levels(x))
breaks <- seq(0.5, length = length(levels(x))+1)
} else {
if(!bins.per.panel.equal){
nint <- round(log2(length(x))+1)
endpoints <- range(x[!is.na(x)])
#if(is.null(breaks)) breaks <- do.breaks(endpoints, nint)
breaks <- do.breaks(endpoints, nint)
}
}
panel.histogram(x,
breaks=breaks,
lty = hilty,
lwd = hilwd,
col = hicol,
border = hiborder,
#type = "density",
...
)
if(dens){
if (is.numeric(x)) {## this should be a choice... to plot this not required
panel.densityplot(x,
#breaks=breaks,
lty=hidlty,
col=hidcol,
lwd=hidlwd,
...)
## dens <- density(x)
## panel.xyplot(dens$x, dens$y,
## type="l",
## lty=hidlty,
## col=hidcol,
## lwd=hidlwd,
## ...
## )
}
}
if (!is.null(math.dens)){
panel.mathdensity(dmath = dnorm,
args = list(mean=math.dens$mean,sd=math.dens$sd),
col.line="black",lwd=3,
...)
}
## vertical Line in histogram
if(!is.null(vline)) {
panel.abline(v=vline,col=vlcol,lwd=vllwd,lty=vllty)
}
## Horizontal Line in histogram
if(!is.null(hline)) {
panel.abline(h=hline,col=hlcol,lwd=hllwd,lty=hllty)
}
## Horizontal Line in histogram, different for each histogram
if(!is.null(hline)) {
panel.abline(h=hline,col=hlcol,lwd=hllwd,lty=hllty)
}
if(showMean | showMedian) sp <- summary(x)
if(showMean) panel.abline(v=sp[4],col=meanlcol,lwd=meanllwd,lty=meanllty)
if(showMedian) panel.abline(v=sp[3],col=medianlcol,lwd=medianllwd,lty=medianllty)
if(showPCTS){
qu <- quantile(x, PCTS, na.rm=T)
panel.abline(v=qu,col=PCTSlcol,lwd=PCTSllwd,lty=PCTSllty)
}
if(!is.null(vdline)) {
panel.abline(v=vdline[groups = panel.number()],
col=vdlcol,lwd=vdllwd,lty=vdllty)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.panel.histogram.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Default QQ panel function for Xpose 4
#'
#' This is the QQ panel function for Xpose 4. This is not intended to be used
#' outside the \code{xpose.plot.qq} function. Most of the arguments take their
#' default values from xpose.data object but this can be overridden by
#' supplying them as argument to \code{xpose.plot.qq}.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param object An xpose.data object.
#' @param col Colour of lines and plot symbols.
#' @param pch Plot character to use.
#' @param cex Amount to scale the plotting character by.
#' @param abllty Line type.
#' @param abllwd Line width.
#' @param ablcol Line colour.
#' @param grid logical value indicating whether a visual reference grid should
#' be added to the graph. (Could use arguments for line type, color etc).
#' @param \dots Other arguments that may be needed in the function.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.qq}}, \code{\link[lattice]{qqmath}},
#' \code{\link[lattice]{panel.qqmathline}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @export xpose.panel.qq
xpose.panel.qq <- function(x, object,
#subscripts,
#inclZeroWRES = FALSE,
#onlyfirst = FALSE,
#samp = NULL,
#xvarnam=NULL,
#breaks=NULL,
#ylab=ylb,
#xlab=xlb,
pch=object@[email protected]$pch,
col=object@[email protected]$col,
cex=object@[email protected]$cex,
abllty = object@[email protected]$abllty,
abllwd = object@[email protected]$abllwd,
ablcol = object@[email protected]$ablcol,
grid = object@[email protected]$grid,
...) {
# browser()
## if(!is.null(samp)) {
## data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,samp=samp)
## } else {
## data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst)
## }
## if(length(unique(data[subscripts,xvarnam])) <= object@[email protected])
## x <- as.factor(x)
if(grid != FALSE) {
panel.grid(h = -1, v = -1)
}
## if(is.factor(x)) {
## nint <- length(levels(x))
## breaks <- seq(0.5, length = length(levels(x))+1)
## } else {
## nint <- round(log2(length(x))+1)
## endpoints <- range(x[!is.na(x)])
## breaks <- do.breaks(endpoints, nint)
## }
# panel.qqmathline(x,breaks,...)
panel.qqmathline(x,
lty = abllty,
lwd = abllwd,
col.line = ablcol,
...)
panel.qqmath(x,
#breaks,
pch=pch,
col=col,
cex=cex,
lty = abllty,
lwd = abllwd,
col.line = ablcol,
...)
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.panel.qq.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' Scatterplot matrix panel function for Xpose 4
#'
#' This is the scatterplot matrix panel function for Xpose 4. This is not
#' intended to be ised outside the \code{xpose.plot.splom} function. Most of
#' the arguments take their default values from xpose.data object but this can
#' be overridden by supplying them as argument to \code{xpose.plot.splom}.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param y Name(s) of the y-variable.
#' @param object An xpose.data object.
#' @param subscripts The standard Trellis subscripts argument (see
#' \code{\link[lattice]{xyplot}})
#' @param groups Name of the variable used for superpose plots.
#' @param inclZeroWRES Logical value indicating whether rows with WRES=0 is
#' included in the plot.
#' @param onlyfirst Logical value indicating whether only the first row per
#' individual is included in the plot.
#' @param type 1-character string giving the type of plot desired. The
#' following values are possible, for details, see 'plot': '"p"' for points,
#' '"l"' for lines, '"o"' for over-plotted points and lines, '"b"', '"c"') for
#' (empty if '"c"') points joined by lines, '"s"' and '"S"' for stair steps and
#' '"h"' for histogram-like vertical lines. Finally, '"n"' does not produce
#' any points or lines.
#' @param col The color for lines and points. Specified as an integer or a text
#' string. A full list is obtained by the R command \code{colours()}. The
#' default is blue (col=4).
#' @param pch The plotting character, or symbol, to use. Specified as an
#' integer. See R help on \code{\link{points}}. The default is an open circle.
#' @param cex The amount by which plotting text and symbols should be scaled
#' relative to the default. 'NULL' and 'NA' are equivalent to '1.0'.
#' @param lty The line type. Line types can either be specified as an integer
#' (0=blank, 1=solid, 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or
#' as one of the character strings '"blank"', '"solid"', '"dashed"',
#' '"dotted"', '"dotdash"', '"longdash"', or '"twodash"', where '"blank"' uses
#' 'invisible lines' (i.e., doesn't draw them).
#' @param lwd the width for lines. Specified as an integer. The default is 1.
#' @param lmline logical variable specifying whether a linear regression line
#' should be superimposed over an \code{\link[lattice]{xyplot}}. \code{NULL} ~
#' FALSE. (\code{y~x})
#' @param lmlwd Line width of the lmline.
#' @param lmlty Line type of the lmline.
#' @param lmcol Line colour of the lmline.
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param smlwd Line width of the x-y smooth.
#' @param smlty Line type of the x-y smooth.
#' @param smcol Line color of the x-y smooth.
#' @param smspan The smoothness parameter for the x-y smooth. The default is
#' 0.667. An argument to \code{\link[lattice]{panel.loess}}.
#' @param smdegr The degree of the polynomials to be used for the x-y smooth,
#' up to 2. The default is 1. An argument to
#' \code{\link[lattice]{panel.loess}}.
#' @param grid logical value indicating whether a visual reference grid should
#' be added to the graph. (Could use arguments for line type, color etc).
#' @param \dots Other arguments that may be needed in the function.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.plot.splom}}, \code{\link{xpose.data-class}},
#' \code{\link[lattice]{xyplot}} \code{\link[lattice]{splom}},
#' \code{\link[lattice]{panel.splom}}, \code{\link[lattice]{panel.pairs}}
#' @keywords methods
#' @export xpose.panel.splom
"xpose.panel.splom" <-
function(x, y, object, subscripts,
onlyfirst=TRUE,
inclZeroWRES=FALSE,
type = "p",
col = object@[email protected]$col,
pch = object@[email protected]$pch,
cex = object@[email protected]$cex,
lty = object@[email protected]$lty,
lwd = object@[email protected]$lwd,
smooth= TRUE,
smlwd = object@[email protected]$smlwd,
smlty = object@[email protected]$smlty,
smcol = object@[email protected]$smcol,
smspan= object@[email protected]$smspan,
smdegr= object@[email protected]$smdegr,
lmline = NULL,
lmlwd = object@[email protected]$lmlwd ,
lmlty = object@[email protected]$lmlty ,
lmcol = object@[email protected]$lmcol ,
grid = object@[email protected]$grid,
##scales = list(),
groups = NULL,
... ) {
if(grid != FALSE) {
panel.grid(h = -1, v = -1)
}
if(any(is.null(groups))) {
panel.splom(x, y,
col =col,
pch =pch,
lty =lty,
type =type,
cex = cex,
lwd = lwd,
...
)
} else {
ord <- order(x)
panel.superpose(x[ord],
y[ord],
subscripts[ord],
pch =pch,
cex = cex,
lty =lty,
type =type,
lwd = lwd,
groups=groups
)
}
if(!any(is.null(smooth))) {
if(!is.factor(x) & !is.factor(y)){
panel.loess(x,y,
span = smspan,
degree= smdegr,
col = smcol,
lwd = smlwd,
lty = smlty )
} else {
if(is.factor(x) & !is.factor(y)){
panel.average(x, y,
fun = median,
horizontal = FALSE,
lwd=smlwd, lty=smlty, col=smcol,
col.line=smcol,
#type="l",
...)
}
if(!is.factor(x) & is.factor(y)){
panel.linejoin(x, y, fun = median, horizontal = TRUE,
lwd=smlwd, lty=smlty, col=smcol,
col.line=smcol, #type=smlty,
...)
}
}
}
if(!any(is.null(lmline))) {
if(!is.factor(x) & !is.factor(y)){
panel.abline(lm(y~x),
col = lmcol,
lwd = lmlwd,
lty = lmlty
)
}
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.panel.splom.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' The generic Xpose functions for box-and-whisker plots
#'
#' This is a wrapper function for the lattice \code{\link[lattice]{bwplot}}
#' function.
#'
#'
#' @param x Name(s) of the x-variable.
#' @param y Name(s) of the y-variable.
#' @param object An xpose.data object.
#' @param inclZeroWRES A logical value indicating whether rows with WRES=0
#' should be plotted.
#' @param onlyfirst A logical value indicating whether only the first row per
#' individual should be included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param panel The name of the panel function to use. This should in most
#' cases be left as \code{\link{xpose.panel.bw}}.
#' @param groups A string with the name of any grouping variable (used as the
#' groups argument to \code{\link[lattice]{panel.xyplot}}.
#' @param ids A logical value indicating whether text labels should be used as
#' plotting symbols (the variable used for these symbols indicated by the
#' \code{idlab} Xpose data variable).
#' @param logy Logical value indicating whether the y-axis should be
#' logarithmic.
#' @param logx Logical value indicating whether the x-axis should be
#' logarithmic.
#' @param aspect The aspect ratio of the display (see
#' \code{\link[lattice]{bwplot}}).
#' @param funy String with the name of a function to apply to the y-variable
#' before plotting, e.g. "abs".
#' @param funx String with the name of a function to apply to the x-variable
#' before plotting, e.g. "abs".
#' @param PI Either "lines", "area" or "both" specifying whether prediction
#' intervals (as lines, as a shaded area or both) should be computed from the
#' data in \code{SData} and added to the display. \code{NULL} means no
#' prediction interval.
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables.
#' @param force.by.factor Logical value. If TRUE, and \code{by} is not
#' \code{NULL}, the variable specified by \code{by} is taken as categorical.
#' @param ordby A string with the name of a variable to be used to reorder any
#' factor conditioning variables (\code{by}). The variable is used in a call to
#' the \code{reorder} function.
#' @param byordfun The name of the function to be used when reordering a factor
#' conditioning variable (see argument \code{ordby}).
#' @param shingnum The number of shingles ("parts") a continuous conditioning
#' variable should be divided into.
#' @param shingol The amount of overlap between adjacent shingles (see argument
#' \code{shingnum})
#' @param strip The name of the function to be used as the strip argument to
#' the \code{\link[lattice]{bwplot}}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param xlb A string giving the label for the x-axis. \code{NULL} if none.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param scales A list to be used for the \code{scales} argument in
#' \code{bwplot}.
#' @param suline A string giving the variable to be used to construct a smooth
#' to superpose on the display. \code{NULL} if none. This argument is used if
#' you want to add a superpose line of a variable not present in the \code{y}
#' list of variables.
#' @param binvar Variable to be used for binning.
#' @param bins The number of bins to be used. The default is 10.
#' @param mirror Should we create mirror plots from simulation data? Value can
#' be \code{FALSE}, \code{TRUE} or \code{1} for one mirror plot, or \code{3}
#' for three mirror plots.
#' @param max.plots.per.page The maximum number of plots per page that can be
#' created with the mirror plots.
#' @param mirror.aspect The aspect ratio of the plots used for mirror
#' functionality.
#' @param pass.plot.list Should we pass the list of plots created with mirror
#' or should we print them directly. Values can be \code{TRUE/FALSE}.
#' @param x.cex The size of the x-axis label.
#' @param y.cex The size of the y-axis label.
#' @param main.cex The size of the title.
#' @param mirror.internal an internal mirror argument used in
#' \code{\link{create.mirror}}. Checks if the \code{strip} argument from
#' \code{\link[lattice]{bwplot}} has been used.
#' @param \dots Other arguments passed to \code{\link{xpose.panel.bw}}.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.data-class}}, Cross-references above.
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## Box & whisker plot of WRES vs PRED
#' xpose.plot.bw("WRES", "PRED", xpdb5, binvar="PRED")
#' }
#'
#' @export xpose.plot.bw
"xpose.plot.bw" <-
function(x,y,object,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL,
panel = xpose.panel.bw,
#groups = xvardef("id",object),
groups = NULL,
#ids = object@[email protected]$ids,
ids = FALSE,
logy = FALSE,
logx = FALSE,
aspect = object@[email protected]$aspect,
funy = NULL,
funx = NULL,
# xvar = NULL,
## Prediction interval settings
PI = FALSE,
## Conditioning settings
by = object@[email protected]$condvar,
force.by.factor = FALSE,
ordby = object@[email protected]$ordby,
byordfun = object@[email protected]$byordfun,
shingnum = object@[email protected]$shingnum,
shingol = object@[email protected]$shingol,
strip = function(...)
strip.default(...,strip.names=c(TRUE,TRUE)),
##par.strip.text=trellis.par.get("add.text"),
## Subset stuff
subset = xsubset(object),
## Axes and titles
#main = NULL,
#main = xpose.create.title(x,y,object,subset,funx,funy,...),
#xlb = xlabel(x,object),
#ylb = xlabel(y,object),
main = xpose.create.title(x,y,object,subset,funx,funy,...),
xlb = xpose.create.label(x,object,funx,logx,...),
ylb = xpose.create.label(y,object,funy,logy,...),
#xlb = NULL,
#ylb = NULL,
scales = list(),
## Superpose smooth
suline = object@[email protected]$suline,
## bins
binvar = NULL,
bins = 10,
## mirror stuff
mirror = FALSE,
max.plots.per.page=4,
mirror.aspect="fill",
pass.plot.list=FALSE,
x.cex=NULL,
y.cex=NULL,
main.cex=NULL,
mirror.internal=list(strip.missing=missing(strip)),
...) {
plotTitle <- main
## for MIRROR functionality
arg.list <- formals(xpose.plot.bw)
arg.names <- names(arg.list)
new.arg.list <- vector("list",length(arg.names))
names(new.arg.list) <- arg.names
for (argnam in arg.names){
if (argnam=="..."){
next
}
tmp <- get(argnam)
if (is.null(tmp)){
} else {
new.arg.list[[argnam]]=tmp
}
}
if (mirror){
create.mirror(xpose.plot.bw,
new.arg.list,mirror,plotTitle,
fix.y.limits=FALSE,...)
} else { # end if mirror
##Get data
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
## Strip "missing" data
data <- subset(data, get(x) != object@Prefs@Miss)
data <- subset(data, get(y) != object@Prefs@Miss)
if(any(is.null(data))) return("The subset expression is invalid.")
if(any(is.na(data))) return("Problem.")
y.bw <- xpose.bin(data, binvar, bins)
#binvar <- y
## Make sure by is a factor if requested
if(!is.null(by) && force.by.factor) {
for(b in by) {
data[,b] <- as.factor(data[,b])
}
}
## Check to see if x and y are both longer than 1
if(length(x)>1 && length(y)>1) {
cat("x and y can not both be longer than 1!\n")
return()
}
## Check to see if more that one x-variable
if(length(x) > 1) {
reps <-c(xvardef("id",object),xvardef("idlab",object),
xvardef("wres",object),y)
if(!is.null(by)) reps <- c(reps,by)
data <- xpose.stack(data,object,x,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL)
Data(object) <- data
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
x <- "values"
## If scales is longer than one then the users has supplied it
##as an argument.
if(length(scales)==0) {
scales=list(x=list(relation="free"))
}
}
## Check to see if more that one y-variable
if(length(y) > 1) {
reps <- c(object@Prefs@Xvardef["id"],
object@Prefs@Xvardef["idlab"],
xvardef("wres",object),x)
if(!is.null(by)) reps <- c(reps,by)
data <- xpose.stack(data,object,y,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL)
Data(object) <- data
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
y <- "values"
## If scales is longer than one then the users has supplied it
##as an argument.
if(length(scales)==0) {
scales=list(y=list(relation="free"))
}
}
## Collect the basic plot formula
bb <- NULL
groups <- groups
if(any(is.null(by))) {
formel <- paste("y.bw~",x,sep="")
#cat(formel)
} else {
for(b in by) {
#b <- by[bs]
bb <- c(bb,xlabel(b,object))
if(!is.factor(data[,b])) {
data[,b] <- equal.count(data[,b],number=shingnum,overl=shingol)
} else {
if(any(!is.null(ordby))) {
data[,b] <- reorder(data[,b],data[,ordby],byordfun)
}
if(names(data[,b,drop=F])!="ind") {
levels(data[,b]) <-
paste(xlabel(names(data[,b,drop=F]),object),":", ## Needs to be fixed
levels(data[,b]),sep="")
}
}
}
bys <- paste(by,collapse="*")
formel <- paste("y.bw~",x,"|",bys,sep="")
}
if(missing(strip)) {
strip <- function(var.name,...)
strip.default(var.name=bb,strip.names=c(F,T),...)
}
## Check to see if panel.superpose should be used
if(any(!is.null(groups))) groups <- data[,groups]
## CHeck to see if a superpose smooth is to be used.
if(!is.null(suline)) {
suline <- data[,suline]
}
## Check for id-numbers as plotting symbols
if(!is.null(ids)) ids <- data[,xvardef("idlab",object)]
## Apply function to y-variable
if(!is.null(funy)) {
data[,y] <- do.call(funy,list(data[,y]))
if(ylb[1]==xlabel(y,object)) {
ylb <- paste(funy," (",xlabel(y,object),")",sep="")
}
}
## Apply function to x-variable
if(!is.null(funx)) {
data[,x] <- do.call(funx,list(data[,x]))
if(xlb[1]==xlabel(x,object)) {
xlb <- paste(funx," (",xlabel(x,object),")",sep="")
}
}
## Sort out the scales
if(logy) {
scales$y$log <- TRUE
}
if(logx) {
scales$x$log <- TRUE
}
xvarnam <- x
yvarnam <- y
if(!is.null(x.cex)) {
if (is.list(xlb)){
xlb$cex=x.cex
} else {
xlb <- list(xlb,cex=x.cex)
}
}
if(!is.null(y.cex)) {
if (is.list(ylb)){
ylb$cex=y.cex
} else {
ylb <- list(ylb,cex=y.cex)
}
}
if(is.null(main)) {
} else {
if(!is.null(main.cex)) {
if (is.list(main)){
main$cex=main.cex
} else {
main <- list(main,cex=main.cex)
}
}
}
xplot <- bwplot(formula(formel),data,obj=object,
prepanel = function(x,y) {
if(length(levs <- unique(x)) < object@[email protected]) {
xlim <- as.character(sort(levs))
} else {
xlim <- range(x)
}
list(xlim=xlim)
},
onlyfirst = onlyfirst,
bins = bins,
binvar = binvar,
samp = samp,
panel = panel,
strip = strip,
##par.strip.text = par.strip.text,
groups=groups,
inclZeroWRES=inclZeroWRES,
PI = PI,
logy=logy,
logx=logx,
xvarnam = xvarnam,
yvarnam = yvarnam,
ids = FALSE,
main=main,
xlab=xlb,
ylab=ylb,
aspect=aspect,
suline=suline,
scales=scales,
...)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.plot.bw.R |
#' The Xpose 4 generic functions for continuous y-variables.
#'
#' This function is a wrapper for the lattice xyplot function.
#'
#' \code{y} must be numeric (continuous) while \code{x} can be either numeric
#' of factor. If \code{x} is numeric then a regular xy-plot is drawn. If x is a
#' factor, on the other hand, a box and whiskers plot is constructed.
#'
#' \code{x} and \code{y} can be either single valued strings or vector of
#' strings. \code{x} and \code{y} can not both be vectors in the same call to
#' the function.
#'
#' If \code{ids} is \code{TRUE}, text labels are added to the plotting symbols.
#' The labels are taken from the \code{idlab} xpose data variable. The way the
#' text labels are plotted is governed by the \code{idsmode} argument (passed
#' down to the panel function). \code{idsmode=NULL} (the default) means that
#' only extreme data points are labelled while a non-\code{NULL} value adds
#' labels to all data points (the default in Xpose 3).
#' \code{xpose.panel.default} identifies extreme data points by fitting a loess
#' smooth (\code{y~x}) and looking at the residuals from that fit. Points that
#' are associated with the highest/lowest residuals are labelled. "High" and
#' "low" are judged by the panel function parameter \code{idsext}, which gives
#' the fraction of the total number of data points that are to be judged
#' extreme in the "up" and "down" direction. The default value for
#' \code{idsext} is 0.05 (see \code{\link{xpose.prefs-class}}). There is also a
#' possibility to label only the high or low extreme points. This is done
#' through the \code{idsdir} argument to \code{xpose.panel.default}. A value of
#' "both" (the default) means that both high and low extreme points are
#' labelled while "up" and "down" labels the high and low extreme points
#' respectively.
#'
#' Data dilution is useful is situations when there is an excessive amount of
#' data. \code{xpose.plot.default} can dilute data in two different ways. The
#' first is a completely random dilution in which all individuals are eligible
#' for exclusion from the plot. In this case the argument \code{dilfrac}
#' determines the fraction of individuals that are excluded from the plot. The
#' second type of dilution uses stratification to make sure that none of the
#' extreme individuals are omitted from the plot. Extreme individuals are
#' identified in a similar manner as extreme data points are identified for
#' text labelling. A smooth is fitted to the data and the extreme residuals
#' from that fit is used to inform about extremeness. What is judged as extreme
#' is determined by the argument \code{dilci}, which defaults to 0.95 (Note
#' that the meaning of this is the opposite to \code{idsext}). \code{dilci}
#' give the confidence level of the interval around the fitted curve outside of
#' which points are deemed to be extreme. Extreme individuals are those that
#' have at least one point in the "extremeness" interval. Individuals that do
#' not have any extreme points are eligible for dilution and \code{dilfrac}
#' give the number of these that should be omitted from the graph. This means
#' that \code{dilfrac} should usually be grater for stratified dilution than in
#' completely random dilution. Any smooths added to a diluted plot is based on
#' undiluted data.
#'
#' More graphical parameters may be passed to
#' \code{\link{xpose.panel.default}}.
#'
#' @param x A string or a vector of strings with the name(s) of the
#' x-variable(s).
#' @param y A string or a vector of strings with the name(s) of the
#' y-variable(s).
#' @param object An "xpose.data" object.
#' @param inclZeroWRES A logical value indicating whether rows with WRES=0
#' should be plotted.
#' @param onlyfirst A logical value indicating whether only the first row per
#' individual should be included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param panel The name of the panel function to use.
#' @param groups A string with the name of any grouping variable (used as the
#' groups argument to \code{panel.xyplot}.
#' @param ids A logical value indicating whether text labels should be used as
#' plotting symbols (the variable used for these symbols indicated by the
#' \code{idlab} xpose data variable).
#' @param logy Logical value indicating whether the y-axis should be
#' logarithmic.
#' @param logx Logical value indicating whether the x-axis should be
#' logarithmic.
#' @param yscale.components Used to change the way the axis look if \code{logy}
#' is used. Can be a user defined function or
#' \code{link{xpose.yscale.components.log10}}. If the axes are not log
#' transformed then
#' \code{\link[lattice:axis.default]{yscale.components.default}} is used.
#' @param xscale.components Used to change the way the axis look if \code{logx}
#' is used. Can be a user defined function or
#' \code{link{xpose.xscale.components.log10}}. If the axes are not log
#' transformed then
#' \code{\link[lattice:axis.default]{xscale.components.default}} is used.
#' @param aspect The aspect ratio of the display (see
#' \code{\link[lattice]{xyplot}}).
#' @param funx String with the name of a function to apply to the x-variable
#' before plotting, e.g. "abs".
#' @param funy String with the name of a function to apply to the y-variable
#' before plotting, e.g. "abs".
#' @param iplot Is this an individual plots matrix? Internal use only.
#' @param PI Either "lines", "area" or "both" specifying whether prediction
#' intervals (as lines, as a shaded area or both) should be computed from the
#' data in \code{SData} and added to the display. \code{NULL} means no
#' prediction interval.
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables.
#' @param force.by.factor Logical value. If TRUE, and \code{by} is not
#' \code{NULL}, the variable specified by \code{by} is taken as categorical.
#' @param ordby A string with the name of a variable to be used to reorder any
#' factor conditioning variables (\code{by}). The variable is used in a call to
#' the \code{reorder.factor} function.
#' @param byordfun The name of the function to be used when reordering a factor
#' conditioning variable (see argument \code{ordby})
#' @param shingnum The number of shingles ("parts") a continuous conditioning
#' variable should be divided into.
#' @param shingol The amount of overlap between adjacent shingles (see argument
#' \code{shingnum})
#' @param by.interval The intervals to use for conditioning on a continuous
#' variable with \code{by}.
#' @param strip The name of the function to be used as the strip argument to
#' the \code{\link[lattice]{xyplot}}. An easy way to change the strip
#' appearance is to use \code{\link[lattice]{strip.custom}}. For example, if
#' you want to change the text in the strips you can use
#' \code{strip=strip.custom(factor.levels=c("Hi","There"))} if the \code{by}
#' variable is a factor and \code{strip=strip.custom(var.name=c("New Name"))}
#' if the \code{by} variable is continuous.
#' @param use.xpose.factor.strip.names Use factor names in strips of
#' conditioning plots..
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param xlb A string giving the label for the x-axis. \code{NULL} if none.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param autocorr Is this an autocorrelation plot? Values can be
#' \code{TRUE/FALSE}.
#' @param scales A list to be used for the \code{scales} argument in
#' \code{\link[lattice]{xyplot}}.
#' @param suline A string giving the variable to be used to construct a smooth
#' to superpose on the display. \code{NULL} if none. This argument is used if
#' you want to add a superpose line of a variable not present in the \code{y}
#' list of variables.
#' @param bwhoriz A logical value indicating if box and whiskers bars should be
#' plotted horizontally or not. Used when the x-variable(s) is categorical.
#' @param dilution Logical value indicating whether data dilution should be
#' used.
#' @param diltype Indicating what type of dilution to apply. \code{NULL} means
#' random dilution without stratification. A non\code{NULL} value means
#' stratified dilution.
#' @param dilfrac Dilution fraction indicating the expected fraction of
#' individuals to display in the plots. The exact meaning depends on the type
#' of dilution (see below).
#' @param dilci A number between 0 and 1 giving the range eligible for dilution
#' in a stratified dilution (see below).
#' @param seed Seed number used for random dilution. \code{NULL} means no seed.
#' @param mirror Should we create mirror plots from simulation data? Value can
#' be \code{FALSE}, \code{TRUE} or \code{1} for one mirror plot, or \code{3}
#' for three mirror plots.
#' @param max.plots.per.page The maximum number of plots per page that can be
#' created with the mirror plots.
#' @param mirror.aspect The aspect ratio of the plots used for mirror
#' functionality.
#' @param pass.plot.list Should we pass the list of plots created with mirror
#' or should we print them directly. Values can be \code{TRUE/FALSE}.
#' @param x.cex The size of the x-axis label.
#' @param y.cex The size of the y-axis label.
#' @param main.cex The size of the title.
#' @param mirror.internal an internal mirror argument used in
#' \code{\link{create.mirror}}. Checks if the \code{strip} argument from
#' \code{\link[lattice]{xyplot}} has been used.
#' @param \dots Other arguments passed to \code{\link{xpose.panel.default}}.
#' @return Returns a xyplot graph object.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.panel.default}}, \code{\link[lattice]{xyplot}},
#' \code{\link[lattice]{panel.xyplot}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## A spaghetti plot of DV vs TIME
#' xpose.plot.default("TIME", "DV", xpdb5)
#'
#' ## A conditioning plot
#' xpose.plot.default("TIME", "DV", xpdb5, by = "SEX")
#'
#' ## Multiple x-variables
#' xpose.plot.default(c("WT", "SEX"), "CL", xpdb5)
#'
#' ## Multiple y-variables
#' xpose.plot.default("WT", c("CL", "V"), xpdb5)
#' xpose.plot.default("WT", c("CL", "V"), xpdb5, by=c("SEX", "HCTZ"))
#'
#' ## determining the interval for the conditioning variable
#' wt.ints <- matrix(c(50,60,60,70,70,80,80,90,90,100,100,150),nrow=6,ncol=2,byrow=T)
#' xpose.plot.default("TIME","DV",xpdb5,by="WT", by.interval=wt.ints)
#' }
#'
#'
#' @export xpose.plot.default
xpose.plot.default <-
function(x,y,object,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL,
panel = xpose.panel.default,
groups = object@Prefs@Xvardef$id,
ids = object@[email protected]$ids,
logy = FALSE,
logx = FALSE,
yscale.components= "default",#function(...) yscale.components.default(...),
xscale.components= "default",#function(...) xscale.components.default(...),
aspect = object@[email protected]$aspect,
funx = NULL,
funy = NULL,
iplot = NULL,
## Prediction interval settings
PI = NULL,
## Conditioning settings
by = object@[email protected]$condvar,
force.by.factor = FALSE,
ordby = object@[email protected]$ordby,
byordfun = object@[email protected]$byordfun,
shingnum = object@[email protected]$shingnum,
shingol = object@[email protected]$shingol,
by.interval = NULL,
##par.strip.text=trellis.par.get("add.text"),
##mirror.par.strip.text=trellis.par.get("add.text"),
strip = function(...){
strip.default(...,strip.names=c(TRUE,TRUE))
},
use.xpose.factor.strip.names=TRUE,
##strip.nams=T,
##strip=strip.custom(strip.names=c(T,T)),
##par.strip.text = mirror.par.strip.text),
##par.strip.text = trellis.par.get("add.text"),
##par.strip.text=NULL,
## Subset stuff
subset = xsubset(object),
autocorr=FALSE,
## Axes and titles
main = xpose.create.title(x,y,object,subset,funx,funy,...),
#main = NULL,
xlb = xpose.create.label(x,object,funx,logx,autocorr.x=autocorr,...),
ylb = xpose.create.label(y,object,funy,logy,autocorr.y=autocorr,...),
##xlb = ifelse((length(x)>1),"Value",xlabel(x,object)),
##ylb = ifelse((length(y)>1),"Value",xlabel(y,object)),
scales = list(),
## Superpose smooth
suline = object@[email protected]$suline,
## Categorical stuff
bwhoriz = object@[email protected]$bwhoriz,
## Dilution stuff
dilution = FALSE,
dilfrac = object@[email protected]$dilfrac,
diltype = object@[email protected]$diltype,
dilci = object@[email protected]$dilci,
seed = NULL,
mirror = FALSE,
max.plots.per.page=4,
mirror.aspect="fill",
pass.plot.list=FALSE,
x.cex = NULL,
y.cex = NULL,
main.cex = NULL,
mirror.internal=list(strip.missing=missing(strip)),
...
) {
## CHecks if use.xpose.factor.strip.names is a logical of length 1
if (!(is.logical(use.xpose.factor.strip.names) &
length(use.xpose.factor.strip.names)==1)){
stop("The provided use.xpose.factor.strip.names argument is not a logical of length 1")
}
plotTitle <- main
## for MIRROR functionality
arg.list <- formals(xpose.plot.default)
arg.names <- names(arg.list)
new.arg.list <- vector("list",length(arg.names))
names(new.arg.list) <- arg.names
for (argnam in arg.names){
if (argnam=="..."){
next
}
tmp <- get(argnam)
if (is.null(tmp)){
} else {
new.arg.list[[argnam]]=tmp
}
}
if (mirror){
if(is.null(object@Nsim)) {
cat(paste("The current Xpose database does not have any simulation data.\n"))
cat(paste("The mirror option cannot be used.\n"))
return(NULL)
}
create.mirror(xpose.plot.default,
new.arg.list,mirror,plotTitle,...)
} else { # end if mirror
##Get data
if(any(is.null(iplot))) {
if(!is.null(samp)) {
#cat(samp)
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=NULL)
}
## Strip "missing" data
all_variables <- c(x,y)
for(i_var in all_variables){
data <- subset(data, get(i_var) != object@Prefs@Miss)
}
if(any(is.null(data))) return("The subset expression is invalid.")
## Make sure by is a factor if requested
if(!is.null(by) && force.by.factor) {
for(b in by) {
data[,b] <- as.factor(data[,b])
}
}
## Sort out dilution
dilsubset <- TRUE
dilname <- NULL
if(dilution) {
if(is.null(diltype)) { # Standard random dilution
data <- create.rand(data,object,dilfrac,seed=seed)
if(is.null(seed)) {
dilsubset <- parse(text="Rnoseed==0")
dilname <- "Rnoseed"
} else {
dilsubset <- parse(text=paste("R",seed,"==0",sep=""))
dilname <- paste("R",seed,"==0",sep="")
}
} else { # Stratified random dilution
data <-create.strat.rand(data,object,x,y,dilfrac,dilci,seed=seed)
if(is.null(seed)) {
dilsubset <- parse(text="RSnoseed==0")
dilname <- "RSnoseed"
} else {
dilsubset <- parse(text=paste("RS",seed,,"==0",sep=""))
dilname <- paste("RS",seed,,"==0",sep="")
}
}
}
## Check to see if x and y are both longer than 1
if(length(x)>1 && length(y)>1) {
cat("x and y can not both be longer than 1\n")
return()
}
## Check to see if more than one x-variable
if(length(x) > 1) {
reps <-c(xvardef("id",object),xvardef("idlab",object),
xvardef("wres",object),y,groups)
if(!is.null(dilname)) reps <- c(reps,dilname)
if(!is.null(by)) reps <- c(reps,by)
#data <- stack.xpose(data,object,x,reps)
data <- xpose.stack(data,object,x,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL,
Prefs = object@Prefs)
Data(object) <- data
#cat(object@[email protected]$type)
if(is.null(main.cex)) main.cex <- 0.9
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
x <- "values"
## If scales is longer than one then the users has supplied it
##as an argument.
if(length(scales)==0) {
scales=list(x=list(relation="free"))
}
}
## Check to see if more than one y-variable
if(length(y) > 1) {
reps <- c(object@Prefs@Xvardef["id"],
object@Prefs@Xvardef["idlab"],
xvardef("wres",object),x,groups)
if(!is.null(dilname)) reps <- c(reps,dilname)
if(!is.null(by)) reps <- c(reps,by)
#data <- stack.xpose(data,object,y,reps)
data <- xpose.stack(data,object,y,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL,
Prefs = object@Prefs)
Data(object) <- data
if(is.null(main.cex)) main.cex <- 0.9
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
y <- "values"
## If scales is longer than one then the users has supplied it
##as an argument.
if(length(scales)==0) {
scales=list(y=list(relation="free"))
}
}
## Collect the basic plot formula
bb <- NULL
groups <- groups
if(any(is.null(by))) {
if(bwhoriz) {
formel <- paste(x,"~",y,sep="")
} else {
formel <- paste(y,"~",x,sep="")
}
} else {
for(b in by) {
##b <- by[bs]
bb <- c(bb,xlabel(b,object))
if(!is.factor(data[,b])) {
if(is.null(by.interval)){
data[,b] <- equal.count(data[,b],number=shingnum,overl=shingol)
} else {
data[,b] <- shingle(data[,b],intervals=by.interval)
}
} else {
if(any(!is.null(ordby))) {
data[,b] <- reorder(data[,b],data[,ordby],byordfun)
}
if(names(data[,b,drop=F])!="ind") {
if(use.xpose.factor.strip.names){
levels(data[,b]) <-
paste(xlabel(names(data[,b,drop=F]),object),":", ## Needs to be fixed
levels(data[,b]),sep="")
}
}
}
}
bys <- paste(by,collapse="*")
if(bwhoriz) {
formel <- paste(x,"~",y,"|",bys,sep="")
} else {
formel <- paste(y,"~",x,"|",bys,sep="")
}
}
if(missing(strip)) {
strip <- function(var.name,...)
strip.default(var.name=bb,strip.names=c(F,T),...)
}
## Check to see if panel.superpose should be used
if(any(!is.null(groups))) groups <- data[,groups]
## CHeck to see if a superpose smooth is to be used.
if(!is.null(suline)) {
suline <- data[,suline]
}
## Check for id-numbers as plotting symbols
##if(!is.null(ids)) ids <- data[,xvardef("idlab",object)]
if(ids){
ids <- data[,xvardef("idlab",object)]
} else {
ids <- NULL
}
## Apply function to x-variable
if(!is.null(funx)) {
data[,x] <- do.call(funx,list(data[,x]))
}
## Apply function to y-variable
if(!is.null(funy)) {
data[,y] <- do.call(funy,list(data[,y]))
## if(!is.null(ylb[1])){
## ##if(ylb[1]==xlabel(y,object)) {
## if(missing(ylb)) {
## if (fun=="abs"){
## ylb <- paste("|",ylb,"|",sep="")
## } else {
## ylb <- paste(fun,"(",ylb,")",sep="")
## }
## }
## }
}
## Sort out the scales
yscale.components.defined <- T
xscale.components.defined <- T
if(!is.function(yscale.components)){
if(!is.na(match(yscale.components,"default"))) {
yscale.components= function(...) yscale.components.default(...)
yscale.components.defined <- F
}
}
if(!is.function(xscale.components)){
if(!is.na(match(xscale.components,"default"))) {
xscale.components= function(...) xscale.components.default(...)
xscale.components.defined <- F
}
}
if(logy) {
scales$y$log <- TRUE
if(!yscale.components.defined){
yscale.components=xpose.yscale.components.log10
}
}
if(logx) {
scales$x$log <- TRUE
if(!xscale.components.defined){
xscale.components=xpose.xscale.components.log10
}
}
xvarnam <- x
yvarnam <- y
if(!is.null(x.cex)) {
if (is.list(xlb)){
xlb$cex=x.cex
} else {
xlb <- list(xlb,cex=x.cex)
}
}
if(!is.null(y.cex)) {
if (is.list(ylb)){
ylb$cex=y.cex
} else {
ylb <- list(ylb,cex=y.cex)
}
}
if(is.null(main)) {
} else {
if(!is.null(main.cex)) {
if (is.list(main)){
main$cex=main.cex
} else {
main <- list(main,cex=main.cex)
}
}
}
## for autocorrelation (not working completely yet)
if(autocorr){
auto.ids <- unique(data[[xvardef("id",object)]])
auto.n <- 0
xplt1 <- 0
xplt2 <- 0
xgrps <- 0
for(i in 1:length(auto.ids)) {
i <- 1
seli <- data[[xvardef("id",object)]] == ids[i]
nobs <- length(data[[x]][seli])
xplt <- matrix(data[[x]][seli], 1, nobs)
if(nobs > 1) {
for(j in 1:(nobs - 1)) {
auto.n <- auto.n + 1
xplt1[auto.n] <- xplt[1, j]
xplt2[auto.n] <- xplt[1, j + 1]
xgrps[auto.n] <- auto.ids[i]
}
}
}
#xlb <- paste(xlb,"(i)",sep="")
#ylb <- paste(ylb,"(i+1)",sep="")
#x <- xplt1
#y <- xplt2
#groups <- xgrps
}
xplot <- xyplot(formula(formel),data,obj=object,
prepanel = function(x,y) {
xlim <- NULL
ylim <- NULL
ret <- list()
if(is.factor(x)){#length(levs <- unique(x)) < object@[email protected]) {
if(length(grep("[A-Z,a-z]",levels(x)))==0) {
xlim <- as.character(sort(as.numeric(levels(x))))
} else {
xlim <- sort(levels(x))
}
} else {
#xlim <- range(x)
}
ret[["xlim"]] <- xlim
if(is.factor(y)){#length(levs <- unique(x)) < object@[email protected]) {
if(length(grep("[A-Z,a-z]",levels(y)))==0) {
ylim <- as.character(sort(as.numeric(levels(y))))
} else {
ylim <- sort(levels(y))
}
} else {
#ylim <- range(y)
}
ret[["ylim"]] <- ylim
#list(xlim=xlim,ylim=ylim)
return(ret)
},
onlyfirst = onlyfirst,
samp = samp,
panel = panel,
strip = strip,
##par.strip.text = par.strip.text,
groups=groups,
inclZeroWRES=inclZeroWRES,
PI = PI,
logy=logy,
logx=logx,
xscale.components=xscale.components,
yscale.components=yscale.components,
xvarnam = xvarnam,
yvarnam = yvarnam,
ids = ids,
main=main,
xlab=xlb,
ylab=ylb,
aspect=aspect,
suline=suline,
bwhoriz = bwhoriz,
subset=eval(dilsubset),
scales=scales,
iplot=iplot,
autocorr=autocorr,
#autocorr=FALSE,
PI.subset=subset,
#drop.unused.levels=FALSE,
...)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.plot.default.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' The Xpose 4 generic functions for continuous y-variables.
#'
#' This function is a wrapper for the lattice xyplot function.
#'
#' \code{x} can be either numeric or factor, and can be either single valued
#' strings or vectors of strings.
#'
#' @param x A string or a vector of strings with the name(s) of the
#' x-variable(s).
#' @param object An "xpose.data" object.
#' @param inclZeroWRES A logical value indicating whether rows with WRES=0
#' should be plotted.
#' @param onlyfirst A logical value indicating whether only the first row per
#' individual should be included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param type The type of histogram to make. See
#' \code{\link[lattice]{histogram}}.
#' @param aspect The aspect ratio of the display (see
#' \code{\link[lattice]{histogram}}).
#' @param scales A list to be used for the \code{scales} argument in
#' \code{histogram}.
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables.
#' @param force.by.factor Logical value. If TRUE, and \code{by} is not
#' \code{NULL}, the variable specified by \code{by} is taken as categorical.
#' @param ordby A string with the name of a variable to be used to reorder any
#' factor conditioning variables (\code{by}). The variable is used in a call to
#' the \code{reorder.factor} function.
#' @param byordfun The name of the function to be used when reordering a factor
#' conditioning variable (see argument \code{ordby})
#' @param shingnum The number of shingles ("parts") a continuous conditioning
#' variable should be divided into.
#' @param shingol The amount of overlap between adjacent shingles (see argument
#' \code{shingnum})
#' @param strip The name of the function to be used as the strip argument to
#' the \code{\link[lattice]{xyplot}}.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param xlb A string giving the label for the x-axis. \code{NULL} if none.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param hiborder the border colour of the histogram - an integer or string.
#' The default is black (see \code{\link[lattice]{histogram}}).
#' @param hicol the fill colour of the histogram - an integer or string. The
#' default is blue (see \code{\link[lattice]{histogram}}).
#' @param hilty the border line type of the histogram - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hilwd the border line width of the histogram - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hidcol the fill colour of the density line - an integer or string.
#' The default is black (see \code{\link[lattice]{histogram}}).
#' @param hidlty the border line type of the density line - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param hidlwd the border line width of the density line - an integer. The
#' default is 1 (see \code{\link[lattice]{histogram}}).
#' @param mirror Should we create mirror plots from simulation data? Value can
#' be \code{FALSE}, \code{TRUE} or \code{1} for one mirror plot, or \code{3}
#' for three mirror plots.
#' @param max.plots.per.page The maximum number of plots per page that can be
#' created with the mirror plots.
#' @param mirror.aspect The aspect ratio of the plots used for mirror
#' functionality.
#' @param pass.plot.list Should we pass the list of plots created with mirror
#' or should we print them directly. Values can be \code{TRUE/FALSE}.
#' @param x.cex The size of the x-axis label.
#' @param y.cex The size of the y-axis label.
#' @param main.cex The size of the title.
#' @param mirror.internal an internal mirror argument used in
#' \code{\link{create.mirror}}. Checks if the \code{strip} argument from
#' \code{\link[lattice]{xyplot}} has been used.
#' @param \dots Other arguments passed to \code{\link{xpose.plot.histogram}}.
#' @return Returns a histogram.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.panel.histogram}},
#' \code{\link[lattice]{histogram}}, \code{\link[lattice]{panel.histogram}},
#' \code{\link{xpose.prefs-class}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' xpose.plot.histogram("AGE", xpdb5, onlyfirst = TRUE)
#' xpose.plot.histogram(c("SEX", "AGE"), xpdb5, onlyfirst = TRUE)
#' }
#'
#'
#' @export xpose.plot.histogram
xpose.plot.histogram <-
function(x,object,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL,
type = "density",
aspect = object@[email protected]$aspect,
scales = list(),
## Conditioning settings
by = object@[email protected]$condvar,
force.by.factor = FALSE,
ordby = object@[email protected]$ordby,
byordfun = object@[email protected]$byordfun,
shingnum = object@[email protected]$shingnum,
shingol = object@[email protected]$shingol,
strip = function(...)
strip.default(...,strip.names=c(TRUE,TRUE)),
##par.strip.text=trellis.par.get("add.text"),
## Subset stuff
subset = xsubset(object),
## Axes and titles
##main = NULL,
main = xpose.create.title.hist(x,object,subset,...),
xlb = NULL,
ylb = "Density", # this should be dependent on type
## Colors and stuff
hicol = object@[email protected]$hicol,
hilty = object@[email protected]$hilty,
hilwd = object@[email protected]$hilwd,
hidcol = object@[email protected]$hidcol,
hidlty = object@[email protected]$hidlty,
hidlwd = object@[email protected]$hidlwd,
hiborder = object@[email protected]$hiborder,
## mirror stuff
mirror = FALSE,
max.plots.per.page=4,
mirror.aspect="fill",
pass.plot.list=FALSE,
x.cex=NULL,
y.cex=NULL,
main.cex=NULL,
mirror.internal=list(strip.missing=missing(strip)),
...) {
plotTitle <- main
## for MIRROR functionality
arg.list <- formals(xpose.plot.histogram)
arg.names <- names(arg.list)
new.arg.list <- vector("list",length(arg.names))
names(new.arg.list) <- arg.names
for (argnam in arg.names){
if (argnam=="..."){
next
}
tmp <- get(argnam)
if (is.null(tmp)){
} else {
new.arg.list[[argnam]]=tmp
}
}
if (mirror){
create.mirror(xpose.plot.histogram,
new.arg.list,mirror,plotTitle,...)
} else { # end if mirror
## x-label
if(!is.null(x)) {
if(length(x)> 1) {
xlb <- NULL
} else {
if(is.null(xlb)) {
xlb <- xlabel(x,object)
}
}
}
##Get data
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
## Strip "missing" data
##data <- subset(data, get(x) != object@Prefs@Miss)
##if(any(is.null(data))) return("The subset expression is invalid!\n")
## Make sure by is a factor if requested
if(!is.null(by) && force.by.factor) {
for(b in by) {
data[,b] <- as.factor(data[,b])
}
}
## Check to see if more that one x-variable
if(length(x) > 1) {
reps <-c(xvardef("id",object),xvardef("idlab",object),
xvardef("wres",object))
if(!is.null(by)) reps <- c(reps,by)
data <- xpose.stack(data,object,x,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL)
Data(object) <- data
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
x <- "values"
scales=list(relation="free")
}
## Strip "missing" data
data <- subset(data, get(x) != object@Prefs@Miss)
if(any(is.null(data))) return("The subset expression is invalid!\n")
## Collect the basic plot formula
bb <- NULL
if(any(is.null(by))) { ## No conditioning
formel <- paste("~",x,sep="")
} else {
for(b in by) {
bb <- c(bb,xlabel(b,object))
if(!is.factor(data[,b])) {
data[,b] <- equal.count(data[,b],number=shingnum,overl=shingol)
} else {
if(any(!is.null(ordby))) {
data[,b] <- reorder(data[,b],data[,ordby],byordfun)
}
if(names(data[,b,drop=F])!="ind") {
levels(data[,b]) <-
paste(xlabel(names(data[,b,drop=F]),object),":", ## Needs to be fixed
levels(data[,b]),sep="")
}
}
}
bys <- paste(by,collapse="*")
formel <- paste("~",x,"|",bys,sep="")
}
if(missing(strip)) {
strip <- function(var.name,...)
strip.default(var.name=bb,strip.names=c(F,T),...)
}
xvarnam <- x
if(!is.null(x.cex)) {
if (is.list(xlb)){
xlb$cex=x.cex
} else {
xlb <- list(xlb,cex=x.cex)
}
}
if(!is.null(y.cex)) {
if (is.list(ylb)){
ylb$cex=y.cex
} else {
ylb <- list(ylb,cex=y.cex)
}
}
if(is.null(main)) {
} else {
if(!is.null(main.cex)) {
if (is.list(main)){
main$cex=main.cex
} else {
main <- list(main,cex=main.cex)
}
}
}
if(missing("type")) {
if (length(levs <- unique(data[,x])) <= object@[email protected]) {
type <- "count"
ylb <- "Count"
}
}
xplot <- histogram(formula(formel),data,
...,
obj=object,
prepanel = function(x,bins.per.panel.equal = TRUE,...) {
if(length(levs <- unique(x)) <= object@[email protected]) {
xlim <- as.character(sort(levs))
return(list(xlim=xlim))
} else {
xlim <- range(x)
if(!bins.per.panel.equal){
nint <- round(log2(length(x))+1)
endpoints <- range(x[!is.na(x)])
breaks <- do.breaks(endpoints, nint)
hdat <- hist(x, breaks=breaks, plot=F)
ddat <- density(x,na.rm=T)
ylim <- c(0, max(hdat$density,ddat$y))
return(list(xlim=xlim,ylim=ylim))
}
return(list(xlim=xlim))
}
},
panel=xpose.panel.histogram,
aspect=aspect,
ylab=ylb,
xlab=xlb,
type=type,
scales=scales,
main=main,
xvarnam=xvarnam,
hidlty = hidlty,
hidcol = hidcol,
hidlwd = hidlwd,
hiborder = hiborder,
hilty = hilty,
hilwd = hilwd,
strip=strip,
hicol = hicol)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.plot.histogram.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
## Added by Justin Wilkins
## 28/11/2005
#' The generic Xpose functions for QQ plots
#'
#' This is a wrapper function for the lattice \code{\link[lattice]{qqmath}}
#' function.
#'
#'
#' @param x A string or a vector of strings with the name(s) of the
#' x-variable(s).
#' @param object An "xpose.data" object.
#' @param inclZeroWRES A logical value indicating whether rows with WRES=0
#' should be plotted.
#' @param onlyfirst A logical value indicating whether only the first row per
#' individual should be included in the plot.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param aspect The aspect ratio of the display (see
#' \code{\link[lattice]{qqmath}}).
#' @param scales A list to be used for the \code{scales} argument in
#' \code{\link[lattice]{qqmath}}.
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables.
#' @param force.by.factor Logical value. If TRUE, and \code{by} is not
#' \code{NULL}, the variable specified by \code{by} is taken as categorical.
#' @param ordby A string with the name of a variable to be used to reorder any
#' factor conditioning variables (\code{by}). The variable is used in a call to
#' the \code{reorder} function.
#' @param byordfun The name of the function to be used when reordering a factor
#' conditioning variable (see argument \code{ordby}).
#' @param shingnum The number of shingles ("parts") a continuous conditioning
#' variable should be divided into.
#' @param shingol The amount of overlap between adjacent shingles (see argument
#' \code{shingnum}).
#' @param strip The name of the function to be used as the strip argument to
#' the \code{\link[lattice]{xyplot}}.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param xlb A string giving the label for the x-axis. \code{NULL} if none.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param pch Plotting symbol.
#' @param col Color of plotting symbol.
#' @param cex Amount to scale the plotting character by.
#' @param abllty Line type for qqline.
#' @param abllwd Line width for qqline.
#' @param ablcol Color for qqline.
#' @param mirror Should we create mirror plots from simulation data? Value can
#' be \code{FALSE}, \code{TRUE} or \code{1} for one mirror plot, or \code{3}
#' for three mirror plots.
#' @param max.plots.per.page The maximum number of plots per page that can be
#' created with the mirror plots.
#' @param mirror.aspect The aspect ratio of the plots used for mirror
#' functionality.
#' @param pass.plot.list Should we pass the list of plots created with mirror
#' or should we print them directly. Values can be \code{TRUE/FALSE}.
#' @param x.cex The size of the x-axis label.
#' @param y.cex The size of the y-axis label.
#' @param main.cex The size of the title.
#' @param mirror.internal an internal mirror argument used in
#' \code{\link{create.mirror}}. Checks if the \code{strip} argument from
#' \code{\link[lattice]{qqmath}} has been used.
#' @param \dots Other arguments passed to \code{\link{xpose.plot.qq}}.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.panel.qq}}, \code{\link[lattice]{qqmath}},
#' \code{\link[lattice]{panel.qqmathline}}, \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## A QQ plot of WRES
#' xpose.plot.qq("WRES", xpdb5)
#' }
#'
#'
#' @export xpose.plot.qq
xpose.plot.qq <-
function(x,object,
inclZeroWRES = FALSE,
onlyfirst = FALSE,
samp = NULL, ## Check if this is needed
aspect = object@[email protected]$aspect,
scales = list(),
## Conditioning settings
by = object@[email protected]$condvar,
force.by.factor = FALSE,
ordby = object@[email protected]$ordby,
byordfun = object@[email protected]$byordfun,
shingnum = object@[email protected]$shingnum,
shingol = object@[email protected]$shingol,
strip = function(...)
strip.default(...,strip.names=c(TRUE,TRUE)),
##par.strip.text=trellis.par.get("add.text"),
## Subset stuff
subset = xsubset(object),
## Axes and titles
main = xpose.create.title.hist(x,object,subset,...),
## main = NULL,
xlb = "Quantiles of Normal",
ylb = paste("Quantiles of ",xlabel(x,object),sep=""),
## Colors and stuff
pch=object@[email protected]$pch,
col=object@[email protected]$col,
cex=object@[email protected]$cex,
abllty = object@[email protected]$abllty,
abllwd = object@[email protected]$abllwd,
ablcol = object@[email protected]$ablcol,
## mirror stuff
mirror = FALSE,
max.plots.per.page=4,
mirror.aspect="fill",
pass.plot.list=FALSE,
x.cex=NULL,
y.cex=NULL,
main.cex=NULL,
mirror.internal=list(strip.missing=missing(strip)),
...) {
plotTitle <- main
## for MIRROR functionality
arg.list <- formals(xpose.plot.qq)
arg.names <- names(arg.list)
new.arg.list <- vector("list",length(arg.names))
names(new.arg.list) <- arg.names
for (argnam in arg.names){
if (argnam=="..."){
next
}
tmp <- get(argnam)
if (is.null(tmp)){
} else {
new.arg.list[[argnam]]=tmp
}
}
if (mirror){
create.mirror(xpose.plot.qq,
new.arg.list,mirror,plotTitle,...)
} else { # end if mirror
## x-label
#if(!is.null(x)) {
# if(length(x)> 1) {
# xlb <- NULL
# } else {
# xlb <- label(x,object)
# }
#}
## y-label
#ylb <- ylb
##Get data
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
## Strip "missing" data
data <- subset(data, get(x) != object@Prefs@Miss)
if(any(is.null(data))) return("The subset expression is invalid!")
## Make sure by is a factor if requested
if(!is.null(by) && force.by.factor) {
for(b in by) {
data[,b] <- as.factor(data[,b])
}
}
## Check to see if more that one x-variable
if(length(x) > 1) {
reps <-c(xvardef("id",object),xvardef("idlab",object),
xvardef("wres",object))
if(!is.null(by)) reps <- c(reps,by)
data <- xpose.stack(data,object,x,reps)
object <- new("xpose.data",
Runno=object@Runno,
Data = NULL)
Data(object) <- data
onlyfirst = FALSE
if(is.null(by)) {
by <- "ind"
} else {
by <- c("ind",by)
}
x <- "values"
scales=list(relation="free")
}
## Collect the basic plot formula
bb <- NULL
if(any(is.null(by))) { ## No conditioning
formel <- paste("~",x,sep="")
} else {
for(b in by) {
bb <- c(bb,xlabel(b,object))
if(!is.factor(data[,b])) {
data[,b] <- equal.count(data[,b],number=shingnum,overl=shingol)
} else {
if(any(!is.null(ordby))) {
data[,b] <- reorder(data[,b],data[,ordby],byordfun)
}
if(names(data[,b,drop=F])!="ind") {
levels(data[,b]) <-
paste(xlabel(names(data[,b,drop=F]),object),":", ## Needs to be fixed
levels(data[,b]),sep="")
}
}
}
bys <- paste(by,collapse="*")
formel <- paste("~",x,"|",bys,sep="")
}
if(missing(strip)) {
strip <- function(var.name,...)
strip.default(var.name=bb,strip.names=c(F,T),...)
}
#xvarnam <- x
if(!is.null(x.cex)) {
if (is.list(xlb)){
xlb$cex=x.cex
} else {
xlb <- list(xlb,cex=x.cex)
}
}
if(!is.null(y.cex)) {
if (is.list(ylb)){
ylb$cex=y.cex
} else {
ylb <- list(ylb,cex=y.cex)
}
}
if(is.null(main)) {
} else {
if(!is.null(main.cex)) {
if (is.list(main)){
main$cex=main.cex
} else {
main <- list(main,cex=main.cex)
}
}
}
xplot <- qqmath(formula(formel),
data,
obj=object,
#prepanel = function(x) {
# if(length(levs <- unique(x)) < object@[email protected]) {
# xlim <- as.character(sort(levs))
# return(list(xlim=xlim))
# } else {
# xlim <- range(x)
# return(list(xlim=xlim))
# }
#},
panel=xpose.panel.qq,
aspect=aspect,
ylab=ylb,
xlab=xlb,
scales=scales,
main=main,
#xvarnam=xvarnam,
abllty = abllty,
abllwd = abllwd,
ablcol = ablcol,
#border = hiborder,
pch=pch,
col=col,
cex=cex,
strip=strip,
...)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.plot.qq.R |
# Xpose 4
# An R-based population pharmacokinetic/
# pharmacodynamic model building aid for NONMEM.
# Copyright (C) 1998-2004 E. Niclas Jonsson and Mats Karlsson.
# Copyright (C) 2005-2008 Andrew C. Hooker, Justin J. Wilkins,
# Mats O. Karlsson and E. Niclas Jonsson.
# Copyright (C) 2009-2010 Andrew C. Hooker, Mats O. Karlsson and
# E. Niclas Jonsson.
# This file is a part of Xpose 4.
# Xpose 4 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. A copy can be cound in the R installation
# directory under \share\licenses. If not, see http://www.gnu.org/licenses/.
#' The Xpose 4 generic functions for scatterplot matrices.
#'
#' This function is a wrapper for the lattice splom function.
#'
#' If \code{ids} is \code{TRUE}, text labels are added to the plotting symbols.
#' The labels are taken from the \code{idlab} xpose data variable. The way the
#' text labels are plotted is governed by the \code{idsmode} argument (passed
#' down to the panel function). \code{idsmode=NULL} (the default) means that
#' only extreme data points are labelled while a non-\code{NULL} value adds
#' labels to all data points (the default in Xpose 3).
#' \code{xpose.panel.default} identifies extreme data points by fitting a loess
#' smooth (\code{y~x}) and looking at the residuals from that fit. Points that
#' are associated with the highest/lowest residuals are labelled. "High" and
#' "low" are judged by the panel function parameter \code{idsext}, which gives
#' the fraction of the total number of data points that are to be judged
#' extreme in the "up" and "down" direction. The default value for
#' \code{idsext} is 0.05 (see \code{link{xpose.prefs-class}}). There is also a
#' possibility to label only the high or low extreme points. This is done
#' through the \code{idsdir} argument to \code{xpose.panel.default}. A value of
#' "both" (the default) means that both high and low extreme points are
#' labelled while "up" and "down" labels the high and low extreme points
#' respectively.
#'
#' More graphical parameters may be passed to \code{\link{xpose.panel.splom}}.
#' for example, if you want to adjust the size of the \code{varnames} and
#' \code{axis tick labels} you can use the parameters \code{varname.cex=0.5}
#' and \code{axis.text.cex=0.5}.
#'
#' @param plist A vector of strings containing variable names for the
#' scatterplot matrix.
#' @param object An "xpose.data" object.
#' @param varnames A vector of strings containing labels for the variables in
#' the scatterplot matrix.
#' @param inclZeroWRES A logical value indicating whether rows with WRES=0
#' should be plotted.
#' @param onlyfirst A logical value indicating whether only the first row per
#' individual should be included in the plot.
#' @param panel The name of the panel function to use.
#' @param lmline logical variable specifying whether a linear regression line
#' should be superimposed over an \code{\link[lattice]{xyplot}}. \code{NULL} ~
#' FALSE. (\code{y~x})
#' @param smooth A \code{NULL} value indicates that no superposed line should
#' be added to the graph. If \code{TRUE} then a smooth of the data will be
#' superimposed.
#' @param groups A string with the name of any grouping variable (used as the
#' groups argument to \code{panel.xyplot}.
#' @param ids A logical value indicating whether text labels should be used as
#' plotting symbols (the variable used for these symbols indicated by the
#' \code{idlab} xpose data variable).
#' @param aspect The aspect ratio of the display (see
#' \code{\link[lattice]{xyplot}}).
#' @param by A string or a vector of strings with the name(s) of the
#' conditioning variables.
#' @param force.by.factor Logical value. If TRUE, and \code{by} is not
#' \code{NULL}, the variable specified by \code{by} is taken as categorical.
#' @param include.cat.vars Logical value.
#' @param ordby A string with the name of a variable to be used to reorder any
#' factor conditioning variables (\code{by}). The variable is used in a call to
#' the \code{reorder.factor} function.
#' @param byordfun The name of the function to be used when reordering a factor
#' conditioning variable (see argument \code{ordby})
#' @param shingnum The number of shingles ("parts") a continuous conditioning
#' variable should be divided into.
#' @param shingol The amount of overlap between adjacent shingles (see argument
#' \code{shingnum})
#' @param strip The name of the function to be used as the strip argument to
#' the \code{\link[lattice]{xyplot}}.
#' @param main A string giving the plot title or \code{NULL} if none.
#' @param xlb A string giving the label for the x-axis. \code{NULL} if none.
#' @param ylb A string giving the label for the y-axis. \code{NULL} if none.
#' @param subset A string giving the subset expression to be applied to the
#' data before plotting. See \code{\link{xsubset}}.
#' @param scales A list to be used for the \code{scales} argument in
#' \code{xyplot}.
#' @param mirror Should we create mirror plots from simulation data? Value can
#' be \code{FALSE}, \code{TRUE} or \code{1} for one mirror plot, or \code{3}
#' for three mirror plots.
#' @param max.plots.per.page The maximum number of plots per page that can be
#' created with the mirror plots.
#' @param mirror.aspect The aspect ratio of the plots used for mirror
#' functionality.
#' @param samp An integer between 1 and object@Nsim
#' (see\code{\link{xpose.data-class}}) specifying which of the simulated data
#' sets to extract from SData.
#' @param pass.plot.list Should we pass the list of plots created with mirror
#' or should we print them directly. Values can be \code{TRUE/FALSE}.
#' @param x.cex The size of the x-axis label.
#' @param y.cex The size of the y-axis label.
#' @param main.cex The size of the title.
#' @param mirror.internal an internal mirror argument used in
#' \code{\link{create.mirror}}. Checks if the \code{strip} argument from
#' \code{\link[lattice]{qqmath}} has been used.
#' @param \dots Other arguments passed to \code{\link{xpose.panel.default}}.
#' @return Returns a scatterplot matrix graph object.
#' @author E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins
#' @seealso \code{\link{xpose.panel.splom}}, \code{\link[lattice]{splom}},
#' \code{\link[lattice]{panel.splom}}, \code{\link{xpose.prefs-class}},
#' \code{\link{xpose.data-class}}
#' @keywords methods
#' @examples
#'
#' \dontrun{
#' ## xpdb5 is an Xpose data object
#' ## We expect to find the required NONMEM run and table files for run
#' ## 5 in the current working directory
#' xpdb5 <- xpose.data(5)
#'
#' ## CL, WT, HT, SEX with a regression line
#' xpose.plot.splom(c("CL", "WT", "HT", "SEX"), xpdb5, lmline = TRUE)
#' }
#'
#'
#' @export xpose.plot.splom
"xpose.plot.splom" <-
function(plist, object,
varnames=NULL,
main = "Scatterplot Matrix",
xlb = NULL,
ylb = NULL,
scales = list(),
onlyfirst=TRUE,
inclZeroWRES=FALSE,
subset = xsubset(object),
by = object@[email protected]$condvar,
force.by.factor=FALSE,
include.cat.vars = FALSE,
ordby = NULL,
byordfun = object@[email protected]$byordfun,
shingnum = object@[email protected]$shingnum,
shingol = object@[email protected]$shingol,
strip = function(...)
strip.default(...,strip.names=c(TRUE,TRUE)),
#par.strip.text=trellis.par.get("add.text"),
groups = NULL,
ids = object@[email protected]$ids,
smooth = TRUE,
lmline = NULL,
panel = xpose.panel.splom,
aspect = object@[email protected]$aspect,
#varname.cex=NULL,
#axis.text.cex=NULL,
## mirror stuff
samp=NULL,
max.plots.per.page=4,
mirror = FALSE,
mirror.aspect="fill",
pass.plot.list=FALSE,
x.cex=NULL,
y.cex=NULL,
main.cex=NULL,
mirror.internal=list(strip.missing=missing(strip)),
...) {
plotTitle <- main
## for MIRROR functionality
arg.list <- formals(xpose.plot.splom)
arg.names <- names(arg.list)
new.arg.list <- vector("list",length(arg.names))
names(new.arg.list) <- arg.names
for (argnam in arg.names){
if (argnam=="..."){
next
}
tmp <- get(argnam)
if (is.null(tmp)){
} else {
new.arg.list[[argnam]]=tmp
}
}
if (mirror){
create.mirror(xpose.plot.splom,
new.arg.list,mirror,plotTitle,...)
} else { # end if mirror
##Get data
#data <- object@Data[, xvardef("parms", object), drop = F]
#mlist <- c(plist, by, groups)
#data <- Data(object,inclZeroWRES,onlyfirst=onlyfirst,subset=subset)[, mlist, drop = F]
if(!is.null(samp)) {
data <- SData(object,inclZeroWRES=inclZeroWRES,onlyfirst=onlyfirst,
subset=subset,samp=samp)
} else {
data <- Data(object,inclZeroWRES=inclZeroWRES,onlyfirst=onlyfirst,subset=subset)
}
## Strip "missing" data
for (i in plist) {
data <- subset(data, get(i) != object@Prefs@Miss)
}
if(any(is.null(data))) return("The data or subset expression is invalid.")
## if the parameter or variable in the list has only one value don't plot it
remove.from.plist=c()
for (i in 1:length(plist)) {
if(!is.factor(data[,plist[i]])){
if(length(unique(data[,plist[i]])) < 2){
remove.from.plist=c(remove.from.plist,i)
cat(paste(plist[i],
"has only one value and will not be\n",
"shown in the scatterplot\n"))
}
} else {
if(!include.cat.vars){
remove.from.plist=c(remove.from.plist,i)
cat(paste(plist[i],
"is categorical and will not be\n",
"shown in the scatterplot\n"))
} else {
if(length(levels(data[,plist[i]])) < 2){
remove.from.plist=c(remove.from.plist,i)
cat(paste(plist[i],
" has only one value and will not be\n",
"shown in the scatterplot\n",sep=""))
}
}
}
}
if(length(remove.from.plist)>0){
plist <- plist[-remove.from.plist]
if(!is.null(varnames)) varnames <- varnames[-remove.from.plist]
}
if(is.null(varnames)) {
varnames <- c()
for (i in plist) {
varnames <- c(varnames, xlabel(i, object))
}
}
## Make sure by is a factor if requested
if(!is.null(by) && force.by.factor) {
for(b in by) {
data[,b] <- as.factor(data[,b])
}
}
## Collect the basic plot formula
bb <- NULL
if(any(is.null(by))) {
formel <- paste("~data[, plist]", sep="")
} else {
for(b in by) {
#b <- by[bs]
bb <- c(bb,xlabel(b,object))
if(!is.factor(data[,b])) {
data[,b] <- equal.count(data[,b],number=shingnum,overl=shingol)
} else {
if(any(!is.null(ordby))) {
data[,b] <- reorder(data[,b],data[,ordby],byordfun)
}
if(names(data[,b,drop=F])!="ind") {
levels(data[,b]) <-
paste(xlabel(names(data[,b,drop=F]),object),":", ## Needs to be fixed
levels(data[,b]),sep="")
}
}
}
bys <- paste(by,collapse="*")
formel <- paste("~data[, plist] | ", bys, sep="")
}
if(missing(strip)) {
strip <- function(var.name,...)
strip.default(var.name=bb,strip.names=c(F,T),...)
}
## Check to see if panel.superpose should be used
if(any(!is.null(groups))) groups <- data[,groups]
## CHeck to see if a superpose smooth is to be used.
suline <- NULL
if(!is.null(suline)) {
suline <- data[,suline]
}
## Check for id-numbers as plotting symbols
if(!is.null(ids)) ids <- data[,xvardef("idlab",object)]
#cat(formel)
#readline()
#browser()
## if(length(plist)>7) {
## varname.cex=0.6
## axis.text.cex=0.6
## }
if(!is.null(x.cex)) {
if (is.list(xlb)){
xlb$cex=x.cex
} else {
xlb <- list(xlb,cex=x.cex)
}
}
if(!is.null(y.cex)) {
if (is.list(ylb)){
ylb$cex=y.cex
} else {
ylb <- list(ylb,cex=y.cex)
}
}
if(is.null(main)) {
} else {
if(!is.null(main.cex)) {
if (is.list(main)){
main$cex=main.cex
} else {
main <- list(main,cex=main.cex)
}
}
}
xplot <- splom(formula(formel), data, obj=object,
#prepanel.limits = function(x)
# if (is.factor(x)) levels(x) else
# extend.limits(range(as.numeric(x), na.rm = TRUE)),
varnames=varnames,
onlyfirst = onlyfirst,
panel=panel,
strip = strip,
#par.strip.text = par.strip.text,
groups=groups,
inclZeroWRES=inclZeroWRES,
ids = ids,
main=main,
#aspect=aspect,
smooth=smooth,
lmline = lmline,
ylab = ylb,
xlab = xlb,
scales = scales,
#varname.cex=varname.cex,
#axis.text.cex=axis.text.cex,
...)
return(xplot)
}
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.plot.splom.R |
#' Summarize an xpose database
#'
#' @param object An xpose data object
#' @param long long format or not.
#'
#' @return ""
#' @export
#'
#' @examples
#' xpose.print(simpraz.xpdb)
#' @family data functions
xpose.print <- function(object ,long=TRUE)
{
cat("The database contains the following observed items:\n")
cat(names(object@Data),fill=60)
if(!any(is.null(object@SData))) {
cat("\nThe database contains the following simulated items:\n")
cat(names(object@SData),fill=60)
}
cat("\nThe following variables are defined:\n\n")
if(!any(is.null(object@Prefs@Xvardef$id)))
cat("ID variable:",object@Prefs@Xvardef$id,"\n")
if(!any(is.null(object@Prefs@Xvardef$idlab)))
cat("Label variable:",object@Prefs@Xvardef$idlab,"\n")
# if(!any(is.null(flag(data)))) {
# cat("Flag variable:",vname(flag(data)),"\n")
# if(!any(is.null(cur.flag(data))))
# cat("Current value of flag:",cur.flag(data),"\n")
# }
if(!any(is.null(object@Prefs@Xvardef$idv)))
cat("Independent variable:",object@Prefs@Xvardef$idv,"\n")
if(!any(is.null(object@Prefs@Xvardef$occ)))
cat("Occasion variable:",object@Prefs@Xvardef$occ,"\n")
if(!any(is.null(object@Prefs@Xvardef$dv))) {
if(is.factor(object@Prefs@Xvardef$dv)) {
cat("Dependent variable (categorical):",object@Prefs@Xvardef$dv,"\n")
} else {
cat("Dependent variable:",object@Prefs@Xvardef$dv,"\n")
}
}
if (long) {
if(!any(is.null(object@Prefs@Xvardef$pred)))
cat("Population prediction variable:",object@Prefs@Xvardef$pred,"\n")
if(!any(is.null(object@Prefs@Xvardef$ipred)))
cat("Individual prediction variable:",object@Prefs@Xvardef$ipred,"\n")
if(!any(is.null(object@Prefs@Xvardef$wres)))
cat("Weighted population residual variable:",object@Prefs@Xvardef$wres,"\n")
if(!any(is.null(object@Prefs@Xvardef$iwres)))
cat("Weighted individual residual variable:",object@Prefs@Xvardef$iwres,"\n")
if(!any(is.null(object@Prefs@Xvardef$res)))
cat("Population residual variable:",object@Prefs@Xvardef$res,"\n")
}
if(!any(is.null(object@Prefs@Xvardef$parms)))
cat("Parameters:",object@Prefs@Xvardef$parms,fill=60)
if(!any(is.null(object@Prefs@Xvardef$covariates))) {
cat("Covariates:",object@Prefs@Xvardef$covariates,fill=60)
conts <- cats <- character(0)
for(i in xvardef("covariates", object))
if(!is.factor(object@Data[[i]])) {
if(length(conts))
conts <- c(conts,i)
else
conts <- i
} else {
if(length(cats))
cats <- c(cats,i)
else
cats <- i
}
cat(" ( Continuous:",conts,")",fill=60)
cat(" ( Categorical:",cats,")",fill=60)
}
if(!any(is.null(object@Prefs@Xvardef$tvparms))) {
cat("Typical parameters:",object@Prefs@Xvardef$tvparms,fill=60)
}
if(!any(is.null(object@Prefs@Xvardef$ranpar))) {
cat("Variability parameters:",object@Prefs@Xvardef$ranpar,fill=60)
}
if(!any(is.null(object@Prefs@Miss)))
cat("Missing value label:",object@Prefs@Miss,"\n")
if(!any(is.null(object@Prefs@Subset)))
cat("Subset:",object@Prefs@Subset,"\n")
invisible()
return(cat(""))
}
| /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.print.R |
xpose.read <-
function(object,
file = "xpose.ini"
) {
# x <- object
#options(warn = -1)
# read ini file
prefs <- read.table(file, col.names=c("Option","Value"))
prefs.m <- as.matrix(prefs)
# iterate and assign
for (i in 1:nrow(prefs.m)) {
# General
if (prefs.m[i,1] == "Miss") {
object@Prefs@Miss = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "Cat.level") {
object@[email protected] = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "DV.Cat.level") {
object@[email protected] = as.numeric(prefs.m[i,2])
}
# Plotting
if (prefs.m[i,1] == "type") {
object@[email protected]$type = as.character(prefs.m[i,2])
}
if (prefs.m[i,1] == "cex") {
object@[email protected]$cex = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "lty") {
object@[email protected]$lty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "lwd") {
object@[email protected]$lwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "col") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$col = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$col = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "pch") {
object@[email protected]$pch = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "grid") {
object@[email protected]$grid = as.logical(prefs.m[i,2])
}
if (prefs.m[i,1] == "aspect") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$aspect = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$aspect = as.character(prefs.m[i,2])
}
}
# Conditioning
# if (prefs.m[i,1] == "ordby") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$ordby = NULL
# } else {
# object@[email protected]$ordby = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "byordfun") {
object@[email protected]$byordfun = as.character(prefs.m[i,2])
}
if (prefs.m[i,1] == "shingnum") {
object@[email protected]$shingnum = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "shingol") {
object@[email protected]$shingol = as.numeric(prefs.m[i,2])
}
# abline
# if (prefs.m[i,1] == "abline") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$abline = NULL
# } else {
# object@[email protected]$abline = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "ablcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$ablcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$ablcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "abllty") {
object@[email protected]$abllty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "abllwd") {
object@[email protected]$abllwd = as.numeric(prefs.m[i,2])
}
# lmline
# if (prefs.m[i,1] == "lmline") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$lmline = NULL
# } else {
# object@[email protected]$lmline = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "lmcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$lmcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$lmcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "lmlty") {
object@[email protected]$lmlty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "lmlwd") {
object@[email protected]$lmlwd = as.numeric(prefs.m[i,2])
}
# smooth
if (prefs.m[i,1] == "smooth") {
if (grep("NULL", prefs.m[i,2]) != 0) {
object@[email protected]$smooth = NULL
} else {
object@[email protected]$smooth = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "smcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$smcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$smcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "smlty") {
object@[email protected]$smlty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "smlwd") {
object@[email protected]$smlwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "smspan") {
object@[email protected]$smspan = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "smdegr") {
object@[email protected]$smdegr = as.numeric(prefs.m[i,2])
}
# suline
# if (prefs.m[i,1] == "suline") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$suline = NULL
# } else {
# object@[email protected]$suline = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "sucol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$sucol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$sucol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "sulty") {
object@[email protected]$sulty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "sulwd") {
object@[email protected]$sulwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "suspan") {
object@[email protected]$suspan = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "sudegr") {
object@[email protected]$sudegr = as.numeric(prefs.m[i,2])
}
# Labelling
if (prefs.m[i,1] == "ids") {
object@[email protected]$ids = as.logical(prefs.m[i,2])
}
# if (prefs.m[i,1] == "idsmode") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$idsmode = NULL
# } else {
# object@[email protected]$idsmode = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "idsext") {
object@[email protected]$idsext = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "idscex") {
object@[email protected]$idscex = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "idsdir") {
object@[email protected]$idsdir = as.character(prefs.m[i,2])
}
# Dilution
if (prefs.m[i,1] == "dilfrac") {
object@[email protected]$dilfrac = as.numeric(prefs.m[i,2])
}
# if (prefs.m[i,1] == "diltype") {
# if (grep("NULL", prefs.m[i,2]) != 0) {
# object@[email protected]$diltype = NULL
# } else {
# object@[email protected]$diltype = as.character(prefs.m[i,2])
# }
# }
if (prefs.m[i,1] == "dilci") {
object@[email protected]$dilci = as.numeric(prefs.m[i,2])
}
# Prediction intervals
if (prefs.m[i,1] == "PIuplty") {
object@[email protected]$PIuplty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIdolty") {
object@[email protected]$PIdolty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PImelty") {
object@[email protected]$PImelty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIuptyp") {
object@[email protected]$PIuptyp = as.character(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIdotyp") {
object@[email protected]$PIdotyp = as.character(prefs.m[i,2])
}
if (prefs.m[i,1] == "PImetyp") {
object@[email protected]$PImetyp = as.character(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIupcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$PIupcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$PIupcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "PIdocol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$PIdocol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$PIdocol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "PImecol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$PImecol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$PImecol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "PIuplwd") {
object@[email protected]$PIuplwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIdolwd") {
object@[email protected]$PIdolwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PImelwd") {
object@[email protected]$PImelwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIuplimit") {
# object@[email protected]$PIdolwd = prefs.m[i,2]
PIuplimit = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIdolimit") {
# object@[email protected]$PImelwd = prefs.m[i,2]
PIdolimit = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "PIarcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$PIarcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$PIarcol = as.character(prefs.m[i,2])
}
}
#B&W plots
if (prefs.m[i,1] == "bwhoriz") {
object@[email protected]$bwhoriz = as.logical(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwratio") {
object@[email protected]$bwratio = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwvarwid") {
object@[email protected]$bwvarwid = as.logical(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwdotpch") {
object@[email protected]$bwdotpch = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwdotcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$bwdotcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$bwdotcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "bwdotcex") {
object@[email protected]$bwdotcex = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwrecfill") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$bwrecfill = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$bwrecfill = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "bwreccol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$bwreccol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$bwreccol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "bwreclty") {
object@[email protected]$bwreclty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwreclwd") {
object@[email protected]$bwreclwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwumbcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$bwumbcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$bwumbcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "bwumblty") {
object@[email protected]$bwumblty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwumblwd") {
object@[email protected]$bwumblwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwoutpch") {
object@[email protected]$bwoutpch = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "bwoutcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$bwoutcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$bwoutcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "bwoutcex") {
object@[email protected]$bwoutcex = as.numeric(prefs.m[i,2])
}
# Histograms
if (prefs.m[i,1] == "hiborder") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$hiborder = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$hiborder = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "hicol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$hicol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$hicol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "hidcol") {
if ((prefs.m[i,2]!="") && (!is.na(suppressWarnings(as.numeric(prefs.m[i,2]))))) {
object@[email protected]$hidcol = as.numeric(prefs.m[i,2])
} else {
object@[email protected]$hidcol = as.character(prefs.m[i,2])
}
}
if (prefs.m[i,1] == "hilty") {
object@[email protected]$hilty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "hilwd") {
object@[email protected]$hilwd = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "hidlty") {
object@[email protected]$hidlty = as.numeric(prefs.m[i,2])
}
if (prefs.m[i,1] == "hidlwd") {
object@[email protected]$hidlwd = as.numeric(prefs.m[i,2])
}
}
object@[email protected]$PIlimits = c(PIdolimit, PIuplimit)
#options(warn = 1)
return(object)
} | /scratch/gouwar.j/cran-all/cranData/xpose4/R/xpose.read.R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.