Using from Stata

To install via Stata, from the Stata command line run:

ssc install statatwoway

The most efficient way to run StataTwoWay is through Python. Please read From Python on how to install PyTwoWay for Python. A version that does not depend on Python is currently in development.

Sample data: download

To run in Stata:

statatwoway fe cre, config("config.txt") env("stata-env")

To see all available results, type:

return list

The estimators you can run are FE, CRE, or both. Additionally, while a config file is required, an environment is not. However, setting up an environment is recommended. Read about setting up environments in Anaconda here.

Use the following example config file as a template. There is no need to include data or filetype options. StataTwoWay generates a temporary datafile and automatically inputs the name of the generated dataset and filetype dta. For help about all the options that can be included in your config file, from the command line run:

pytw -h

Example config.txt:

col_dict = "{'i': 'your_workerid_col', 'j': 'your_firmid_col', 'y': 'your_compensation_col', 't': 'your_year_col'}"

Note

Your data must include the following columns:
  • i: the worker identifier

  • j: the firm identifier

  • y: the compensation variable

  • t: the time

Example data

i

j

y

t

1

1

1000

2019

1

2

1500

2020

2

3

500

2019

2

3

550

2020