npde (version 2.0)

npde: Compute normalised prediction distribution errors

Description

These functions compute normalised prediction distribution errors (npde) and optionally prediction discrepancies (pd). npde asks the user the name and structure of the files containing the data, using pdemenu, while autonpde takes these variables and others as arguments.

Usage

autonpde(namobs, namsim, iid, ix, iy, imdv = 0, icens = 0, icov = 0, iipred = 0, boolsave = TRUE, namsav = "output", type.graph = "eps", verbose = FALSE, calc.npde=TRUE, calc.pd=TRUE, decorr.method = "cholesky", cens.method = "cdf", units = list(x="",y=""), detect=FALSE, ties=TRUE)

Arguments

namobs
name of the file containing the observed data, or a dataframe containing the observed data (in both cases, the column containing the various data required for the computation of the pde can be set using the arguments iid,ix and iy below)
namsim
name of the file containing the simulated data, or a dataframe containing the simulated data (the program will assume that subject ID are in column 1 and simulated Y in column 3, see User Guide)
iid
name/number of the column in the observed data containing the patient ID; if missing, the program will attempt to detect a column named id
ix
name/number of the column in the observed data containing the independent variable (X); ; if missing, the program will attempt to detect a column named X
iy
name/number of the column in the observed data containing the dependent variable (Y); if missing, the program will attempt to detect a column with the response
imdv
name/number of the column containing information about missing data (MDV), defaults to 0 (column not present)
icens
name/number of the column containing information about censored data (cens), defaults to 0 (column not present)
icov
name/number of the column(s) containing covariate information defaults to 0 (no covariates)
iipred
name/number of the column(s) with individual predictions (ipred), defaults to 0 (individual predictions not available)
units
a list with components x, y and cov (optional), specifying the units respectively for the predictor (x), the response (y), and the covariates (a vector of length equal to the number of covariates). Units will default to (-) if not given.
detect
a boolean controlling whether automatic recognition of columns in the dataset is on, defaults to FALSE
boolsave
a boolean (TRUE if graphs and results are to be saved to a file, FALSE otherwise), defaults to TRUE
namsav
name of the files to which results are to be saved (defaults to "output", which will produce a file called output.eps (if the default format of postscript is kept, see type.graph) for the graphs and a file called output.npde for the numerical results (see value)
type.graph
type of graph (one of "eps","jpeg","png","pdf"), defaults to postscript ("eps")
calc.npde
a boolean (TRUE if npde are to be computed, FALSE otherwise), defaults to TRUE
calc.pd
a boolean (TRUE if pd are to be computed, FALSE otherwise), defaults to TRUE
cens.method
a character string indicating the method used to handle censored data (see npde.cens.method) defaults to cdf
decorr.method
a character string indicating the method used to decorrelate observed and simulated data in the computation of npde (see npde.decorr.method) defaults to cholesky
ties
a boolean (if FALSE, the distributions of pd and npde are smoothed by jittering the values so that there are no ties), defaults to TRUE
verbose
a boolean (TRUE if messages are to be printed as each subject is processed, FALSE otherwise), defaults to FALSE

Value

An object of class NpdeObject

Details

Both functions compute the normalised prediction distribution errors (and/or prediction discrepancies) in the same way. npde is an interactive function whereas autonpde takes all required input as arguments.

When the computation of npde fails because of numerical problems, error messages are printed out, then pd are computed instead and graphs of pd are plotted so that the user may evaluate why the computation failed.

The function also prints out the characteristics of the distribution of the npde (mean, variance, skewness and kurtosis) as well as the results of the statistical tests applied to npde. In addition, if boolsave is TRUE, two files are created:

results file
the numerical results are saved in a file with extension .npde (the name of which is given by the user). The file contains the components id, xobs, ypred, npde, pd stored in columns
graph file
the graphs are saved to a file with the same name as the results file, and with extension depending on the format.

References

K. Brendel, E. Comets, C. Laffont, C. Laveille, and F. Mentre. Metrics for external model evaluation with an application to the population pharmacokinetics of gliclazide. Pharmaceutical Research, 23:2036--49, 2006.

See Also

npde.graphs, gof.test

Examples

Run this code
data(theopp)
data(simtheopp)

# Calling autonpde with dataframes

x<-autonpde(theopp,simtheopp,1,3,4,boolsave=FALSE)
x

# Calling autonpde with names of files to be read from disk

write.table(theopp,"theopp.tab",quote=FALSE,row.names=FALSE)
write.table(simtheopp,"simtheopp.tab",quote=FALSE,row.names=FALSE)
x<-autonpde(namobs="theopp.tab", namsim="simtheopp.tab", iid = 1,
ix = 3, iy = 4, imdv=0, boolsave = FALSE)

head(x["results"]["res"])

Run the code above in your browser using DataCamp Workspace