Model {PvSTATEM} | R Documentation |
Logistic regression model for the standard curve
Description
This model uses the nplr
package to fit the model. The model is fitted using the formula:
y = B + \frac{T - B}{(1 + 10^{b \cdot (x_{mid} - x)})^s},
where:
-
y
is the predicted value, MFI in our case, -
x
is the independent variable, dilution in our case, -
B
is the bottom plateau - the right horizontal asymptote, -
T
is the top plateau - the left horizontal asymptote, -
b
is the slope of the curve at the inflection point, -
x_{mid}
is the x-coordinate at the inflection point, -
s
is the asymmetric coefficient.
This equation is referred to as the Richards' equation. More information about the model can be found in the nplr
package documentation.
Public fields
analyte
(
character(1)
)
Name of the analyte for which the model was fitteddilutions
(
numeric()
)
Dilutions used to fit the modelmfi
(
numeric()
)
MFI values used to fit the modelmfi_min
(
numeric(1)
)
Minimum MFI used for scaling MFI values to the range [0, 1]mfi_max
(
numeric(1)
)
Maximum MFI used for scaling MFI values to the range [0, 1]model
(
nplr
)
Instance of thenplr
model fitted to the datalog_dilution
(
logical()
)
Indicator should the dilutions be transformed using thelog10
functionlog_mfi
(
logical()
)
Indicator should the MFI values be transformed using thelog10
functionscale_mfi
(
logical()
)
Indicator should the MFI values be scaled to the range [0, 1]
Active bindings
top_asymptote
(
numeric(1)
)
The top asymptote of the logistic curvebottom_asymptote
(
numeric(1)
)
The bottom asymptote of the logistic curve
Methods
Public methods
Method new()
Create a new instance of Model R6 class
Usage
Model$new( analyte, dilutions, mfi, npars = 5, verbose = TRUE, log_dilution = TRUE, log_mfi = TRUE, scale_mfi = TRUE, mfi_min = NULL, mfi_max = NULL )
Arguments
analyte
(
character(1)
)
Name of the analyte for which the model was fitted.dilutions
(
numeric()
)
Dilutions used to fit the modelmfi
MFI (
numeric()
)
values used to fit the modelnpars
(
numeric(1)
)
Number of parameters to use in the modelverbose
(
logical()
)
IfTRUE
prints messages,TRUE
by defaultlog_dilution
(
logical()
)
IfTRUE
the dilutions are transformed using thelog10
function,TRUE
by defaultlog_mfi
(
logical()
)
IfTRUE
the MFI values are transformed using thelog10
function,TRUE
by defaultscale_mfi
(
logical()
)
IfTRUE
the MFI values are scaled to the range [0, 1],TRUE
by defaultmfi_min
(
numeric(1)
)
Enables to set the minimum MFI value used for scaling MFI values to the range [0, 1]. Use values before any transformations (e.g., before thelog10
transformation)mfi_max
(
numeric(1)
)
Enables to set the maximum MFI value used for scaling MFI values to the range [0, 1]. Use values before any transformations (e.g., before thelog10
transformation)
Method predict()
Predict the dilutions from the MFI values
Usage
Model$predict(mfi)
Arguments
mfi
(
numeric()
)
MFI values for which we want to predict the dilutions.
Returns
(data.frame()
)
Dataframe with the predicted dilutions, MFI values, and the 97.5% confidence intervals
The columns are named as follows:
-
dilution
- the dilution value -
dilution.025
- the lower bound of the confidence interval -
dilution.975
- the upper bound of the confidence interval -
MFI
- the predicted MFI value
Method get_plot_data()
Data that can be used to plot the standard curve.
Usage
Model$get_plot_data()
Returns
(data.frame()
)
Prediction dataframe for scaled MFI (or logMFI) values in the range [0, 1].
Columns are named as in the predict
method
Method print()
Function prints the basic information about the model such as the number of parameters or samples used
Usage
Model$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
Model$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
plate_file <- system.file("extdata", "CovidOISExPONTENT.csv", package = "PvSTATEM")
layout_file <- system.file("extdata", "CovidOISExPONTENT_layout.csv", package = "PvSTATEM")
plate <- read_luminex_data(plate_file, layout_filepath = layout_file)
model <- create_standard_curve_model_analyte(plate, "S2", log_mfi = TRUE)
print(model)