Form the correlation matrix of order order whose correlations follow the ar2 pattern. The resulting matrix is banded.
matrix
order
mat.ar2(ARparameters, order)
A numeric containing the two autoregressive parameter values of the process, being the weights given to the lag 1 and lag 2 response values.
numeric
The order of the matrix to be formed.
A banded correlation matrix whose elements follow an ar2 pattern.
The correlations in the correlation matrix, corr say, are calculated from the autoregressive parameters, ARparameters. The values in
corr
ARparameters
the diagonal (k = 1) of corr are one;
k = 1
the first subdiagonal band (k = 2) of corr are equal to ARparameters[1]/(1-ARparameters[2]);
k = 2
ARparameters[1]/(1-ARparameters[2])
in subsequent disgonal bands, (k = 3:order), of corr are ARparameters[1]*corr[k-1] + ARparameters[2]*corr[k-2].
k = 3:order
ARparameters[1]*corr[k-1] + ARparameters[2]*corr[k-2]
mat.I, mat.J, mat.exp, mat.gau, mat.banded, mat.ar1, mat.ar3, mat.sar2, mat.ma1, mat.ma2, mat.arma
mat.I
mat.J
mat.exp
mat.gau
mat.banded
mat.ar1
mat.ar3
mat.sar2
mat.ma1
mat.ma2
mat.arma
# NOT RUN { corr <- mat.ar2(ARparameters = c(0.4, 0.2), order = 4) # }
Run the code above in your browser using DataLab