Generate p-dimensional matrices so that its inverse is tri-diagonal.

tridiag(p = 8, base = 0.7, n = NULL)

Arguments

p

desired dimension

base

base multiplier

n

option to generate n observations from covariance matrix S

Value

Omega, S

Examples

# generate tridiagonal matrix with p = 5 tridiag(p = 5)
#> $Omega #> [,1] [,2] [,3] [,4] [,5] #> [1,] 1.960784e+00 -1.372549 -3.217196e-16 1.246813e-15 -7.763029e-16 #> [2,] -1.372549e+00 2.921569 -1.372549e+00 -8.842423e-16 -3.055370e-17 #> [3,] 2.464545e-17 -1.372549 2.921569e+00 -1.372549e+00 6.749121e-16 #> [4,] -4.299393e-17 0.000000 -1.372549e+00 2.921569e+00 -1.372549e+00 #> [5,] -1.632681e-17 0.000000 1.328627e-16 -1.372549e+00 1.960784e+00 #> #> $S #> [,1] [,2] [,3] [,4] [,5] #> [1,] 1.0000 0.700 0.49 0.343 0.2401 #> [2,] 0.7000 1.000 0.70 0.490 0.3430 #> [3,] 0.4900 0.700 1.00 0.700 0.4900 #> [4,] 0.3430 0.490 0.70 1.000 0.7000 #> [5,] 0.2401 0.343 0.49 0.700 1.0000 #>