<p>I have the following issue: each time I run the estimation of the TFP by using <em>prodest</em> package in R 4.0.3, I obtain different coefficients before the variables as well as omega variable is different:</p>
<p>The dataset is here: <a href="https://drive.google.com/file/d/11cZ4ozUOtKxlXR3fLtjaQjsr9G-z54yN/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/11cZ4ozUOtKxlXR3fLtjaQjsr9G-z54yN/view?usp=sharing</a></p>
<p>The code is the following:</p>
<pre><code>remove(list=ls())

library(plm)
library(dplyr)
library(ggplot2)
library(prodest)


pckg&lt;-c(&quot;plm&quot;,&quot;readxl&quot;,&quot;dplyr&quot;,&quot;ggplot2&quot;,&quot;prodest&quot;)
install.packages(c(&quot;plm&quot;,&quot;readxl&quot;,&quot;dplyr&quot;,&quot;ggplot2&quot;,&quot;prodest&quot;))
lapply(pckg, require, character.only = TRUE)

# Set the working directory
setwd(&quot;------&quot;)

# Downloading the survey data
Data &lt;- read.csv(&quot;test.csv&quot;, header=TRUE, sep=&quot;,&quot;)
str(Data)

Data<span class="math-container">$ID&lt;-as.numeric(as.factor(Data$</span>ID))

summary(Data)

# Creating a panel data frame

DataA &lt;- Data %&gt;% 
  filter(NACE == 'A') %&gt;% 
  filter(VA &gt; 0, L &gt; 0, FA &gt; 0, M &gt; 0, Turn &gt; 0, TFA &gt; 0) %&gt;%
  mutate(ID = ID,
         Year = Year,
         l = log(L),
         va = log(VA),
         k = log(TFA),
         m = log(M),
         turn = log(Turn),
         ta = log(TA))


  
####################################################################################################################################
mod2LP &lt;- prodest::prodestLP(DataA<span class="math-container">$va, fX = DataA$</span>l, sX = DataA<span class="math-container">$k, pX = DataA$</span>m, idvar = DataA<span class="math-container">$ID, timevar = DataA$</span>Year, 
                             R = 100, cX = NULL, opt = &quot;optim&quot;, theta0 = NULL, cluster = NULL, tol = 1e-100, exit = FALSE)  
mod2LP
omegaLP &lt;- prodest::omega(mod2LP)
summary(mod2LP)
summary(omegaLP)

DataA$omega &lt;- prodest::omega(mod2LP) 

hist(omegaLP)


mod2OP &lt;- prodest::prodestOP(DataA11<span class="math-container">$turn, fX = DataA11$</span>l, sX = DataA11<span class="math-container">$k, pX = DataA11$</span>m, idvar = DataA11<span class="math-container">$ID, timevar = DataA11$</span>Year, 
                             R = 100, cX = NULL, opt = &quot;optim&quot;, theta0 = NULL, cluster = NULL, tol = 1e-100, exit = FALSE)  

mod2OP
omegaOP &lt;- prodest::omega(mod2OP)
summary(mod2OP)
summary(omegaOP)



mod2ACF &lt;-  prodest::prodestACF(DataA<span class="math-container">$va, fX = DataA$</span>l, sX = DataA<span class="math-container">$k, pX = DataA$</span>m, idvar = DataA<span class="math-container">$ID, timevar = DataA$</span>Year, 
                                R = 100, cX = NULL, opt = 'optim', theta0 = NULL, cluster = NULL)  

mod2ACF
omegaACF &lt;- prodest::omega(mod2ACF)
summary(mod2ACF)
summary(omegaACF)

DataA$omega &lt;- prodest::omega(mod2ACF) 



mod2W &lt;-  prodest::prodestWRDG(DataA<span class="math-container">$va, fX = DataA$</span>l, sX = DataA<span class="math-container">$k, pX = DataA$</span>m, idvar = DataA<span class="math-container">$ID, timevar = DataA$</span>Year, 
                                   cX = NULL)  
mod2W
omegaW &lt;- prodest::omega(mod2W)
summary(mod2W)
summary(omegaW)

####################################################################################################################################

</code></pre>
<p>Now if you run ACF or Wooldridge methods several times, you will obtain different coefficients as well as TFP measures.</p>
<p>Any ideas on how to solve it?</p>

CC BY-SA 4.0
2020-12-01T12:18:20.380Z
@1muflon1 Do you have any ideas, why that can happens? Maybe it is because theta0 variable, that could be added to the formula of ACF, to run the same optimization?
Wadim iLchuk
CC BY-SA 4.0
2020-11-23T12:44:23.653Z
what do you mean you get different results? I tested the code and every model you include always gives the same coefficient estimates when the code is rerun. Of course the models you test are not the same model so their individual results will not be the same - thats not by accident since they are  representing different methods but they do not change on re-running of the code as far as I can see. Can you pls provide some example of what you mean by this?
1muflon1
CC BY-SA 4.0
2020-11-24T16:05:49.683Z
Now I run ACF model and get 0.537 and 0.404 coefficients with mean omega 0.9904. Second time I run ACF code, I get 0.406 and 0.378 coefficients and mean omega 1.466. Third time -0.046 and 0.508 and mean omega 1.912
Wadim iLchuk
CC BY-SA 4.0
2022-10-12T09:50:51.057Z
If you go through the ACF paper, you will see you need to give the starting points for the second step estimate. I do not know how does prodestACF deal with it if you don't, but what Ackerberg et al. suggest in their paper is to use OLS coefficients as candidates to be used for the starting point
Bob
<microeconomics><production-function><productivity>
Prodest package in R for TFP estimation, gives different results
Wadim iLchuk
# Prodest package in R for TFP estimation, gives different results

(Asked by: username_0 on 2020-11-23)

I have the following issue: each time I run the estimation of the TFP by using prodest package in R 4.0.3, I obtain different coefficients before the variables as well as omega variable is different:
The dataset is here: https://drive.google.com/file/d/11cZ4ozUOtKxlXR3fLtjaQjsr9G-z54yN/view?usp=sharing
The code is the following:
remove(list=ls())

library(plm)
library(dplyr)
library(ggplot2)
library(prodest)


pckg<-c("plm","readxl","dplyr","ggplot2","prodest")
install.packages(c("plm","readxl","dplyr","ggplot2","prodest"))
lapply(pckg, require, character.only = TRUE)

# Set the working directory
setwd("------")

# Downloading the survey data
Data <- read.csv("test.csv", header=TRUE, sep=",")
str(Data)

Data$ID<-as.numeric(as.factor(Data$ID))

summary(Data)

# Creating a panel data frame

DataA <- Data %>% 
  filter(NACE == 'A') %>% 
  filter(VA > 0, L > 0, FA > 0, M > 0, Turn > 0, TFA > 0) %>%
  mutate(ID = ID,
         Year = Year,
         l = log(L),
         va = log(VA),
         k = log(TFA),
         m = log(M),
         turn = log(Turn),
         ta = log(TA))


  
####################################################################################################################################
mod2LP <- prodest::prodestLP(DataA$va, fX = DataA$l, sX = DataA$k, pX = DataA$m, idvar = DataA$ID, timevar = DataA$Year, 
                             R = 100, cX = NULL, opt = "optim", theta0 = NULL, cluster = NULL, tol = 1e-100, exit = FALSE)  
mod2LP
omegaLP <- prodest::omega(mod2LP)
summary(mod2LP)
summary(omegaLP)

DataA$omega <- prodest::omega(mod2LP) 

hist(omegaLP)


mod2OP <- prodest::prodestOP(DataA11$turn, fX = DataA11$l, sX = DataA11$k, pX = DataA11$m, idvar = DataA11$ID, timevar = DataA11$Year, 
                             R = 100, cX = NULL, opt = "optim", theta0 = NULL, cluster = NULL, tol = 1e-100, exit = FALSE)  

mod2OP
omegaOP <- prodest::omega(mod2OP)
summary(mod2OP)
summary(omegaOP)



mod2ACF <-  prodest::prodestACF(DataA$va, fX = DataA$l, sX = DataA$k, pX = DataA$m, idvar = DataA$ID, timevar = DataA$Year, 
                                R = 100, cX = NULL, opt = 'optim', theta0 = NULL, cluster = NULL)  

mod2ACF
omegaACF <- prodest::omega(mod2ACF)
summary(mod2ACF)
summary(omegaACF)

DataA$omega <- prodest::omega(mod2ACF) 



mod2W <-  prodest::prodestWRDG(DataA$va, fX = DataA$l, sX = DataA$k, pX = DataA$m, idvar = DataA$ID, timevar = DataA$Year, 
                                   cX = NULL)  
mod2W
omegaW <- prodest::omega(mod2W)
summary(mod2W)
summary(omegaW)

####################################################################################################################################


Now if you run ACF or Wooldridge methods several times, you will obtain different coefficients as well as TFP measures.
Any ideas on how to solve it?

**Tags:** microeconomics, production-function, productivity
> **Comments:**
> **username_1**: what do you mean you get different results? I tested the code and every model you include always gives the same coefficient estimates when the code is rerun. Of course the models you test are not the same model so their individual results will not be the same - thats not by accident since they are  representing different methods but they do not change on re-running of the code as far as I can see. Can you pls provide some example of what you mean by this?  
> **username_0**: Now I run ACF model and get 0.537 and 0.404 coefficients with mean omega 0.9904. Second time I run ACF code, I get 0.406 and 0.378 coefficients and mean omega 1.466. Third time -0.046 and 0.508 and mean omega 1.912  
> **username_0**: @1muflon1 Do you have any ideas, why that can happens? Maybe it is because theta0 variable, that could be added to the formula of ACF, to run the same optimization?  
> **username_2**: If you go through the ACF paper, you will see you need to give the starting points for the second step estimate. I do not know how does prodestACF deal with it if you don't, but what Ackerberg et al. suggest in their paper is to use OLS coefficients as candidates to be used for the starting point  

---

## 0 answers

