Recitation 7: Examining Entry and Exit Data

Introducing the Data

This recitation will provide a guide to the data you will use for your last homework assignment, where you will estimate the dynamic duopoly model.

We will use data from Dearing and Blevins (2024). Let’s see what it looks like:

using DataFrames, DataFramesMeta, CSV

data = CSV.read("../data/clubstore_county.csv",DataFrame)
19320×9 DataFrame
19295 rows omitted
Row market year active1 active2 active3 lactive1 lactive2 lactive3 pop
Int64 Int64 Int64 Int64 Int64 Int64 Int64 Int64 Int64
1 1 2010 0 0 0 0 0 0 2
2 1 2011 0 0 0 0 0 0 2
3 1 2012 0 0 0 0 0 0 2
4 1 2013 0 0 0 0 0 0 2
5 1 2014 0 0 0 0 0 0 2
6 1 2015 0 0 0 0 0 0 2
7 1 2016 0 0 0 0 0 0 2
8 1 2017 0 0 0 0 0 0 2
9 1 2018 0 0 0 0 0 0 2
10 1 2019 0 0 0 0 0 0 2
11 1 2020 0 0 0 0 0 0 2
12 1 2021 0 0 0 0 0 0 2
13 2 2010 1 0 0 1 0 0 4
19309 1610 2010 0 0 0 0 0 0 2
19310 1610 2011 0 0 0 0 0 0 2
19311 1610 2012 0 0 0 0 0 0 2
19312 1610 2013 0 0 0 0 0 0 2
19313 1610 2014 0 0 0 0 0 0 2
19314 1610 2015 0 0 0 0 0 0 2
19315 1610 2016 0 0 0 0 0 0 2
19316 1610 2017 0 0 0 0 0 0 2
19317 1610 2018 0 0 0 0 0 0 2
19318 1610 2019 0 0 0 0 0 0 2
19319 1610 2020 0 0 0 0 0 0 2
19320 1610 2021 0 0 0 0 0 0 2

This is market level panel data that indicates the presence of three club stores in each market and each year. The variable active1 indicates the presence of firm 1 and so on. Similarly, the variable lactive1 indicates if firm was active in the previous year. As you will recall, these lagged values are state variables for the Markov Perfect Equilibrium.

The variable pop is a categorical variable that ranks the size of each market by population. This variable is the observable \(x\) that we introduced in our description of the model.

By plotting activity rates by this variable, we can get a sense of how it matters.

using StatsPlots, Statistics

d = @chain data begin
    groupby([:year,:pop])
    @combine :number = mean(:active1 .+ :active2 .+ :active3) 
    @transform :pop = string.(:pop)
end
@df d plot(:year,:number,group=:pop,title = "Average number of active firms by year and market size")

Depicting entry and exit

We can derive entry and exit indicators by comparing activity dummies with their lagged values. For example, for firm 1 entry patterns look like this:

@chain data begin
    @subset :lactive1.==0
    groupby(:pop)
    @combine :entry = mean(:active1)
    @df plot(:pop,:entry)
end

And exit patterns look like this:

@chain data begin
    @subset :lactive1.==1
    groupby(:pop)
    @combine :exit = mean(:active1.==0)
    @df plot(:pop,:exit)
end

Mapping to the model

An obvious problem is that there are three firms in the data and our model has only two firms. It would not be too difficult to extend the model to three firms but we have already jumped away from reality by assuming symmetry. For the purposes of the assignment let’s ignore firm 3 and consider only firm 2.

Recall that equillibrium is characterized by a symmetric policy function \(p(x,a,a')\), the probability of being active given the market size \(x\), the previous activity of the firm (\(a\)) and the previous activity of their competitor:

policies = @chain data begin
    groupby([:pop,:lactive1,:lactive2])
    @combine :p1 = mean(:active1) :p2 = mean(:active2) :num_obs = length(:active1)
    @orderby :pop :lactive1 :lactive2
end
18×6 DataFrame
Row pop lactive1 lactive2 p1 p2 num_obs
Int64 Int64 Int64 Float64 Float64 Int64
1 1 0 0 0.000471032 0.0 6369
2 1 0 1 0.0 1.0 19
3 1 1 0 0.826087 0.0 23
4 2 0 0 0.00169651 0.00113101 5305
5 2 0 1 0.0 0.96875 128
6 2 1 0 0.974545 0.0 275
7 3 0 0 0.0122468 0.00471032 2123
8 3 0 1 0.00930233 0.990698 215
9 3 1 0 0.984489 0.00729927 1096
10 3 1 1 0.95 1.0 20
11 4 0 0 0.0380349 0.0126783 631
12 4 0 1 0.0128617 0.987138 311
13 4 1 0 0.986077 0.019656 1221
14 4 1 1 0.968504 0.984252 254
15 5 0 0 0.0454545 0.0568182 88
16 5 0 1 0.0117647 0.996078 255
17 5 1 0 0.989035 0.0504386 456
18 5 1 1 0.988701 0.990584 531

In theory, this gives two separate estimates of the equilibrium choice probabilities (due to the assumed symmetry).

How do you want to estimate the model?

There are five parameters in the model (\(\phi_{0},\phi_{1},\phi_{2},\phi_{3},\phi_{4}\)). There are so many ways to estimate these parameters. You could

  1. Target particular moments (i.e. mean rates of activity, entry, or exit by market size) by simulating decisions using the distribution of initial market states that is in the data.
  2. Many sensible moments could be calculated in the model directly using the choice probabilities \(p\) that come from the model solution, so you could do minimum distance without needing to use simulation.
  3. One example of the above would be to simply do minimum distance on the estimated choice probabilities using choice probabilities at the model solution.
  4. You could also just do maximum likelihood.

It will be completely up to you but you can use any remaining time in recitation to write down your plan for estimating the model and getting standard errors.

References

Dearing, Adam, and Jason R. Blevins. 2024. “Efficient and Convergent Sequential Pseudo-Likelihood Estimation of Dynamic Discrete Games.” Review of Economic Studies.