View source: R/calculate_mgfr_relm.R
calculate_mgfr_relm | R Documentation |
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.
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"
)
time |
A vector of time values (minutes) |
relmipirazin_conc |
A vector of relmipirazin plasma measurements (ug/mL) |
relm_units |
relmipirazin concentration units, defaults to |
time_units |
Time units, defaults to |
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
|
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) |
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
)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.