Skip to contents

Fit a Gaussian mixture distribution to weighted observations

Usage

fit_gaussian_mixture(value, weight, k = 2, max_iter = 100, tol = 1e-06)

Arguments

value

A numeric vector of observed values

weight

A numeric vector of weights

Value

A list with the fitted parameters mean, sd and p, each of which is a vector with one entry for each component of the mixture

Examples

cod_data <- validate_ppmr_data(barnes_data, species = "Atlantic cod")
fit_gaussian_mixture(cod_data$log_ppmr, cod_data$n_prey)
#> $p
#> [1] 0.7647755 0.2352245
#> 
#> $mean
#> [1] 4.619355 9.321923
#> 
#> $sd
#> [1] 1.646948 1.736973
#>