rGCgeo {SpatGC} | R Documentation |
Generate Data from GC Spatial Regression Model with Geospatial Dependency
Description
This function generates spatially dependent count data based on the Gamma-Count (GC) spatial regression model. It uses a specified geospatial dependency model with parameters such as 'sigma' for variance and 'range' for spatial range. The function returns a list containing the generated data and relevant information about the simulation.
Usage
rGCgeo(
n = n,
alpha,
beta0,
beta,
V = NULL,
rho = 1,
sigma = NULL,
range = NULL
)
Arguments
n |
Integer. The number of knots (or spatial units) for which the data should be generated. |
alpha |
Numeric. The dispersion parameter of the Gamma-Count model. |
beta0 |
Numeric. The intercept term for the model. |
beta |
Numeric vector. The regression coefficients (fixed effects) for the model. |
V |
Optional numeric. The variance of the spatial random effects for lattice data. |
rho |
Optional numeric. The spatial correlation coefficient for the CAR model. Default is 1. |
sigma |
Optional numeric. The variance of the spatial random effects for geospatial data with Matern covariance. |
range |
Optional numeric. The range parameter for geospatial data with Matern covariance. |
Value
A list containing the following components:
- covariate
A matrix of covariates with the specified number of knots ('n') and columns based on the length of 'beta'.
- phi
A vector of spatial random effects generated from the Matern covariance model.
- eta
A vector representing the linear predictor, calculated as the dot product of the covariates and coefficients plus the spatial effects ('phi').
- mu
A vector of mean response values calculated as the product of 'alpha' and the exponential of 'eta'.
- y
A vector of simulated count data based on the GC model and the mean response values ('mu').
- ID
A vector of knot IDs from 1 to 'n'.
Examples
# Generate data from the GC spatial regression model with geospatial dependency
data <- rGCgeo(n = 100, alpha = 1, beta0 = 0.3, beta = c(-0.5, 0.5),
sigma = 1, range = 2)
# View the generated data
print(data)