feat: add SDI beta coefficients database and dynamic autoselector#23
Open
aitorvv wants to merge 5 commits into
Open
feat: add SDI beta coefficients database and dynamic autoselector#23aitorvv wants to merge 5 commits into
aitorvv wants to merge 5 commits into
Conversation
…i_class to _pkgdown.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Este PR añade soporte para el autoselector dinámico de coeficientes beta en el cálculo de Stand Density Index (SDI) a partir del dataset sdi_coefficients, permitiendo el cálculo automatizado en base a la especie, país y región, y cayendo en cascada en diversos fallbacks (regional, nacional, por género y un default absoluto de Reineke 1933). La función para el cálculo del SDI y su documentación ha sido adaptada.
VERIFICATION CODE
Inspect new dataset
devtools::load_all()
str(sdi_coefficients) # tibble with columns: article_id, country, region, species, beta...
Verify auto-selector with exact match (includes Spain and region)
result_exact <- silv_density_sdi_auto(
ntrees = 800,
dg = 23.4,
species = "Pinus sylvestris",
country = "Spain",
region = "Castilla y León"
)
print(result_exact$sdi_model) # must print "del-rio-2006 (Spain, Castilla y León)"
print(result_exact$beta) # must print -1.75
print(result_exact$sdi) # calculated SDI
Verify region fallback
result_region <- silv_density_sdi_auto(
ntrees = 800,
dg = 23.4,
species = "Pinus pinaster",
country = "Spain",
region = "Unknown region"
)
print(result_region$sdi_model) # must print "aguirre-2017 (Spain, all regions)"
print(result_region$beta) # must print -1.9477
Verify default fallback linked to Reineke (1933)
result_default <- silv_density_sdi_auto(
ntrees = 800,
dg = 23.4,
species = "Unknown species"
)
print(result_default$sdi_model) # must print "reineke-1933 (-1.605)"
print(result_default$beta) # must print -1.605