## Usage

```
makePTA(
simdata,
simlabels,
targets,
target.type,
success,
outeq = 1,
free.fraction = 1,
start,
end,
icen = "median",
block = 1
)
```

## Arguments

- simdata
Can be one of multiple inputs. Typically it is a vector of simulator output filenames, e.g. c("simout1.txt","simout2.txt"), with wildcard support, e.g. "simout*" or "simout?", or a list of PMsim objects made by

`simdata`

with suitable simulated regimens and observations. The number and times of simulated observations does not have to be the same in all objects. It can also be a*PMpta*object previously made with`makePTA`

can be passed for recalculation with a new success value or simlabels. Finally,*PMpost*and*PMmatrix*objects are also allowed.- simlabels
Optional character vector of labels for each simulation. Default is

`c('Regimen 1', 'Regimen 2',...)`

.- targets
A vector of pharmacodynamic targets, such as Minimum Inhibitory Concentrations (MICs), e.g.

`c(0.25, 0.5,1,2,4,8,16,32)`

. This can also be a sampled distribution using makePTAtarget.- target.type
A numeric or character vector, length 1. If numeric, must correspond to an observation time common to all PMsim objects in

`simdata`

, rounded to the nearest hour. In this case, the target statistic will be the ratio of observation at time`target.type`

to target. This enables testing of a specific timed concentration (e.g. one hour after a dose or C1) which may be called a peak, but is not actually the maximum drug concentration. Be sure that the time in the simulated data is used, e.g. 122 after a dose given at 120. Character values may be one of "time", "auc", "peak", or "min", for, respectively, percent time above target within the time range specified by`start`

and`end`

, ratio of area under the curve within the time range to target, ratio of peak concentration within the time range to target, or ratio of minimum concentration within the time range to target.- success
A single value specifying the success statistic, e.g. 0.4 for proportion time (end-start) above target, or 100 for peak:target.

- outeq
An integer specifying the number of the simulated output equation to use. Default is 1.

- free.fraction
Proportion of free, active drug. Default is 1, i.e. 100% free drug or 0% protein binding.

- start
Specify the time to begin PTA calculations. Default is a vector with the first observation time for subjects in each element of

`simdata`

, e.g. dose regimen. If specified as a vector, values will be recycled as necessary.- end
Specify the time to end PTA calculations so that PTA is calculated from

`start`

to`end`

. Default for end is the maximum observation time for subjects in each element of`simdata`

, e.g. dose regimen. If specified as a vector, values will be recycled as necessary. Subjects with insufficient data (fewer than 5 simulated observations) for a specified interval will trigger a warning. Ideally then, the simulated datset should contain sufficient observations within the interval specified by`start`

and`end`

.- icen
Can be either "median" for the predictions based on medians of

`pred.type`

parameter value distributions, or "mean". Default is "median".- block
Which block to plot, where a new block is defined by dose resets (evid=4); default is 1.

## Value

The output of `makePTA`

is a list of class *PMpta*,
which has 2 objects:

**results**A data frame with the following columns: simnum, id, target, pdi.*simnum*is the number of the simulation;*id*is the simulated profile number within each simulation;*target*is the specified target;*pdi*is the target pharmacodynamic index, e.g. time > target, auc:target, etc.

**outcome**A data frame summarizing the results with the following columns: simnum, target, prop.success, pdi.mean, and pdi.sd. If`targets`

was specified via makePTAtarget to be a sampled distribution, then the target column will be missing from the outcome table.*simnum*and*target*are as for`results`

.*prop.success*is the proportion with a pdi >`success`

, as specified in*pdi.mean*and*pdi.sd*have the mean and standard deviation of the target pharmacodynamic index (e.g. proportion end-start above target, ratio of Cmax to target) for each simulation and target.

There are several attributes for this object that reflect the conditions used
to create it. Access the values of these attributes with `attr(x, which)`

as detailed in `base::attr()`

.

*simlabels*Values for the`simlabels`

*simTarg*Values for the`targets`

*success*Value for`success`

threshold*type*Value for`target.type`

## Details

`makePTA`

will calculate the PTA for any number of simulations, targets and definitions of success.
Simulations typically differ by dose, but may differ by other features such as children vs. adults. This function will also
accept data from real subjects either in the form of a *PMpost* or a *PMmatrix* object.
If a *PMpta* object is passed to the function as the `simdata`

, the only other parameter required is success.
If desired, a new set of simlabels can be specified; all other parameters will be ignored.