I'm trying to calculate TFP with the estprod
package in R because this package allows me to calculate with Gross-Output (like with levinsohn petrin) but I have trouble getting omega
While the prodest
package can calculate omega but I can't add Gross-Output.
Has anyone calculated the TFP in R?
[updated] Reproducible example
library(prodest)
library(estprod)
data = structure(list(Y = c(12.8268952320028, 12.8521337216858, 12.8297798993317, 12.6357098405348,
12.4004643557221, 12.3600068590732, 12.826153741752, 12.8990697648315,
12.8393196511736, 12.7619091581355),
Labor = c(18.2268433780233, 18.1280743937883,
16.2004953940248, 18.4010948157752, 16.1374389570964, 18.3902253199657,
16.2359220634517, 16.2468898407345, 16.2720069307031, 16.2673373011924),
Capital = c(12.1642906069818, 12.088450259469,
12.0237634086603, 12.0750443461238, 12.0098651639831, 12.0601371534517,
11.9679864443247, 11.9299321784366, 12.0016971178669, 12.1209493577051),
Materials = c(18.1472736836291, 17.7735308597061,
17.1908332586684, 18.3914858811768, 18.2747180360049, 16.9304018090212,
18.4414110290762, 18.0188590654862, 18.1427756804037, 15.805209131618),
id = c(1070101, 1070101, 1070101, 1070101,
1070101, 1070101, 1070102, 1070102, 1070102, 1070102),
year = c(2013,2014, 2015, 2016, 2017, 2018, 2013, 2014, 2015, 2016)),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -10L))
# Y, Labor, Capital, Materials are in logarithms
mod1 = estprod::levinsohn_petrin(data,
formula = Y ~ Labor | Capital | Materials,
id = "id",
time = "year",
reps = 20,
gross = T) #estprod with Gross-Output = T
#how can i calculate omega with estprod?
mod2 = prodest::prodestLP(data$Y, # prodest does not have the parameter Gross-Output
fX = data$Labor,
sX = data$Capital,
pX = data$Materials,
idvar = data$id,
timevar = data$year,
opt='optim',
exit = F,
tol = 1e-100)
omega = prodest::omega(mod2) #with 'prodest' I can calculate omega