npde: Compute normalised prediction distribution errors

Description Usage Arguments Details Value Author(s) References See Also Examples

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

1
2
3
4
5
6
  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, method = "cholesky",
    cens.method = "cdf", units = list(x="",y=""),
    detect=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)

boolsave

a boolean (T if graphs and results are to be saved to a file, F otherwise), defaults to T

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")

verbose

a boolean (T if messages are to be printed as each subject is processed, F otherwise), defaults to FALSE

calc.npde

a boolean (T if npde are to be computed, F otherwise), defaults to TRUE

calc.pd

a boolean (T if pd are to be computed, F otherwise), defaults to TRUE

cens.method

a character string indicating the method used to handle censored data (see npde.cens.method) defaults to cdf

method

a character string indicating the method used to decorrelate observed and simulated data in the computation of npde (see npde.decorrel.method) defaults to cholesky

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 TRUE

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 T, 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.

Value

An object of class NpdeObject

Author(s)

Emmanuelle Comets <emmanuelle.comets@bichat.inserm.fr>

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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"])

Example output

Loading required package: mclust
Package 'mclust' version 5.4.3
Type 'citation("mclust")' for citing this R package in publications.
     Loading library npde, version 2.0, August 2012
         please direct bugs, questions and feedback to emmanuelle.comets@inserm.fr

---------------------------------------------
Distribution of npde :
      nb of obs: 120 
           mean= 0.0668   (SE= 0.095 )
       variance= 1.074   (SE= 0.14 )
       skewness= 0.511 
       kurtosis= 0.2912 
---------------------------------------------

Statistical tests
  t-test                     : 0.481
  Fisher variance test       : 0.55
  SW test of normality       : 0.00273 **
Global adjusted p-value      : 0.00819 **
---
Signif. codes: '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 
---------------------------------------------
Object of class NpdeObject
-----------------------------------------
----        Component data           ----
-----------------------------------------
Object of class NpdeData
Dataset theopp 
    Structured data: Conc ~ Time | ID 
This object has the following components:
     data: data
     with 12 subjects
      120 observations
The data has the following components
     X: Time 
     Y: Conc 
     missing data: mdv  (1=missing)
-----------------------------------------
----        Component results        ----
-----------------------------------------
Object of class NpdeRes
  containing the following elements:
    predictions (ypred)
    prediction discrepancies (pd)
    normalised prediction distribution errors (npde)
    completed responses (ycomp) for censored data
    decorrelated responses (ydobs)
  the dataframe has  120 non-missing observations and 132 lines.
---------------------------------------------
Distribution of npde :
      nb of obs: 120 
           mean= 0.0668   (SE= 0.095 )
       variance= 1.074   (SE= 0.14 )
       skewness= 0.511 
       kurtosis= 0.2912 
---------------------------------------------

Statistical tests
  t-test                     : 0.481
  Fisher variance test       : 0.55
  SW test of normality       : 0.00273 **
Global adjusted p-value      : 0.00819 **
---
Signif. codes: '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 
---------------------------------------------
     ypred ycomp   pd       ydobs      npde
1      NaN   NaN  NaN          NA        NA
2 2.923864  2.84 0.55 -0.05124648 0.1256613
3 4.682299  6.57 0.85  1.96398150 2.0537489
4 6.264357 10.50 0.99  2.56602650 2.3263479
5 6.986255  9.66 0.98  0.41616411 0.5244005
6 6.511039  8.58 0.93  0.28430866 0.2533471

npde documentation built on May 2, 2019, 5:23 p.m.