calculate_summary_statistic: calculate_summary_statistic

View source: R/functions_wrapper.R

calculate_summary_statisticR Documentation

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)

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.

Value

(numeric) The summary statistic

Examples

## Not run: 
model <- load_example_model("pheno")
calculate_summary_statistic(model, "max", "TIME")
calculate_summary_statistic(model, "median", "log(WGT)")
calculate_summary_statistic(model, "median", "TVCL")

## End(Not run)


pharmr documentation built on May 28, 2026, 5:08 p.m.