% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diagnostics.R
\name{diagnose_hausman}
\alias{diagnose_hausman}
\title{Local Hausman test diagnostic on a gwpr_fit object}
\usage{
diagnose_hausman(object, ...)
}
\arguments{
\item{object}{A `gwpr_fit` object.}

\item{...}{Currently ignored.}
}
\value{
A named list with elements:
\describe{
  \item{`local_hausman`}{Data frame with columns `unit_id`, `statistic`,
    `p_value`, `df`, `status`.}
  \item{`n_tested`}{Number of units tested.}
  \item{`n_failed`}{Number of units where the test could not be computed.}
  \item{`status`}{Overall status: `"ok"`, `"not_applicable"`, or
    `"no_local_results"`.}
}
}
\description{
Performs a local Hausman test (within vs. random) for each spatial unit
using test statistics pre-computed during model fitting or stored in
`local_results`.
}
\details{
**Applicable models**: gaussian with `model = "random"`.  For pooling
models the Hausman test is not meaningful; the function returns a
`status = "not_applicable"` result.  For logistic models the function also
returns `status = "not_applicable"`.

**Panel balance requirement**: No constraint at the unit level.

**Failure conditions**: Returns `status = "missing_hausman_data"` for any
unit where the required statistics are absent from `local_results`.

**Logistic interpretation limit**: Not applicable.
}
\examples{
\donttest{
library(sf)
pts <- sf::st_as_sf(
  data.frame(id = 1:4, X = c(0,1,0,1), Y = c(0,0,1,1)),
  coords = c("X", "Y"), crs = NA_integer_
)
dat <- data.frame(
  id   = rep(1:4, each = 5),
  time = rep(1:5, 4),
  y    = rnorm(20),
  x1   = rnorm(20)
)
fit <- fit_gwpr(y ~ x1, data = dat, spatial = pts, id = "id",
                time = "time", bandwidth = 2, workers = 1)
diagnose_hausman(fit)
}

}
