Box.test package:stats R Documentation _B_o_x-_P_i_e_r_c_e _a_n_d _L_j_u_n_g-_B_o_x _T_e_s_t_s _D_e_s_c_r_i_p_t_i_o_n: Compute the Box-Pierce or Ljung-Box test statistic for examining the null hypothesis of independence in a given time series. These are sometimes known as 'portmanteau' tests. _U_s_a_g_e: Box.test(x, lag = 1, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0) _A_r_g_u_m_e_n_t_s: x: a numeric vector or univariate time series. lag: the statistic will be based on 'lag' autocorrelation coefficients. type: test to be performed: partial matching is used. fitdf: number of degrees of freedom to be subtracted if 'x' is a series of residuals. _D_e_t_a_i_l_s: These tests are sometimes applied to the residuals from an 'ARMA(p, q)' fit, in which case the references suggest a better approximation to the null-hypothesis distribution is obtained by setting 'fitdf = p+q', provided of course that 'lag > fitdf'. _V_a_l_u_e: A list with class '"htest"' containing the following components: statistic: the value of the test statistic. parameter: the degrees of freedom of the approximate chi-squared distribution of the test statistic (taking 'fitdf' into account. p.value: the p-value of the test. method: a character string indicating which type of test was performed. data.name: a character string giving the name of the data. _N_o_t_e: Missing values are not handled. _A_u_t_h_o_r(_s): A. Trapletti _R_e_f_e_r_e_n_c_e_s: Box, G. E. P. and Pierce, D. A. (1970), Distribution of residual correlations in autoregressive-integrated moving average time series models. _Journal of the American Statistical Association_, *65*, 1509-1526. Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time series models. _Biometrika_ *65*, 297-303. Harvey, A. C. (1993) _Time Series Models_. 2nd Edition, Harvester Wheatsheaf, NY, pp. 44, 45. _E_x_a_m_p_l_e_s: x <- rnorm (100) Box.test (x, lag = 1) Box.test (x, lag = 1, type="Ljung")