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 fitted

dilutions

(numeric())
Dilutions used to fit the model

mfi

(numeric())
MFI values used to fit the model

mfi_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 the nplr model fitted to the data

log_dilution

(logical())
Indicator should the dilutions be transformed using the log10 function

log_mfi

(logical())
Indicator should the MFI values be transformed using the log10 function

scale_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 curve

bottom_asymptote

(numeric(1))
The bottom asymptote of the logistic curve

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 model

mfi

MFI (numeric())
values used to fit the model

npars

(numeric(1))
Number of parameters to use in the model

verbose

(logical())
If TRUE prints messages, TRUE by default

log_dilution

(logical())
If TRUE the dilutions are transformed using the log10 function, TRUE by default

log_mfi

(logical())
If TRUE the MFI values are transformed using the log10 function, TRUE by default

scale_mfi

(logical())
If TRUE the MFI values are scaled to the range [0, 1], TRUE by default

mfi_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 the log10 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 the log10 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)
#> Reading Luminex data from: /home/runner/work/_temp/Library/PvSTATEM/extdata/CovidOISExPONTENT.csv
#> using format xPONENT
#> 
#> New plate object has been created with name: CovidOISExPONTENT!
#> 
model <- create_standard_curve_model_analyte(plate, "S2", log_mfi = TRUE)
print(model)
#> Instance of the Model class fitted for analyte ' S2 ': 
#>  - fitted with 5 parameters
#>  - using 11 samples
#>  - using log residuals (mfi):  TRUE 
#>  - using log dilution:  TRUE 
#>  - top asymptote: 6587.765 
#>  - bottom asymptote: 24.6534 
#>  - goodness of fit: 0.996416 
#>  - weighted goodness of fit: 0.9998704