Hi Statalists,

I am fitting a panel VECM model with -xtpmg-. I am looking for the methods to conduct Granger causality test, impulse response and variance decomposition after the estimation. The variables include
Code:
* Endogenous variable: tov vol a1 a2 a3 a4 (cointegration exists)
* Exogenous variable: er
I realise that -xtpmg- does not include those functions as that of -pvar- to panel VAR, hence I was wondering if I can use the two-step procedure to fit my panel vecm to -pvar-.

Code:
* panel vecm using -xtpmg-
xtpmg d.tov d.vol d.a1 d.a2 d.a3 d.a4 er, lr(l.tov vol a1 a2 a3 a4) dfe

*generate first diff for pvar
foreach v in vol tov a1 a2 a3 a4 {
gen d`v' = d.`v'
}

*two-step replicating panel vecm
xtreg l.tov vol a1 a2 a3 a4,fe
predict resid
pvar dvol dtov da1 da2 da3 da4, exo(resid er)
Before I carry on any post estimation, the fitting result from my two-step -pvar- is different from my -xtpmg- estimation, so I sense I might not replicate it correctly...

My questions are
- Is there any alternative to conduct the aforementioned post estimation for panel vecm model? If Stata does not have the package, is there any other package available by R or Eviews?
- I was wondering is that possible to use the two-step procedure to fit panel vecm?

I attach a demonstrative, random-generate data input in the do-file. Thanks in advance for any advice or comment!