psar: Profile Boosting for Spatial Auto-regressive Model

plagsarlmR Documentation

Profile Boosting for Spatial Auto-regressive Model

Description

Profile boosting variable selection for spatial auto-regressive (SAR) model

\bm{y} = \rho W \bm{y} + X \beta + \bm{\varepsilon},

where \bm{y}, \bm{\varepsilon} \in \mathbb{R}^n, X \in \mathbb{R}^{n \times p}, \rho \in (-1, 1).

Usage

plagsarlm(
  formula,
  data = list(),
  listw,
  na.action,
  Durbin,
  type,
  method = "eigen",
  quiet = NULL,
  zero.policy = NULL,
  interval = NULL,
  tol.solve = .Machine$double.eps,
  trs = NULL,
  control = list(),
  stopFun = "EBIC",
  keep = NULL,
  maxK = NULL,
  verbose = FALSE
)

psar.fit(x, y, w, stopFun = "EBIC", keep = NULL, maxK = NULL, verbose = FALSE)

Arguments

formula

Parameters passed to spatialreg::lagsarlm.

data

Parameters passed to spatialreg::lagsarlm.

listw

Parameters passed to spatialreg::lagsarlm.

na.action

Parameters passed to spatialreg::lagsarlm.

Durbin

Parameters passed to spatialreg::lagsarlm.

type

Parameters passed to spatialreg::lagsarlm.

method

Parameters passed to spatialreg::lagsarlm.

quiet

Parameters passed to spatialreg::lagsarlm.

zero.policy

Parameters passed to spatialreg::lagsarlm.

interval

Parameters passed to spatialreg::lagsarlm.

tol.solve

Parameters passed to spatialreg::lagsarlm.

trs

Parameters passed to spatialreg::lagsarlm.

control

Parameters passed to spatialreg::lagsarlm.

stopFun

Parameter passed to pboost.

keep

Parameter passed to pboost.

maxK

Parameter passed to pboost.

verbose

Parameter passed to pboost.

x

Numeric feature matrix.

y

Response vector.

w

Weight matrix (row-sum scaled being one).

Value

Model object fitted on the selected features.

Examples

set.seed(2026)

w <- set_rook_matrix(15, 15)

n <- NROW(w)
p <- 30
x <- matrix(rnorm(n*p), n) %*% chol(0.7^abs(outer(1:p, 1:p, "-")))
eta <- drop(x[, 1:3] %*% runif(3, 1.5, 2.0))

rho0 <- 0.2
sig0 <- 1.0
y <- solve(diag(n) - rho0 * w, rnorm(n, eta, sd=sig0)) |> drop()

## ---------- pboost ----------
system.time( egg <- psar.fit(x, y, w, verbose=TRUE) )
y.tilde <- (diag(NROW(x)) - egg[["rho"]] * w) %*% y

beta.hat <- egg[["beta"]]
idx <- as.integer(sub("[[:alpha:]]", "", names(beta.hat)))
sig2.hat <- mean( (y.tilde - drop(x[, idx, drop=FALSE] %*% beta.hat))^2 )
print( egg[["sig2"]] - sig2.hat )

## Not run: 
system.time(
plagsarlm(y ~ ., data=data.frame(y, x), listw=spdep::mat2listw(w, style="W"), verbose=TRUE)
)

## End(Not run)

## ---------- frs ----------
fsar.fit(x, y, w, verbose=TRUE)

## Not run: 
system.time(
flagsarlm(y ~ ., data=data.frame(y, x), listw=spdep::mat2listw(w, style="W"), verbose=TRUE)
)

## End(Not run)


pboost documentation built on May 24, 2026, 9:08 a.m.