% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model_rw1.R
\name{fit_rw1}
\alias{fit_rw1}
\title{Fit Random Walk on Coefficients Model (RW1-approx)}
\usage{
fit_rw1(formula, data, theta_innov = 2, rw_scale = 0.01, seed = 42)
}
\arguments{
\item{formula}{an object of class \code{\link[stats]{formula}} specifying
the model (e.g., \code{Y ~ X1 + X2}).}

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

\item{theta_innov}{positive numeric; the Arvind parameter for state
innovations (default: 2.0).}

\item{rw_scale}{numeric; proportion of OLS coefficients used as innovation
scale (default: 0.01).}

\item{seed}{integer; random seed for reproducibility (default: 42).}
}
\value{
An object of class \code{"ArvindFit"}, a list containing:
\describe{
\item{model_type}{character; \code{"RW1-approx"}.}
\item{fitted}{numeric vector; fitted values.}
\item{residuals}{numeric vector; raw residuals.}
\item{theta}{numeric; estimated Arvind parameter for residuals.}
\item{sigma}{numeric; residual scale.}
\item{shift}{numeric; shift applied to residuals.}
\item{e_pos}{numeric vector; positive standardised residuals.}
\item{negloglik}{numeric; negative log-likelihood.}
\item{beta_t}{matrix; time-varying coefficient paths.}
\item{beta_final}{numeric vector; final coefficient values.}
\item{sigma_rw}{numeric vector; random walk innovation scales.}
\item{theta_innov}{numeric; Arvind parameter used for innovations.}
\item{n}{integer; number of observations.}
\item{p}{integer; number of parameters.}
\item{X}{matrix; design matrix.}
\item{Y}{numeric vector; response variable.}
\item{formula}{the model formula.}
\item{data}{the input data frame.}
}
}
\description{
Fits a stochastic regression model with time-varying coefficients evolving
as a random walk with Arvind-distributed innovations. The observation
errors also follow the Arvind distribution.
}
\examples{
dat <- simulate_arvind_data(n = 50, seed = 1)
m1 <- fit_rw1(Y ~ X1 + X2 + X3, dat, seed = 42)
m1$theta

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