# TFP in R via estprod package

I want to calculate the TFP by using the estprod function (I use R 4.0.2). As far as I understood the only way to calculate the TFP is manual following this logic . omega_1 = (data$Y - data$Labor*coefs$statistic[1] - data$Capital*coefs$statistic[2] - data$Materials*coefs\$statistic[3]) - this is basically the approach other author on StackExchange suggested to use in order to calculate the TFP. However, after running the regressions (LP, OP, Wooldridge) I get only 2 coefficients in the output, for capital and fo labor only, while for materials the coefficient is missing.

Would really much appreciate any comments and support, the dataset is available here: https://drive.google.com/file/d/1aedWYABus1fQjKWxkOmYOmxv-qSja7hF/view?usp=sharing

The code is the following so far:

remove(list=ls())

library(plm)
library(dplyr)
library(ggplot2)
library(prodest)
library(estprod)
library(broom)

# Set the working directory

str(Data)

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

summary(Data)

# Creating a panel data frame
PData <- pdata.frame(Data, index = c("ID","Year"))

pdim(PData)
pvar(PData)

DataA <- Data %>%
filter(NACE == 'A') %>%
filter(VA > 0, L > 0, K > 0, M > 0) %>%
select(ID, Year, L, VA, K, M) %>%
summarise(ID = ID,
Year = Year,
l = log(L),
va = log(VA),
k = log(K),
m = log(M))

####################################################################################################################################
mod1LP = estprod::levinsohn_petrin(data = DataA, va ~ l | k | m, id = "ID", time = "Year", bootstrap = TRUE, gross = FALSE)
summary(mod1LP)

mod1OP = estprod::olley_pakes(data = DataA, va ~ l | k | m, id = "ID", time = "Year", bootstrap = TRUE, gross = FALSE)
summary(mod1OP)

mod1W = estprod::wooldridge(data = DataA, va ~ l | k | m, id = "ID", time = "Year", bootstrap = TRUE, gross = FALSE)
summary(mod1W)


In order to get coefficient for the materials in the Levinsohn-Petrin model you need to set the gross option true.

 mod1LP = estprod::levinsohn_petrin(data = DataA, va ~ l | k | m, id = "ID", time = "Year", bootstrap = TRUE, gross = TRUE)
summary(mod1LP)

Call
estprod::levinsohn_petrin(data = DataA, formula = va ~ l | k |
m, gross = TRUE, id = "ID", time = "Year", bootstrap = TRUE)

Coefficients
Estimate Std. Error z value  Pr(>|z|)
l 0.1033754  0.0067384  15.341 < 2.2e-16 ***
k 0.5859219  0.0048667 120.394 < 2.2e-16 ***
m 0.4808831  0.0143580  33.492 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#Bootstraped standard errors.


The other two functions unfortunately don't collect the coefficients for proxy variables.

An alternative is to find some different proxy and use $$m$$ as a control (I do not necessarily endorse such option from scientific perspective but if you are hell bent on having coefficient for $$m$$ its an option). In your dataset you don't have any additional variables beside $$l$$, $$k$$ and $$m$$ (aside from COGS that is always N/A) so I will just create a new variable to show it would work:

 DataA$$m2<-(DataA$$m)^2

mod1OP = estprod::olley_pakes(data = DataA, va ~  l |  k | m2 |  m, id = "ID", time = "Year", bootstrap = TRUE, gross = TRUE)
summary(mod1OP)

Call
estprod::olley_pakes(data = DataA, formula = va ~ l | k | m2 |
m, id = "ID", time = "Year", bootstrap = TRUE,
gross = TRUE)

Coefficients
Estimate Std. Error z value  Pr(>|z|)
l  0.1057613  0.0040007 26.4360 < 2.2e-16 ***
k  0.4643984  0.0308697 15.0438 < 2.2e-16 ***
m -0.0458770  0.0048684 -9.4234 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

#Bootstraped standard errors.

mod1W = estprod::wooldridge(data = DataA, va ~ l | k | m2 | m, id = "ID", time = "Year", bootstrap = FALSE, gross = TRUE)
summary(mod1W)

Call
estprod::wooldridge(data = DataA, formula = va ~ l | k | m2 |
m, gross = TRUE, id = "ID", time = "Year", bootstrap = FALSE)

Coefficients
Estimate Std. Error t value  Pr(>|t|)
l 0.1210159  0.0075386  16.053 < 2.2e-16 ***
k 0.4670722  0.0135809  34.392 < 2.2e-16 ***
m 0.2595440  0.0158134  16.413 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Again such course of action does not seem to make sense to me but it gives you the desired output.

• Hey, @1muflon1, thank you again for the clarification! Oct 5, 2020 at 10:11
• My main concern was, how to calculate the TFP from the estprod package if it gives only 2 coefficients, while I need 3 of them? Oct 5, 2020 at 11:44
• @WadimiLchuk if you care about net output and not gross output then you can just use the first 2 coefficients and turn the gross argument false then the functions estimate the net output
– 1muflon1
Oct 5, 2020 at 11:57