-1

I would like to export results of cross section dependence tests for 12 panel data sets to a table in order to compare them with similar tests done with different software. Below is the regression and test instruction example from the xtcsd help page (unfortunately the example dataset is not available but a similar example dataset tbl15-1.dta from the xttest2 page is available). The instruction below will help you understand what I'm trying to achieve:

use "http://fmwww.bc.edu/ec-p/data/Greene2000/TBL15-1.dta"
xtset firm year
xtreg i f c,fe
xtcsd, pesaran

To display the test statistic, I can use

return list

How do I acess the p-value for that statistic?

I have found how to export estimation results using the command esttab. How do I export test results to a file in Stata?

Following @Maarten Buis's comment below on the p-value, here is how I exported test results to a csv file using the low level file access:

file open xtcsdfile using xtcsd.csv, write replace
file write xtcsdfile "pesaran,pvalue" _n
file write xtcsdfile (r(pesaran)) "," (2*(normal(-abs(r(pesaran))))) _n
file close xtcsdfile
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110

1 Answers1

2

The Pesaran statistic will (asymptotically) follow a standard normal distribution if the null-hypothesis is true, so: the p-value is 2*(normal(-abs(r(pesaran))))

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
Maarten Buis
  • 2,684
  • 12
  • 17
  • Thanks, I figured this out by looking at `viewsource xtcsd.ado` (it used `norm()` from STATA version 6 which has been renamed to `normal()`). My STATA command to extract the Pesaran test p-value becomes `display 2*(1-normal(abs(r(pesaran))))` – Paul Rougieux Mar 02 '15 at 11:14
  • I would use `normal(-something)` instead of `1-normal(something)` as the former is more numerically stable than the latter. For more see: http://www.stata-journal.com/sjpdf.html?articlenum=pr0025 – Maarten Buis Mar 02 '15 at 11:55