rGCgeo | R Documentation |
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.
rGCgeo(
n = n,
alpha,
beta0,
beta,
V = NULL,
rho = 1,
sigma = NULL,
range = NULL
)
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. |
A list containing the following components:
A matrix of covariates with the specified number of knots ('n') and columns based on the length of 'beta'.
A vector of spatial random effects generated from the Matern covariance model.
A vector representing the linear predictor, calculated as the dot product of the covariates and coefficients plus the spatial effects ('phi').
A vector of mean response values calculated as the product of 'alpha' and the exponential of 'eta'.
A vector of simulated count data based on the GC model and the mean response values ('mu').
A vector of knot IDs from 1 to 'n'.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.