calculate_mgfr_relm: Relmipirazin measured GFR with 2-compartment model (early and...

View source: R/calculate_mgfr_relm.R

calculate_mgfr_relmR Documentation

Relmipirazin measured GFR with 2-compartment model (early and late sampling)

Description

This method requires multiple early (alpha phase, typically <120 min) and late (beta phase) sample measurements of relmipirazin to determine GFR (glomerular filtration rate). This function uses nonlinear modeling via the nls() function to fit the 2-compartment model of relmipirazin kinetics using the formula C=A*e^(- \alpha * t) + B*e^(- \beta * t) . The general method and provided examples are modified from Schwartz et al. Kidney Int. 2006.. Results are returned as a non-indexed value for GFR (mgfr_2c) and also indexed to BSA of 1.73m2 if height and weight are provided (mgfr_2c_bsa). The summary provides estimates of kinetic parameters (k10, k21, k12) which can be used in ODE models, but is not implemented here.

Usage

calculate_mgfr_relm(
  time,
  relmipirazin_conc,
  relm_units = "ng/mL",
  time_units = "min",
  id = NULL,
  height = NA,
  height_units = "m",
  weight = NA,
  weight_units = "kg",
  nls_weights = TRUE,
  output = "summary"
)

Arguments

time

A vector of time values (minutes)

relmipirazin_conc

A vector of relmipirazin plasma measurements (ug/mL)

relm_units

relmipirazin concentration units, defaults to ng/mL

time_units

Time units, defaults to min

id

Study identifier (optional, passed to plot title)

height

Patient Height, cm

height_units

Height units, if not in cm

weight

Patient Weight, kg

weight_units

Weight units, if not in kg

output

Desired output, defaults to summary of model. Alternatively can specify gfr, gfr_bsa, fit, or plot

summary results include the named variables:

  • mgfr_2c The measured GFR (mL/min)

  • mgfr_2c_bsa The measured GFR (mL/min/1.73 m2) indexed to body surface area (BSA calculated by DuBois equation)

  • relmipirazin_m Relmipirazin mass (ucg) injected. Determined either by user-provided syringe weight or volume injected.

  • relmipirazin_0 Relmipirazin concentration at t=0 calculated by A+B (theoretical, not measured)

  • relmipirazin_vd Relmipirazin Volume of distribution estimated by Dose/relmipirazint0

  • relm_auc Relmipirazin calculated AUC from t=0 to Infinity, estimated by A/a + B/b

  • A Model parameter A

  • a Model parameter a, or \alpha

  • B Model parameter B

  • b Model parameter b, or \beta

  • model_r2 Model Pseudo-R2, calculated as the linear regression R2 for predicted~observed values

  • k10 Relmipirazin elimination rate constant from central compartment (1/min)

  • k21 Relmipirazin transfer rate constant from peripheral to central compartment (1/min)

  • k12 Relmipirazin transfer rate constant from central to peripheral compartment (1/min)

gfr returns a single mgfr_2c value, the measured GFR (mL/min). gfr_bsa returns a single mgfr_2c_bsa value, the measured GFR (mL/min/1.73 m2) indexed to body surface area (BSA calculated by DuBois equation).

fit returns the non-linear regression model fit object.

plot returns a base-R plot of observed and predicted regression curve vs time, and summary measures in the legend.

relm_inj_wt

Relmipirazin injection Weight by syringe weight determination (Pre-Post weight difference; recommended method) in grams

relm_inj_vol

Relmipirazin injection Volume by syringe volume injected (Not preferred; use if weights not available)

Value

Desired output with either a data.frame of results (summary), a single value of BSA adjusted GFR (gfr), an ⁠nls object⁠ for model fit (fit), or a plot with observed values, model fit curve, and summary results in the figure legend (plot)

Examples

calculate_mgfr_relm(df_rel_a$time, df_rel_a$relmapirazin_ng_ml, height = 1.6002, weight = 71.698, output="plot")
calculate_mgfr_relm(df_rel_a$time, df_rel_a$relmapirazin_ng_ml, height = 1.6002, weight = 71.698, output="plot", nls_weights = FALSE)

# ODE MODEL FOR COMPARISON; 
# Example only to verify ODE parameter estimates, not required for GFR calculation
# This model uses solution from the nls model to get the kinetic parameters
library(deSolve)
m2c <- function(Time, State, Pars) {
  with(as.list(c(State, Pars)), {
    drelmipirazin <- -k10*relmipirazin - k12*relmipirazin + k21*C2 # Central Conc
    dC2 <-  k12*relmipirazin - k21*C2                    # Peripheral Conc
    return(list(c(drelmipirazin, dC2)))
  })
}
# get parameters from nls model
relm_nlfit <- calculate_mgfr_2c(dat$time, dat$relmipirazin_ug_ml, height = 1.67, weight = 70, relm_inj_vol = 5)
pars  <- c(k10 = relm_nlfit$k10, k21 = relm_nlfit$k21, k12 = relm_nlfit$k12)
# plug into the ODE model solution
yini  <- c(relmipirazin = relm_nlfit$A+relm_nlfit$B, C2=0)
times <- seq(0, 360, by = 1)
out   <- ode(yini, times, m2c, pars)
out_df <- as.data.frame(out)
# Plot to verfiy kinetic parameters vs nls model
calculate_mgfr_2c(dat$time, dat$relmipirazin_ug_ml, height = 1.67, weight = 70, relm_inj_vol = 5, output="plot")
lines(out_df$time, out_df$relmipirazin, lty=2)

JMLuther/tabletools documentation built on April 14, 2025, 3:09 a.m.