Learn R Programming

pharmr (version 2.2.0)

calculate_summary_statistic: calculate_summary_statistic

Description

Calculate a summary statistic for an expression over the dataset

The expression can be a dataset column name, a variable from the model, e.g. a derived covariate or a matematical expression involving dataset columns or model variables. If a calculation involves population parameters, the initial estimates will be used.

Usage

calculate_summary_statistic(model, stat, expr, default = NULL)

Value

(numeric) The summary statistic

Arguments

model

(Model) Pharmpy model

stat

(str) The summary statistic. Can be "max", "min", "median" or "mean"

expr

(str (optional)) A mathematical expression containing column or variable names

default

(numeric (optional)) An optional default value to use in case the statistic couldn't be calculated. For example if the model has no dataset.

Examples

Run this code
if (FALSE) {
model <- load_example_model("pheno")
calculate_summary_statistic(model, "max", "TIME")
calculate_summary_statistic(model, "median", "log(WGT)")
calculate_summary_statistic(model, "median", "TVCL")
}

Run the code above in your browser using DataLab