feature/spdep
@imadmali is already working on this.
Since Mar 2, 2017.
- Dominant language
- R
- Stars
- 401
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
I'm just starting an issue to track the feature/spdep branch which incorporates (some) spatial models from spdep in rstanarm.
Currently it looks something like this:
┌─ stan_lagsarlm.R ───┐
user ──┤ ├─ stan_sp.fit.R ── spatial.stan
└─ stan_errorsarlm.R ─┘
spdep doesn't use .fit.R files for doing the heavy lifting for their modeling functions so currently I deal with all of the models in stan_sp.fit.R (to stay somewhat consistent with the other rstanarm models). As for spatial weights, the user can include a a listw object (as required in spdep) or a symmetric matrix (usually row normalized) in the call.
There are two other models that we might also want to include,
spdep::sacsarlm()(Spatial simultaneous autoregressive SAC model estimation)spdep::lagmess()(matrix exponential spatial lag model)
Stuff to implement for stan_lagsarlm.R and stan_errorsarlm.R:
- check spatial weights (row normalized, convert from listw, etc.)
- center data
- QR decomposition
- prior for spatial autocorrelation (beta)
- prior for intercept
- prior summary
- optimize/vb
- print/summary stuff (in stanreg.R)
- predict/posterior_predict
- loo
- examples
- documentation
- vignette(s)
- tests
The response variable is basically modeled as multivariate normal with an NxN covariance matrix,
Sigma = solve( (I - rho * W) %*% t(I - rho * W) )
(where I is a diagonal matrix, W is a spatial weight matrix, and rho is spatial correlation term) and linear predictor,
mu = X * beta (times other stuff, depending on the model)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.