The input vector th parameterizes a Gaussian mixture, and tau_min / tau_max 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'(t), at the points t = seq(tau_min,tau_max,len=N), where N is 1000 by default.

(2) Identify points where f'(t) changes sign, then numerically estimate the crossing point between the two t values where there was a sign change.

(3) Create a vector of critical points, t_crit, which includes tau_min / tau_max as well as the crossing points found in the preceding step.

(4) Calculate the density at the critical points to identify the peak value, f_peak, and corresponding calendar date, t_peak, as well as the index of the peak in t_crit, ind_peak.

(5) For each time period (the length(t_peak)-1 durations defined by t_peak) determine the sign of the density function, f(t), and create a character vector, slope, that has the value 'pos' if f(t) is positive and 'neg' if f(t) is negative.

(6) Finally, create a character vector, pattern, that appends the index of the peak in t_crit (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.

summarize_trunc_gauss_mix_sample(th, tau_min, tau_max, N = 1000)

Arguments

th

The Gaussian mixture parameterization

tau_min

The lower truncation value

tau_max

The upper truncation value

N

The number of points use for identifying slope changes (default: 1000)

Value

A list consisting of:

  • periods A data-frame where the columns t_lo/t_hi indicate the starting and ending calendars dates of periods and slope is negative if the growth rate is negative over that time period and positive if it is positive.

  • ind_peak The index of the period in the data-frame periods with the peak value of the density.

  • t_peak The calendar date of the peak value of the density.

  • f_peak The value of the density function at the peak calendar date.

  • pattern A unique pattern that summaries the periods of growth/decary and relative locaiton of the peak (see Description).