<p><strong>3. How do we recover parameters from production function estimates</strong> (INCOMPLETE ANSWER - will be updated with how to do this in R once I have time to figure it out, or if somebody else knows...)</p>
<p>Blundell and Bond aren't estimating the parameters of a Cobb-Douglas production function. They're estimates the parameters of a &quot;dynamic (common factor) representation&quot; of a production function, specifically:</p>
<p><span class="math-container">$(1) \ \ y_{it} = \beta_n n_{i,t} - \rho \beta_n n_{i,t-1} + \beta_k k_{i,t} - \rho \beta_k k_{i,t} + \rho y_{i,t-1} + (\gamma_t - \rho \gamma_{t-1}) + (\eta_i(1-\rho) + e_{it} + m_{it} - \rho m_{i,t-1})$</span></p>
<p>...which they get by quasi-differencing their production function and doing something weird with the <span class="math-container">$v_{it}$</span> term (not shown above). Changing the symbols, they re-write this as:</p>
<p><span class="math-container">$(2) \ \ y_{it} = \pi_1n_{it} + \pi_2 n_{i,t-1} + \pi_3 k_{it} + \pi_4 k_{i,t-1} + \pi_5 y_{i,t-1} + \gamma^*_t + (\eta^*_i +w_{it})$</span></p>
<p>Where the * presumably indicates steady-state values, but again, I wish I had access to a teacher to explain precisely why they write that. Anyway, what their SYS-GMM estimator returns is a vector of parameter values <span class="math-container">$\boldsymbol{\pi} = (\pi_1,...,\pi_5)'$</span>. We now have to use this to get the vector of parameters <span class="math-container">$\boldsymbol{\theta} = (\beta_n,\beta_k,\rho)$</span>.</p>
<p>The only place I can find an explanation of how one does that is <a href="https://rev-inv-ope.univ-paris1.fr/fileadmin/rev-inv-ope/files/39228/39218-04.pdf" rel="nofollow noreferrer">this paper</a> applying SYS-GMM to Cuba. They refer to Woolridge 2002 (I don't have it), and assert that one can consider the problem as defined by the relationship <span class="math-container">$\boldsymbol{\pi} = h(\boldsymbol{\theta})$</span>. We have <span class="math-container">$\boldsymbol{\pi}$</span>, we need <span class="math-container">$\boldsymbol{\theta}$</span>, and we will have to employ some function h() to make the link. It sounds like h() is taken to be an instance of a general class of minimum distance estimators, and we can (according to Woolridge 2002, apparently) solve the problem by solving:</p>
<p><span class="math-container">$min (\boldsymbol{\theta}) = (\hat{\pi}-h(\theta))'\Omega(\hat{\pi}-h(\theta)) $</span></p>
<p>where <span class="math-container">$\Omega$</span> is some weighting function. And again, apparently <span class="math-container">$\Omega$</span> should be chosen as the variance of the matrix of parameters, obtained by &quot;the delta method&quot;.</p>
<p>...but now it gets confusing, because although it's easy to find info on the delta method online, the matrix of parameters includes the unknowns <span class="math-container">$\boldsymbol{\theta}$</span>. I guess the way to tackle this is to multiply it all out and plug into <code>optim</code>, using some arbitrary choice on starting values (factor shares of output, if $ valued?). I will update if I get a chance to try that...</p>
<p>In going from equation (1) to (2) it is pretty obvious that:</p>
<p><span class="math-container">$$h(\beta_n,\beta_k,\rho) = \begin{pmatrix} \beta_n \\ - \rho \beta_n \\ \beta_k \\ - \rho \beta_k \\ \rho \end{pmatrix}= \begin{pmatrix} \pi_1 \\ \pi_2 \\ \pi_3  \\ \pi_4 \\ \pi_5 \end{pmatrix},$$</span></p>
<p>and <span class="math-container">$$\Omega = var(\pi)$$</span></p>

CC BY-SA 4.0
2021-03-29T20:22:06.113Z
I added the function $h()$ to your post. If you disagree just delete. Woolridge (2002) i available online [here](https://jrvargas.files.wordpress.com/2011/01/wooldridge_j-_2002_econometric_analysis_of_cross_section_and_panel_data.pdf).
Jesper Hybel
CC BY-SA 4.0
2021-03-29T20:32:22.000Z
Minimum distance is discussed on page 442 in the chapter on GMM. Standard errors requires you to calculate $\partial h(\theta)/\partial \theta$ being a $5 \times 3$ matrix in this case.
Jesper Hybel
CC BY-SA 4.0
2021-04-08T02:37:44.760Z
@JesperHybel thanks for the link to Wooldridge. Yes, that's h() and omega AFAIK. The problem is how to put it all together in R. There is a stata function [here] (https://www.soderbom.net/Resources.htm) for those who read stata. Looking at this again today, I think I'm missing something fundamental about how structural parameters are recovered from reduced form models in economics.
antifrax
CC BY-SA 4.0
2021-03-29T15:27:55.950Z
2021-03-29T20:19:24.297Z
2021-03-29T20:19:24.297Z
antifrax
<p>I want to replicate Blundell and Bond (2000) Table III in R. I'm using the function <code>pgmm</code> from package <code>plm</code>, which (apparently) replicates the approach of Stata's <code>xtabond2</code> (Roonman, 2009). The estimates I get are qualitatively similar, but not the same, the Arellano-Bond test of serial correlation suggests the moment conditions are invalide....and I'm sad to say I don't yet see how to recover the production function coefficients.</p>
<p>The authors of <code>plm</code> have a useful companion textbook: Millo and Croissant 2018 Panel Data Econometrics in R. I get the data from there (associated packaged pder), and follow section 7.5 for set-up and diagnostics. Here is a self-contained example:</p>
<pre><code>library(plm)
library(pder) # contains the Blundell and Bond dataset
#detach(package:dplyr) # if loaded, dplyr::lag masks plm::lag

data('RDPerfComp')
str(RDPerfComp) #n.b. - variables already in logs (see ?RDPerfComp)
</code></pre>
<p>And now to replicate some of the columns from Blundell and Bond 2000 Table 3:</p>
<pre><code># &quot;OLS levels&quot;
ols&lt;-plm(y~lag(y,1) + lag(n,0:1) + lag(k,0:1),
             data=RDPerfComp, index=c(&quot;id&quot;,&quot;year&quot;), 
             effect=&quot;twoways&quot;, model = &quot;pooling&quot;)
summary(ols)

# &quot;Within groups&quot;
within_groups&lt;-plm(y~lag(y,1) + lag(n,0:1) + lag(k,0:1),
                   data=RDPerfComp, index=c(&quot;id&quot;,&quot;year&quot;), 
                   effect=&quot;twoways&quot;, model = &quot;within&quot;)
summary(within_groups)

# &quot;SYS t-2&quot;
sys_t2&lt;-pgmm(
  y ~ lag(y,1) + lag(n,0:1) + lag(k,0:1) |
    lag(y,2:99) + lag(n,2:99) + lag(k,2:99),
  data=RDPerfComp, index=c(&quot;id&quot;,&quot;year&quot;),
  effect=&quot;twoways&quot;,model=&quot;onestep&quot;,
  transformation=&quot;ld&quot;
)
summary(sys_t2,robust=TRUE,time.dummies=FALSE) # both options can be provided directly in pgmm()

# &quot;SYS t-3&quot;
sys_t3&lt;-pgmm(
  y ~ lag(y,1) + lag(n,0:1) + lag(k,0:1) |
    lag(y,3:99) + lag(n,3:99) + lag(k,3:99),
  data=RDPerfComp, index=c(&quot;id&quot;,&quot;year&quot;),
  effect=&quot;twoways&quot;,model=&quot;onestep&quot;,
  transformation=&quot;ld&quot;
)
summary(sys_t3,robust=TRUE)
</code></pre>
<p>The results are very similar for the pooled OLS model, almost identical for fixed effects/within model, and only &quot;qualitatively similar&quot; (magnitudes, signs) for the SYS-GMM models, with some exceptions (notable the estimate for the y_t-1 coefficient). More concerning, the Sargan-Hansen test appears to reject the null of valid instruments for both the SYS-GMM models:</p>
<pre><code>sargan(sys_t2) # same statistic as reported by summary()
sargan(sys_t3)
</code></pre>
<p>...and the Arellano-Bond moment condition test appears to reject the null of no serial correlation, suggesting that the moment conditions are invalid</p>
<pre><code>mtest(sys_t2) # you can make this robust using vcovc =
mtest(sys_t3)
</code></pre>
<p>So my questions:</p>
<ol>
<li>Am I specifying these wrong (probably - my first try with gmm) or are we just looking at the results of different machinery?</li>
<li>What could explain the diagnostic test results, which appear to say the SYS-GMM models aren't valid?</li>
<li>How do we get Beta_n, Beta_k, and rho (the production function parameters, as given in the  middle panel of Table III) from these results? (EDIT: OK, as stated in the paper, via testing and imposing the coefficient restrictions using &quot;a minimum distance estimator&quot; see eq'n 2.3 and text below in original paper)</li>
</ol>
<p>(yes these are 'advanced undergrad' type questions, no this is not coursework)</p>

CC BY-SA 4.0
2021-03-29T00:33:27.973Z
Good luck.  Given you hit the "within model" numbers almost exactly, it is surprising that you did not do quite so well on what should be the simpler OLS model.  For those who cannot access the Blundell and Bond (2000) behind a paywall, their earlier [IFS 1998 publication](https://www.ifs.org.uk/wps/wp9904.pdf) is easily available, with the coefficients you are trying to replicate in Table 2
Henry
CC BY-SA 4.0
2021-03-29T01:08:15.607Z
...is this perhaps known to be a dumb thing to try to do, and if so can you shed some light on why?
antifrax
CC BY-SA 4.0
2021-03-29T01:10:09.330Z
No - this is a very good thing to try to do.  R is free and Stata is not, so being able to replicate Stata results in R is an admirable exercise
Henry
CC BY-SA 4.0
2021-03-29T01:13:22.790Z
I did see one comment somewhere (lost track of it) suggesting that there were problems with the code used in the original 2000 paper, such that replication might be difficult. The point of trying to do it is just to learn about the SYS-GMM approach to production functions.
antifrax
CC BY-SA 4.0
2021-03-29T16:34:04.813Z
Are you actually able to replicate the tables from their paper in stata? I tried to do it but I could not do it, maybe I just made mistake, but  perhaps they indeed had some problem with code used in their original paper
1muflon1
CC BY-SA 4.0
2021-03-29T16:39:26.813Z
Run the script I posted above and see what you think. To me it seems OK, but I expected to be closer on the SYS-GMM estimates, since `plm::pgmm` is meant to be an R port of Stata's `xtabond2`.
antifrax
CC BY-SA 4.0
2021-05-19T11:40:55.857Z
I would expect you to get wrong estimates on the OLS replication (but I am not entirely sure). Using the lag(y,1) in the formula I would be surprised if this was actually lag(y,1) by ID which is what you want.
Jesper Hybel
<production-function><applied-econometrics><paneldata><r>
Replicate Blundell and Bond (2000) results using R
antifrax
# Replicate Blundell and Bond (2000) results using R

(Asked by: username_0 on 2021-03-28)

I want to replicate Blundell and Bond (2000) Table III in R. I'm using the function pgmm from package plm, which (apparently) replicates the approach of Stata's xtabond2 (Roonman, 2009). The estimates I get are qualitatively similar, but not the same, the Arellano-Bond test of serial correlation suggests the moment conditions are invalide....and I'm sad to say I don't yet see how to recover the production function coefficients.
The authors of plm have a useful companion textbook: Millo and Croissant 2018 Panel Data Econometrics in R. I get the data from there (associated packaged pder), and follow section 7.5 for set-up and diagnostics. Here is a self-contained example:
library(plm)
library(pder) # contains the Blundell and Bond dataset
#detach(package:dplyr) # if loaded, dplyr::lag masks plm::lag

data('RDPerfComp')
str(RDPerfComp) #n.b. - variables already in logs (see ?RDPerfComp)

And now to replicate some of the columns from Blundell and Bond 2000 Table 3:
# "OLS levels"
ols<-plm(y~lag(y,1) + lag(n,0:1) + lag(k,0:1),
             data=RDPerfComp, index=c("id","year"), 
             effect="twoways", model = "pooling")
summary(ols)

# "Within groups"
within_groups<-plm(y~lag(y,1) + lag(n,0:1) + lag(k,0:1),
                   data=RDPerfComp, index=c("id","year"), 
                   effect="twoways", model = "within")
summary(within_groups)

# "SYS t-2"
sys_t2<-pgmm(
  y ~ lag(y,1) + lag(n,0:1) + lag(k,0:1) |
    lag(y,2:99) + lag(n,2:99) + lag(k,2:99),
  data=RDPerfComp, index=c("id","year"),
  effect="twoways",model="onestep",
  transformation="ld"
)
summary(sys_t2,robust=TRUE,time.dummies=FALSE) # both options can be provided directly in pgmm()

# "SYS t-3"
sys_t3<-pgmm(
  y ~ lag(y,1) + lag(n,0:1) + lag(k,0:1) |
    lag(y,3:99) + lag(n,3:99) + lag(k,3:99),
  data=RDPerfComp, index=c("id","year"),
  effect="twoways",model="onestep",
  transformation="ld"
)
summary(sys_t3,robust=TRUE)

The results are very similar for the pooled OLS model, almost identical for fixed effects/within model, and only "qualitatively similar" (magnitudes, signs) for the SYS-GMM models, with some exceptions (notable the estimate for the y_t-1 coefficient). More concerning, the Sargan-Hansen test appears to reject the null of valid instruments for both the SYS-GMM models:
sargan(sys_t2) # same statistic as reported by summary()
sargan(sys_t3)

...and the Arellano-Bond moment condition test appears to reject the null of no serial correlation, suggesting that the moment conditions are invalid
mtest(sys_t2) # you can make this robust using vcovc =
mtest(sys_t3)

So my questions:

Am I specifying these wrong (probably - my first try with gmm) or are we just looking at the results of different machinery?
What could explain the diagnostic test results, which appear to say the SYS-GMM models aren't valid?
How do we get Beta_n, Beta_k, and rho (the production function parameters, as given in the  middle panel of Table III) from these results? (EDIT: OK, as stated in the paper, via testing and imposing the coefficient restrictions using "a minimum distance estimator" see eq'n 2.3 and text below in original paper)

(yes these are 'advanced undergrad' type questions, no this is not coursework)

**Tags:** production-function, applied-econometrics, paneldata, r

> **Comments:**
> **username_1**: Good luck.  Given you hit the "within model" numbers almost exactly, it is surprising that you did not do quite so well on what should be the simpler OLS model.  For those who cannot access the Blundell and Bond (2000) behind a paywall, their earlier [IFS 1998 publication](https://www.ifs.org.uk/wps/wp9904.pdf) is easily available, with the coefficients you are trying to replicate in Table 2  
> **username_0**: ...is this perhaps known to be a dumb thing to try to do, and if so can you shed some light on why?  
> **username_1**: No - this is a very good thing to try to do.  R is free and Stata is not, so being able to replicate Stata results in R is an admirable exercise  
> **username_0**: I did see one comment somewhere (lost track of it) suggesting that there were problems with the code used in the original 2000 paper, such that replication might be difficult. The point of trying to do it is just to learn about the SYS-GMM approach to production functions.  
> **username_2**: Are you actually able to replicate the tables from their paper in stata? I tried to do it but I could not do it, maybe I just made mistake, but  perhaps they indeed had some problem with code used in their original paper  
> **username_0**: Run the script I posted above and see what you think. To me it seems OK, but I expected to be closer on the SYS-GMM estimates, since `plm::pgmm` is meant to be an R port of Stata's `xtabond2`.  
> **username_3**: I would expect you to get wrong estimates on the OLS replication (but I am not entirely sure). Using the lag(y,1) in the formula I would be surprised if this was actually lag(y,1) by ID which is what you want.  

---

## 1 answers

### Answer by username_0 on 2021-03-29. Score: 3

**3. How do we recover parameters from production function estimates** (INCOMPLETE ANSWER - will be updated with how to do this in R once I have time to figure it out, or if somebody else knows...)

Blundell and Bond aren't estimating the parameters of a Cobb-Douglas production function. They're estimates the parameters of a "dynamic (common factor) representation" of a production function, specifically:

$(1) \ \ y\_{it} = \beta\_n n\_{i,t} - \rho \beta\_n n\_{i,t-1} + \beta\_k k\_{i,t} - \rho \beta\_k k\_{i,t} + \rho y\_{i,t-1} + (\gamma\_t - \rho \gamma\_{t-1}) + (\eta\_i(1-\rho) + e\_{it} + m\_{it} - \rho m\_{i,t-1})$

...which they get by quasi-differencing their production function and doing something weird with the $v\_{it}$ term (not shown above). Changing the symbols, they re-write this as:

$(2) \ \ y\_{it} = \pi\_1n\_{it} + \pi\_2 n\_{i,t-1} + \pi\_3 k\_{it} + \pi\_4 k\_{i,t-1} + \pi\_5 y\_{i,t-1} + \gamma^\*\_t + (\eta^\*\_i +w\_{it})$

Where the \* presumably indicates steady-state values, but again, I wish I had access to a teacher to explain precisely why they write that. Anyway, what their SYS-GMM estimator returns is a vector of parameter values $\boldsymbol{\pi} = (\pi\_1,...,\pi\_5)'$. We now have to use this to get the vector of parameters $\boldsymbol{\theta} = (\beta\_n,\beta\_k,\rho)$.

The only place I can find an explanation of how one does that is [this paper](https://rev-inv-ope.univ-paris1.fr/fileadmin/rev-inv-ope/files/39228/39218-04.pdf) applying SYS-GMM to Cuba. They refer to Woolridge 2002 (I don't have it), and assert that one can consider the problem as defined by the relationship $\boldsymbol{\pi} = h(\boldsymbol{\theta})$. We have $\boldsymbol{\pi}$, we need $\boldsymbol{\theta}$, and we will have to employ some function h() to make the link. It sounds like h() is taken to be an instance of a general class of minimum distance estimators, and we can (according to Woolridge 2002, apparently) solve the problem by solving:

$min (\boldsymbol{\theta}) = (\hat{\pi}-h(\theta))'\Omega(\hat{\pi}-h(\theta)) $

where $\Omega$ is some weighting function. And again, apparently $\Omega$ should be chosen as the variance of the matrix of parameters, obtained by "the delta method".

...but now it gets confusing, because although it's easy to find info on the delta method online, the matrix of parameters includes the unknowns $\boldsymbol{\theta}$. I guess the way to tackle this is to multiply it all out and plug into `optim`, using some arbitrary choice on starting values (factor shares of output, if $ valued?). I will update if I get a chance to try that...

In going from equation (1) to (2) it is pretty obvious that:

$$h(\beta\_n,\beta\_k,\rho) = \begin{pmatrix} \beta\_n \\ - \rho \beta\_n \\ \beta\_k \\ - \rho \beta\_k \\ \rho \end{pmatrix}= \begin{pmatrix} \pi\_1 \\ \pi\_2 \\ \pi\_3 \\ \pi\_4 \\ \pi\_5 \end{pmatrix},$$

and $$\Omega = var(\pi)$$

> **Comments:**
> **username_3**: I added the function $h()$ to your post. If you disagree just delete. Woolridge (2002) i available online [here](https://jrvargas.files.wordpress.com/2011/01/wooldridge_j-_2002_econometric_analysis_of_cross_section_and_panel_data.pdf).  
> **username_3**: Minimum distance is discussed on page 442 in the chapter on GMM. Standard errors requires you to calculate $\partial h(\theta)/\partial \theta$ being a $5 \times 3$ matrix in this case.  
> **username_0**: @JesperHybel thanks for the link to Wooldridge. Yes, that's h() and omega AFAIK. The problem is how to put it all together in R. There is a stata function [here] (https://www.soderbom.net/Resources.htm) for those who read stata. Looking at this again today, I think I'm missing something fundamental about how structural parameters are recovered from reduced form models in economics.  

---

