This is a template function for creating structured goodness of fit diagnostics using the functions in the Xpose specific library.
Usage
gof(
runno = NULL,
save = FALSE,
onefile = FALSE,
saveType = "pdf",
pageWidth = 7.6,
pageHeight = 4.9,
structural = TRUE,
residual = TRUE,
covariate = FALSE,
iiv = FALSE,
iov = FALSE,
all = FALSE,
myTrace = xpPage
)
Arguments
- runno
The run number fo Xpose to identify the appropriate files to read. In addition
runno
is used to construct the file name to save plots in.runno
can also beNULL
for cases in which the function is used for non-Xpose based code.- save
Logical.
TRUE
if the plot(s) is to be saved in a file.FALSE
if the plot(s) is to be displayed on screen. The plot(s) will be saved in a file named with the function name followed by the word 'run', the run number, an order number followed by a file name extension appropriate for the selectedsaveType
. For example 'gofrun1-01.pdf' for the first plot file created by a script calledgof
based on output from run 1 andsaveType='pdf'
.- onefile
Logical.
TRUE
if plots are to be save in a single file andFALSE
if each plot should be saved as a separate file. In the latter case, each file will be have an incremented order number (01-99).- saveType
The type of graphics file to produce if
save=TRUE
. Allowed values are 'pdf' (default), 'wmf' (only Windows) and 'png'.- pageWidth
The width of the graphics device in inches.
- pageHeight
The height of the graphics device in inches.
- structural
Logical.
TRUE
if the code in the structural model section (see below) should be executed andFALSE
if not.- residual
Logical.
TRUE
if the code in the residual model section (see below) should be executed andFALSE
if not.- covariate
Logical.
TRUE
if the code in the covariate model section (see below) should be executed andFALSE
if not.- iiv
Logical.
TRUE
if the code in the IIV model section (see below) should be executed andFALSE
if not.- iov
Logical.
TRUE
if the code in the IOV model section (see below) should be executed andFALSE
if not.- all
Logical.
TRUE
if the code in all sections (see below) should be executed.- myTrace
NULL
or the name of a function. The value ofmyTrace
can used with the latticepage=
argument to annotate plots for traceability.
Details
The gof
function is provided as a template to facilitate the
(structured) use of the functions in the Xpose specific library. Xpose
specific is extensively described in the 'Xpose Bestiary'.
The function can be renamed so that multiple scripts can be used in parallel.
The function is set up to make it easy to display plots on screen as well as to save them in files. In the latter case, plots are save in a sub-directory called 'Plots'.
The arguments structural
, residual
, covariate
,
iiv
, iov
and all
are just "switches" to different parts
of the code (if-blocks). These blocks can be removed or the default values
of the arguments changed to better suit the needs of the user.
It is also possible to add tracing information to the produced plots. This
is done via the myTrace
argument. A non-NULL value should be a
function that returns a panel.text
object. The default is the
xpPage
function that will put a string concatenated from the device
name, function name, working directory and date, in small, faint grey, font
at the bottom of each graph page. Note that the user need to add
page=myTrace
as an argument to the Xpose functions for this to have
an effect.
The function calls a support function called gofSetup
, which is
responsible for setting up the graphics device and determining the file
names for saved graphs.
See also
Other generic functions:
xpose.multiple.plot
,
xpose4-package
Other specific functions:
absval.cwres.vs.cov.bw()
,
absval.cwres.vs.pred()
,
absval.cwres.vs.pred.by.cov()
,
absval.iwres.cwres.vs.ipred.pred()
,
absval.iwres.vs.cov.bw()
,
absval.iwres.vs.idv()
,
absval.iwres.vs.ipred()
,
absval.iwres.vs.ipred.by.cov()
,
absval.iwres.vs.pred()
,
absval.wres.vs.cov.bw()
,
absval.wres.vs.idv()
,
absval.wres.vs.pred()
,
absval.wres.vs.pred.by.cov()
,
absval_delta_vs_cov_model_comp
,
addit.gof()
,
autocorr.cwres()
,
autocorr.iwres()
,
autocorr.wres()
,
basic.gof()
,
basic.model.comp()
,
cat.dv.vs.idv.sb()
,
cat.pc()
,
cov.splom()
,
cwres.dist.hist()
,
cwres.dist.qq()
,
cwres.vs.cov()
,
cwres.vs.idv()
,
cwres.vs.idv.bw()
,
cwres.vs.pred()
,
cwres.vs.pred.bw()
,
cwres.wres.vs.idv()
,
cwres.wres.vs.pred()
,
dOFV.vs.cov()
,
dOFV.vs.id()
,
dOFV1.vs.dOFV2()
,
data.checkout()
,
dv.preds.vs.idv()
,
dv.vs.idv()
,
dv.vs.ipred()
,
dv.vs.ipred.by.cov()
,
dv.vs.ipred.by.idv()
,
dv.vs.pred()
,
dv.vs.pred.by.cov()
,
dv.vs.pred.by.idv()
,
dv.vs.pred.ipred()
,
ind.plots()
,
ind.plots.cwres.hist()
,
ind.plots.cwres.qq()
,
ipred.vs.idv()
,
iwres.dist.hist()
,
iwres.dist.qq()
,
iwres.vs.idv()
,
kaplan.plot()
,
par_cov_hist
,
par_cov_qq
,
parm.vs.cov()
,
parm.vs.parm()
,
pred.vs.idv()
,
ranpar.vs.cov()
,
runsum()
,
wres.dist.hist()
,
wres.dist.qq()
,
wres.vs.idv()
,
wres.vs.idv.bw()
,
wres.vs.pred()
,
wres.vs.pred.bw()
,
xpose.VPC()
,
xpose.VPC.both()
,
xpose.VPC.categorical()
,
xpose4-package
Examples
if (FALSE) {
## This is an example of how the function may be setup by a user.
library(xpose4)
mygof <- gof
fix(mygof)
myggof <- function (runno = NULL, save = FALSE, onefile = FALSE, saveType = "pdf",
pageWidth = 7.6, pageHeight = 4.9, structural = TRUE, residual = TRUE,
covariate = FALSE, iiv = FALSE, iov = FALSE, all = FALSE, myTrace=xpPage) {
gofSetup(runno, save, onefile, saveType, pageWidth, pageHeight)
xpdb <- xpose.data(runno)
if (structural || all) {
xplot <- dv.vs.pred.ipred(xpdb, page = myPage)
print(xplot)
}
if (residual || all) {
xplot <- absval.wres.vs.pred(xpdb, page = myPage)
print(xplot)
}
if (covariate || all) {
}
if (iiv || all) {
}
if (iov || all) {
}
if (save) dev.off()
invisible()
}
## The function can then be execute, e.g.:
mygof(1)
}