Description Usage Arguments Value Examples
View source: R/PeakFunctions_multi_expGaussian.R
Calculate Exponentially Modified Gaussian Probability Density(s) or Peak(s)
1 2 3 4 5 6 7 8 9 | multi_expGaussian(
x,
mus,
sigmas,
lambdas,
probDensity,
ks,
returnComponentPks = FALSE
)
|
x |
a vector of x-coordinates from which the corrisponding y-coordinates are calculated |
mus |
the means of the gaussian components |
sigmas |
the standard deviations of the gaussian components |
lambdas |
rate parameters of the exponential components |
probDensity |
Should the function produce a probability density 'TRUE' or exponentially modified gaussian peaks 'FALSE' with amplitudes ks? default is 'TRUE'. |
ks |
Amplitudes of the gaussian peaks. Only used when 'probDensity == 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. |
returns either a single vector of y-coordinates the same length as x or a data.frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | xVec <- seq(from = 1, to = 100, by = 0.1)
pdist <- multi_expGaussian(x = xVec,
mus = c(5, 10, 15),
sigmas = c(1, 2, 4),
lambdas = c(0.1, 0.1, 0.2),
probDensity = TRUE,
returnComponentPks = FALSE)
pdist_components <- multi_expGaussian(x = xVec,
mus = c(5, 10, 15),
sigmas = c(1, 2, 4),
lambdas = c(0.1, 0.1, 0.2),
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.