R/SimulateAR1.R

Defines functions SimulateAR1

Documented in SimulateAR1

SimulateAR1 <-
function(n, phi){
sde <- sqrt(1-phi^2)
e<-rnorm(n, sd=sde) #variance of time series will be 1
u<-numeric(n)
u[1]<-rnorm(1)
for (i in 2:n)
    u[i] <- phi*u[i-1] + e[i]
u
}

Try the pRSR package in your browser

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

pRSR documentation built on May 2, 2019, 12:09 a.m.