# rcopCAR: Simulate areal data.

Description Usage Arguments Details Value Examples

### Description

rcopCAR simulates areal data from the copCAR model.

### Usage

 1 rcopCAR(rho, beta, X, A, family) 

### Arguments

 rho the spatial dependence parameter ρ such that ρ \in [0, 1). beta the vector of regression coefficients β = (β_1, …, β_p)'. X the n by p design matrix X. A the symmetric binary adjacency matrix for the underlying graph. family the marginal distribution of the observations and link function to be used in the model. This can be a character string naming a family function, a family function, or the result of a call to a family function. (See family for details of family functions.) Supported familes are binomial, poisson, and negbinomial.

### Details

This function simulates data from the copCAR model with the given spatial dependence parameter ρ, regression coefficients β, design matrix X, and adjacency structure A. For negative binomial marginal distributions, a value for the dispersion parameter θ>0 is also required; this value must be passed to the negbinomial family function. For more details on the copCAR model, see copCAR.

### Value

A vector of length n distributed according to the specified copCAR model.

### Examples

  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 # Use the 20 x 20 square lattice as the underlying graph. m = 20 A = adjacency.matrix(m) # Create a design matrix by assigning coordinates to each vertex # such that the coordinates are restricted to the unit square. x = rep(0:(m - 1) / (m - 1), times = m) y = rep(0:(m - 1) / (m - 1), each = m) X = cbind(x, y) # Set the dependence parameter and regression coefficients. rho = 0.995 # strong dependence beta = c(1, 1) # the mean surface increases in the direction of (1, 1) # Simulate Poisson data from the corresponding copCAR model. z = rcopCAR(rho, beta, X, A, family = poisson(link = "log")) # Simulate Bernoulli outcomes. Z = rcopCAR(rho, beta, X, A, family = binomial(link = "logit")) # Set the dispersion parameter. theta = 10 # Simulate negative binomial outcomes. Z = rcopCAR(rho, beta, X, A, family = negbinomial(theta)) 

Search within the copCAR package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.