This function will create an object suitable for plotting visual predictive checks (VPCs) and prediction-corrected visual predictive checks (pcVPCs).

## Arguments

- result
The result of a prior run, loaded with PM_load.

- tad
Boolean operator to use time after dose rather than time after start. Default is

`FALSE`

.- binCov
A character vector of the names of covariates which are included in the model, i.e. in the model equations and which need to be binned. For example

`binCov='wt'`

if "wt" is included in a model equation like V=V0*wt, or`binCov=c( 'wt', 'crcl')`

if both "wt" and "crcl" are included in model equations.- doseC
An integer with the number of dose/covariate bins to cluster, if known from a previous run of this function. Including this value will skip the clustering portion for doses/covariates.

- timeC
An integer with the number of observation time bins to cluster, if known from a previous run of this function. Including this value will skip the clustering portion for observation times.

- tadC
An integer with the number of time after dose bins to cluster, if known from a previous run of this function. Including this value will skip the clustering portion for time after dose. This argument will be ignored if

`tad=FALSE`

.- limits
Limits on simulated parameters. See SIMrun.

- ...
Other parameters to be passed to SIMrun, especially

`limits`

.

## Value

The output of `make_valid`

is a list of class `PMvalid`

, which is a list with the following.

simdata The combined, simulated files for all subjects using the population mean values and each subject as a template. See SIMparse This object will be automatically saved to the run, to be loaded with PM_load next time.

timeBinMedian A data frame with the median times for each cluster bin.

tadBinMedian A data frame with the median time after dose (tad) for each cluster bin. This will be

`NA`

if`tad = FALSE`

.opDF A data frame with observations, predicitons, and bin-corrected predictions for each subject.

ndpe An object with results of normalized distrubition of prediction errors analysis.

npde_tad NPDE with time after dose rather than absolute time, if

`tad = TRUE`

## Details

The function will guide the user
through appropriate clustering of doses, covariates and sample times for
prediction correction using the methods of Bergstrand et al (2011).
*NOTE:* Including `tad`

is only
valid if steady state conditions exist for each patient.
This means that dosing is stable and regular
for each patient, without changes in amount or timing, and that
sampling occurs after the average concentrations
are the same from dose to dose. Otherwise observations are *NOT*
superimposable and `tad`

should
*NOT* be used, i.e. should be set to `FALSE`

.

## Examples

```
if (FALSE) {
library(PmetricsData)
valid <- NPex$validate(limits = c(0, 3))
}
```