AdditionalRegressors: ISlSeries;
The AdditionalRegressors property returns additional regressors.
If the DOLS method is selected, additional regressors are ignored.
To get cointegration and deterministic regressors, use the ISmCointegratingRegression.CointegratingRegressors and ISmCointegratingRegression.DeterministicRegressors properties.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
CointReg: SmCointegratingRegression;
x: ISlSerie;
can, fra, ger, ita, jpn, uk, us: Array[20] Of Double;
ar: Array Of Double;
i, j, res, FirstPoint, LastPoint: Integer;
str: String;
Begin
CointReg := New SmCointegratingRegression.Create;
// variable values
can[00] := 6209; fra[00] := 4110; ger[00] := 3415; ita[00] := 2822; jpn[00] := 1475; uk[00] := 5320; us[00] := 8680;
can[01] := 6385; fra[01] := 4280; ger[01] := 3673; ita[01] := 3023; jpn[01] := 1649; uk[01] := 5484; us[01] := 9132;
can[02] := 6752; fra[02] := 4459; ger[02] := 4013; ita[02] := 3131; jpn[02] := 1787; uk[02] := 5517; us[02] := 9213;
can[03] := 6837; fra[03] := 4545; ger[03] := 4278; ita[03] := 3351; jpn[03] := 1884; uk[03] := 5791; us[03] := 9450;
can[04] := 6495; fra[04] := 4664; ger[04] := 4577; ita[04] := 3463; jpn[04] := 1972; uk[04] := 5971; us[04] := 9177;
can[05] := 6907; fra[05] := 4861; ger[05] := 5135; ita[05] := 3686; jpn[05] := 2108; uk[05] := 6158; us[05] := 9756;
can[06] := 7349; fra[06] := 5195; ger[06] := 5388; ita[06] := 3815; jpn[06] := 2249; uk[06] := 6238; us[06] := 9756;
can[07] := 7213; fra[07] := 5389; ger[07] := 5610; ita[07] := 3960; jpn[07] := 2394; uk[07] := 6322; us[07] := 9724;
can[08] := 7061; fra[08] := Double.Nan; ger[08] := 5787; ita[08] := 4119; jpn[08] := 2505; uk[08] := 6340; us[08] := 9476;
can[09] := 7180; fra[09] := 5610; ger[09] := 6181; ita[09] := 4351; jpn[09] := 2714; uk[09] := 6569; us[09] := 9913;
can[10] := Double.Nan; fra[10] := 5948; ger[10] := 6633; ita[10] := 4641; jpn[10] := Double.Nan; uk[10] := 6813; us[10] := 9974;
can[11] := Double.Nan; fra[11] := 6218; ger[11] := 6910; ita[11] := 5008; jpn[11] := Double.Nan; uk[11] := 6974; us[11] := 10046;
can[12] := Double.Nan; fra[12] := 6521; ger[12] := 7146; ita[12] := 5305; jpn[12] := Double.Nan; uk[12] := 6994; us[12] := 10467;
can[13] := 7722; fra[13] := 6788; ger[13] := 7248; ita[13] := 5611; jpn[13] := 4008; uk[13] := 7220; us[13] := 10740;
can[14] := 8088; fra[14] := 7222; ger[14] := 7689; ita[14] := 5693; jpn[14] := 4486; uk[14] := 7570; us[14] := 11157;
can[15] := 8516; fra[15] := 7486; ger[15] := 8046; ita[15] := 5804; jpn[15] := 4663; uk[15] := 7686; us[15] := 11738;
can[16] := 8941; fra[16] := 7832; ger[16] := 8143; ita[16] := 6121; jpn[16] := 5115; uk[16] := 7811; us[16] := 12274;
can[17] := 9064; fra[17] := 8153; ger[17] := 8064; ita[17] := 6546; jpn[17] := 5655; uk[17] := 8012; us[17] := 12450;
can[18] := 9380; fra[18] := 8468; ger[18] := 8556; ita[18] := 6918; jpn[18] := 6358; uk[18] := 8265; us[18] := 12874;
can[19] := 9746; fra[19] := 9054; ger[19] := 9177; ita[19] := 7349; jpn[19] := 6995; uk[19] := 8326; us[19] := 13135;
// sample period
CointReg.ModelPeriod.FirstPoint := 1;
CointReg.ModelPeriod.LastPoint := 15;
// First and last forecast point
CointReg.Forecast.FirstPoint := 15;
CointReg.Forecast.LastPoint := 20;
// source series
CointReg.Explained.Value := can;
// cointegrating regressors
CointReg.CointegratingRegressors.Clear;
x := CointReg.CointegratingRegressors.Add;
x.Value := fra;
x := CointReg.CointegratingRegressors.Add;
x.Value := jpn;
// determinate regressors
x := CointReg.DeterministicRegressors.Add;
x.Value := ger;
x := CointReg.DeterministicRegressors.Add;
x.Value := uk;
// additional regressors
CointReg.AdditionalRegressors.Clear;
x := CointReg.AdditionalRegressors.Add;
x.Value := ita;
x := CointReg.AdditionalRegressors.Add;
x.Value := us;
// trend specification
CointReg.TrendSpecification := TrendSpecificationType.ConstLinear;
// estimation method
CointReg.EstimationMethod := CREstimationMethodType.FMOLS;
// use finite differences
CointReg.UseDifferencedData := True;
// Missing data treatment method
CointReg.MissingData.Method := MissingDataMethod.Casewise;
// take into account that coefficients are found approximately on calculating confidence limits
CointReg.Forecast.CoefUncertaintyInSECalc := True;
// model calculation and output of results
res := CointReg.Execute;
Debug.WriteLine(CointReg.Errors);
FirstPoint := CointReg.Forecast.FirstPoint;
LastPoint := CointReg.Forecast.LastPoint;
For i := 0 To CointReg.WarningsCount - 1 Do
Debug.WriteLine(CointReg.Warnings[i]);
End For;
Debug.WriteLine("Cointegrating model coefficients: ");
Debug.Indent;
For i := 0 To CointReg.CointegratingCoefficients.Estimate.Length - 1 Do
Debug.WriteLine(CointReg.CointegratingCoefficients.Estimate[i].ToString + " " +
CointReg.CointegratingCoefficients.StandardError[i].ToString + " " +
CointReg.CointegratingCoefficients.TStatistic[i].ToString + " " +
CointReg.CointegratingCoefficients.Probability[i].ToString);
End For;
Debug.Unindent;
Debug.WriteLine("Determinate model coefficients:");
Debug.Indent;
For i := 0 To CointReg.DeterministicCoefficients.Estimate.Length - 1 Do
Debug.WriteLine(CointReg.DeterministicCoefficients.Estimate[i].ToString + " " +
CointReg.DeterministicCoefficients.StandardError[i].ToString + " " +
CointReg.DeterministicCoefficients.TStatistic[i].ToString + " " +
CointReg.DeterministicCoefficients.Probability[i].ToString);
End For;
Debug.Unindent;
Debug.WriteLine("Model characteristics");
Debug.Indent;
Debug.WriteLine("Determination coefficient: " + CointReg.SummaryStatistics.R2.ToString);
Debug.WriteLine("Adjusted determination coefficient: " + CointReg.SummaryStatistics.AdjR2.ToString);
Debug.WriteLine("Standard regression error: " + CointReg.SummaryStatistics.SE.ToString);
Debug.WriteLine("Sum of squared residuals: " + CointReg.SummaryStatistics.SSR.ToString);
Debug.WriteLine("Durbin-Watson statistic: " + CointReg.SummaryStatistics.DW.ToString);
Debug.Unindent;
Debug.WriteLine("Covariance matrix: ");
Debug.Indent;
For i := 0 To CointReg.CovarianceMatrix.GetUpperBound(1) Do
str := "";
For j := 0 To CointReg.CovarianceMatrix.GetUpperBound(2) Do
str := str + (CointReg.CovarianceMatrix[i, j] As Double).ToString + " ";
End For;
Debug.WriteLine(str);
End For;
Debug.Unindent;
ar := CointReg.Explained.Value;
ar[0] := Double.Nan;
Debug.WriteLine("Standard deviation: " + Statistics.StDev(ar).ToString);
Debug.WriteLine("Modeling series");
Debug.Indent;
For i := 0 To CointReg.Fitted.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(CointReg.Fitted[i]);
End For;
Debug.Unindent;
Debug.WriteLine("Residual series");
Debug.Indent;
For i := 0 To CointReg.Residuals.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(CointReg.Residuals[i]);
End For;
Debug.Unindent;
Debug.WriteLine("Forecast series");
Debug.Indent;
For i := FirstPoint To LastPoint - 1 Do
Debug.WriteLine(i.ToString + " " + CointReg.Forecast.Value[i].ToString);
End For;
Debug.Unindent;
Debug.WriteLine("Upper confidence limit:");
Debug.Indent;
For i := FirstPoint To LastPoint - 1 Do
Debug.WriteLine(i.ToString + " " + CointReg.Forecast.UpperConfidenceLevel[i].ToString);
End For;
Debug.Unindent;
Debug.WriteLine("Lower confidence limit:");
Debug.Indent;
For i := FirstPoint To LastPoint - 1 Do
Debug.WriteLine(i.ToString + " " + CointReg.Forecast.LowerConfidenceLevel[i].ToString);
End For;
Debug.Unindent;
End Sub UserProc;
After executing the example the console window displays cointegrating and deterministic model coefficients, model characteristics, covariance matrix, standard deviation, modeling series, residual series, forecasting series, and lower and upper confidence limits.
See also: