I have an unbalanced panel with 15063 firms between 2012 and 2018.
I am using this code to estimate the production function with Levinsohn & Petrin method:
levpet <- prodestLP(Y=base$c_y,
fX=base$c_l,
sX=base$c_k,
pX=base$c_m,
idvar=base$ruc,
timevar = base$year,
R=100 )
where
c_y
is log of value addedc_l
is log of wagesc_k
is log of capitalc_m
is log of materialsruc
is the firm identifier (a string)year
is a numeric.
The error I am getting looks like this:
Error in `[[<-.data.frame`(`*tmp*`, i, value = c(42719L, 82109L, 82678L, :
replacement has 469326 rows, data has 78221
I don´t know what it means or what I have to do about it.
How can I solve it? My data is very similar to this one:
data(chilean)
data and prodestLP
function are inside library(prodest)
These are all the libraries I have in the current script
library(tidyverse)
library(dplyr)
library(foreign)
library(haven)
library(readxl)
library(stringr)
library(expss)
library(lubridate)
library(prodest)
library(plm)
Thanks in advance.
Edit: With the dataset that's in the prodest package it runs just fine. Here's an example: https://rpubs.com/hacamvan/319728
My dataset is very similar, just way more observations, and a string idvar.
I think I've made it.
I had to assign a numerical id for every firm. then it worked.
now I just hope I can export the regressions.