Computation of bootstrap p-value for the sup-type test for testing linearity of Poisson Network Autoregressive model of order \(p\) (PNAR(\(p\))) versus the non-linear Threshold alternative (T-PNAR(\(p\))).
score_test_tnarpq_j(supLM, b, y, W, p, d, Z = NULL, J = 499,
gama_L = NULL, gama_U = NULL, tol = 1e-9, ncores = 1, seed = NULL)
A list including:
The bootstrap p-value of the sup test.
The adjusted version of bootstrap p-value of the sup test.
The optimal values of the \(\gamma\) parameter for score test boostrap replications.
The values of perturbed test statistic at the optimum point gamaj
.
The optimized value of the test statistic. See the function
global_optimise_LM_tnarpq
.
The estimated parameters from the linear model, in the following order: (intercept, network parameters, autoregressive parameters, covariates). The dimension of the vector should be \(2p + 1 + q\), where \(q\) denotes the number of covariates.
A \(TT \times N\) time series object or a \(TT \times N\) numerical matrix with the \(N\) multivariate count time series over \(TT\) time periods.
The \(N \times N\) row-normalized non-negative adjacency matrix describing the network. The main diagonal entries of the matrix should be zeros, all the other entries should be non-negative and the maximum sum of elements over the rows should equal one. The function row-normalizes the matrix if a non-normalized adjacency matrix is provided.
The number of lags in the model.
The lag parameter of non-linear variable (should be between 1 and \(p\)).
An \(N \times q\) matrix of covariates (one for each column), where \(q\) is the number of covariates in the model. Note that they must be non-negative.
The number of bootstrap samples to draw.
The lower value of the nuisance parameter \(\gamma\) to consider. Use NULL if there is not information about its value. See the details for default computation.
The upper value of the nuisance parameter \(\gamma\) to consider. Use NULL if there is not information about its value. See the details for default computation.
Tolerance level for the optimizer.
Number of cores to use for parallel computing. By default the number of cores is set to 1 (no parallel computing). Note: If for some reason the parallel does not work then load the doParallel package yourseleves.
To replicate the results use a seed for the generator, an integer number.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
The function computes a bootstrap p-value for the sup-type test for testing linearity of Poisson Network Autoregressive model of order \(p\) (PNAR(\(p\))) versus the following Threshold alternative (T-PNAR(\(p\))). For each node of the network \(i=1,...,N\) over the time sample \(t=1,...,TT\) $$ \lambda_{i,t}=\beta_{0}+\sum_{h=1}^{p}\left[\beta_{1h}X_{i,t-h}+\beta_{2h}Y_{i,t-h}+(\alpha_{0}+\alpha_{1h}X_{i,t-h}+\alpha_{2h}Y_{i,t-h})I(X_{i,t-d}\leq\gamma)\right]+\sum_{l=1}^{q}\delta_{l}Z_{i,l} $$ where \(X_{i,t}=\sum_{j=1}^{N}W_{ij}Y_{j,t}\) is the network effect, i.e. the weighted average impact of node \(i\) connections, with the weights of the mean being \(W_{ij}\), the single element of the network matrix \(W\). The sequence \(\lambda_{i,t}\) is the expectation of \(Y_{i,t}\), conditional to its past values.
The null hypothesis of the test is defined as \(H_{0}: \alpha_{0}=\alpha_{11}=...=\alpha_{2p}=0\), versus the alternative that at least one among \(\alpha_{s,h}\) is not \(0\), for \(s=0,1,2\). The test statistic has the form $$ LM(\gamma)=S^{'}(\hat{\theta},\gamma)\Sigma^{-1}(\hat{\theta},\gamma)S(\hat{\theta},\gamma) $$ where $$ S(\hat{\theta}, \gamma)=\sum_{t=1}^{TT}\sum_{i=1}^{N}\left(\frac{Y_{i,t}}{\lambda_{i,t}(\hat{\theta}, \gamma)}-1\right)\frac{\partial\lambda_{i,t}(\hat{\theta},\gamma)}{\partial\alpha} $$ is the partition of the quasi score related to the vector of non-linear parameters \(\alpha=(\alpha_{0},...,\alpha_{2p})\), evaluated at the estimated parameters \(\hat{\theta}\) under the null assumption \(H_{0}\) (linear model), and \(\Sigma(\hat{\theta},\gamma)\) is the variance of \(S(\hat{\theta},\gamma)\).
Since the test statistic depends on an unknown nuisance parameter (\(\gamma\)), the supremum of the statistic is considered in the test, \(\sup_{\gamma}LM(\gamma)\). This value can be computed for the available sample by using the function global_optimise_LM_tnarpq
and should be supplied here as an input supLM
.
The function performs the bootstrap resampling of the test statistic \(\sup_{\gamma}LM(\gamma)\) by employing Gaussian perturbations of the score \(S(\hat{\theta},\gamma)\). For details see Armillotta and Fokianos (2023, Sec. 5).
The values of gama_L
and gama_U
are computed internally as the mean over \(i=1,...,N\) of \(20\%\) and \(80\%\) quantiles of the empirical distribution of the network mean \(X_{i,t}\) for \(t=1,...,TT\). In this way the optimization is performed for values of \(\gamma\) such that the indicator function \(I(X_{i,t-d}\leq\gamma)\) is not always close to 0 or 1. Alternatively, their value can be supplied by the user. For details see Armillotta and Fokianos (2023, Sec. 4-5).
Note: For large datasets the function may require few minutes to run. Parallel computing is suggested to speed up the computations.
Armillotta, M. and K. Fokianos (2023). Nonlinear network autoregression. Annals of Statistics, 51(6): 2526--2552.
Armillotta, M. and K. Fokianos (2024). Count network autoregression. Journal of Time Series Analysis, 45(4): 584--612.
Armillotta, M., Tsagris, M. and Fokianos, K. (2024). Inference for Network Count Time Series with the R Package PNAR. The R Journal, 15/4: 255--269.
global_optimise_LM_tnarpq,
global_optimise_LM_stnarpq, score_test_stnarpq_j
# load data
data(crime)
data(crime_W)
#estimate linear PNAR model
mod1 <- lin_estimnarpq(crime, crime_W, p = 2)
b <- mod1$coefs[, 1]
# \donttest{
g <- global_optimise_LM_tnarpq(b = b, y = crime, W = crime_W, p = 2, d = 1)
supg <- g$supLM
score_test_tnarpq_j(supLM = supg, b = b, y = crime, W = crime_W, p = 2, d = 1, J = 5)
# }
Run the code above in your browser using DataLab