Recent Releases of geostan
geostan - geostan 0.8.1
This release fixes a line of code in a vignette (in v.0.8.0) that caused installation to fail for 'old' versions of R (< 4.0).
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan about 1 year ago
geostan - geostan 0.8.0
New Features
Spatial econometric models and better sampling for hierarchical spatial auto-regressive models:
- geostan now provides more support for spatial econometric models: spatial error (SEM), spatially-lagged dependent variable (SLM), and the ‘Durbinized’ versions of each (SDEM, SDLM). Methods for calculating impacts are and predicted values for SLM/SDLM are included. Users can also draw from the posterior predictive distributions of these models: see geostan::stan_sar and geostan::impacts.
- geostan::sim_sar can now simulate draws from the spatial lag model as well as the spatial error model.
- The CAR and SAR models, when placed in a Poisson or binomial model for count data, can sample poorly when the data is sparse. This can usually be fixed using the new
zmpoption which switches CAR/SAR models to a zero-mean parameterization. Details are in the vignette on building custom spatial models.
Bug fix
- A bug was introduced to v0.7.0 which added a small bias to coefficient estimates which only appeared when the slx option was used. This has been fixed.
Other stuff
- A set of Monte Carlo analyses have been added to the package tests, verifying that the estimates match expectations. This is also part of a process of moving away from the ‘testthat’ package.
- The package documentation and vignettes have also been improved a little bit.
Upcoming release
- The new vignette on 'Spatial analysis with geostan' causes installation to fail on older versions of windows and mac os, so v0.8.1 will come out with a patch for this in the coming days.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan about 1 year ago
geostan - geostan 0.7.0
V0.7.0 includes various adjustments to speed up the models, and the DIC is now provided for model comparison (in addition to WAIC).
New features:
- Deviance information criteria (DIC). WAIC is considered to be more robust than DIC, but DIC remains common in spatial statistics because (unlike WAIC) it does not assume independent observations. Changes in the background that should improve the user experience:
Changes in the background that should improve the user experience:
- Samples for the pointwise log likelihood are no longer collected in the Stan models. Instead, they are calculated in R when needed for calculating waic or dic. This should improve sampling speed and lower memory and storage use.
- The QR decomposition is now implemented (automatically) for models with covariates. (Note that this cannot be used for measurement error models.) The benefits of the QR decomposition in terms of sampling speed and efficiency are greatest when covariates are centered (which you can do using the centerx argument).
- A change recommended by Roger Bivand takes advantage of an improvement in spdep’s creation of neighbors objects (https://github.com/ConnorDonegan/geostan/issues/19). This will speed up the shape2mat function in some cases. Other changes:
Other changes:
- Stan code for the CAR and SAR models has been simplified a bit. The changes are reflected in the vignette on custom spatial models. The output of prepcardata and prepsardata have changed somewhat, but the user workflow is the same.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 1 year ago
geostan - geostan 0.6.2
geostan was removed from CRAN for a moment due to an issue with the StanHeaders R package. This should be resolved now. This release puts geostan back on CRAN with minimal internal changes to geostan. The package home page still provides install instructions that serve if/when geostan is not available on CRAN.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 1 year ago
geostan - geostan 0.6.1
Two updates:
- Multiple changes related to spatial connectivity matricies, including a new vignette.
- A change to geostan::predict.
There are three updates related to spatial connectivity matrices:
- There is a new vignette on spatial connectivity matrices (see
browseVignettes('geostan')), written for new users. - Visualizing spatial neighbors: geostan::edges can now return a simple features object; this can be used to visualize (map) the graph structure of the spatial connectivity matrix. There is an example in the new vignette.
- Changes to geostan::shape2mat: an option for k-nearest neighbors has been added, the queen argument is being replaced by method, and the function now prints a summary of the matrix to the console (using the new
geostasn::n_nbsfunction)
There was one change to the geostan::predict method:
- this method is for getting predicted values from a fitted model, given user-provided covariate values. Previously, the function used a point estimate of the intercept when calculating the predicted values. Now, the method uses samples from the posterior distribution of the intercept, just like it does for other parameters. The user (still) has the option to provide a matrix of samples for the intercept term; this is in case one wishes to incorporate the spatial trend term into the intercept (as a spatially-varying intercept).
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 1 year ago
geostan - geostan 0.6.0
Updates to geostan:
- Missing outcome data is now allowed in most models
- A bug in
prep_icar_datahas been fixed - Install instructions for using
install_github
Details:
The model fitting functions (
stan_glm,stan_car, etc.) now allow for missing data in the outcome variable (not covariates). This is explained in the geostan::stan_glm documentation, next to the discussion of handling censored observations. When missing observations are present, there will (only) be a warning issued. This functionality is available for any GLM (stan_glm), any ESF model (stan_esf), and any model for count data (Poisson and binomial models including CAR and SAR models). The only models for which this functionality is not currently available are CAR and SAR models that are being been fit to continuous outcome variables.The
prep_icar_datafunction, which is used inside stan_icar, did not have the expected behavior in all cases - for some cases the function would fail to create the data required for the ICAR models, and the models would fail. (This means that it is unlikely that any results obtained from the models were negatively influenced by this issue - if you obtained results, then the bug probably didn't affect you.) This has been fixed thanks to this pull request.New install instructions are found on the package home page https://connordonegan.github.io/geostan/ Please report any difficulties with installation.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 1 year ago
geostan - geostan 0.5.4
This release updates some of the vignettes (especially the one on measurement error models) and incorporates an important update to StanHeaders, which addresses an issue that may have caused installation errors for some users.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan almost 2 years ago
geostan - geostan 0.5.3
Minor updates
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan about 2 years ago
geostan - geostan 0.5.2
geostan 0.5.2
This release was built using rstan 2.26.23, which incorporates Stan's new syntax for declaring arrays. Some models seems to run a little bit faster, but otherwise there are no changes that users should notice.
A new vignette shows how to implement some of geostan's spatial models directly in Stan, using the custom Stan functions that make the CAR and SAR models sample quickly, and using some geostan functions that make the data cleaning part easy.
The warnings issued about the sp package can be ignored; these are due to geostan's dependence on spdep, which imports sp but does not use any of the deprecated functions.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 2 years ago
geostan - geostan 0.5.1
This release fixes some issues that were introduced with the slim and drop arguments (in v0.5.0).
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 2 years ago
geostan - geostan 0.5.0
New additions
The package now provides some support for spatial regression with raster data, including for layers with hundreds of thousands of observations (possibly more, depending on one’s computational resources). Two new additions make this possible.
- slim = TRUE The model fitting functions (stanglm, stancar, stansar, stanesf, stan_icar) now provide the option to trim down the parameters for which MCMC samples are collected. For large N and/or many N-length vectors of parameters, this option can speed up sampling considerably and reduce memory usage. The new drop argument provides users control over which parameter vectors will be ignored. This functionality may be helpful for any number of purposes, including modeling large data sets, measurement error models, and Monte Carlo studies.
prep_sar_data2andprep_car_data2These two functions can quickly prepare required data for SAR and CAR models when using raster layers (observations on a regularly spaced grid). The standard and more generally applicable functions,prep_car_dataandprep_sar_data, are limited in terms of the size of spatial weights matrices they can handle. These new functions are discussed in a new vignette titled “Raster regression." Seevignette("raster-regression", package = "geostan").
Minor changes
The PDF documentation has been improved—previously, multi-line equations were not rendered properly. Now they render correctly, and a mistake in the description of Binomial CAR models has been corrected.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 2 years ago
geostan - v0.4.1
geostan 0.4.1
Minor changes
- The recommended citation for the software has been updated since the software has gone through peer-review in The Journal of Open Source Software. Many thanks to the two peer reviewers of the project, Chris Jochem and Virgilio Gómez Rubio. The following changes were introduced following Chris J.'s recommendations.
- The spatial diagonstic function (
sp_diag) will now take a spatial connectivity matrix from the fitted model object provided by the user. This way the matrix will be the same one that was used to fit the model. (All of the model fitting functions have been updated to support this functionality.) - The documentation of the methods for fitted models (
residuals,fitted,spatial, etc.) were previously packed into one page. Now, the documentation is spread over a few pages and the methods are grouped together in a more reasonable fashion.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan about 3 years ago
geostan - geostan 0.4.0
New Additions
SAR models
The simultaneously-specified spatial autoregressive (SAR) model---referred to as the spatial error model (SEM) in the spatial econometrics literature---has been implemented. The SAR model can be applied directly to continuous data (as the likelihood function) or it can be used as prior model for spatially autocorrelated parameters. Details are provided on the documentation page for the stan_sar function.
Minor changes
Previously, when getting fitted values from an auto-normal model (i.e., the CAR model with
family = auto_gaussian()) the fitted values did not include the implicit spatial trend. Now, thefitted.geostan_fitmethod will return the fitted values with the implicit spatial trend (by default; change using thetrendargument); this is consistent with the behavior ofresiduals.geostan_fit, which has an option todetrendthe residuals. This applies to the SAR and CAR auto-normal specifications. For details, see the documentation pages forstan_carandstan_sar.The documentation for the models (
stan_glm,stan_car,stan_esf,stan_icar,stan_sar) now uses Latex to typeset the model equations.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 3 years ago
geostan - geostan 0.3.0
New additions
- New exploratory spatial data analysis functions have been added: the Geary Ratio (GR) and the local Geary's C. These complement the Moran coefficient and local Moran's I.
- The vignette on spatial autocorrelation has been updated and expanded, including with a short discussion of exploratory spatial data analysis (ESDA).
- The vignette on spatial measurement error models/working with ACS data has been completely re-written.
Minor changes
- geostan models can now be used with the bridgesampling package for model camparison with Bayes factors (e.g., use
bridge_sampler(geostan_fit$stanfit)). By default, geostan only collects MCMC samples for parameters that are expected to be of some interest for users. To become compatible with bridgesampling, thekeep_allargument was added to all of the model fitting functions. For important background and details see the bridgesampling package documentation and vignettes on CRAN. stan_carnow has an option to provide the connectivity matrix C, which is used to calculate spatial-lag of X (SLX) terms and residual spatial autocorrelation. Previously, there was no option to provide this matrix, as it was taken from the car_parts argument. However, that choice is only appropriate when the WCAR specification is used. Now, if C is missing and the WCAR specification has not been used a warning will appear.- Previously, the
lisafunction would automatically center and scale the variate before computing local Moran's I. Now, the variate will be centered and scaled by default but the user has the option to turn the scaling off (so the variate will be centered, but not divided by its standard deviation). This function also row-standardized the spatial weights matrix automatically, but there was no reason why. That's not done anymore.
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan over 3 years ago
geostan - geostan 0.2.1
geostan's first release on CRAN
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan almost 4 years ago
geostan - geostan 0.2.0
Scientific Software - Peer-reviewed
- R
Published by ConnorDonegan about 4 years ago