Learn R Programming

sptotal implements finite population block kriging (Ver Hoef (2008)), a geostatistical approach to predicting means and totals of count data for finite populations.

See sptotal's Website for more information.

Installation

sptotal can be installed from CRAN

install.packages("sptotal")

or using devtools

library(devtools)
install_git("https://github.com/highamm/sptotal.git")

Simple Example

The sptotal package can be used for spatial prediction in settings where there are a finite number of sites and some of these sites were not sampled. Note that, to keep this example simple, we are simulating response values that are spatially independent. In a real example, we assume that there is some spatial dependence in the response.

set.seed(102910)
spatial_coords <- expand.grid(1:10, 1:10)
toy_df <- data.frame(xco = spatial_coords[ ,1],
yco = spatial_coords[ ,2], counts = sample(c(rpois(50, 15),
rep(NA, 50)), size = 100, replace = TRUE))

mod <- slmfit(formula = counts ~ 1, xcoordcol = "xco",
ycoordcol = "yco", data = toy_df)
summary(mod)

pred <- predict(mod)

We can look at the predictions with

pred$Pred_df[1:6, c("xco", "yco", "counts", "counts_pred_count")]

Methods and Basic Functions

sptotal Main Functions:

slmfit() fits a spatial linear model to the response on the observed/sampled sites. \code{check.variogram} can be used to construct an empirical variogram of the residuals of the spatial linear model.

predict.slmfit() uses the spatial linear model fitted with slmfit() and finite population block kriging to predict counts/densities at unobserved locations. A prediction for the total count as well as a prediction variance are given by default.

For more details on how to use these functions, please see the Vignette by running

browseVignettes("sptotal")

and clicking HTML.

The methods in this package are based on the following reference:

Ver Hoef, Jay M. "Spatial methods for plot-based sampling of wildlife populations." \emph{Environmental and Ecological Statistics} 15, no. 1 (2008): 3-13.

Citation

To cite this package in the literature, run the following line:

citation("sptotal")

Copy Link

Version

Install

install.packages('sptotal')

Monthly Downloads

328

Version

1.0.1

License

GPL-2

Maintainer

Higham Matt

Last Published

December 11th, 2022

Functions in sptotal (1.0.1)

get.predplot-deprecated

Create a default map from predictions
plot.slmfit

Plot an Empirical Semi-Variogram of Residuals
mginv

Constructing the generalized inverse of a matrix
plot.predict.slmfit

Create a default map from predictions
fitted.slmfit

Extract Fitted Values from an slmfit object.
get.predinfo-deprecated

Display basic summary information in a tabular form.
loglik.slmfit

Extract Log-Likelihood from a fitted class slmfit object
geostatSim

Simulate geostatistical data on set of given locations
m2LL.FPBK.nodet

Covariance Parameter Estimation Function.
simdata

Simulated Spatially Autocorrelated Data.
pointSimCSR

simulate completely spatially random point patterns.
print.predict.stratafit

Prints a short summary for the predict.stratafit() function.
predict.stratafit

Perform Finite Population Block Kriging
print.predict.slmfit

Prints a short summary for the predict.slmfit() function.
slmfit

Fits a Spatial Linear Model
print.slmfit

Prints the fitted coefficient table of a fitted spatial linear model.
residuals.slmfit

Extract Model Residuals from an slmfit object.
print.summary.slmfit

Prints the summary of a fitted spatial linear model.
summary.slmfit

Summarizes a fitted spatial linear model.
predict.slmfit

Perform Finite Population Block Kriging
summary.stratafit

Summarizes a fitted spatial linear model with a stratification variable..
pointSimSyst

Creates a systematic grid of points.
sv

Semi-variogram computation
stratafit

Fits a Separate Spatial Linear Model for Each Stratum
sptotal

sptotal: A package used for performing Finite Population Block Kriging (FPBK) on polygonal count data.
corModelExponential

Spatial Correlation Models
AIC.slmfit

Extract the AIC from a slmfit object for comparing models.
coef.slmfit

Extract Model Coefficients from a slmfit object
AKmoose_df

Data Set with Alaska Moose Counts.
check.variogram-deprecated

Plot an Empirical Semi-Variogram of Residuals
LLtoTM

Convert Lat and Long to Transverse Mercator (TM)
USlakes

Dissolved Organic Carbon in U.S. Lakes
estcovparm

Estimate Covariance Parameters
exampledataset

Data Set with Uncorrelated Poisson Counts.
GR2

Computes the Generalized R-squared.