top of page

Mastering the White Noise Test in Stata: A Step-By-Step Guide

Jan 23, 2024

When conducting a time series analysis, it is crucial to understand if a series is a white noise or not. A series is considered white noise if it is a random sequence of variables with zero mean, constant variance, and no autocorrelation. The white noise test in Stata allows you to determine if the residual errors in your model are random and not correlated, which indicates that your model is well-specified.

In this article, we provide a step-by-step guide on how to run the white noise test in Stata to analyze the quality of your time series model.

Step 1: Install necessary packages
To run the white noise test in Stata, you will need to install the 'wntestq' package if you haven’t already done so. You can install it by typing the following command in the Stata command window:

ssc install wntestq

Step 2: Set up the model
Before running the white noise test, you need to set up your time series model. This involves specifying the time and the dependent and independent variables. For example:

tsset time_variable
regress dependent_variable independent_variable

Step 3: Run the white noise test
Now that your model has been specified, you can run the white noise test using the command:

wntestq _resid, lags(num) graph

In this command, '_resid' refers to the residuals obtained from the previous regression and 'lags(num)' allows you to specify the number of lags you want to test for autocorrelation. The 'graph' option will produce a plot of the autocorrelation function and the Ljung-Box Q-statistic.

Step 4: Interpret the results
After running the test, Stata will produce an output table with the Ljung-Box Q-statistic and the corresponding p-value for each specified lag. Low p-values (typically less than 0.05) indicate significant autocorrelation in the residuals, i.e., your model is not well-specified, and you should consider refining it. High p-values indicate that the residuals are a white noise, meaning your model is appropriate.

In conclusion, the white noise test in Stata is an essential tool for evaluating the quality and reliability of your time series models. For more tips and best practices in using Stata, check out our resources section.

bottom of page