Harry Kelejian and Gianfranco Piras, "An Extension of the J-test to a Spatial Panel Data Framework", Journal of Applied Econometrics, Vol. 31, No. 2, 2016, pp. 387-402. EMPIRICAL APPLICATION The files to reproduce the empirical application are contained in the zip files kp-applic.zip and kp-shape.zip. The file kp-applic.zip contains: - four R codes (try.R, predictors.R, datasetessential.R, and kpt.panel.R) - a dataset in format csv (cornwell1.csv) These are all ASCII text files in DOS format, so Unix/Linux users should use "unzip -a". The file kp-shape.zip contains a shape file (north_carol.shp) to create the spatial weights matrix, along with two related files, north_carol.shx and north_carol.dbf. These are all binary files. See http://en.wikipedia.org/wiki/Shapefile for information about shape files. The empirical application of the paper uses the well known economic model of crime estimated by Cornwell and Trumbull (1994). They use panel data on 90 counties over the period 1981-1987. The first two columns of the dataset are the FIPS for the county and the year. The data are organized such that the fast index is year. The dataset cornwell1.csv only provides the final variables included in the model along with the instruments. This is different from other version of the dataset in that they include also pre-transformed variables. To reproduce the results In Kelejian and Piras (2014), first open the file try.R. The first line set the working directory. This should be the same directory in which the data file and codes are stored. This is the only part of the code that the user should modify. The main routine after performing some necessary calculation, uses the function predictors_mod() (in the file predictors.R), and then the function kptest() (in the file kpt.panel.R) to perform the J-test. N.B. To reproduce the results, three R libraries are necessary (and all the libraries required by those three): - maptools - spdep - splm MONTE CARLO The files related to the Monte Carlo experiment are contained in the zip file kp-monte.zip. These are all ASCII text files in DOS format, so Unix/Linux users should use "unzip -a". The folder contains four functions: - run.R - sim.Jtestpanel.R - predictors.R - kpt.panel.R run.R is the function that can be used to run the entire experiment. For example, on a Linux machine, one could simply open the terminal and type: R CMD BATCH run.R out.R The main function is named sim.Jtestpanel.R and performs all the experiments for the various combinations of the simulation parameters as described in the paper. The tables of results are printed after each of the experiments and saved on disk in the same directory. To replicate the Monte Carlo results one should have installed the same libraries as in the empirical example.