Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of cipstest / lags = 0L #39

Closed
akoncak opened this issue Jan 31, 2023 · 4 comments
Closed

Result of cipstest / lags = 0L #39

akoncak opened this issue Jan 31, 2023 · 4 comments

Comments

@akoncak
Copy link

akoncak commented Jan 31, 2023

Hello,
My question about Pesaran, M.H. (2007)'s CIPS test. In R, we can test via cipstest command. I was trying to regenerate the critical values of this test. I took test statistic via cipstest commad. However, my critical values are always smaller than the original ones.

I just wanted to be sure from my data-generating process and wrote code in GAUSS. I got the same results as the original paper.
After that, using the same data set, model, and lag length R's cipstest gives different results from Eviews, Stata (pescadf), and GAUSS (tspdlib library). All of these programs provide the same result. I wonder why this difference.

Thank you,

@tappek
Copy link
Collaborator

tappek commented Feb 2, 2023

Hi there,
It will be hard to follow up on this one without any reproducible code. Tests often have many options which can make it somewhat involved to replicate test results across various implementations.

@akoncak
Copy link
Author

akoncak commented Feb 2, 2023

Hello,

Thank you for your answer.

I generated data and test it with R. Test statistic is -1.35 (for "dmg" and "mg") and -1.27 (for "cmg"). After with same generated data I tested in Stata, Eviews and GAUSS. It's -1.465 for all of them (You can find data set in txt file: data_pseudo.txt).

Thanks,

#Pseudo Panel Data
set.seed(5)
N=30             #number of cross sections N= 30, 50, 100
T=30              #number of time period    T= 10, 20, 30, 50, 100

y = matrix(0, T+50, N)
y[1, ] = 0 

e = matrix(0, T+50, N)

for (j in 1:N) {
  for (i in 2:(T+50)) {
    
    #Cross-section depen.
    ft = matrix(rnorm(T+50, 0, 1), T+50, N)  
    # gamma = matrix(runif(N, 0, 1), 1, N)*4-1   #High: U[-1, 3]; Low: U[0, 0.02]
    # crosssec = ft%*%t(gamma)
    
    y[i, j] = y[i - 1, j] + ft[i, j ] + e[i, j]  
  }}

# y = trimr(y,50,0)                              #delete first 50 obs
# dgp=as.matrix(as.vector(y))


#CIPS Test
pdat = pdata.frame(dgp, N)

type="drift"      #"none", "drift", "trend"
lags=0            #integer, lag order for Dickey-Fuller augmentation
model="cmg"       #one of "cmg" (default), "mg", "dmg",
cipstest(pdat[ ,1], lags= lags, type = type, model=model)

@GiovanniMillo
Copy link

Hello. Thank you for the bug report (and thx tappek for bringing this to my attention).
I have checked the cipstest() results against Stata's pescadf on your data: all is fine for positive lag orders, but for lag=0 cipstest outputs the test statistic of lag=1 (and a warning that something has gone wrong in the code!)
We will fix this.
All that said, please notice that (afaik) nobody ever uses lag=0 in applications, since the time when "DF" became "ADF". This is why nobody spotted this before. Thx once more for doing so.

@akoncak
Copy link
Author

akoncak commented Feb 8, 2023

Hello @GiovanniMillo thank you for your explanation. I understand now

@akoncak akoncak closed this as completed Feb 8, 2023
@tappek tappek changed the title About result of cipstest Result of cipstest / lags = 0L Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants