get_curve: Compute the model for a given subject's data and best-fit...

Description Usage Arguments Value Examples

View source: R/model_fns.R

Description

This function calculates the biphasic or single phase model given a subject's data and best-fit parameters

Usage

1
get_curve(data, best_param, param_names, whichcurve = get_biphasic)

Arguments

data

data frame with columns for the subject's identifier ('id') and timing of sampling ('time')

best_param

named numeric vector of best fit parameters obtained from fitting the biphasic or single phase model to the subjects data

param_names

character vector containing the names of the parameters in 'best_param'

whichcurve

character indicating which model function should be used. Use 'get_biphasic' for the biphasic model, or 'get_singlephase' for the single phase model. Defaults to 'get_biphasic'.

Value

data frame with columns for the sampling times ('time'), fitted viral load predictions ('fit'), and the corresponding subject identifier ('id')

Examples

1
2
3
4
5
6
7
8
9
nobs <- 7
example_param <- c(A = 10000, delta = 0.03, B = 1000, gamma = 0.68)

vldata <- get_biphasic(params = example_param, timevec = seq(5, 100, length.out = nobs))

subjectdata <- data.frame(id = 123, time = seq(5, 100, length.out = nobs),
                          vl = 10^ (log10(vldata) + rnorm(nobs, 0, 0.2)))

get_curve(data = subjectdata, best_param = example_param, param_names = names(example_param))

ushr documentation built on April 22, 2020, 1:05 a.m.