Learn R Programming

SDD (version 1.2)

ADF: Serial Dependence Diagrams

Description

The function computes (and by default plots) different types of serial dependence diagrams.

Usage

ADF(x, dtype = c("ADF", "CADF", "RPADF", "DeltaADF", "ACF"), lag.max = floor(10 * log10(length(x))), alpha = 0.05, num.clas, B = 99, bandwidth, delta = "Delta_1", fres = ".Perm", fdenest = ".denest", fdiv, argacf, R = 1:lag.max, p.adjust.method =  p.adjust.methods, plot = TRUE, ...) "print"(x, digits=3, ...)

Arguments

x
an "ADF" object or a univariate numeric time series object or a numeric vector.
dtype
an optional character string. It specifies the type of autodependence function and must be:
  • "ADF" (default; see Bagnato, Punzo, Nicolis, 2012)
  • "CADF" (see Bagnato, Punzo, Nicolis, 2012)
  • "RPADF" (see Bagnato, De Capitani, Punzo, 2014)
  • "DeltaADF" (see Bagnato, De Capitani, Punzo, 2013)
  • "ACF"

lag.max
maximum lag at which to calculate the ADF. Default is 10*log10(n) where n is the length of the series .
alpha
significance level of the tests of lag-independence (related to each bar). Default value is 0.05.
num.clas
when dtype="ADF" or "CADF" or "RPADF", it sets the number of equifrequency classes for each of the two marginal distributions of the contingency table. If not specified, it is determined internally using a rule of thumb described in Bagnato, Punzo, Nicolis (2012).
B
when dtype="DeltaADF", it sets the number of permutations used. Default value is 99 (see Bagnato, De Capitani, Punzo, 2013a,b).
bandwidth
when dtype="DeltaADF", it sets the bandwidth used for the Gaussian kernel density estimator. Default value is computed with likelihood cross-validation (see Bagnato, De Capitani, Punzo, 2013a,b).
delta
a character vector; when dtype="DeltaADF", it specifies the type of divergence measure used (see Bagnato, De Capitani, Punzo, 2013b); for each element in delta a different plot is produced. Possible values are:
  • "Delta_1" (default)
  • "Delta_0.5"
  • "Delta_2"
  • "Delta_3"
  • "Delta_4"
  • "Delta_SD"
  • "Delta_L1"
  • "Delta_ST"
  • "Delta_fdiv"; in this case, the external function named fdiv is used to compute divergence.

fres
an optional character string which specifies, when dtype="DeltaADF", the name of the external function(x,B) specifying the resampling method from the raw series, where x is a time series and B the number of resamples; the function should return a matrix with B rows and length(x) columns. If not specified, permutations are randomly generated.
fdenest
an optional character string which specifies when dtype="DeltaADF", the name of the external function(x,m,ngrid,bandwidth) to use for univariate and bivariate density estimation, where x is the time series, m is the lag considered, ngrid is the number of points in the grid, and bandwidth is the bandwidth; the function should return:
  • fi, a matrix of dimension ngrid x ngrid containing conjoint density estimates for lag m
  • gi, a matrix of dimension ngrid x ngrid containing conjoint density estimates in case of independence, for lag m
  • ngi, is equal to ngrid.
If fdenest is not specified, the Gaussian kernel density estimation is used (see Bagnato, De Capitani, Punzo, 2013a,b).
fdiv
an optional character string which specifies, when dtype="DeltaADF" and delta="Delta_fdiv" , the name of the external function(fi,gi,ngi) to use to compute divergence; its arguments are defined as in fdenest; the function should return a scalar.
plot
if TRUE (default), the specified ADF is displayed.
argacf
when dtype="ACF", it is a list with optional arguments for function acf().
R
a vector. It specifies the lags on which to test for simultaneous independence (see Bagnato, Punzo, 2010, 2012 and Bagnato, De Capitani, Punzo, 2013b). Default value is 1:lag.max
p.adjust.method
a character string. It specifies the method to be used in the simultaneous independence test. It must be one of p.adjust.methods.
...
optional arguments to be passed to the plot.SDD method, such as graphical parameters.
digits
minimal number of significant digits.

Value

Returned from this function is a SDD object which is a list with the following components:
res
a data frame. According to dtype, it may contain:
  • lag, a numeric vector containing the lags at which the bars of the diagrams are computed
  • vbar, height of the bars of the diagram
  • pvalue, p-values associated to the bars of the diagram
  • pstar, transformed p-values associated to the bars of the diagram. If dtype="DeltaADF" transformed p-values are vbar
  • n, vector of length lag.max, containing the effective number of pairs considered for each lag
  • crit.val, vector, of length lag.max, with the critical values
  • xmin vector of length lag.max, containing the non-centrality parameters for each bar of the RP-ADF
dtype
a character string. It specifies the type of serial dependence diagram generated.
delta
a character string. It specifies, when type="DeltaADF", the type divergence measure used.
num.clas
a scalar. It is the number of classes in each contingency table.
alpha
a scalar. It specifies the significance level of the tests of lag independence (related to each bar).
df
a scalar. It contains the degrees of freedom of the reference chi-square distribution used when dtype is one of: "ADF", "RPADF", or "CADF".
bandwidth
a scalar. It is the bandwidth used in kernel density estimation.
series
the name of the series x.
R
a vector. It specifies the lags to test in the simultaneous independence tests.
p.adjust.method
a character string. It specifies the method to be used in the simultaneous independence tests. It must be one of p.adjust.methods.
p.adjust
a vector. It contains the adjusted probabilities for the simultaneous independence tests.

Details

There are print and data.frame methods for objects of class "ADF".

References

Bagnato L, De Capitani L, Mazza A, Punzo A (2015). SDD: An R Package for Serial Dependence Diagrams. Journal of Statistical Software, 64(2), 1-19. URL: http://www.jstatsoft.org/v64/c02/

Bagnato L, De Capitani L, Punzo A (2013a). Improving the autodependogram using the Kulback-Leibler divergence. arXiv:1306.5006 [stat.ME], URL: http://arxiv.org/pdf/1306.5006v1.pdf

Bagnato L, De Capitani L, Punzo A (2013b). Testing Serial Independence via Density-Based Measures of Divergence. Methodology and Computing in Applied Probability, 16(3), 627-641.

Bagnato L, De Capitani L, Punzo A (2014). Detecting Serial Dependencies with the Reproducibility Probability Autodependogram. Advances in Statistical Analysis, 98(1), 35-61.

Bagnato L, Punzo A (2010). On the Use of $\chi^2$ Test to Check Serial Independence. Statistica & Applicazioni, VIII(1), 57-74.

Bagnato L, Punzo A (2012). Checking Serial Independence of Residuals from a Nonlinear Model. In W Gaul, A Geyer-Shulz, L Schmidt-Thieme, J Kunze (eds.), Challenges at the Interface of Data Analysis, Computer Science, and Optimization, volume XIV of Studies in Classification, Data Analysis and Knowledge Organization, pp. 203-211. Springer-Verlag, Berlin Heidelberg.

Bagnato L, Punzo A, Nicolis O (2012). The autodependogram: a graphical device to investigate serial dependencies. Journal of Time Series Analysis, 33(2), 233-254.

Bagnato L, Punzo A (2013). Using the Autodependogram in Model Diagnostic Checking. In N Torelli, F Pesarin, A Bar-Hen (eds.), Advances in Theoretical and Applied Statistics, volume XIX of Studies in Theoretical and Applied Statistics, pp. 129-139. Springer-Verlag, Berlin Heidelberg.

See Also

SDD-package, plot.SDD, SMI, acf

Examples

Run this code

# Dependence Diagrams on raw data

data("SMI")
ADF(SMI^2, dtype="ACF", main="")
ADF(SMI, main="") 
ADF(SMI, dtype="RPADF", main="")

# Dependence Diagrams on residuals from a fitted model

library("tseries")
residuals <- garch(SMI, order=c(1,1))$residuals[-1]
ADF(residuals^2, dtype="ACF", main="")
ADF(residuals, dtype="RPADF", main="")

Run the code above in your browser using DataLab