pkmod: Create a pkmod object

View source: R/methods.R

pkmodR Documentation

Create a pkmod object

Description

User function to create pkmod objects with validation checks. Multiple rows are permitted for arguments 'pars_pk', 'pars_pd', 'init'

Usage

pkmod(
  pars_pk = NULL,
  init = NULL,
  pkfn = NULL,
  pars_pd = NULL,
  pdfn = NULL,
  pdinv = NULL,
  pcmpt = NULL,
  ecmpt = NULL,
  sigma_add = 0,
  sigma_mult = 0,
  log_response = FALSE,
  Omega = NULL
)

Arguments

pars_pk

Vector or matrix of named PK parameters. If not specified, the pkmod function will be inferred from the parameter names. Print 'list_parnms()' for acceptable parameter names.

init

Vector of initial concentrations. Will default to values of zero in all compartments if not specified.

pkfn

PK model function. Functions provided in 'tci' include 'pkmod1cpt', 'pkmod2cpt', 'pkmod3cpt', and 'pkmod3cptm'. User-defined functions should be specified here.

pars_pd

PD model parameters if a PD model is specified

pdfn

PD model function

pdinv

Inverse PD model function for use in TCI algorithms

pcmpt

Index of plasma compartment. Defaults to first compartment if not specified.

ecmpt

Index of effect-site compartment if a PD model is specified. Will default to last compartment if unspecified.

sigma_add

Standard deviation of additive residual error

sigma_mult

Standard deviation of multiplicative residual error

log_response

Logical value indicating if the response should be logged prior to adding error.

Omega

Optional matrix of random effect parameters. Column names should correspond to names of pars_pk, pars_pd, and sigma_add or sigma_mult.

Value

Returns a list with class "pkmod" if validation checks are passed. Returns an error if not.

Examples

# 1-compartment model
pkmod(pars_pk = c(CL = 10, V1 = 10))
# 2-compartment model
pkmod(pars_pk = c(CL = 10, V1 = 10, Q = 3, v2 = 20))
# 2-compartment model with random effects matrix
Omega <- matrix(diag(c(0.3,0.2,0,0.4)), 4,4, dimnames = list(NULL,c("CL","V1","Q","v2")))
pkmod(pars_pk = c(CL = 10, V1 = 10, Q = 3, v2 = 20), Omega = Omega)

tci documentation built on Aug. 15, 2022, 9:09 a.m.