R/AR1.R

Defines functions AR1

AR1 <-
function(x)
{
T <- length(x) -1
Y <- x[2:T]
Y_ <- x[1:(T-1)]

ALPHA <- solve(t(Y_) %*% Y_ ) %*% t(Y_) %*% Y
RE <- Y - Y_ %*% ALPHA
SIGMAS <- sum(RE^2) / (T-1)
STDA <- sqrt( SIGMAS * solve(t(Y_) %*% Y_ ))
return(list(ALPHA=ALPHA,STDA=STDA))
}

Try the vrtest package in your browser

Any scripts or data that you put into this service are public.

vrtest documentation built on Aug. 31, 2023, 9:08 a.m.