The VC package

Estimation procedure by Ekkehart Schlicht (University of Munich). Implemented by Johannes Ludsteck (Institute for Employment Research Nuremberg).

VC is a method-of-moments estimation procedure for linear time series models with time-varying (random walk) coefficients, developed by Ekkehart Schlicht (University of Munich).

Consider the model
(Subscript[y, t]) = (Subscript[a, t]) (Subscript[x, t]) + (Subscript[u, t])
where (Subscript[a, t]) and (Subscript[x, t]) is are - vectors, (Subscript[u, t]) 
        follows a normal distribution and (Subscript[a, t]) 
        is generated by a random walk process of the form
(Subscript[a, t]) = (Subscript[a, t - 1]) + (Subscript[v, t])
\(where\ \(v\_t\) 
            follows\ a\ multivariate\ normal\ distribution\ with\ mean\ 0\ and\ variance - covariance\ matrix\ ∑ = 
        diag \(\((σ\_1\%2,  ... , σ\_n\%2)\)\(.\)\)\)
It is routine to estimate such models by Maximum Likelihood using the Kalman filter.  However, for short time series, maximum likelihood estimation produces corner solutions ((Subscript[σ, i]^2)=0) in many cases, even if the true variances are strictly positive. VC does better in many cases.

This loads the package

<< VC`

Load some helper packages used to generate simulated data.

<< Statistics`ContinuousDistributions`;
<< Statistics`MultinormalDistribution`;
<< LinearAlgebra`MatrixManipulation`;

Two further helper functions. VCModel generates simulated data for a linear time series model with varying coefficients.

VCModel[t_, Sigma_?MatrixQ, bv_?VectorQ, uv_, 
          opts___] := 
Module[{n = Length[bv], mndist, 
            brand, urand, b, x, y, 
            bMat}, 

mndist = 
            MultinormalDistribution[Table[0.0, {n - 1}], 
              Sigma]; 
brand := 
            Map[Random[NormalDistribution[0.0, #]] &, 
              Sqrt[bv]]; 
urand := 
            RandomArray[NormalDistribution[0.0, Sqrt[uv]], 
              t]; 
x = 
            Map[Join[{1.0}, #] &, 
              RandomArray[mndist, t]]; 
b = 
            Flatten[bMat = 
                NestList[#1 + brand &, Table[1.0, {n}], 
                  t - 1]]; 
y = 
            X[x] . b + urand; 
{y, x, 
            Transpose[bMat]}];

    
X[x_] := 
        Module[{t, n}, 
{t, n} = 
            Dimensions[
              x]; 
SparseArray[{i_, j_} /; (i - 1) n < 
                  j ≤ i n :> 
              x[[i, 
                j - (i - 1) n]], {t, 
              t n}]];

Here we set the parameters of the model and generate the data

SeedRandom[123]; t = 50;
S = 5 {{1, 0.5}, {0.5, 1}};
bv = {0.05, 0.1, 0.15};
{y, x, b} = VCModel[t, S, bv, 1.0];

This is a plot of the time paths of the three coefficients

Show[
      GraphicsArray[
        Map[ListPlot[#, 
PlotJoined -> True, 
              DisplayFunction -> Identity] &, 
          b]], 
DisplayFunction -> $DisplayFunction, 
      ImageSize -> 500]

The next cell contains a call to VCEstimate. VCEstimate returns a List containing [1] a matrix with the time paths of the coefficients bhat, [2] a matrix with the respective standard errors sdb, [3] the standard error of the residual sdu, and [4] the vector of standard errors of the random walk residuals sdi. Since the computation of the estimates may be time-consuming for lage models, the estimation process is reported

{bhat, sdb, sdu, sdi} = VCEstimate[x, y];

The cell above serves as an iteration monitor. It prints the number of completed iterations, the actual value of the  convergence criterion and the actual value of variance ratios (=sdi/sdu). The convergence criterion used to compute the estimator is the maximum of relative changes of the variance ratios between two successive steps of the fixed point iteration.

CIPlot is a helper function which allows to plot the coefficients together with confidence interval bands (default option is 0.95 percent bands).

Options[CIPlot]

CIPlot[bhat, sdb, Columns -> 3]

If the option StoppingCriterion->a is given, VCEstimate stops the fixed point interation if the maximum relative change of the variance ratios is  0.1^a (default value is StoppingCriterion->5).

{bhat, sdb, sdu, sdi} = 
        VCEstimate[x, y, StoppingCriterion -> 3];

The extension of VC to panel data is straightforward. This extension is implemented in the package. Since only less users will be interested in panel data applications, we do not demonstrate them here. The interested reader is referred to the package documentation (type ?VCEstimate). Note that panel data are tractable only if the cross-section dimension and time dimension are small (less than 100).