surrogate              package:tseries              R Documentation

_G_e_n_e_r_a_t_e _S_u_r_r_o_g_a_t_e _D_a_t_a _a_n_d _S_t_a_t_i_s_t_i_c_s

_D_e_s_c_r_i_p_t_i_o_n:

     Generates 'ns' surrogate samples from the original data 'x' and
     computes the standard error and the bias of 'statistic' as in a
     bootstrap setup, if 'statistic' is given.

_U_s_a_g_e:

     surrogate(x, ns = 1, fft = FALSE, amplitude = FALSE,
               statistic = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: a numeric vector or time series.

      ns: the number of surrogate series to compute.

     fft: a logical indicating whether phase randomized surrogate data
          is generated.

amplitude: a logical indicating whether amplitude-adjusted surrogate
          data is computed.

statistic: a function which when applied to a time series returns a
          vector containing the statistic(s) of interest.

     ...: Additional arguments for 'statistic' which are passed
          unchanged each time it is called.

_D_e_t_a_i_l_s:

     If 'fft' is 'FALSE', then 'x' is mixed in temporal order, so that
     all temporal dependencies are eliminated, but the histogram of the
     original data is preserved.  If 'fft' is 'TRUE', then surrogate
     data with the same spectrum as 'x' is computed by randomizing the
     phases of the Fourier coefficients of 'x'.  If in addition
     'amplitude' is 'TRUE', then also the amplitude distribution of the
     original series is preserved.

     Note, that the interpretation of the computed standard error and
     bias is different than in a bootstrap setup.

     To compute the phase randomized surrogate and the amplitude
     adjusted data algorithm 1 and 2 from Theiler et al. (1992), pp.
     183, 184 are used.

     Missing values are not allowed.

_V_a_l_u_e:

     If 'statistic' is 'NULL', then it returns a matrix or time series
     with 'ns' columns and 'length(x)' rows containing the surrogate
     data. Each column contains one surrogate sample.

     If 'statistic' is given, then a list of class
     '"resample.statistic"' with the following elements is returned: 

statistic: the results of applying 'statistic' to each of the simulated
          time series.

orig.statistic: the results of applying 'statistic' to the original
          series.

    bias: the bias of the statistics computed as in a bootstrap setup.

      se: the standard error of the statistics computed as in a
          bootstrap setup.

    call: the original call of 'surrogate'.

_A_u_t_h_o_r(_s):

     A. Trapletti

_R_e_f_e_r_e_n_c_e_s:

     J. Theiler, B. Galdrikian, A. Longtin, S. Eubank, and J. D. Farmer
     (1992): Using Surrogate Data to Detect Nonlinearity in Time
     Series, in _Nonlinear Modelling and Forecasting_, Eds. M. Casdagli
     and S. Eubank, Santa Fe Institute, Addison Wesley, 163-188.

_S_e_e _A_l_s_o:

     'sample', 'tsbootstrap'

_E_x_a_m_p_l_e_s:

     x <- 1:10  # Simple example
     surrogate(x)

     n <- 500  # Generate AR(1) process
     e <- rnorm(n)  
     x <- double(n)
     x[1] <- rnorm(1)
     for(i in 2:n) {
       x[i] <- 0.4 * x[i-1] + e[i]
     }
     x <- ts(x)

     theta <- function(x)  # Autocorrelations up to lag 10
       return(acf(x, plot=FALSE)$acf[2:11])

     surrogate(x, ns=50, fft=TRUE, statistic=theta) 

