Estimates coefficients of a regression model with autoregressive errors of any specified order.
lsdvFit(y, x, series_length, n_lags[, lsc])¶
lsdvFit(dataset, formula, series_length, n_lags[, lsc])
y (Nx1 vector) – data.
x (Nxk vector) – independent data.
dataset (string) – name of data set or null string.
formula (string) – formula string of the model. E.g. “y ~ X1 + X2” ‘y’ is the name of dependent variable, ‘X1’ and ‘X2’ are names of independent variables; E.g. “y ~ .” , ‘.’ means including all variables except dependent variable ‘y’;
series_length (scalar) – number of time periods for each case or instance.
num_lags (scalar) – number of lagged values of the dependent variable.
lsc (struct) –
Optional input, an instance of a lsdvmtControl structure. The following members of lsc are referenced within this routine:
scalar, if nonzero constraints will be applied to the autoregression coefficients. Default = 1.
scalar, if nonzero, data are scaled.
scalar, determines the output to be printed.
string, title to be printed at top of header.
out (struct) –
An instance of an lsdvOutstructure. The following members of out are referenced within this routine:
Jx1 vector, uncorrected autoregression coefficients.
Kx1 vector, uncorrected regression coefficients.
Jx1 vector, bias corrected autoregression coefficients.
Kx1 vector, bias corrected regression coefficients.
Jx1 vector, autoregression coefficient standard errors.
Kx1 vector, regression coefficient standard errors.
KxK matrix, covariance matrix of parameters
scalar, residual sums of squares.
scalar, total sums of squares.
scalar, explained sums of squares.
scalar, pooled residual sums of squares.
K+Jx1 vector, bias corrections.
Jx2 matrix, Lagrangeans for constraints.
scalar, number of cases.
scalar, number of observations with missing data.
scalar, number of degrees of freedom.
scalar, number of observations.
scalar, number of parameters.
scalar, number of periods in time series.
Dataset and formula¶
new; library tsmt; // Declare lsdvmt control structure struct lsdvmtControl c0; c0 = lsdvmtControlCreate(); // Turn screen output on c0.output = 1; // Scale data before running c0.scale = 0; // Declare output structure struct lsdvmtOut out; // Call lsdvmt function out = lsdvFit(getGAUSSHome() $+ "pkgs/tsmt/examples/lsdv.dat", "Y~X1+X2+X3", 50, 2, c0);
new; library tsmt; //Load data data = loadd( getGAUSSHome() $+ "pkgs/tsmt/examples/lsdv.dat"); //Dependent variable y = data[., 1]; //Independent variable x = data[., 2:4]; //Declare lsdvmt control structure struct lsdvmtControl c0; c0 = lsdvmtControlCreate(); //Turn screen output on c0.output = 1; //Scale data before running c0.scale = 0; //Declare output structure struct lsdvmtOut out; //Call lsdvmt function out = lsdvFit(y, x, 50, 2, c0);
The data must be contained in a GAUSS dataset cross-sectional unit by cross-sectional unit, with one variable containing an index for the units. From each cross-sectional unit all observations must be grouped together. For example, for the first cross-sectional unit there may be 10 rows in the dataset, for the second cross-sectional unit there may be another 10 rows, and so on. Each row in the dataset contains measurements on the endogenous and exogenous variables measured for each observation along with the index identifying the cross-sectional unit.
The index variable must be a series of integers. While all observations for each cross-sectional unit must be grouped together, they do not have to be sorted according to the index.