Specifying quantiles for quantile regression

Goals

This tutorial introduces the use of the optional input, tau, to specify quantile levels for the quantileFitprocedure.

The tau input

The quantileFit procedure accepts the optional input, tau, as the third input:

quantileFit(dataset, formula, tau)

or

quantileFit(y, x, tau)

GAUSS accepts a single quantile level or a vector of quantile levels with values $0 \lt τ \lt 1$. By default, GAUSS estimates the regression for the 5%, 50%, and 95%. If you want estimates for these quantile levels you do not need to use the tau input. However, if you wish to change these quantile levels, you will need to specify custom tau levels.

Basic example

Consider the example from our previous tutorial where we estimated:

$$ln(wage) = \alpha + \beta_1 * age + \beta_2 * age^2 + \beta_3 * tenure .$$

Specifying a single quantile level

First, let's estimate the model for the 35% quantile level:

// Create string with full path to dataset
dataset = getGAUSSHome() $+ "examples/regsmpl.dta";

// Specify quantile level
tau = 0.35;

// Estimate the model with matrix inputs
call quantileFit(dataset, "ln_wage ~ age + age:age + tenure", tau);

This produces the following results :

Total observations:                                   28101
Number of variables: 3
VAR. / tau (in %) 35%
------------------------------- CONSTANT 0.6846 age 0.0471 age:age -0.0008 tenure 0.0471

Comparing multiple quantile level

Now, let's compare estimates of the model for the 35%, 50%, and 85% quantile levels:

// Create string with full path to dataset
dataset = getGAUSSHome() $+ "examples/regsmpl.dta";

// Specify quantile level
tau = 0.35|0.55|0.85;

// Estimate the model with matrix inputs
call quantileFit(dataset, "ln_wage ~ age + age:age + tenure", tau);

This produces the following output:

Total observations:                                   28101
Number of variables: 3
VAR. / tau (in %) 35% 55% 85%
--------------------------------------------------- CONSTANT 0.6846 0.4234 0.1441 age 0.0471 0.0739 0.1081 age:age -0.0008 -0.0011 -0.0014 tenure 0.0471 0.0457 0.0285

The output tables now contains three columns, one for each quantile level estimated.

Conclusion

This tutorial showed you how to specify the quantile levels to be estimated when using quantileFit. You should now know how to:

  • Specify a single quantile levels for use with quantileFit
  • Specify multiple quantile levels for use with quantileFit

In the next tutorial we will learn how perform weighted analysis using the quantileFit procedure.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.