% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model_tvlm.R
\name{fit_tvlm}
\alias{fit_tvlm}
\title{Fit Time-Varying Coefficient Linear Model (tvLM)}
\usage{
fit_tvlm(formula, data, bw = NULL, seed = 42)
}
\arguments{
\item{formula}{an object of class \code{\link[stats]{formula}}.}

\item{data}{a data frame containing the variables in the formula.}

\item{bw}{numeric or \code{NULL}; the bandwidth for kernel smoothing.
If \code{NULL} (default), bandwidth is selected automatically via
leave-one-out cross-validation.}

\item{seed}{integer; random seed for reproducibility (default: 42).}
}
\value{
An object of class \code{"ArvindFit"}, a list containing the
same standard fields as \code{\link[=fit_rw1]{fit_rw1()}}, plus:
\describe{
\item{tv_coefs}{matrix; time-varying coefficient estimates.}
\item{tv_fit}{the fitted \code{tvReg::tvLM} object.}
}
}
\description{
Fits a time-varying coefficient linear model using kernel-weighted
least squares (via the \pkg{tvReg} package) with Arvind-distributed
residuals.
}
\examples{
dat <- simulate_arvind_data(n = 50, seed = 1)
m2 <- fit_tvlm(Y ~ X1 + X2 + X3, dat, bw = 0.5, seed = 42)
m2$theta

}
\seealso{
\code{\link[=diagnostics_arvind]{diagnostics_arvind()}}, \code{\link[=forecast_arvind]{forecast_arvind()}}, \code{\link[=cv_arvind]{cv_arvind()}}
}
