WhiteNoiseTest: Test for White Noise

View source: R/WhiteNoiseTest.R

WhiteNoiseTestR Documentation

Test for White Noise

Description

Test fails to reject the null hypothesis of no white noise if p-value < 0.05. Consequently, b the data is a (Gaussian) white noise if a p-value is below 0.05.

Usage

WhiteNoiseTest(TimeSeries, lags = 1, type = "c", PlotIt = TRUE)

Arguments

TimeSeries

[1:n] vector of data, e.g. residuals of time series

lags

Number of lags to investigate in the statistical test

type

A character string describing the type of UnitrootTests (the unit root regression). Valid choices are "nc" for a regression with no intercept (constant) nor time trend, and "c" for a regression with an intercept (constant) but no time trend, "ct" for a regression with an intercept (constant) and a time trend. The default is "c".

PlotIt

If TRUE plots the gaussian in relation to the TimeSeries data. If each sample has a normal distribution with zero mean, the signal is said to be Gaussian white noise [Diebold, 2007].

Details

White noise can be described as a random process, e.g. Brownian Movement, Random Walk. The simplest unit-root nonstationary time series is the univariate random walk [Tsay, 2013]. Therefore, using distribution analysis and a unit root test, this function can serve as a indication for white noise, because unit root is a feature of white noise. If the mean is around zero (red line visible in plot) and the distribution gaussian (magenta line overlaps blue line) and the pvalue is small than white noise can be assumed. It is a difficult task to try to generally to proof white noise. Thus, if one of the two approaches (statistical versus visual) do not agree, than the result is unclear and the residuals should be tested with other approaches.

Value

Output of UnitrootTests in mode invisible

Author(s)

Michael Thrun

References

[Tsay, 2013] Tsay, Ruey S: Multivariate time series analysis: with R and financial applications, John Wiley & Sons, 201.

[Diebold, 2007] Diebold, Frank: Elements of Forecasting (Fourth ed.), 2007

See Also

UnitrootTests temporal Data Mining, A.Ultsch

Examples


 Z1 = rnorm(1000) 
 WhiteNoiseTest(Z1)
 
 
  require(portes)
  Z2 <- varima.sim(n=400) #Generates white noise
  WhiteNoiseTest(Z2)


#Data is not wihite noise, because not gaussian distributed
data("airquality")
WhiteNoiseTest(airquality$Ozone)

data("airquality")
#Data is not white noise, because not gaussian distributed
WhiteNoiseTest(airquality$Ozone)

#Data is not wihite noise, because mean not around zero
WhiteNoiseTest(airquality$Wind)


Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.