diff --git a/DESCRIPTION b/DESCRIPTION index 24f5339..170ce7a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: SSN2 Title: Spatial Modeling on Stream Networks -Version: 0.2.0 +Version: 0.2.1 Authors@R: c( person(given = "Michael", family = "Dumelle", diff --git a/NEWS.md b/NEWS.md index 33c2ec4..c45ee40 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# SSN2 0.2.1 + +## Minor Updates + +* Enhanced numeric stability of deviance and pseudo R-squared for `ssn_glm()` models when `family = "beta"` [(#23)](https://github.com/USEPA/SSN2/issues/23). +* Updated `reexport.Rd` to reflect changes in `spmodel v0.8.0`'s handling of `AIC()` and `AICc()`. + # SSN2 0.2.0 ## Major Updates diff --git a/R/get_model_stats_glm.R b/R/get_model_stats_glm.R index 2073c44..1a73774 100644 --- a/R/get_model_stats_glm.R +++ b/R/get_model_stats_glm.R @@ -445,7 +445,9 @@ get_deviance_glm <- function(family, y, fitted_response, size, dispersion) { } else if (family == "inverse.gaussian") { half_deviance_i <- 0.5 * (y - fitted_response)^2 / (y * fitted_response^2) } else if (family == "beta") { - constant <- log(gamma(fitted_response * dispersion)) + log(gamma((1 - fitted_response) * dispersion)) - log(gamma(y * dispersion)) - log(gamma((1 - y) * dispersion)) + # has NA problem for large dispersion + # constant <- log(gamma(fitted_response * dispersion)) + log(gamma((1 - fitted_response) * dispersion)) - log(gamma(y * dispersion)) - log(gamma((1 - y) * dispersion)) + constant <- lgamma(fitted_response * dispersion) + lgamma((1 - fitted_response) * dispersion) - lgamma(y * dispersion) - lgamma((1 - y) * dispersion) half_deviance_i <- constant + (y - fitted_response) * dispersion * log(y) + ((1 - y) - (1 - fitted_response)) * dispersion * log(1 - y) } deviance_i <- 2 * half_deviance_i diff --git a/README.md b/README.md index da72cda..0b9c775 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![cran checks](https://badges.cranchecks.info/worst/SSN2.svg)](https://cran.r-project.org/web/checks/check_results_SSN2.html) [![R-CMD-check](https://github.com/USEPA/SSN2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/USEPA/SSN2/actions/workflows/R-CMD-check.yaml) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) -[![status](https://joss.theoj.org/papers/66fd932526762f8ccd8bd9c3954e0e3d/status.svg)](https://joss.theoj.org/papers/66fd932526762f8ccd8bd9c3954e0e3d) +[![status](https://joss.theoj.org/papers/10.21105/joss.06389/status.svg)](https://joss.theoj.org/papers/10.21105/joss.06389) # SSN2: Spatial Modeling on Stream Networks diff --git a/_pkgdown.yml b/_pkgdown.yml index d71acfb..1069461 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: ~ +url: https://usepa.github.io/SSN2/ template: - bootstrap: 5 + bootstrap: 3 diff --git a/cran-comments.md b/cran-comments.md index 759ca03..09be54b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,5 @@ -This is a minor update that adds a few small features and bug fixes. Thank you. +This is a minor update that enhances stability and includes updates to `reexports.Rd` +to reflect changes in `spmodel v0.8.0`'s handling of `AIC()` and `AICc()`. Thank you. ------- diff --git a/docs/404.html b/docs/404.html index dbe33f7..70fc951 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,78 +4,112 @@ - +