% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api.R
\name{fit_gwpr}
\alias{fit_gwpr}
\title{Fit GWPR with a given bandwidth}
\usage{
fit_gwpr(
  formula,
  data,
  spatial,
  id,
  time,
  bandwidth,
  family = c("gaussian", "binomial"),
  model = c("within", "pooling", "random"),
  effect = c("individual", "time", "two-way", "nested"),
  kernel = c("bisquare", "gaussian", "exponential", "tricube", "boxcar"),
  adaptive = FALSE,
  threshold = 0.5,
  workers = 1L,
  seed = NULL,
  ...
)
}
\arguments{
\item{formula}{A \code{formula} object.}

\item{data}{A \code{data.frame} with panel data.}

\item{spatial}{An \code{sf} object.}

\item{id}{Character scalar; unit ID column name.}

\item{time}{Character scalar; time column name.}

\item{bandwidth}{Numeric scalar.  The bandwidth to use (fixed distance or
number of neighbours when \code{adaptive = TRUE}).}

\item{family}{\code{"gaussian"} (default) or \code{"binomial"}.}

\item{model}{\code{"within"} (default), \code{"pooling"}, or
\code{"random"}.}

\item{effect}{\code{"individual"} (default), \code{"time"},
\code{"two-way"}, or \code{"nested"}.}

\item{kernel}{Kernel function name (default \code{"bisquare"}).}

\item{adaptive}{Logical; \code{FALSE} (default) for fixed bandwidth.}

\item{threshold}{Numeric; classification threshold (binomial only,
default \code{0.5}).}

\item{workers}{Positive integer; number of parallel workers (default 1).}

\item{seed}{Integer random seed, or \code{NULL}.}

\item{...}{Currently unused.}
}
\value{
A \code{gwpr_fit} object.
}
\description{
Validates inputs, prepares data, builds spatial weights, and fits the
Geographically Weighted Panel Regression for the specified bandwidth.
Returns a \code{gwpr_fit} object.
}
\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)
print(fit)
}

}
