This function was originally sourced from the `automap` package (version 1.1-16), which is no longer available on CRAN. It is provided here with minimal modification for internal use in this package.
`autofitVariogram()` automates the fitting of a variogram model to spatial input data by testing a range of model types and kappa values (for Matern and Stein models), and selecting the best-fit model based on the sum of squared errors.
Dependencies from `gstat`, `sp`, and `sf` are required for this function to operate correctly.
Arguments
- formula
model formula for the variogram (e.g., `z ~ 1`)
- input_data
an `sf` or `Spatial*` object containing the spatial data
- model
a character vector of variogram model names (e.g., `"Sph"`, `"Exp"`)
- kappa
vector of kappa values for Matern/Stein models
- fix.values
optional vector of fixed values for nugget, range, sill
- verbose
logical; if `TRUE`, prints additional output
- GLS.model
optional variogram model for Generalized Least Squares
- start_vals
optional vector of starting values for nugget, range, sill
- miscFitOptions
named list of additional control options
- ...
additional arguments passed to `gstat::variogram()`