View source: R/Calculate_maxRBA.R
Calculate_maxRBA | R Documentation |
Calculate_maxRBA
calculates the maximum residual after baseline-adjustment for each viral strain
Calculate_maxRBA( dat_list, subjectCol = "SubjectID", method = c("exp", "lm"), yMinZero = FALSE, scoreFun = max, discretize = c(0.2, 0.3), normalize = FALSE, scaleResiduals = FALSE, responseLabels = paste0(c("low", "moderate", "high"), "Responder"), na_action = "na.fail", ... )
dat_list |
a named list like the one returned by |
subjectCol |
the name of the column specifying a subject ID. Default is "SubjectID". |
method |
a character string specifying the method used to model the relationship between day 0 and fold change values. One of either "lm" for a linear model or "exp" for an exponential model. |
yMinZero |
a logical specifying whether fitted y values below 0 should be set to 0. |
scoreFun |
a function applied to all (potentially scaled) residuals for each subject to determine the endpoint. Default is |
discretize |
a vector of quantiles in (0, 0.5] specifying where to make the cutoff for low, moderate and high responses. Default is 20% and 30%. |
normalize |
Logical specifying whether residuals should be normalized with the inverse normal transform. Default is |
scaleResiduals |
Logical. Should residuals be scaled inversely by the square of the confidence intervals from the linear model. |
responseLabels |
names for low, moderate and high responses |
na_action |
how should missing |
... |
Additional arguments passed to |
Calculates the baseline-adjusted fold change for each strain of virus
using (unnormalized) fold change and baseline titers. Linear regression or
an exponential curve is used to remove the effect of baseline titers on fold changes.
The score function (scoreFun
) is used to combine the adjusted fold change across
multiple strains.
Missing (NA
) values are handled by being returned as missing in the
endpoints in the output
A list with the following elements:
the models calculated on each strain separately (with names the same as on dat_list
)
the matrix of residuals
a named vector containing the continuous maxRBA endpoint
a named vector containing the discrete maxRBA endpoint with cutoffs defined by the <X>% quantile (may be more than 1, see discretize
)
Stefan Avey
lm, nls
## Prepare the data titer_list <- FormatTiters(Year2_Titers) ## Using a linear fit endpoints <- Calculate_maxRBA(titer_list, method = "lm") summary(endpoints) ## Get discrete endpoints using upper/lower 30% endpoints$maxRBA_d30 ## Get endpoints with a 50% split into high and low endpoints <- Calculate_maxRBA(titer_list, method = "exp", discretize = 0.5) endpoints$maxRBA_d50
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.