生產函式

R中的TFP通過estprod包

  • October 4, 2020

我想使用 estprod 函式計算 TFP(我使用 R 4.0.2)。據我了解,計算 TFP 的唯一方法是手動遵循此邏輯在此處輸入圖像描述omega_1 = (data$Y - data$Labor*coefs$statistic[1] - data$Capital*coefs$statistic[2] - data$Materials*coefs$statistic[3])- 這基本上是 StackExchange 上的其他作者建議用來計算 TFP 的方法。然而,在執行回歸(LP、OP、Wooldridge)之後,我在輸出中只得到 2 個係數,僅用於資本和​​勞動力,而對於材料,係數缺失。

非常感謝任何評論和支持,數據集可在此處獲得: https ://drive.google.com/file/d/1aedWYABus1fQjKWxkOmYOmxv-qSja7hF/view?usp=sharing

到目前為止,程式碼如下:

remove(list=ls())

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

# Set the working directory
setwd("C:/Users/vadya/Desktop/baka")

# Downloading the survey data
Data <- read.csv("LV.csv", header=TRUE, sep=",")
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)

為了獲得 Levinsohn-Petrin 模型中材料的係數,您需要將總選項設置為 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.

不幸的是,其他兩個函式沒有收集代理變數的係數。

另一種方法是找到一些不同的代理並使用 $ m $ 作為對照(從科學的角度來看,我不一定支持這樣的選擇,但如果你一心想要獲得係數 $ m $ 它是一個選項)。在您的數據集中,您沒有任何其他變數 $ l $ , $ k $ 和 $ m $ (除了 COGS 總是 N/A)所以我將創建一個新變數來顯示它會起作用:

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

同樣,這種做法對我來說似乎沒有意義,但它給了你想要的輸出。

引用自:https://economics.stackexchange.com/questions/40053