R/GetB.R

`GetB` <-
function(phi){
 p<-length(phi)
 if (p == 1)
    a<-phi^2
 else {
    a<-p*as.vector(acf(phi,lag.max=p,type="covariance",demean=FALSE,plot=FALSE)$acf)
    for (i in 1:(p-1))
        a<-c(a,p*as.vector(acf(c(phi[-(1:i)],rep(0,i)),lag.max=p,type="covariance",demean=FALSE,plot=FALSE)$acf)[1:(p-i)])
    }
 FromSymmetricStorageUpper(a)
}

Try the FitAR package in your browser

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

FitAR documentation built on May 2, 2019, 3:22 a.m.