figureModelCurves: Generate model associated figures.

Description Usage Arguments Value Examples

View source: R/figureGeneration.R

Description

Generates figures using ggplot that shows the input data and the fitted curves.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
figureModelCurves(
  dataInput,
  sigmoidalFitVector = NULL,
  doubleSigmoidalFitVector = NULL,
  showParameterRelatedLines = FALSE,
  xlabelText = "time",
  ylabelText = "intensity",
  fittedXmin = 0,
  fittedXmax = NA
)

Arguments

dataInput

A data frame or a list contatining the dataframe. The data frame should be composed of at least two columns. One represents time, and the other represents intensity. The data should be normalized with the normalize data function sicegar::normalizeData() before imported into this function.

sigmoidalFitVector

the output of the sicegar::sigmoidalFitFunction(), or the agumented version of the output generated by the help of sicegar::parameterCalculation(), which contains parameters related with sigmoidal model. Default is NULL.

doubleSigmoidalFitVector

the output of the sicegar::doubleSigmoidalFitFunction(), or the agumented version of the output generated by the help of sicegar::parameterCalculation(), which contains parameters related with double sigmoidal model. Default is NULL.

showParameterRelatedLines

if equal to TRUE, figure will show parameter related lines on the curves. Default is FALSE.

xlabelText

the x-axis name; with default "time"

ylabelText

the y-axis name; with default "intensity"

fittedXmin

the minimum of the fitted data that will be plotted (Default 0)

fittedXmax

the maximum of the fitted data that will be plotted (Default timeRange)

Value

Returns infection curve figures.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
time <- seq(3, 24, 0.1)

#simulate intensity data and add noise
noise_parameter <- 0.2
intensity_noise <- runif(n = length(time), min = 0, max = 1) * noise_parameter
intensity <- sicegar::doublesigmoidalFitFormula(time,
                                               finalAsymptoteIntensityRatio = .3,
                                               maximum = 4,
                                               slope1Param = 1,
                                               midPoint1Param = 7,
                                               slope2Param = 1,
                                               midPointDistanceParam = 8)
intensity <- intensity + intensity_noise

dataInput <- data.frame(intensity = intensity, time = time)
normalizedInput <- sicegar::normalizeData(dataInput, dataInputName = "sample001")


# Do the double sigmoidal fit
doubleSigmoidalModel <- sicegar::multipleFitFunction(dataInput = normalizedInput,
                                                    model = "doublesigmoidal",
                                                    n_runs_min = 20,
                                                    n_runs_max = 500,
                                                    showDetails = FALSE)

doubleSigmoidalModel <- sicegar::parameterCalculation(doubleSigmoidalModel)

fig01 <- sicegar::figureModelCurves(dataInput = normalizedInput,
                                  doubleSigmoidalFitVector = doubleSigmoidalModel,
                                  showParameterRelatedLines = TRUE)
print(fig01)

wilkelab/sicegar documentation built on May 8, 2021, 11:08 p.m.