Estimates initial parameter values from the data, providing a starting point for optimization.
Details
Starting values affect whether the nonlinear fit converges. Estimate them from the local peak height, width at half maximum and asymmetry.
Examples
model <- create_peak_model("gaussian")
x <- seq(0, 10, by = 0.1)
y <- dnorm(x, mean = 5, sd = 1)
peak_idx <- which.max(y)
initial <- peak_model_initial_guess(model, x, y, peak_idx)
initial
#> $height
#> [1] 0.3989423
#>
#> $center
#> [1] 5
#>
#> $width
#> [1] 1.019186
#>