% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model_linear.R
\name{fit_linear_local_model}
\alias{fit_linear_local_model}
\title{Fit a single local panel linear model}
\usage{
fit_linear_local_model(
  local_data,
  formula,
  model,
  effect,
  weights,
  index,
  random_method = "swar"
)
}
\arguments{
\item{local_data}{A `pdata.frame` or plain `data.frame` with columns for
all formula variables plus the panel indices.}

\item{formula}{A formula object.}

\item{model}{Character scalar: `"pooling"`, `"within"`, or
`"random"`.}

\item{effect}{Character scalar: `"individual"`, `"time"`, `"two-way"`,
or `"nested"`.}

\item{weights}{Numeric vector of kernel weights aligned with the rows of
`local_data`.}

\item{index}{Character vector of length 2 giving the panel index
column names: `c(id_col, time_col)`.}

\item{random_method}{Character scalar; estimation method for variance
components when `model = "random"` (default `"swar"`).}
}
\value{
A list with elements:
\describe{
  \item{`fit`}{The fitted model object, or `NULL` on failure.}
  \item{`status`}{`"ok"` or `"failed"`.}
  \item{`error`}{`NULL` or character string with the error message.}
  \item{`metadata`}{Named list with additional model-fitting metadata,
    e.g. flagging single-observation individuals for within models.}
}
}
\description{
Fits a geographically weighted panel linear model for one focal spatial
unit.  Errors are caught and returned as a structured failure result rather
than propagating to the caller.
}
\keyword{internal}
