hdVARtest | R Documentation |
Conduct global and simultaneous testing on the transition matrix.
hdVARtest(
Y,
A_est,
sig2_eta,
sig2_epsilon,
global_H0 = NULL,
global_idx = NULL,
simul_H0 = NULL,
simul_idx = NULL,
FDR_levels = 0.05,
grid_num = 2000
)
Y |
observations of time series, a p by T matrix. |
A_est |
a p by p matrix of transition matrix |
sig2_eta |
scalar; estimate of propagation error variance |
sig2_epsilon |
scalar; estimate of measurement error variance |
global_H0 |
a p by p matrix of global null hypothesis for transition matrix |
global_idx |
a p by p boolean matrix. The TRUE/nonzero entry indicates the entry of interest
in global hypothesis testing. If |
simul_H0 |
a p by p matrix of simultaneous null hypothesis for transition matrix |
simul_idx |
a p by p boolean matrix. The TRUE/nonzero entry indicates the entry of interest
in simultaneous hypothesis testing. If |
FDR_levels |
a vector of FDR control levels |
grid_num |
scalar; the number of grids for cutoff search in FDR control. |
a list of testing results and gaussian test statistic matrices.
pvalue | scalar; p-value of global testing. Exist if global_H0 is not NULL. |
global_test_stat | a p by p matrix of gaussian test statistic for global null hypothesis.
Exist if global_H0 is not NULL. |
simul_test_stat | a p by p matrix of gaussian test statistic for simultaneous null hypothesis.
Exist if simul_H0 is not NULL. |
FDR_levels | a vector of FDR control levels. The same as input argument FDR_levels . |
crt | a vector of critical values for rejecting entries in simultaneous hypothesis under corresponding FDR control levels. |
selected | a three-way tensor. The first two modes are p by p, and the third mode is for FDR control levels.
Nonzero elements indicate rejected entries (the first two modes) in simultanous hypothesis at correspoding FDR control levels (the third mode).
The entries outside of simul_idx is set at zero.
|
Xiang Lyu, Jian Kang, Lexin Li
p= 3; Ti=200 # dimension and time
A=diag(1,p) # transition matrix
sig_eta=sig_epsilon=0.2 # error std
Y=array(0,dim=c(p,Ti)) #observation t=1, ...., Ti
X=array(0,dim=c(p,Ti)) #latent t=1, ...., T
Ti_burnin=300 # time for burn-in to stationarity
for (t in 1:(Ti+Ti_burnin)) {
if (t==1){
x1=rnorm(p)
} else if (t<=Ti_burnin) { # burn in
x1=A%*%x1+rnorm(p,mean=0,sd=sig_eta)
} else if (t==(Ti_burnin+1)){ # time series used for learning
X[,t-Ti_burnin]=x1
Y[,t-Ti_burnin]=X[,t-Ti_burnin]+rnorm(p,mean=0,sd=sig_epsilon)
} else {
X[,t- Ti_burnin]=A%*%X[,t-1- Ti_burnin]+rnorm(p,mean=0,sd=sig_eta)
Y[,t- Ti_burnin]=X[,t- Ti_burnin]+rnorm(p,mean=0,sd=sig_epsilon)
}
}
# null hypotheses are true
hdVARtest(Y,A,sig_eta^2,sig_epsilon^2,global_H0=A,global_idx=NULL,
simul_H0=A,simul_idx=NULL,FDR_levels=c(0.05,0.1))
# null hypotheses are false
hdVARtest(Y,A,sig_eta^2,sig_epsilon^2,global_H0=matrix(0,p,p),global_idx=NULL,
simul_H0=matrix(0,p,p),simul_idx=NULL,FDR_levels=c(0.05,0.1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.