fit_model_triphasic {ushr}R Documentation

Fit model and obtain parameter estimates

Description

This function fits the triphasic model to the processed data and extracts the best-fit parameters.

Usage

fit_model_triphasic(data, id_vector, param_names, initial_params,
  free_param_index, n_min_triphasic, forward_param_transform_fn,
  inv_param_transform_fn, searchmethod)

Arguments

data

dataframe with columns for each subject's identifier ('id'), viral load measurements ('vl'), and timing of sampling ('time')

id_vector

vector of identifiers corresponding to the subjects to be fitted.

param_names

names of parameter vector.

initial_params

named vector of the initial parameter guess.

free_param_index

logical vector indicating whether the parameters A, delta, A_b, delta_b, B, gamma are to be recovered. This should be c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) for the triphasic model.

n_min_triphasic

the minimum number of data points required to fit the triphasic model.

forward_param_transform_fn

list of transformation functions to be used when fitting the model in optim. Defaults to log transformations for all parameters (to allow unconstrained optimization).

inv_param_transform_fn

list of transformation functions to be used when back-transforming the transformed parameters. Should be the inverse of the forward transformation functions. Defaults to exponential.

searchmethod

optimization algorithm to be used in optim. Defaults to Nelder-Mead.


[Package ushr version 0.2.3 Index]