View source: R/f_dispensing_models.R
f_fit_di | R Documentation |
Fits a linear mixed-effects model to the dispensed doses at drug dispensing visits.
f_fit_di(df, model, nreps, showplot = TRUE)
df |
The subject-level dosing data, including |
model |
The model used to analyze the dispensed doses, with options including "constant", "linear model", and "linear mixed-effects model". |
nreps |
The number of simulations for drawing posterior model parameters. |
showplot |
A Boolean variable that controls whether or not to
show the fitted dose bar chart. It defaults to |
A list with three components:
fit
: A list of results from the model fit that includes
model
: The specific model used in the analysis.
mud
: The estimated mean dose.
vmud
: The estimated variance of mud
.
sigmab
: The estimated between-subject standard deviation.
sigmae
: The estimated within-subject residual standard
deviation.
aic
: The Akaike Information Criterion value.
bic
: The Bayesian Information Criterion value.
fit_plot
: A fitted dose bar chart.
theta
: Posterior draws of model parameters.
fixed
: Posterior draws of fixed model parameters:
mud
, sigmab
, and sigmae
.
random
: Posterior draws of subject random effects.
usubjid
: The unique subject ID associated with
the subject random effects.
Kaifeng Lu, kaifenglu@gmail.com
library(dplyr)
observed <- f_dose_observed(df2, visitview2, showplot = FALSE)
vf <- observed$vf
vf1 <- vf %>% filter(kit == 3)
di_fit <- f_fit_di(vf1, model = "linear mixed-effects model", nreps = 200)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.