Wolfram Language

Random Matrices

Simulate a Vector AR Process

Use MatrixNormalDistribution to simulate the vector autoregressive process.

In[1]:=
Click for copyable input
sigR = Covariance[ARProcess[{a}, 1][Range[0, 100]]]; sigC = {{s11, s12}, {s12, s22}};
In[2]:=
Click for copyable input
rules = {a -> 1/2, s11 -> 1, s12 -> 1/2, s22 -> 3};
In[3]:=
Click for copyable input
\[ScriptCapitalD] = MatrixNormalDistribution[sigR, sigC] /. rules;

Simulate a random sample from the matrix distribution.

In[4]:=
Click for copyable input
vals = RandomVariate[\[ScriptCapitalD], 10^4];

Construct TemporalData from sampled values.

In[5]:=
Click for copyable input
td = TemporalData[vals, {0, Length[sigR] - 1, 1}, ValueDimensions -> 2]
Out[5]=

Estimate the diagonal vector autoregressive process.

In[6]:=
Click for copyable input
proc = ARProcess[{a IdentityMatrix[2]}, sigC];
In[7]:=
Click for copyable input
sol = FindProcessParameters[td, proc]
Out[7]=

Compare to the original values.

In[8]:=
Click for copyable input
sol[[All, 2]] - rules[[All, 2]]
Out[8]=

Related Examples

de es fr ja ko pt-br ru zh