quantileFitLoc#

Purpose#

Perform local linear or quadratic quantile regression.

Format#

q = quantileFitLoc(y, x[, tau[, xstar]][, qCtl])#
q = quantileFitLoc(dataset, formula[, tau[, xstar]][, qCtl])
Parameters:
  • y (Nx1 vector) – dependent variable.

  • x (NxK matrix or sparse matrix or N-dimensional array) – independent variables

  • dataset (string) – name of dataset.

  • 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’;

    E.g "y ~ -1 + X1 + X2", ‘-1’ means no intercept model.

  • tau (Mx1 vector) – Optional argument, quantile levels. Default = { 0.05, 0.5, 0.95 };

  • xstar (P*1 vector) – Optional argument, quantile points. Default = seqa(0, 1/(50-1), 50).

  • qCtl (struct) –

    Optional argument. instance of the qfitControl structure containing the following members:

    qCtl.bandwidth

    scalar, the multiplicative factor of the bandwidth. Default = 1.

    qCtl.reg_type

    scalar, the regression type. Default = 1.

    1:

    Linear regression.

    2:

    Quadratic regression.

    qCtl.varnames

    string array, variable names. Default = {"X1", "X2", ..., "XK"}.

    qCtl.verbose

    scalar, print results Default = 1.

    1:

    Printing on.

    0:

    No printing.

    qCtl.const

    scalar, include constant in regression. Default = 1.

    1:

    a constant term will be added.

    0:

    no constant term will be added.

Returns:

q (PxM matrix) – estimated quantile \(Y|X=xstar\)

Examples#

new;
cls;

// Set random number generator seed for
// repeatable random numbers
rndseed 4893;

N = 1000;
X = rndu(N, 1);
Y = sin(9*X) + (rndu(N, 1) - 0.5);

// Call quantileFitLoc
q = quantileFitLoc(Y, X);

Source#

quantilefit.src

See also

Functions glm(), olsmt(), quantileFit()