get_winning_model.pk {invivoPKfit}R Documentation

Get winning model

Description

Get winning model for a fitted 'pk' object

Usage

## S3 method for class 'pk'
get_winning_model(obj, newdata = NULL, method = NULL, criterion = "AIC", ...)

Arguments

obj

A [pk()] object

newdata

Optional: A 'data.frame' containing new data to plot. Must contain at least variables 'Chemical', 'Species', 'Route', 'Media', 'Dose', 'Time', 'Time.Units', 'Conc', 'Detect', 'Conc_SD'. Default 'NULL', to use the data in 'obj$data'.

method

Character: One or more of the [optimx::optimx()] methods used in fitting. The winning model will be determined for each of these methods. Default 'NULL' to get the winning model for each method in 'obj$settings_optimx$method'.

criterion

The name of a criterion function to use for model comparison. Default "AIC". Must be the name of a function that (as for 'AIC') accepts arguments 'obj', 'newdata', 'method' and 'model' (may accept other arguments, specified in '...') and returns output as for 'AIC': a data.frame with a column with the same name as 'criterion' that has calculated values for model comparison. The "winning" value will be the smallest value.

...

Optional: Other arguments to 'criterion' function.

Details

Get the winning model (i.e. the model with the lowest value of the criterion specified in 'criterion') for a fitted 'pk' object, for a specified method, and optionally for a specified new dataset. When there are ties it will return the first encounter, where the priority is: model_1comp > model_2comp > model_flat.

Value

A data.frame with one row for each 'data_group', 'model' and 'method' and The return value has attribute 'criterion' giving the name of the criterion function used to compare models.

Author(s)

Caroline Ring, Gilberto Padilla Mercado


[Package invivoPKfit version 2.0.1 Index]