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