Hurdle_GEESAR: Hurdle Model using GEESAR

View source: R/Hurdle_GEESAR.R

Hurdle_GEESARR Documentation

Hurdle Model using GEESAR

Description

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.

Usage

Hurdle_GEESAR(
  formula,
  data,
  W,
  weights = NULL,
  toler = 1e-05,
  maxit = 200,
  trace = FALSE
)

Arguments

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.

Value

A list containing the logit and Poisson-truncated models.

Examples


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)



spatemR documentation built on June 8, 2025, 1:16 p.m.