View source: R/Hurdle_GEESAR.R
Hurdle_GEESAR | R Documentation |
This function fits a hurdle model using GEESAR, consisting of: (1) A logit model for zero vs. non-zero responses. (2) A truncated Poisson model for positive counts.
Hurdle_GEESAR(
formula,
data,
W,
weights = NULL,
toler = 1e-05,
maxit = 200,
trace = FALSE
)
formula |
A formula specifying the model. |
data |
The dataset. |
W |
The spatial weight matrix. |
weights |
Optional weights. |
toler |
Convergence tolerance. |
maxit |
Maximum number of iterations. |
trace |
Logical. If TRUE, prints progress. |
A list containing the logit and Poisson-truncated models.
set.seed(123)
n <- 100
x <- rnorm(n)
y <- rpois(n, lambda = exp(0.5 * x))
y[rbinom(n, 1, 1/(1+exp(-0.5*x)))] <- 0 # Introduce zeros
W <- matrix(rbinom(n^2,1,0.2), n, n) # Example spatial weight matrix
diag(W) <- 0
rtot <- rowSums(W)
W <- W/ifelse(rtot==0, 0.1, rtot)
model <- Hurdle_GEESAR(y ~ x, data = data.frame(y, x), W = W)
summary_SAR(model$logit_model)
summary_SAR(model$poisson_truncated_model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.