R/AR.Fore.R

Defines functions AR.Fore

AR.Fore <-
function(x,b,h)
{
n <- nrow(x)
p <- length(b)-1

b1 <- b[p+1]
b2 <- b[1:p]
rx <- x[(n-p+1):n,1]

for( i in 1:h)
{
    f <- b1 + sum( b2 * rx[length(rx):(length(rx)-p+1)])
    rx <- c(rx,f)
}
f <- rx[(p+1):(p+h)]
return(as.matrix(f))
}

Try the BootPR package in your browser

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

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