Calculation of additional parameters of interest

knitr::opts_chunk$set(echo = TRUE)

After we have successfully fitted either a sigmoidal or double-sigmoidal model to input data, we may want to extract additional information of interest about the fitted curves, such as the midpoint of the curve and the slope at the midpoint. This information can be calculated with the function parameterCalculation(). It is called automatically by the top-level interface fitAndCategorize(), but it needs to be called manually if we fit curves with multipleFitFunction().

###*****************************
# INITIAL COMMANDS TO RESET THE SYSTEM
rm(list = ls())
if (is.integer(dev.list())){dev.off()}
cat("\014")
seedNo=14159
set.seed(seedNo)
###*****************************

###*****************************
require("sicegar")
require("dplyr")
require("ggplot2")
###*****************************
time=seq(3,24,0.5)

#simulate intensity data and add noise
noise_parameter=0.1
intensity_noise=stats::runif(n = length(time),min = 0,max = 1)*noise_parameter
intensity=sicegar::sigmoidalFitFormula(time, maximum=4, slope=1, midPoint=8)
intensity=intensity+intensity_noise

dataInputSigmoidal=data.frame(time, intensity)
noise_parameter=0.2
intensity_noise=runif(n = length(time),min = 0,max = 1)*noise_parameter
intensity=sicegar::doublesigmoidalFitFormula(time,
                                    finalAsymptoteIntensityRatio=.3,
                                    maximum=4,
                                    slope1=1,
                                    midPoint1Param=7,
                                    slope2=1,
                                    midPointDistanceParam=8)
intensity=intensity+intensity_noise

dataInputDoubleSigmoidal=data.frame(time, intensity)
normalizedSigmoidalInput = sicegar::normalizeData(dataInput = dataInputSigmoidal, 
                                         dataInputName = "sigmoidalSample")

normalizedDoubleSigmoidalInput = sicegar::normalizeData(dataInput = dataInputDoubleSigmoidal, 
                                         dataInputName = "doubleSigmoidalSample")

Assume we have fitted a sigmoidal or double-sigmoidal model using sicegar::multipleFitFunction():

sigmoidalModel <- multipleFitFunction(dataInput=normalizedSigmoidalInput,
                                   model="sigmoidal")
doubleSigmoidalModel <- multipleFitFunction(dataInput=normalizedDoubleSigmoidalInput,
                                         model="doublesigmoidal")

We can then apply sicegar::parameterCalculation() to the generated model objects:

sigmoidalModelAugmented <- parameterCalculation(sigmoidalModel)
doubleSigmoidalModelAugmented <- parameterCalculation(doubleSigmoidalModel)

Compare the contents of the fitted model before and after parameter calculation:

# before parameter calculation 
t(sigmoidalModel)
# after parameter calculation 
t(sigmoidalModelAugmented)

We see that the variable additionalParameters has switched from FALSE to TRUE, and further, there are numerous additional quantities listed now, starting with maximum_x. Below, we describe the meaning of these additional parameters for the sigmoidal and double-sigmoidal models.

Additional parameters for the sigmoidal model

The following parameters are calculated by parameterCalculation() for the sigmoidal model.

1. Maximum of the fitted curve.

2. Midpoint of the fitted curve. This is the point where the slope is maximal and the intensity half of the maximum intensity.

3. Slope of the fitted curve.

4. Parameters related to the slope tangent, which is the tangent line that passes through the midpoint of the curve.

Additional parameters for the double-sigmoidal model

# Parameters for double sigmoidal model
print(t(doubleSigmoidalModel))

1. Maximum of the fitted curve.

2. Final asymptote intensity of the fitted model

3. First midpoint of the fitted curve. This is the point where the intensity first reaches half of its maximum.

4. Second midpoint of the fitted curve. This is the point at which the intensity decreases halfway from its maximum to its final asymptotic value.

5. Slopes of the fitted curve.

6. Parameters related to the first slope tangent, which is the tangent line that passes through the first midpoint of the curve.

7. Parameters related to the second slope tangent, which is the tangent line that passes through the second midpoint of the curve.



Try the sicegar package in your browser

Any scripts or data that you put into this service are public.

sicegar documentation built on Aug. 23, 2019, 5:05 p.m.