Description Usage Arguments Value References See Also Examples
Fits a geostatistical spatial model using a block composite likelihood. The block composite likelihood provides quick estimation of spatial models at a cost of a small reduction in statistical efficiency.
1 2 3 4 5 |
formula |
symbolic description of the mean structure of the model. See |
data |
optional data frame containing the variables used in the model formula. |
S |
an n by 2 matrix of spatial locations for each observation |
cov |
spatial covariance type. Can be either one of ‘exp’ or ‘matern’. |
cov.inits |
optional list of initial values for covariance function parameters. Specified as a named list(nugget, psill, range, smoothness): ‘nugget’ for the nugget effect, ‘psill’ for the partial sill, ‘range’ for the spatial range, and ‘smoothness’ for the Matérn smoothness. |
B |
an optional vector of block memberships for each observation. |
neighbors |
an optional two column matrix specifying the unique neighbor relationships of the blocks. |
fixed |
optional list of fixed covariance parameters that are not to be estimated. Specified as a named list(nugget, psill, range, smoothness) with the same meaning as in ‘cov.inits’. |
blocks |
optional list specifying how the grid of blocks is created. Specified as a named list(type, nblocks): ‘type’ of blocks can be ‘regular’ for a square grid of blocks, ‘cluster’ (default) for an irregular grid of blocks, or ‘full’ for the full likelihood; ‘nblocks’ specifies the number of blocks to place observations into, with the default being n/50, and ‘type=regular’ requires that ‘nblocks’ is a perfect square. Also, ‘nblocks <= 2’ specifies the full likelihood. |
verbose |
boolean to show informational messages (‘verbose=TRUE’) during fit |
tol |
convergence tolerance of log-likelihood. |
maxIter |
maximum number of Fisher scoring iterations before stopping. |
nthreads |
when ‘pthreads’ are available, the number of threads to use when fitting the block composite likelihood. In most cases you will want to set this to be the number of processor cores available to you. See the ‘spacious’ manual for help enabling ‘pthreads’ support. |
gpu |
boolean to use an available ‘nVidia’ GPU for fitting full likelihood models when ‘CUDA’ support is enabled. See the ‘spacious’ manual for help enabling ‘CUDA’ support. |
engine |
can be one of ‘C’ or ‘R’. Use of ‘C’ is recommended, as ‘R’ does not have threading or GPU support is primarily for testing and prototyping. |
convergence |
boolean indicating if the algorithm converged. |
nIter |
number of Fisher scoring iterations performed. |
time |
timing of fit. Includes Fisher scoring and standard error calculations. Does not include initial value for grid creation timings. |
ll |
log-likelihood for estimated parameters. |
iters_ll |
log-likelihood at each iteration. |
beta |
mean parameter estimates. |
se_beta |
estimated standard errors of mean parameters. |
vcov_beta |
estimated covariance matrix of mean parameters. |
theta |
covariance paramter estimates. |
se_theta |
estimated standard errors of covariance parameters. |
vcov_theta |
estimated covariance matrix of covariance parameters. |
theta_fixed |
vector indicating which covariance parameters were held fixed. |
iters_theta |
matrix of covariance parameter values at each iteration. |
y |
response. |
X |
model matrix. |
S |
observation locations. |
grid |
grid of polygons that specify the region contained in each block. |
B |
block memberships. |
neighbors |
matrix of neighbor pairs. |
nblocks |
number of blocks. |
lik_form |
likelihood type. |
cov |
covariance type. |
fitted |
fitted values of data used in fit. |
resids |
residuals of fitted values. |
verbose |
was verbose used in fit? |
tol |
convergence tolerance. |
max_iter |
maximum number of iterations or fit. |
nthreads |
number of threads used in fit. |
gpu |
boolean indicating use of GPU. |
engine |
engine used to perform estimation. |
terms |
terms used in creating model information. |
Jo Eidsvik, Benjamin A. Shaby, Brian J. Reich, Matthew Wheeler, and Jarad Niemi. “Estimation and prediction in spatial models with block composite likelihoods.” Journal of Computational and Graphical Statistics (accepted)
predict.spacious
,
plot.spacious
,
mean_max_temps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Not run:
# generate data
set.seed(1983)
n <- 1000
S <- matrix(runif(n*2), n, 2)
D <- rdist(S); diag(D) <- 0
Sigma <- 0.5 * diag(n) + 0.5*exp(-D/0.10)
y <- 5 + t(chol(Sigma)) %*% rnorm(n)
# fit full model
fit.full <- spacious(y~1, S=S, cov="exp",
blocks=list(type="full"), verbose=TRUE)
summary(fit.full)
plot(fit.full)
# fit BCL model
fit.bcl <- spacious(y~1, S=S, cov="exp",
blocks=list(type="regular", nblocks=4^2), verbose=TRUE, nthreads=4)
summary(fit.bcl)
plot(fit.bcl)
# make predictions
pred.full <- predict(fit.full, newS=cbind(0.5,0.5),
interval="prediction", level=0.95)
print(pred.full)
pred.bcl <- predict(fit.bcl, newS=cbind(0.5,0.5),
interval="prediction", level=0.95)
print(pred.bcl)
## End(Not run)
## Not run:
# fit data with cluster block type
data(anom.2011)
fit.full <- spacious(anom~lon+lat+elev, data=anom.2011,
S=cbind(anom.2011$lon, anom.2011$lat),
blocks=list(type="full"), verbose=TRUE)
summary(fit.full)
plot(fit.full)
fit.bcl <- spacious(anom~lon+lat+elev, data=anom.2011,
S=cbind(anom.2011$lon, anom.2011$lat),
blocks=list(type="cluster", nblocks=4^2), verbose=TRUE, nthreads=4)
summary(fit.bcl)
plot(fit.bcl)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.