Estimates the parameters of a normal distribution by weighted maximum likelihood.
Details
The fitted mean is weighted.mean(value, weight). The fitted standard
deviation is
$$\sqrt{\frac{\sum_i w_i(x_i-\bar{x}_w)^2}{\sum_i w_i}}.$$
This is the maximum-likelihood rather than the unbiased estimate: there is no
finite-sample correction. Consequently, the result is invariant to a common
positive rescaling of all weights. Inputs are checked by the internal
weighted-observation validator.
Examples
cod_data <- validate_ppmr_data(barnes_data, species = "Atlantic cod")
fit_normal(cod_data$log_ppmr, cod_data$n_prey)
#> $mean
#> [1] 5.725514
#>
#> $sd
#> [1] 2.600442
#>