fusion.dstan | R Documentation |
Fit a spatial fusion model using Stan based on the unifying framework proposed by Wang and Furrer (2021). One or more latent Gaussian process(es) is assumed to be associated with the spatial response variables.
## S3 method for class 'dstan' fusion(data, n.latent = 1, bans = 0, pp.offset, verbose = FALSE, prior.pointbeta, prior.areabeta, prior.tausq, prior.phi, prior.z, nsamples = 2000, nburnin = 1000, thinning = 1, nchain = 2, ncore = 2, adapt.delta = 0.95, ...)
data |
an object of class |
n.latent |
integer. Number of latent processes to be modeled. |
bans |
either 0 or a matrix of 0s and 1s with dimension J times n.latent, where J is the total number of response variables. If |
pp.offset |
numeric, vector of numeric or matrix of numeric. Offset term for point pattern data. |
verbose |
logical. If TRUE, prints progress and debugging information. |
prior.pointbeta |
a list with prior information for the coeffients of geostatistical model component. The default prior is |
prior.areabeta |
a list with prior information for the coeffients of lattice model component. The default prior is |
prior.tausq |
a list with prior information for the coeffients of geostatistical model component. The default prior is |
prior.phi |
a list with prior information for the spatial range parameter. NO default prior is available. We recomend using a moderately informative normal prior. |
prior.z |
a list with prior information for the design matrix, which also controls the partial sill. The default prior is |
nsamples |
a positive integer specifying the number of samples for each chain (including burn-in samples). Default 2000. |
nburnin |
a positive integer specifying the number of burn-in samples. Default 1000. |
thinning |
a positive integer specifying the thinning parameter. Default 1. |
nchain |
a positive integer specifying the number of chains. Default 2. |
ncore |
a positive integer specifying the number of cores to use when executing the chains in parallel. Default 2. |
adapt.delta |
a numeric value between 0 and 1 specifying the target acceptance rate. Default 0.95. |
... |
additional arguments passed to |
In the model parameterization, beta
are fixed-effect coefficients, phi
is the range parameter, Z_ij
is the ith row and j column of the design matrix for latent processes and tau_sq
is the variance parameter of a normal distribution.
NOTE: Only exponential covariance model for the latent processes is implemented. However, it can be easily extended by modifying the model code from the output.
The returned value is a list consists of
model |
an object of S4 class |
data |
the data structure used to fit the model |
Craig Wang
Wang, C., Furrer, R. and for the SNC Study Group (2021). Combining heterogeneous spatial datasets with process-based spatial fusion models: A unifying framework, Computational Statistics & Data Analysis
fusion.dinla
, fusion.dstan
, fusionData
for preparing data, fitted.fusionModel
for extracting fitted values, predict.fusionModel
for prediction.
## example based on simulated data ## Not run: dat <- fusionSimulate(n.point = 20, n.area = 10, psill = 1, phi = 1, nugget = 0, tau.sq = 0.5, point.beta = list(rbind(1,5)), area.beta = list(rbind(-1, 0.5)), distributions = c("normal","poisson"), design.mat = matrix(c(1,1))) geo_data <- data.frame(x = dat$mrf[dat$sample.ind, "x"], y = dat$mrf[dat$sample.ind, "y"], cov.point = dat$data$X_point[,2], outcome = dat$data$Y_point[[1]]) lattice_data <- sp::SpatialPolygonsDataFrame(dat$poly, data.frame(outcome = dat$data$Y_area[[1]], cov.area = dat$data$X_area[,2])) dat_stan <- fusionData(geo.data = geo_data, geo.formula = outcome ~ cov.point, lattice.data = lattice_data, lattice.formula = outcome ~ cov.area, distributions = c("normal","poisson"), method = "Stan") ## S3 method for class 'dstan' mod_stan <- fusion(data = dat_stan, n.latent = 1, bans = 0, prior.phi = list(distr = "normal", pars = c(1, 10))) summary(mod_stan) # To kill parallel process except one (for stopping a stan call) # system("killall R") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.