multi_fraserSuzuki: Calculate Fraser-Suzuki Peak Models

Description Usage Arguments Value Examples

View source: R/PeakFunctions_multi_fraserSuzuki.R

Description

Calculate Fraser-Suzuki Peak Models

Usage

1
2
3
4
5
6
7
8
9
multi_fraserSuzuki(
  x,
  mus,
  sigmas,
  as,
  probDensity,
  returnComponentPks = FALSE,
  ks
)

Arguments

x

A vector of x-coordinates from which the corrisponding y-coordinates are calculated

mus

A vector of mean values

sigmas

A vector of standard deviations

as

a vector of values controling tailing. If a[i] > 0, model produces peak tails. If a[i] < 0, model produces fronting peaks

probDensity

Should the function produce probability distributions 'TRUE' with integrated area from min(x) to max(x) equal to 1 or produce gaussian peaks 'FALSE' with amplitudes ks? default is 'TRUE'.

returnComponentPks

Should the function return a single vector containing the sum of each individual peak 'FALSE' or a data.frame containing the input vector 'x', each component peak 'peak_n', and the summed result of the component peaks 'peak_sum'. The default is FALSE.

ks

A vector of amplitudes for the gaussian peaks. Only used when 'probDensity == TRUE'

Value

returns either a single vector of y-coordinates the same length as x or a data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#Fraser-Suzuki Peak Model Probability Distribution from multiple peaks
xVec <- seq(from = 1, to = 100, by = 0.1)
pdist <- multi_fraserSuzuki(x = xVec,
                            mus = c(5, 10, 15),
                            sigmas = c(1, 2, 4),
                            as = c(-1, 1, 0.5),
                            probDensity = TRUE,
                            returnComponentPks = FALSE)

pdist_components <- multi_fraserSuzuki(x = xVec,
                                       mus = c(5, 10, 15),
                                       sigmas = c(1, 2, 4),
                                       as = c(-1, 1, 0.5),
                                       probDensity = TRUE,
                                       returnComponentPks = TRUE)

plot(x = xVec, y = pdist)
plot(x = pdist_components$x, y = pdist_components$peak_sum)
points(x = pdist_components$x, y = pdist_components$peak_1, col = "red")
points(x = pdist_components$x, y = pdist_components$peak_2, col = "blue")
points(x = pdist_components$x, y = pdist_components$peak_3, col = "green")

pmbrophy/SummitR documentation built on May 20, 2020, 12:36 a.m.