sim_spData {spStack} | R Documentation |
Simulate spatial data on unit square
Description
Generates synthetic spatial data of different types where the spatial co-ordinates are sampled uniformly on an unit square. Different types include point-referenced Gaussian, Poisson, binomial and binary data. The design includes an intercept and fixed covariates sampled from a standard normal distribution.
Usage
sim_spData(n, beta, cor.fn, spParams, spvar, deltasq, family, n_binom)
Arguments
n |
sample size. |
beta |
a |
cor.fn |
a quoted keyword that specifies the correlation function used
to model the spatial dependence structure among the observations. Supported
covariance model key words are: |
spParams |
a numeric vector containing spatial process parameters - e.g., spatial decay and smoothness. |
spvar |
value of spatial variance parameter. |
deltasq |
value of noise-to-spatial variance ratio. |
family |
a character specifying the distribution of the response as a
member of the exponential family. Valid inputs are |
n_binom |
necessary only when |
Value
a data.frame
object containing the columns -
s1, s2
2D-coordinates in unit square
x1, x2, ...
covariates, not including intercept
y
response
n_trials
present only when binomial data is generated
z_true
true spatial effects with which the data is generated
Author(s)
Soumyakanti Pan span18@ucla.edu,
Sudipto Banerjee sudipto@ucla.edu
Examples
set.seed(1729)
n <- 10
beta <- c(2, 5)
phi0 <- 2
nu0 <- 0.5
spParams <- c(phi0, nu0)
spvar <- 0.4
deltasq <- 1
sim1 <- sim_spData(n = n, beta = beta, cor.fn = "matern",
spParams = spParams, spvar = spvar, deltasq = deltasq,
family = "gaussian")