Heuristic method to guess number of components and their parameters (mean, standard deviation and weight) from observation data.

mx_guess_components(x, bw = 1, minpeak = 0, mincut = 0.9, ...)

Arguments

x

vector of (non-binned) observation data

bw

bandwidth of kernel density, cf. density

minpeak

minimum value of the total maximum which is regarded as peak

mincut

minimum relative height of a pit compared to the lower of the two neighbouring maxima at which these maxima are regarded as separate peaks (default value is derived from golden section)

...

further arguments passed to density

Value

data frame with mean (mean), standard deviation sd and mixing proportions L

Details

The function guesses approximate start values of parameters that then need subsequent identification, e.g. with a maximum likelihood or EM (expectation maximization) method.

See also

Examples

set.seed(123) x <- c(rnorm(20, 5, 1), rnorm(30, 10, 1), rnorm(50, 20, 2)) hist(x, breaks=20)
mx_guess_components(x)
#> mean sd L #> 1 5.021476 1.258172 0.1934724 #> 2 9.939100 1.333979 0.3068663 #> 3 20.297907 2.051515 0.4996613