Title: | Poisson Network Autoregressive Models |
---|---|
Description: | Quasi likelihood-based methods for estimating linear and log-linear Poisson Network Autoregression models with p lags and covariates. Tools for testing the linearity versus several non-linear alternatives. Tools for simulation of multivariate count distributions, from linear and non-linear PNAR models, by using a specific copula construction. References include: Armillotta, M. and K. Fokianos (2023). "Nonlinear network autoregression". Annals of Statistics, 51(6): 2526--2552. <doi:10.1214/23-AOS2345>. Armillotta, M. and K. Fokianos (2024). "Count network autoregression". Journal of Time Series Analysis, 45(4): 584--612. <doi:10.1111/jtsa.12728>. 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. <doi:10.32614/RJ-2023-094>. |
Authors: | Michail Tsagris [aut, cre], Mirko Armillotta [aut, cph], Konstantinos Fokianos [aut] |
Maintainer: | Michail Tsagris <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.7 |
Built: | 2024-12-05 06:45:18 UTC |
Source: | CRAN |
Quasi likelihood-based methods for estimating linear and log-linear Poisson Network Autoregression models with p lags and covariates. Tools for testing the linearity versus several non-linear alternatives. Tools for simulation of multivariate count distributions, from linear and non-linear PNAR models, by using a specific copula construction. References include:
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.
Package: | PNAR |
Type: | Package |
Version: | 1.7 |
Date: | 2024-09-05 |
License: | GPL(>=2) |
Disclaimer: Dr Mirko Armillotta and Konstantinos Fokianos wrote the initial functions. Dr Tsagris modified them, created the package and he is the maintainer.
We would to like to acknowledge Manos Papadakis for his help with the "htest" class object and S3 methods (print() and summary() functions).
Michail Tsagris, Mirko Armillotta and Konstantinos Fokianos.
Armillotta, M. and K. Fokianos (2024). Count network autoregression. Journal of Time Series Analysis, 45(4): 584–612.
Armillotta, M. and K. Fokianos (2023). Nonlinear network autoregression. Annals of Statistics, 51(6): 2526–2552.
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.
This function generates a network from the Stochastic Block Model with blocks.
adja(N, K, alpha, directed = FALSE)
adja(N, K, alpha, directed = FALSE)
N |
The number of nodes on the network. |
K |
The number of blocks. Each block has dimension |
alpha |
The network density. A value in |
directed |
Logical scalar, whether to generate a directed network or not. If TRUE a directed network is generated. |
For each pair of nodes it performs a Bernoulli trial with values 1 "draw an edge", 0 "otherwise".
The probabilities of these trials are bigger if the two nodes are in the same block, lower otherwise, and they are specified based on the number of nodes on the network and network density
:
Probability to draw an edge for a pair of nodes in the same block:
.
Probability to draw an edge for a pair of nodes in different blocks:
.
A row-normalized non-negative matrix describing the network. The main diagonal entries of the matrix are zeros, all the other entries are non-negative and the sum of elements over the rows equals one.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
Faust, K. and S. Wasserman (1992). Blockmodels: Interpretation and evaluation. Social Networks, 14, 5–61.
W <- adja(N = 20, K = 5, alpha = 0.1)
W <- adja(N = 20, K = 5, alpha = 0.1)
This function generates a network from the Erdos-Renyi model.
adja_gnp(N, alpha, directed = FALSE)
adja_gnp(N, alpha, directed = FALSE)
N |
The number of nodes on the network. |
alpha |
The network density. A value in |
directed |
Logical scalar, whether to generate a directed network. If TRUE a directed network is generated. |
For each pair of nodes it performs a Bernoulli trial with values 1 "draw an edge", 0 "otherwise".
Each trial has the same probability of having an edge; this is equal to , specified based on the number of nodes on the network
and the network density
alpha
.
A row-normalized non-negative matrix describing the network. The main diagonal entries of the matrix are zeros, all the other entries are non-negative and the maximum sum of elements over the rows equals one.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
Erdos, P. and A. Renyi (1959). On random graphs. Publicationes Mathematicae, 6, 290–297.
W <- adja_gnp(N = 20, alpha= 0.1)
W <- adja_gnp(N = 20, alpha= 0.1)
Monthly number of burglaries on the south side of Chicago (552 blocks) during 2010-2015 (72 temporal observations).
crime
crime
A time series object ("ts" class) with multivariate time series, a matrix with 72 rows and 552 columns.
Clark and Dixon (2021), available at https://github.com/nick3703/Chicago-Data.
Clark, N. J. and P. M. Dixon (2021). A class of spatially correlated self-exciting statistical models. Spatial Statistics, 43, 1–18.
crime_W, lin_estimnarpq, log_lin_estimnarpq
data(crime) data(crime_W) mod1 <- lin_estimnarpq( crime, crime_W, p = 1) mod2 <- log_lin_estimnarpq( crime, crime_W, p = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq( crime, crime_W, p = 1) mod2 <- log_lin_estimnarpq( crime, crime_W, p = 1)
Non-negative row-normized adjacency matrix describing the network structure between Chicago census blocks.
crime_W
crime_W
A matrix with 552 rows and 552 columns.
Clark and Dixon (2021), available at https://github.com/nick3703/Chicago-Data.
Clark, N. J. and P. M. Dixon (2021). A class of spatially correlated self-exciting statistical models. Spatial Statistics, 43, 1–18.
crime, lin_estimnarpq, log_lin_estimnarpq
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) mod2 <- log_lin_estimnarpq(crime, crime_W, p = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) mod2 <- log_lin_estimnarpq(crime, crime_W, p = 1)
This function counts the number of events within a specified time.
getN(x, tt = 1)
getN(x, tt = 1)
x |
A matrix of (positive) inter-event times. |
tt |
A positive time. |
The number of events within time tt
(possibly 0), for each column of
x
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
rcopula, poisson.MODpq, poisson.MODpq.log
x <- rcopula(n = 100, N = 50, rho = 0.3) getN(x)
x <- rcopula(n = 100, N = 50, rho = 0.3) getN(x)
Global optimization of the linearity test statistic for the Smooth Transition
Poisson Network Autoregressive model of order with
covariates
(ST-PNAR(
)) with respect to the nuisance scale parameter
.
global_optimise_LM_stnarpq(gama_L = NULL, gama_U = NULL, len = 10, b, y, W, p, d, Z = NULL, tol = 1e-9)
global_optimise_LM_stnarpq(gama_L = NULL, gama_U = NULL, len = 10, b, y, W, p, d, Z = NULL, tol = 1e-9)
gama_L |
The lower value of the |
gama_U |
The upper value of the |
len |
The number of increments to consider for the |
b |
The estimated parameters from the linear model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The length of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
tol |
Tolerance level for the optimizer. |
The function optimizes the quasi score test statistic, under the null assumption of linearity, for testing linearity of Poisson Network Autoregressive model of order against the following ST-PNAR(
) model, with respect to the unknown nuisance parameter (
). For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expectation of
, conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative that at least one among
is not 0. The test statistic has the form
where
is the partition of the quasi score related to the vector of non-linear parameters , evaluated at the estimated parameters
under the null assumption
(linear model) and
is the variance of
.
The optimization employes the Brent algorithm (Brent, 1973) applied in the interval from gama_L
to gama_U
. To be sure that the global optimum is found, the optimization is performed at (len
-1) consecutive equidistant sub-intervals and then the maximum over them is taken as global optimum.
The values of gama_L
and gama_U
are computed internally as gama_L
and
gama_U
, where
is the overall mean of
over the nodes
and times
. Since the non-linear function
ranges between 0 and 1, by considering
to be a representative value for the network mean,
gama_U
and gama_L
would be the values of leading the non-linear switching function to be 0.1 and 0.9, respectively, so that in the optimization procedure the extremes of the function domain are excluded. Alternatively, their value can be supplied by the user. For details see Armillotta and Fokianos (2023, Sec. 4-5).
A list including:
gama |
The optimum value of the |
supLM |
The value of the objective function at the optimum. |
int |
A vector with the extremes points of sub-intervals. |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Brent, R. (1973) Algorithms for Minimization without Derivatives. Prentice-Hall, Englewood Cliffs N.J.
score_test_stnarpq_j, global_optimise_LM_tnarpq,
score_test_tnarpq_j
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) b <- mod1$coefs[, 1] global_optimise_LM_stnarpq(b = b, y = crime, W = crime_W, p = 1, d = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) b <- mod1$coefs[, 1] global_optimise_LM_stnarpq(b = b, y = crime, W = crime_W, p = 1, d = 1)
Global optimization of the linearity test statistic for the Threshold Poisson
Network Autoregressive model of order with
covariates
(T-PNAR(
)) with respect to the nuisance threshold parameter
.
global_optimise_LM_tnarpq(gama_L = NULL, gama_U = NULL, len = 10, b, y, W, p, d, Z = NULL, tol = 1e-9)
global_optimise_LM_tnarpq(gama_L = NULL, gama_U = NULL, len = 10, b, y, W, p, d, Z = NULL, tol = 1e-9)
gama_L |
The lower value of the |
gama_U |
The upper value of the |
len |
The number of increments to consider for the |
b |
The estimated parameters from the linear model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The dimension of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
tol |
Tolerance level for the optimizer. |
The function optimizes the quasi score test statistic, under the null assumption of linearity,
for testing linearity of Poisson Network Autoregressive model of order against the following T-PNAR(
) model, with respect to the unknown nuisance parameter (
). For each node of the network
over
the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
, and
is the indicator function. The sequence
is the expectation of
, conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative that at least one among
is not
, for
. The test statistic has the form
where
is the partition of the quasi score related to the vector of non-linear parameters , evaluated at the estimated parameters
under the null assumption
(linear model) and
is the variance of
.
The optimization employes the Brent algorithm (Brent, 1973) applied in the interval from gama_L
to gama_U
. To be sure that the global optimum is found, the optimization is performed at (len
-1) consecutive equidistant sub-intervals and then the maximum over them is taken as global optimum.
The values of gama_L
and gama_U
are computed internally as the mean over of
and
quantile of the empirical distribution of the network mean
for
. In this way the optimization is performed for values of
such that the indicator function
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).
A list including:
gama |
The optimum value of the |
supLM |
The value of the objective function at the optimum. |
int |
A vector with the extremes points of sub-intervals. |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Brent, R. (1973) Algorithms for Minimization without Derivatives. Prentice-Hall, Englewood Cliffs N.J.
score_test_tnarpq_j, global_optimise_LM_stnarpq,
score_test_stnarpq_j
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) b <- mod1$coefs[, 1] global_optimise_LM_tnarpq(b = b, y = crime, W = crime_W, p = 2, d = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) b <- mod1$coefs[, 1] global_optimise_LM_tnarpq(b = b, y = crime, W = crime_W, p = 2, d = 1)
Estimation of the linear Poisson Network Autoregressive model of order
with
covariates (PNAR(
)).
lin_estimnarpq(y, W, p, Z = NULL, uncons = FALSE, init = NULL, xtol_rel = 1e-8, maxeval = 100)
lin_estimnarpq(y, W, p, Z = NULL, uncons = FALSE, init = NULL, xtol_rel = 1e-8, maxeval = 100)
y |
A |
W |
The |
p |
The number of lags in the model. |
Z |
An |
uncons |
logical, if TRUE an unconstrained optimization is run (default is FALSE). |
init |
A vector of starting values for the optimization algorithm. If this is NULL, the function computes them internally. |
xtol_rel |
The stopping tolerance of the optimization algorithm. |
maxeval |
The maximum number of evalutions the optimization algorithm will perform. |
This function performs constrained estimation of the linear Poisson NAR() model with
non-negative valued covariates, for each node of the network
over the time sample
, defined as
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expecation of
, conditional to its past values. The parameter
is the intercept of the model,
are the network coefficients,
are the autoregressive parameters, and
are the coefficients assocciated to the covariates
.
The estimation of the parameters of the model is performed by Quasi Maximum Likelihood Estimation (QMLE), maximizing the following quasi log-likelihood
with respect to the vector of unknown parameters described above. The coefficients are defined only in the non-negative real line.
By default, the optimization is constrained in the stationary region where ; this can be removed by setting
uncons = TRUE
. However, the model estimates might be inconsistent if the estimated parameters lie outside the stationary region.
The ordinary least squares estimates are employed as starting values of the optimization procedure. Robust standard errors and z-tests are also returned.
A list with attribute class "PNAR" including:
coefs |
A matrix with the estimated QMLE coefficients, their standard errors their Z-test statistics and the relevant p-values computed via the standard normal approximation. |
score |
The value of the quasi score function at the optimization point. It should be close to 0 if the optimization is successful. |
loglik |
The value of the maximized quasi log-likelihood. |
ic |
A vector with the Akaike information criterion (AIC), the Bayesian information criterion (BIC) and the Quasi information criterion (QIC). |
Alternatively, these can be printed via the function summary.PNAR
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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..
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) summary(mod1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) summary(mod1)
Scatter plot of information criteria versus the number of lags in the linear Poisson Network Autoregressive model of order with
covariates (PNAR(
)).
lin_ic_plot(y, W, p = 1:10, Z = NULL, uncons = FALSE, ic = "QIC")
lin_ic_plot(y, W, p = 1:10, Z = NULL, uncons = FALSE, ic = "QIC")
y |
A |
W |
The |
p |
A vector with integer numbers, the range of lags in the model, for which the AIC, BIC and QIC will be computed. |
Z |
An |
uncons |
Logical, if TRUE an unconstrained optimization without stationarity constraints is performed (default is FALSE). |
ic |
The information criterion you want to plot, "QIC" (default value), "AIC" or "BIC". |
The function computes the AIC, BIC or QIC for a range of lag orders of the
linear Poisson Network Autoregressive model of order with
covariates (PNAR(
)).
A scatter plot with the lag order versus either QIC (default), AIC or BIC, and a vector with their values, for each lag order.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
lin_estimnarpq, log_lin_ic_plot
data(crime) data(crime_W) lin_ic_plot(crime, crime_W, p = 1:3)
data(crime) data(crime_W) lin_ic_plot(crime, crime_W, p = 1:3)
Starting values for the linear Poisson Network Autoregressive model of order
with
covariates (PNAR(
)).
lin_narpq_init(y, W, p, Z = NULL)
lin_narpq_init(y, W, p, Z = NULL)
y |
A |
W |
The |
p |
The number of lags in the model. |
Z |
An |
The function computes starting values to be used in the function lin_estimnarpq
.
These are simply the ordinary least squares estimators with a correction.
If any of the the resulting coefficients is negative they become equal to 0.001.
A vector with the initial values.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
data(crime) data(crime_W) x0 <- lin_narpq_init(crime, crime_W, p = 2)
data(crime) data(crime_W) x0 <- lin_narpq_init(crime, crime_W, p = 2)
Estimation of the log-linear Poisson Network Autoregressive model of order
with
covariates (log-PNAR(
)).
log_lin_estimnarpq(y, W, p, Z = NULL, uncons = FALSE, init = NULL, xtol_rel = 1e-8, maxeval = 100)
log_lin_estimnarpq(y, W, p, Z = NULL, uncons = FALSE, init = NULL, xtol_rel = 1e-8, maxeval = 100)
y |
A |
W |
The |
p |
The number of lags in the model. |
Z |
An |
uncons |
logical, if TRUE an unconstrained optimization is performed (default is FALSE). |
init |
A vector of starting values for the optimization algorithm. If this is NULL, the function computes them internally. |
xtol_rel |
The stopping tolerance of the optimization algorithm. |
maxeval |
The maximum number of evalutions the optimization algorithm will perform. |
This function performs a constrained estimation of the linear Poisson NAR() model with
non-negative valued covariates, for each node of the network
over the time sample
, defined as
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the log of the expectation of
, conditional to its past values. The parameter
is the intercept of the model,
are the network coefficients,
are the autoregressive parameters, and
are the coefficients assocciated to the covariates
.
The estimation of the parameters of the model is performed by Quasi Maximum Likelihood Estimation (QMLE), maximizing the following quasi log-likelihood
with respect to the vector of unknown parameters described above.
By default, the optimization is constrained in the stationary region where ; this can be removed by setting
uncons = TRUE
. However, the model estimates might be inconsistent if the estimated parameters lie outside the stationary region.
The ordinary least squares estimates are employed as starting values of the optimization procedure. Robust standard errors and z-tests are also returned.
A list with attribute class "PNAR" including:
coefs |
A matrix with the estimated QMLE coefficients, their standard errors, their Z-test statistics and the relevant p-values computed via the standard normal approximation. |
score |
The value of the quasi score function at the optimization point. It should be close to 0 if the optimization is successful. |
loglik |
The value of the maximized quasi log-likelihood. |
ic |
A vector with the Akaike information criterion (AIC), the Bayesian information criterion (BIC) and the Quasi information criterion (QIC). |
Alternatively, these can be printed via the function summary.PNAR
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
data(crime) data(crime_W) mod1 <- log_lin_estimnarpq(crime, crime_W, p = 2) summary(mod1)
data(crime) data(crime_W) mod1 <- log_lin_estimnarpq(crime, crime_W, p = 2) summary(mod1)
Scatter plot of information criteria versus the number of lags in log-linear Poisson Network Autoregressive model of order
with
covariates (log-PNAR(
)).
log_lin_ic_plot(y, W, p = 1:10, Z = NULL, uncons = FALSE, ic = "QIC")
log_lin_ic_plot(y, W, p = 1:10, Z = NULL, uncons = FALSE, ic = "QIC")
y |
A |
W |
The |
p |
A vector with integer numbers, the range of lags in the model, for which the AIC, BIC and QIC will be computed. |
Z |
An |
uncons |
Logical, if TRUE an unconstrained optimization without stationarity constraints is performed (default is FALSE). |
ic |
The information criterion you want to plot, "QIC" (default value), "AIC" or "BIC". |
The function computes the AIC, BIC or QIC for a range of lag orders of the
log-linear Poisson Network Autoregressive model of order with
covariates (PNAR(
)).
A scatter plot with the lag order versus either QIC (default), AIC or BIC, and a vector with their values, for each lag order.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
log_lin_estimnarpq, lin_ic_plot
data(crime) data(crime_W) log_lin_ic_plot(crime, crime_W, p = 1:3)
data(crime) data(crime_W) log_lin_ic_plot(crime, crime_W, p = 1:3)
Starting values for the log-linear Poisson Network Autoregressive model of order
with
covariates (log-PNAR(
)).
log_lin_narpq_init(y, W, p, Z = NULL)
log_lin_narpq_init(y, W, p, Z = NULL)
y |
A |
W |
The |
p |
The number of lags in the model. |
Z |
An |
This function computes initial values for the log-linear Poisson Network
Autoregressive model of order with
covariates (log-PNAR(
))
with stationarity conditions. These initial values are simply the ordinary least
squares estimators with a correction.
A vector with the initial values.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
data(crime) data(crime_W) mod1 <- log_lin_narpq_init(crime, crime_W, p = 2)
data(crime) data(crime_W) mod1 <- log_lin_narpq_init(crime, crime_W, p = 2)
Generation of multivariate count time series from a linear Poisson Network Autoregressive
model of order with
covariates (PNAR(
)).
poisson.MODpq(b, W, p, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
poisson.MODpq(b, W, p, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
b |
The coefficients of the model, in the following order: (intercept, network
parameters, autoregressive parameters, covariates). The dimension of the vector
should be |
W |
The |
p |
The number of lags in the model. |
Z |
An |
TT |
The temporal sample size. |
N |
The number of nodes on the network. |
copula |
Which copula function to use? The choices are "gaussian", "t", or "clayton". |
rho |
The value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
This function generates counts from a linear Poisson NAR() model, where
non time-varying
covariates are allowed as well. The counts are simulated from
, where
is a sequence of
-dimensional IID Poisson count processes, with intensity 1, and
whose structure of dependence is modelled through a copula construction
on their associated exponential waiting times random variables. For details see Armillotta and Fokianos (2024, Sec. 2.1-2.2).
The sequence is the expectation of
, conditional to its past values and it is generated by means of the following PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The parameter
is the intercept of the model,
are the network coefficients,
are the autoregressive parameters, and
are the coefficients assocciated to the covariates
.
A list including:
p2R |
The Toeplitz correlation matrix, if employed in the copula or NULL else. |
lambda |
A |
y |
A |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Fokianos, K., Stove, B., Tjostheim, D., and P. Doukhan (2020). Multivariate count autoregression. Bernoulli, 26(1), 471–499.
poisson.MODpq.log, poisson.MODpq.nonlin,
poisson.MODpq.stnar, poisson.MODpq.tnar
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq( b = c(0.5, 0.3, 0.2), W = W, p = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq( b = c(0.5, 0.3, 0.2), W = W, p = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
Generation of counts from a log-linear Poisson Network Autoregressive model of
order with
covariates (log-PNAR(
)).
poisson.MODpq.log(b, W, p, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
poisson.MODpq.log(b, W, p, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
b |
The coefficients of the model, in the following order: (intercept, network
parameters, autoregressive parameters, covariates). The dimension of the vector
should be |
W |
The |
p |
The number of lags in the model. |
Z |
An |
TT |
The temporal sample size. |
N |
The number of nodes on the network. |
copula |
Which copula function to use? The "gaussian", "t", or "clayton". |
rho |
The the value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
This function generates counts from a log-linear Poisson NAR() model, where
non time-varying covariates are allowed as well. The counts are simulated from
, where
is a sequence of
-dimensional IID Poisson count processes, with intensity 1, and whose structure of dependence is modelled through a copula construction
on their associated exponential waiting times random variables. For details see Armillotta and Fokianos (2024, Sec. 2.1-2.2).
The sequence is the log of the expecation of
, conditional to its past values and it is generated by means of the following log-PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The parameter
is the intercept of the model,
are the network coefficients,
are the autoregressive parameters, and
are the coefficients assocciated to the covariates
.
A list including:
p2R |
The Toeplitz correlation matrix, if employed in the copula or NULL else. |
log_lambda |
A |
y |
A |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Fokianos, K., Stove, B., Tjostheim, D., and P. Doukhan (2020). Multivariate count autoregression. Bernoulli, 26(1), 471–499.
poisson.MODpq, poisson.MODpq.nonlin,
poisson.MODpq.stnar, poisson.MODpq.tnar
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.log( b = c(0.5, 0.3, 0.2), W = W, p = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.log( b = c(0.5, 0.3, 0.2), W = W, p = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
Generation of counts from a non-linear Intercept Drift Poisson Network
Autoregressive model of order with
covariates (ID-PNAR(
)).
poisson.MODpq.nonlin(b, W, gama, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
poisson.MODpq.nonlin(b, W, gama, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
b |
The linear coefficients of the model, in the following order: (intercept,
network parameters, autoregressive parameters, covariates). The dimension of
the vector should be |
W |
The |
gama |
A scalar non-linear intercept drift parameter. |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
TT |
The temporal sample size. |
N |
The number of nodes on the network. |
copula |
Which copula function to use? The "gaussian", "t", or "clayton". |
rho |
The value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
This function generates counts from a non-linear Intercept Drift Poisson NAR() model, where
non time-varying covariates are allowed as well. The counts are simulated from
, where
is a sequence of
-dimensional IID Poisson count processes, with intensity 1, and whose structure of dependence is modelled through a copula construction
on their associated exponential waiting times random variables. For details see Armillotta and Fokianos (2024, Sec. 2.1-2.2). The sequence
is the expecation of
, conditional to its past values and it is generated by means of the following ID-PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
.
The parameter is the intercept of the model,
are the network coefficients,
are the autoregressive parameters,
is the non-linear coefficient associated with the intercept drift, and
are the coefficients assocciated with the covariates
. The coefficient
is considered as an extra parameter defining the lag of the network effect in the non-linear part of the model and is left to be set by the user. For details on ID-PNAR models see Armillotta and Fokianos (2023, Sec. 2).
A list including:
p2R |
The Toeplitz correlation matrix, if employed in the copula or NULL else. |
lambda |
A |
y |
A |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
poisson.MODpq, poisson.MODpq.log,
poisson.MODpq.stnar, poisson.MODpq.tnar
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.nonlin( b = c(0.5, 0.3, 0.2), W = W, gama = 1, p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.nonlin( b = c(0.5, 0.3, 0.2), W = W, gama = 1, p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
Generation of multivariate count time series from a non-linear Smooth Transition Poisson Network
Autoregressive model of order with
covariates (ST-PNAR(
)).
poisson.MODpq.stnar(b, W, gama, a, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
poisson.MODpq.stnar(b, W, gama, a, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
b |
The linear coefficients of the model, in the following order: (intercept, network
parameters, autoregressive parameters, covariates). The dimension of the vector
should be |
W |
The |
gama |
The scalar nuisance smoothing parameter. |
a |
Vector of non-linear parameters. The dimension of the vector should be |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
TT |
The temporal sample size. |
N |
The number of nodes on the network. |
copula |
Which copula function to use? The choices are "gaussian", "t", or "clayton". |
rho |
The value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
This function generates counts from a non-linear Smooth Transition Poisson NAR() model, where
non time-varying covariates are allowed as well. The counts are simulated from
, where
is a sequence of
-dimensional IID Poisson count processes, with intensity 1, and whose structure of dependence is modelled through a copula construction
on their associated exponential waiting times random variables. For details see Armillotta and Fokianos (2024, Sec. 2.1-2.2).
The sequence is the expecation of
, conditional to its past values and it is generated by means of the following ST-PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
.
The parameter is the intercept of the model,
are the network coefficients,
are the autoregressive parameters,
are the non-linear smooth transition parameters,
is the nuisance smoothing parameter, and
are the coefficients assocciated to the covariates
. The coefficient
is considered as an extra parameter defining the lag of the network effect in the non-linear part of the model and is left to be set by the user. For details on ST-PNAR models see Armillotta and Fokianos (2023, Sec. 2).
A list including:
p2R |
The Toeplitz correlation matrix, if employed in the copula or NULL else. |
lambda |
A |
y |
A |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
poisson.MODpq, poisson.MODpq.log,
poisson.MODpq.nonlin, poisson.MODpq.tnar
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.stnar( b = c(0.5, 0.3, 0.2), W = W, gama = 0.2, a = 0.4, p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.stnar( b = c(0.5, 0.3, 0.2), W = W, gama = 0.2, a = 0.4, p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
Generation of multivariate count time series from a non-linear Threshold Poisson network Autoregressive
model of order with
covariates (T-PNAR(
)).
poisson.MODpq.tnar(b, W, gama, a, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
poisson.MODpq.tnar(b, W, gama, a, p, d, Z = NULL, TT, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1)
b |
The linear coefficients of the model, in the following order: (intercept, network
parameters, autoregressive parameters, covariates). The dimension of the vector
should be |
W |
The |
gama |
The scalar nuisance threshold parameter. |
a |
Vector of non-linear parameters. The dimension of the vector should be
|
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
TT |
The temporal sample size. |
N |
The number of nodes on the network. |
copula |
Which copula function to use? The "gaussian", "t", or "clayton". |
rho |
The value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
This function generates counts from a non-linear Threshold Poisson NAR() model, where
non time-varying covariates are allowed as well. The counts are simulated from
, where
is a sequence of
-dimensional IID Poisson count processes, with intensity 1, and whose structure of dependence is modelled through a copula construction
on their associated exponential waiting times random variables. For details see Armillotta and Fokianos (2024, Sec. 2.1-2.2).
The sequence is the expecation of
, conditional to its past values and it is generated by means of the following T-PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
, and
is the indicator function.
The parameter is the intercept of the model,
are the network coefficients,
are the autoregressive parameters, the
vector of non-linear parameters is divided as follows:
is the intercept,
are the network coefficients,
are the autoregressive parameters;
is the nuisance threshold parameter, and
are the coefficients assocciated to the covariates
. The coefficient
is considered as an extra parameter defining the lag of the network effect in the non-linear part of the model and is left to be set by the user. For details on T-PNAR models see Armillotta and Fokianos (2023, Sec. 2).
A list including:
p2R |
The Toeplitz correlation matrix, if employed in the copula or NULL else. |
lambda |
A |
y |
A |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
poisson.MODpq, poisson.MODpq.log,
poisson.MODpq.nonlin, poisson.MODpq.stnar
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.tnar( b = c(0.5, 0.3, 0.2), W = W, gama = 1, a = c(0.2, 0.2, 0.2), p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
W <- adja( N = 20, K = 5, alpha= 0.5) y <- poisson.MODpq.tnar( b = c(0.5, 0.3, 0.2), W = W, gama = 1, a = c(0.2, 0.2, 0.2), p = 1, d = 1, Z = NULL, TT = 1000, N = 20, copula = "gaussian", corrtype = "equicorrelation", rho = 0.5)$y
Random number generation of copula functions.
rcopula(n, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1, cholR = NULL)
rcopula(n, N, copula = "gaussian", corrtype = "equicorrelation", rho, dof = 1, cholR = NULL)
n |
The number of random values to generate. |
N |
The number of variables for which random valeus will be generated. |
copula |
Which copula function to use? The "gaussian", "t", or "clayton". |
rho |
The the value of the copula parameter ( |
corrtype |
Used only for elliptical copulas. The type of correlation matrix employed for
the copula; it will either be the "equicorrelation" or "toeplitz". The
"equicorrelation" option generates a correlation matrix where all the off-diagonal
entries equal |
dof |
The degrees of freedom for Student's t copula. |
cholR |
An alternative input for elliptic copulas, providing directly the Cholesky decomposition for a specific correlation matrix to be passed, otherwise leave it NULL. |
This function generates random copula values from Gaussian, Student's t, or Clayton copulas based on a single copula paremeter and different correlation structures.
An matrix with the simulated copula values.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
Nelsen, Roger B. (1999). An Introduction to Copulas, Springer.
getN, poisson.MODpq, poisson.MODpq.log
u <- rcopula(n = 100, N = 50, rho = 0.3)
u <- rcopula(n = 100, N = 50, rho = 0.3)
Quasi score test for testing linearity of Poisson Network Autoregressive model
of order against the non-linear Intercep Drift (ID) version
(ID-PNAR(
)).
score_test_nonlinpq_h0(b, y, W, p, d, Z = NULL)
score_test_nonlinpq_h0(b, y, W, p, d, Z = NULL)
b |
The estimated parameters from the linear PNAR model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The dimension of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
The function computes the quasi score test for testing linearity of Poisson Network Autoregressive model of order against the following ID-PNAR(
) model. For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expectation of
conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative
. The test statistic has the form
where
is the partition of the quasi score related to the non-linear parameter , evaluated at the estimated parameters
under the null assumption
(linear model), and
is the variance of
. Under
, the test asymptotically follows the
distribution with 1 degree of freedom. For details see Armillotta and Fokianos (2023, Sec. 4).
A list with attribute class "htest" including:
statistic |
The value of the |
parameter |
The degrees of freedom of the |
p.value |
The p-value of the |
null.value |
The value of the |
alternative |
The alternative hypothesis, |
method |
The name of the test. |
data.name |
Information on the arguments used. |
Alternatively, these can be printed via the function summary.nonlin
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
score_test_stnarpq_j, score_test_tnarpq_j,
lin_estimnarpq
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) ca <- mod1$coefs[, 1] score_test_nonlinpq_h0(ca, crime, crime_W, p = 2, d = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) ca <- mod1$coefs[, 1] score_test_nonlinpq_h0(ca, crime, crime_W, p = 2, d = 1)
Computation of Davies bound p-value for the sup-type test for testing linearity
of Poisson Network Autoregressive model of order (PNAR(
)) versus
the non-linear Smooth Transition alternative (ST-PNAR(
)).
score_test_stnarpq_DV(b, y, W, p, d, Z = NULL, gama_L = NULL, gama_U = NULL, len = 100)
score_test_stnarpq_DV(b, y, W, p, d, Z = NULL, gama_L = NULL, gama_U = NULL, len = 100)
b |
The estimated parameters from the linear model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The dimension of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
gama_L |
The lower value of the nuisance parameter |
gama_U |
The upper value of the nuisance parameter |
len |
The length of the grid of values of |
The function computes an upper-bound for the p-value of the sup-type test for testing linearity of Poisson Network
Autoregressive model of order (PNAR(
)) versus the following Smooth Transition alternative (ST-PNAR(
)).
For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expectation of
, conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative that at least one among
is not 0. The test statistic has the form
where
is the partition of the quasi score related to the vector of non-linear parameters , evaluated at the estimated parameters
under the null assumption
(linear model), and
is the variance of
. Since the test statistic depends on an unknown nuisance parameter (
), the supremum of the statistic is considered in the test,
. The function computes the bound of the p-value, suggested by Davies (1987), for the test statistic
, with scalar nuisance parameter
, as follows.
where is the maximum of the test statistic
, computed by the available sample, over a grid of values for the nuisance parameter
;
is the number of non-linear parameters tested. So the first summand of the bound is just the p-value of a chi-square test with
degrees of freedom. The second summand is a correction term depending on
, which is the approximated total variation computed as
The feasible bound allows to approximate the p-values of the sup-type test in a straightforward way, by adding to the tail probability of a chi-square distribution a correction term which depends on the total variation of the process. For details see Armillotta and Fokianos (2023, Sec. 5).
The values of gama_L
and gama_U
are computed internally as gama_L
and
gama_U
, where
is the overall mean of
over the nodes
and times
. Since the non-linear function
ranges between 0 and 1, by considering
to be a representative value for the network mean,
gama_U
and gama_L
would be the values of leading the non-linear switching function to be 0.1 and 0.9, respectively, so that in the optimization procedure the extremes of the function domain are excluded. Alternatively, their values can be supplied by the user.
A list including:
DV |
The Davies bound of p-values for sup test. |
supLM |
The value of the sup test statistic in the sample |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Davies, R. B. (1987). Hypothesis testing when a nuisance parameter is present only under the alternative. Biometrika 74, 33–43.
score_test_stnarpq_j, global_optimise_LM_stnarpq
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) ca <- mod1$coefs[, 1] score_test_stnarpq_DV(ca, crime, crime_W, p = 1, d = 1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) ca <- mod1$coefs[, 1] score_test_stnarpq_DV(ca, crime, crime_W, p = 1, d = 1)
Computation of bootstrap p-value for the sup-type test for testing linearity of
Poisson Network Autoregressive model of order (PNAR(
)) versus the
non-linear Smooth Transition alternative (ST-PNAR(
)).
score_test_stnarpq_j(supLM, b, y, W, p, d, Z = NULL, J = 499, gama_L = NULL, gama_U = NULL, tol = 1e-9, ncores = 1, seed = NULL)
score_test_stnarpq_j(supLM, b, y, W, p, d, Z = NULL, J = 499, gama_L = NULL, gama_U = NULL, tol = 1e-9, ncores = 1, seed = NULL)
supLM |
The optimized value of the test statistic. See the function
|
b |
The estimated parameters from the linear model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The dimension of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
J |
The number of bootstrap samples to draw. |
gama_L |
The lower value of the nuisance parameter |
gama_U |
The upper value of the nuisance parameter |
tol |
Tolerance level for the optimizer. |
ncores |
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. |
seed |
To replicate the results use a seed for the generator, an integer number. |
The function computes a bootstrap p-value for the sup-type test for testing linearity of Poisson Network Autoregressive model of order (PNAR(
)) versus the following Smooth Transition alternative (ST-PNAR(
)). For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expectation of
, conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative that at least one among
is not
. The test statistic has the form
where
is the partition of the quasi score related to the vector of non-linear parameters , evaluated at the estimated parameters
under the null assumption
(linear model), and
is the variance of
.
Since the test statistic depends on an unknown nuisance parameter (), the supremum of the statistic is considered in the test,
. This value can be computed for the available sample by using the function
global_optimise_LM_stnarpq
and should be supplied here as an input supLM
.
The function performs the bootstrap resampling of the test statistic by employing Gaussian perturbations of the score
. For details see Armillotta and Fokianos (2023, Sec. 5).
The values of gama_L
and gama_U
are computed internally as gama_L
and
gama_U
, where
is the overall mean of
over the nodes
and times
. Since the non-linear function
ranges between 0 and 1, by considering
to be a representative value for the network mean,
gama_U
and gama_L
would be the values of leading the non-linear switching function to be 0.1 and 0.9, respectively, so that in the optimization procedure the extremes of the function domain are excluded. Alternatively, their value can be supplied by the user.
Note: For large datasets the function may require few minutes to run. Parallel computing is suggested to speed up the computations.
A list including:
pJ |
The bootstrap p-value of the sup test. |
cpJ |
The adjusted version of bootstrap p-value of the sup test. |
gamaj |
The optimal values of the |
supLMj |
The values of perturbed test statistic at the optimum point |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
score_test_stnarpq_DV, global_optimise_LM_stnarpq,
score_test_tnarpq_j
# load data data(crime) data(crime_W) #estimate linear PNAR model mod1 <- lin_estimnarpq(crime, crime_W, p = 2) b <- mod1$coefs[, 1] g <- global_optimise_LM_stnarpq(b = b, y = crime, W = crime_W, p = 2, d = 1) supg <- g$supLM score_test_stnarpq_j(supLM = supg, b = b, y = crime, W = crime_W, p = 2, d = 1, J = 5)
# load data data(crime) data(crime_W) #estimate linear PNAR model mod1 <- lin_estimnarpq(crime, crime_W, p = 2) b <- mod1$coefs[, 1] g <- global_optimise_LM_stnarpq(b = b, y = crime, W = crime_W, p = 2, d = 1) supg <- g$supLM score_test_stnarpq_j(supLM = supg, b = b, y = crime, W = crime_W, p = 2, d = 1, J = 5)
Computation of bootstrap p-value for the sup-type test for testing linearity of
Poisson Network Autoregressive model of order (PNAR(
)) versus the
non-linear Threshold alternative (T-PNAR(
)).
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)
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)
supLM |
The optimized value of the test statistic. See the function
|
b |
The estimated parameters from the linear model, in the following order:
(intercept, network parameters, autoregressive parameters, covariates).
The dimension of the vector should be |
y |
A |
W |
The |
p |
The number of lags in the model. |
d |
The lag parameter of non-linear variable (should be between 1 and |
Z |
An |
J |
The number of bootstrap samples to draw. |
gama_L |
The lower value of the nuisance parameter |
gama_U |
The upper value of the nuisance parameter |
tol |
Tolerance level for the optimizer. |
ncores |
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. |
seed |
To replicate the results use a seed for the generator, an integer number. |
The function computes a bootstrap p-value for the sup-type test for testing linearity of Poisson Network Autoregressive model of order (PNAR(
)) versus the following Threshold alternative (T-PNAR(
)). For each node of the network
over the time sample
where is the network effect, i.e. the weighted average impact of node
connections, with the weights of the mean being
, the single element of the network matrix
. The sequence
is the expectation of
, conditional to its past values.
The null hypothesis of the test is defined as , versus the alternative that at least one among
is not
, for
. The test statistic has the form
where
is the partition of the quasi score related to the vector of non-linear parameters , evaluated at the estimated parameters
under the null assumption
(linear model), and
is the variance of
.
Since the test statistic depends on an unknown nuisance parameter (), the supremum of the statistic is considered in the test,
. 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 by employing Gaussian perturbations of the score
. For details see Armillotta and Fokianos (2023, Sec. 5).
The values of gama_L
and gama_U
are computed internally as the mean over of
and
quantiles of the empirical distribution of the network mean
for
. In this way the optimization is performed for values of
such that the indicator function
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.
A list including:
pJ |
The bootstrap p-value of the sup test. |
cpJ |
The adjusted version of bootstrap p-value of the sup test. |
gamaj |
The optimal values of the |
supLMj |
The values of perturbed test statistic at the optimum point |
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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] 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)
# load data data(crime) data(crime_W) #estimate linear PNAR model mod1 <- lin_estimnarpq(crime, crime_W, p = 2) b <- mod1$coefs[, 1] 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)
S3 methods for extracting the results of the bound p-value for testing for smooth transition effects on PNAR() model.
## S3 method for class 'DV' summary(object, ...) ## S3 method for class 'summary.DV' print(x, ...) ## S3 method for class 'DV' print(x, ...)
## S3 method for class 'DV' summary(object, ...) ## S3 method for class 'summary.DV' print(x, ...) ## S3 method for class 'DV' print(x, ...)
object |
An object containing the results of the function |
x |
An object containing the results of the function |
... |
Extra arguments the user can pass. |
The functions print the output of the bound p-value for testing for smooth transition effects on PNAR() model.
The functions print the results of the function score_test_stnarpq_DV
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
Davies, R. B. (1987). Hypothesis testing when a nuisance parameter is present only under the alternative. Biometrika 74, 33–43.
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) ca <- mod1$coefs[, 1] a <- score_test_stnarpq_DV(ca, crime, crime_W, p = 1, d = 1) print(a) summary(a)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 1) ca <- mod1$coefs[, 1] a <- score_test_stnarpq_DV(ca, crime, crime_W, p = 1, d = 1) print(a) summary(a)
S3 methods for extracting the results of the non-linear hypothesis test.
## S3 method for class 'nonlin' summary(object, ...) ## S3 method for class 'summary.nonlin' print(x, ...) ## S3 method for class 'nonlin' print(x, ...)
## S3 method for class 'nonlin' summary(object, ...) ## S3 method for class 'summary.nonlin' print(x, ...) ## S3 method for class 'nonlin' print(x, ...)
object |
An object containing the results of the function |
x |
An object containing the results of the function |
... |
Extra arguments the user can pass. |
The functions print the output of the non-linear hypothesis test.
The functions print the results of the function score_test_nonlinpq_h0
.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) ca <- mod1$coefs[, 1] a <- score_test_nonlinpq_h0(ca, crime, crime_W, p = 2, d = 1) print(a) summary(a)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) ca <- mod1$coefs[, 1] a <- score_test_nonlinpq_h0(ca, crime, crime_W, p = 2, d = 1) print(a) summary(a)
S3 methods for extracting the results of the estimation functions.
## S3 method for class 'PNAR' summary(object, ...) ## S3 method for class 'summary.PNAR' print(x, ...) ## S3 method for class 'PNAR' print(x, ...)
## S3 method for class 'PNAR' summary(object, ...) ## S3 method for class 'summary.PNAR' print(x, ...) ## S3 method for class 'PNAR' print(x, ...)
object |
An object containing the results of the estimation function |
x |
An object containing the results of the estimation function |
... |
Extra arguments the user can pass. |
These functions print the output of the estimation functions.
The print.PNAR() function prints the coefficients of the model. The summary.PNAR() function prints the output in the lm() style.
Mirko Armillotta, Michail Tsagris and Konstantinos Fokianos.
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.
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) mod1 print(mod1) summary(mod1)
data(crime) data(crime_W) mod1 <- lin_estimnarpq(crime, crime_W, p = 2) mod1 print(mod1) summary(mod1)