Monday, April 30, 2012

Production Possibility Frontier: Simulation & Estimation

* Production Possibility Frontier
* Stata simulation and estimation

* This simulatoin estimates a production possibility frontier model
* while simultaneously estimating the effects of market power
* on productivity.  It loosely models the paper by Saleem Shaik,
* Albert Allen, Seanicaa Edwards, and James Harris 2009
* "Market Structure Conduct Performance Hypothesis Revisited Using
* Stochastic Frontier Efficiency Analysis"

* v represents firm or time specific random errors
* u represents technical inefficiencies

* Performance(u)=f(X1)
* Output(Y2)=f(X2;B)+v-u

* We want to ask if performance u is explained by: market share and
* market concentration

* u = intercept + B1 mshare + B2 Mconc + e

* Y = intercept + A1 labor + A2 capital + v - u

* They model different firms in different industries which they
* hope have the same production structure but different market shares
* and market concentration.

* Set the random seed
set seed 101

* I simulate 10 firms in 7 different industries

clear
set obs 10

forv i=1/7 {
  * Generate labels for each firm in each industry _# refers to the different
  * industries
 

  * Generate market shares using a beta distribution.  The mean is about .1
  * but it ranges from 0 to 1
  gen share_`i' = rbeta(2,5)
 
  * Create a measure of total market share
  egen total_share_`i' = sum(share_`i')
 
  * Standardize the shares so that they add up to 1
  replace share_`i' = share_`i'/total_share_`i'
 
  * Drop total share
  drop total_share_*
 
  * Order firms from largest to smallest
  gsort -share_`i'

  * Label the firms according to size
  gen firm_`i'=_n

  * Create concentration index CRM
  gen CRM_`i' = sum(share_`i')
 
  * But we will only use CR4
  gen CR4_temp = CRM_`i' if firm_`i'==4
  egen CR4_`i' = mean(CR4_temp)
  drop CR4_temp
}
sum

* Now we want to create 1000 orders per firm
expand 1000

forv i=1/7 {

  * Let's create vectors of input per observation
  gen labor_`i'=runiform()*10
  gen capital_`i'=runiform()*10

  * Larger firms (share) tend to get larger contracts
  qui replace labor_`i'=labor_`i'+6*share_`i'
  qui replace capital_`i'=capital_`i'+6*share_`i'

  * u is the half normal function plus some extra terms
  * that Shaik uses.  The argument is that larger firms (large share)
  * are large because they are efficient but that high
  * market concentration leads to greater inefficiency.
  gen u_`i' = 1+abs(rnormal()*5) - 2*share_`i' + CR4_`i'
 
  * v is normally distributed
  gen v_`i' = rnormal()*20
 
  * Now we are ready to formulate our production model
  gen y_`i' = 5*labor_`i' + 5*capital_`i' + 10*((labor_`i')*(capital_`i'))^.75 - u_`i' + v_`i'
}

* Unfortunately our data is wide now when we want to use the xtfrontier command.
* So we will transform from wide to tall with the reshape command

* This is neccessary
gen obs_num = _n
reshape long share_ firm_ CRM_ CR4_ labor_ capital_ u_  v_ y_, i(obs_num) j(industry)

sort industry obs_num

* I will map out the production possibility frontier
xtile x_y= y, nquantiles(50)
xtile x_labor=labor, nquantiles(50)
xtile x_capital=capital, nquantiles(50)

foreach i in 5 10 15 20 25 30 35 40 45 {
  bysort x_labor: egen min_labor_`i'=mean(labor) if x_y==`i'
  bysort x_labor: egen min_capital_`i'=mean(capital) if x_y==`i'
 
  gen min_capital_`i'2=min_capital_`i'^2
  gen min_capital_`i'3=min_capital_`i'^3
  gen min_capital_`i'4=min_capital_`i'^4
  gen min_capital_`i'5=min_capital_`i'^5

  qui reg min_labor_`i' min_capital_`i' min_capital_`i'2 ///
        min_capital_`i'3 min_capital_`i'4 min_capital_`i'5
  predict min_labor_fit_`i'
  label var min_labor_fit_`i' "`=`i'*2'% percentile"
}

* Creates a noisy graph of production possibilities
twoway (line min_labor_20 min_capital_20) ///
       (line min_labor_30 min_capital_30) ///
       (line min_labor_40 min_capital_40) ///
        , title(Production Possibility Frontier) ///

* A smoother graph is found by using the fitted values from the previous regression.
twoway (line min_labor_fit_5 min_capital_5, sort) ///
       (line min_labor_fit_10 min_capital_10, sort) ///
       (line min_labor_fit_15 min_capital_15, sort) ///
       (line min_labor_fit_20 min_capital_20, sort) ///
       (line min_labor_fit_25 min_capital_25, sort) ///
       (line min_labor_fit_30 min_capital_30, sort) ///
       (line min_labor_fit_35 min_capital_35, sort) ///
       (line min_labor_fit_40 min_capital_40, sort) ///
       (line min_labor_fit_45 min_capital_45, sort) ///
       , title(Production Possibility Frontier) ///

* Now to remove the unneccessary _s from the variables
foreach v in share_ firm_ CRM_ CR4_ labor_ capital_ u_  v_ y_ {
  * This command will find the first instance of _ in the `v' and replace it empty
  local v_temp = subinstr("`v'","_","",1)
  rename `v' `v_temp'
}

gen labor_capital = (labor*capital)^.75

* This is pretty similar to doing a single OLS regression:
reg y labor capital CR4 share

* This is pretty similar to doing a single OLS regression:
reg y labor capital labor_capital CR4 share


* However, you can see that the simultaneous equation estimate is able to get at what
* we are interested in, "How does market share and concentration predict performance?"
* The OLS regression is only trying to predict output which ends up with a weaker estimate.

* Set the different industries as the panel variable
xtset industry

* First step; I will estimate the production fontier model, with a max number of
* interations of 10.
xtfrontier y labor capital, ti iter(10)

xtfrontier y labor capital labor_capital, ti

* I have not got this to work entirely the way I would like it to.  I might return to this in the future.

1 comment:

  1. informative post! Could you please continue?

    ReplyDelete