Description Usage Arguments Value
View source: R/bd_summarize_trunc_gauss_mix_sample.R
The input vector th parameterizes a Gaussian mixture, and ymin / ymax give the limits of truncation. Summarize the sample by identifying growth / decay periods and the peak value using the following procedure.
(1) Calculate the derivative, f'(y), at the points y = seq(ymin,ymax,len=N), where N is 1000 by default.
(2) Identify points where f'(y) changes sign, then numerically estimate the crossing point between the two y values where there was a sign change.
(3) Create a vector of critical points, ycrit, which includes ymin / ymax as well as the crossing points found in the preceding step.
(4) Calculate the density at the critical points to identify the peak value, fpeak, and corresponding calendar date, ypeak, as well as the index of of the peak in ycrit, indPeak.
(5) For each time period (the length(ypeak)-1 durations defined by ypeak) determine the sign of the density function, f(y), and create a character vector, slope, that has the value 'pos' if f(y) is positive and 'neg' if f(y) is negative.
(6) Finally, create a character vector, pattern, that appends the index of the peak in ycrit (converted to a character) to the character vector slope. This defines a unique pattern of the sample that takes into account periods of growth / decline and the relative location of the peak.
1 | bd_summarize_trunc_gauss_mix_sample(th, ymin, ymax, N = 1000)
|
th |
The Gaussian mixture parameterization |
ymin |
The lower truncation value |
N |
(Default 1000) The number of points use for identifying slope changes |
ymin |
The upper truncation value |
A list consisting of ylo / yhi (specifying the time periods), indPeak, ypeak, fpeak, and pattern (see Description)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.