Skip to content

Commit

Permalink
Merge pull request #10 from USEPA/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
michaeldumelle authored May 26, 2023
2 parents c4e4724 + 7a56c2b commit af015e1
Show file tree
Hide file tree
Showing 321 changed files with 21,283 additions and 5,204 deletions.
12 changes: 4 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spmodel
Title: Spatial Statistical Modeling and Prediction
Version: 0.3.0
Version: 0.4.0
Authors@R: c(
person(given = "Michael",
family = "Dumelle",
Expand All @@ -16,12 +16,7 @@ Authors@R: c(
role = "aut",
email = "[email protected]")
)
Description: Fit, summarize, and predict for a variety of spatial statistical models
applied to point-referenced and areal (lattice) data. Parameters
are estimated using various methods. Additional modeling features include anisotropy,
non-spatial random effects, partition factors, big data approaches, and more. Model-fit statistics are
used to summarize, visualize, and compare models. Predictions at unobserved locations are
readily obtainable. For additional details, see Dumelle et al. (2023) <doi:10.1371/journal.pone.0282524>.
Description: Fit, summarize, and predict for a variety of spatial statistical models applied to point-referenced and areal (lattice) data. Parameters are estimated using various methods. Additional modeling features include anisotropy, non-spatial random effects, partition factors, big data approaches, and more. Model-fit statistics are used to summarize, visualize, and compare models. Predictions at unobserved locations are readily obtainable. For additional details, see Dumelle et al. (2023) <doi:10.1371/journal.pone.0282524>.
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand All @@ -42,7 +37,8 @@ Suggests:
knitr,
testthat (>= 3.0.0),
ggplot2,
ranger
ranger,
statmod
VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://usepa.github.io/spmodel/
Expand Down
136 changes: 136 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
# Generated by roxygen2: do not edit by hand

S3method(AIC,spautor)
S3method(AIC,spgautor)
S3method(AIC,spglm)
S3method(AIC,splm)
S3method(AICc,spautor)
S3method(AICc,spgautor)
S3method(AICc,spglm)
S3method(AICc,splm)
S3method(anova,spautor)
S3method(anova,spgautor)
S3method(anova,spglm)
S3method(anova,splm)
S3method(augment,spautor)
S3method(augment,spgautor)
S3method(augment,spglm)
S3method(augment,splm)
S3method(coef,spautor)
S3method(coef,spgautor)
S3method(coef,spglm)
S3method(coef,splm)
S3method(coefficients,spautor)
S3method(coefficients,spgautor)
S3method(coefficients,spglm)
S3method(coefficients,splm)
S3method(confint,spautor)
S3method(confint,spgautor)
S3method(confint,spglm)
S3method(confint,splm)
S3method(cooks.distance,spautor)
S3method(cooks.distance,spgautor)
S3method(cooks.distance,spglm)
S3method(cooks.distance,splm)
S3method(cov_initial_search,car)
S3method(cov_initial_search,cauchy)
Expand All @@ -35,15 +51,44 @@ S3method(cov_initial_search,sar)
S3method(cov_initial_search,spherical)
S3method(cov_initial_search,triangular)
S3method(cov_initial_search,wave)
S3method(cov_initial_search_glm,car)
S3method(cov_initial_search_glm,cauchy)
S3method(cov_initial_search_glm,circular)
S3method(cov_initial_search_glm,cosine)
S3method(cov_initial_search_glm,cubic)
S3method(cov_initial_search_glm,exponential)
S3method(cov_initial_search_glm,gaussian)
S3method(cov_initial_search_glm,gravity)
S3method(cov_initial_search_glm,jbessel)
S3method(cov_initial_search_glm,magnetic)
S3method(cov_initial_search_glm,matern)
S3method(cov_initial_search_glm,none)
S3method(cov_initial_search_glm,pentaspherical)
S3method(cov_initial_search_glm,pexponential)
S3method(cov_initial_search_glm,rquad)
S3method(cov_initial_search_glm,sar)
S3method(cov_initial_search_glm,spherical)
S3method(cov_initial_search_glm,triangular)
S3method(cov_initial_search_glm,wave)
S3method(covmatrix,spautor)
S3method(covmatrix,spgautor)
S3method(covmatrix,spglm)
S3method(covmatrix,splm)
S3method(deviance,spautor)
S3method(deviance,spgautor)
S3method(deviance,spglm)
S3method(deviance,splm)
S3method(fitted,spautor)
S3method(fitted,spgautor)
S3method(fitted,spglm)
S3method(fitted,splm)
S3method(fitted.values,spautor)
S3method(fitted.values,spgautor)
S3method(fitted.values,spglm)
S3method(fitted.values,splm)
S3method(formula,spautor)
S3method(formula,spgautor)
S3method(formula,spglm)
S3method(formula,splm)
S3method(get_initial_range,cauchy)
S3method(get_initial_range,circular)
Expand All @@ -63,9 +108,15 @@ S3method(get_initial_range,spherical)
S3method(get_initial_range,triangular)
S3method(get_initial_range,wave)
S3method(glance,spautor)
S3method(glance,spgautor)
S3method(glance,spglm)
S3method(glance,splm)
S3method(glances,spautor)
S3method(glances,spautor_list)
S3method(glances,spgautor)
S3method(glances,spgautor_list)
S3method(glances,spglm)
S3method(glances,spglm_list)
S3method(glances,splm)
S3method(glances,splm_list)
S3method(gloglik_products,car)
Expand All @@ -88,42 +139,95 @@ S3method(gloglik_products,spherical)
S3method(gloglik_products,triangular)
S3method(gloglik_products,wave)
S3method(hatvalues,spautor)
S3method(hatvalues,spgautor)
S3method(hatvalues,spglm)
S3method(hatvalues,splm)
S3method(influence,spautor)
S3method(influence,spgautor)
S3method(influence,spglm)
S3method(influence,splm)
S3method(labels,spautor)
S3method(labels,spgautor)
S3method(labels,spglm)
S3method(labels,splm)
S3method(laploglik_products,car)
S3method(laploglik_products,cauchy)
S3method(laploglik_products,circular)
S3method(laploglik_products,cosine)
S3method(laploglik_products,cubic)
S3method(laploglik_products,exponential)
S3method(laploglik_products,gaussian)
S3method(laploglik_products,gravity)
S3method(laploglik_products,jbessel)
S3method(laploglik_products,magnetic)
S3method(laploglik_products,matern)
S3method(laploglik_products,none)
S3method(laploglik_products,pentaspherical)
S3method(laploglik_products,pexponential)
S3method(laploglik_products,rquad)
S3method(laploglik_products,sar)
S3method(laploglik_products,spherical)
S3method(laploglik_products,triangular)
S3method(laploglik_products,wave)
S3method(logLik,spautor)
S3method(logLik,spgautor)
S3method(logLik,spglm)
S3method(logLik,splm)
S3method(loocv,spautor)
S3method(loocv,spgautor)
S3method(loocv,spglm)
S3method(loocv,splm)
S3method(model.frame,spautor)
S3method(model.frame,spgautor)
S3method(model.frame,spglm)
S3method(model.frame,splm)
S3method(model.matrix,spautor)
S3method(model.matrix,spgautor)
S3method(model.matrix,spglm)
S3method(model.matrix,splm)
S3method(plot,spautor)
S3method(plot,spgautor)
S3method(plot,spglm)
S3method(plot,splm)
S3method(predict,spautor)
S3method(predict,spautorRF)
S3method(predict,spautorRF_list)
S3method(predict,spautor_list)
S3method(predict,spgautor)
S3method(predict,spgautor_list)
S3method(predict,spglm)
S3method(predict,spglm_list)
S3method(predict,splm)
S3method(predict,splmRF)
S3method(predict,splmRF_list)
S3method(predict,splm_list)
S3method(print,anova.spautor)
S3method(print,anova.spgautor)
S3method(print,anova.spglm)
S3method(print,anova.splm)
S3method(print,spautor)
S3method(print,spgautor)
S3method(print,spglm)
S3method(print,splm)
S3method(print,summary.spautor)
S3method(print,summary.spgautor)
S3method(print,summary.spglm)
S3method(print,summary.splm)
S3method(pseudoR2,spautor)
S3method(pseudoR2,spgautor)
S3method(pseudoR2,spglm)
S3method(pseudoR2,splm)
S3method(resid,spautor)
S3method(resid,spgautor)
S3method(resid,spglm)
S3method(resid,splm)
S3method(residuals,spautor)
S3method(residuals,spgautor)
S3method(residuals,spglm)
S3method(residuals,splm)
S3method(rstandard,spautor)
S3method(rstandard,spgautor)
S3method(rstandard,spglm)
S3method(rstandard,splm)
S3method(spcov_matrix,car)
S3method(spcov_matrix,cauchy)
Expand Down Expand Up @@ -221,18 +325,30 @@ S3method(sprnorm,spherical)
S3method(sprnorm,triangular)
S3method(sprnorm,wave)
S3method(summary,spautor)
S3method(summary,spgautor)
S3method(summary,spglm)
S3method(summary,splm)
S3method(tidy,anova.spautor)
S3method(tidy,anova.spgautor)
S3method(tidy,anova.spglm)
S3method(tidy,anova.splm)
S3method(tidy,spautor)
S3method(tidy,spgautor)
S3method(tidy,spglm)
S3method(tidy,splm)
S3method(varcomp,spautor)
S3method(varcomp,spgautor)
S3method(varcomp,spglm)
S3method(varcomp,splm)
S3method(vcov,spautor)
S3method(vcov,spgautor)
S3method(vcov,spglm)
S3method(vcov,splm)
export(AICc)
export(augment)
export(covmatrix)
export(dispersion_initial)
export(dispersion_params)
export(esv)
export(glance)
export(glances)
Expand All @@ -244,9 +360,17 @@ export(spautor)
export(spautorRF)
export(spcov_initial)
export(spcov_params)
export(spgautor)
export(spglm)
export(splm)
export(splmRF)
export(sprbeta)
export(sprbinom)
export(sprgamma)
export(sprinvgauss)
export(sprnbinom)
export(sprnorm)
export(sprpois)
export(tidy)
export(varcomp)
import(Matrix)
Expand Down Expand Up @@ -275,9 +399,14 @@ importFrom(stats,coefficients)
importFrom(stats,complete.cases)
importFrom(stats,confint)
importFrom(stats,cooks.distance)
importFrom(stats,dbeta)
importFrom(stats,dbinom)
importFrom(stats,delete.response)
importFrom(stats,deviance)
importFrom(stats,dgamma)
importFrom(stats,dist)
importFrom(stats,dnbinom)
importFrom(stats,dpois)
importFrom(stats,fitted)
importFrom(stats,fitted.values)
importFrom(stats,formula)
Expand All @@ -288,6 +417,7 @@ importFrom(stats,lm)
importFrom(stats,logLik)
importFrom(stats,model.frame)
importFrom(stats,model.matrix)
importFrom(stats,model.offset)
importFrom(stats,model.response)
importFrom(stats,na.omit)
importFrom(stats,na.pass)
Expand All @@ -301,12 +431,18 @@ importFrom(stats,qqline)
importFrom(stats,qqnorm)
importFrom(stats,qt)
importFrom(stats,quantile)
importFrom(stats,rbeta)
importFrom(stats,rbinom)
importFrom(stats,reformulate)
importFrom(stats,resid)
importFrom(stats,residuals)
importFrom(stats,rgamma)
importFrom(stats,rnbinom)
importFrom(stats,rnorm)
importFrom(stats,rpois)
importFrom(stats,rstandard)
importFrom(stats,terms)
importFrom(stats,var)
importFrom(stats,vcov)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
32 changes: 32 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# spmodel 0.4.0

## Major updates

* Added an `spglm()` function to fit spatial generalized linear models for point-referenced data (i.e., generalized geostatistical models).
* `spglm()` syntax is very similar to `splm()` syntax.
* Poisson, negative binomial, binomial, beta, gamma, and inverse Gaussian families are accommodated.
* `spglm()` fitted model objects use the same generics as `splm()` fitted model objects.
* Added an `spgautor()` function to fit spatial generalized linear models for areal data (i.e., spatial generalized autoregressive models).
* `spgautor()` syntax is very similar to `spautor()` syntax.
* Poisson, negative binomial, binomial, beta, gamma, and inverse Gaussian families are accommodated.
* `spgautor()` fitted model objects use the same generics as `spautor()` fitted model objects.

## Minor updates

* In `augment()`, made the `level` and `local` arguments explicit (rather than being passed to `predict()` via `...`).
* Added `offset` support for relevant modeling functions.
* Minor documentation updates.
* Minor vignette updates.

## Bug fixes

* Fixed a bug in `spcov_params()` that yielded output with improper names when a named vector was used as an argument.
* Fixed a bug in `spautor()` that did not properly coerce `M` if given as a matrix (instead of a vector).
* Fixed a bug in `esv()` that prevented coercion of `POLYGON`geometries to `POINT` geometries if `data` was an `sf` object.
* Fixed a bug in `esv()` that did not remove `NA` values from the response.
* Fixed a bug in `splm()` and `spautor()` that caused an error when random effects or partition factors were ordered factors.
* Fixed a bug in `spautor()` that prevented an error from occurring when a partition factor was not categorical or not a factor
* Fixed a bug in `covmatrix(object, newdata)` that returned a matrix with improper dimensions when `spcov_type` was `"none"`.
* Fixed a bug in `predict()` that caused an error when at least one level of a fixed effect factor was not observed within a local neighborhood (when the `local` method was `"covariance"` or `"distance")`.
* Fixed a bug in `cooks.distance()` that used the Pearson residuals instead of the standarized residuals.

# spmodel 0.3.0

## Minor updates
Expand Down
6 changes: 5 additions & 1 deletion R/AIC.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' several fitted model objects for which a log-likelihood
#' value can be obtained.
#'
#' @param object A fitted model object from [splm()] or [spautor()]
#' @param object A fitted model object from [splm()], [spautor()], [spglm()], or [spgautor()]
#' where \code{estmethod} is \code{"ml"} or \code{"reml"}.
#' @param ... Optionally more fitted model objects.
#' @param k The penalty parameter, taken to be 2. Currently not allowed to differ
Expand Down Expand Up @@ -128,10 +128,12 @@ AIC.splm <- function(object, ..., k = 2) {

#' @rdname AIC.spmodel
#' @method AIC spautor
#' @order 2
#' @export
AIC.spautor <- AIC.splm

#' @rdname AIC.spmodel
#' @order 5
#' @export
AICc <- function(object, ..., k = 2) {
# method dispatch
Expand All @@ -140,6 +142,7 @@ AICc <- function(object, ..., k = 2) {

#' @rdname AIC.spmodel
#' @method AICc splm
#' @order 6
#' @export
AICc.splm <- function(object, ..., k = 2) {

Expand Down Expand Up @@ -219,5 +222,6 @@ AICc.splm <- function(object, ..., k = 2) {

#' @rdname AIC.spmodel
#' @method AICc spautor
#' @order 7
#' @export
AICc.spautor <- AICc.splm
Loading

0 comments on commit af015e1

Please sign in to comment.