Giter VIP home page Giter VIP logo

prodest's Introduction

prodest

Stata and R packages for Production Function and Markup Estimation.

prodest in Stata (Rovigatti et al., SJ 2018 or Mollisi et al., 2017 - WP version) is available on the SSC archive - type ssc install prodest to install the latest stable version.

prodest in R (Rovigatti, 2017) is available on the CRAN - type install.packages("prodest") to install the latest stable version.

The packages implement most of the methods for production function estimation. The R prodest package provides functions to estimate the productivity, state and free variables parameters. Full description of the models, their issues and characteristics is available on both the packages' documentation and the relative working papers.

Please cite prodest in publications:

Rovigatti, G. and Mollisi, V. (2018) Theory and practice of total-factor productivity estimation: The control function approach using Stata The Stata Journal 18.3: 618-662

Rovigatti, G. (2017) prodest: Production Function Estimation in R.
R package. CRAN page: https://cran.r-project.org/web/packages/prodest/index.html

Rovigatti, G. (2017) Production Function Estimation in R: The prodest Package Journal of Open Source Software, 2(18), 371

markupest in Stata (Rovigatti, WP 2020) is available on the SSC archive - type ssc install markupest to install the latest stable version.

Please cite markupest in publications:

Rovigatti, G. (2020). Markup estimation using Stata: Micro and Macro approaches with markupest Working Paper

prodest's People

Contributors

arfon avatar davidvandijcke avatar gabrielerovigatti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

prodest's Issues

License

Hi,

I'm currently reviewing your package for JOSS. Can you please add a license with the contents of an OSI approved software license?

Cheers,
Sebastian

Sampling weights option

Hi Gabriele,

Superb package!

For us who work with survey data however, sampling weights oftentimes need to be taken into account. Is it possible to implement the methods in the package with weights? So far I see no option for this.

Cheers.

Chilean data has same values for "cX" and "inv"

When I call
data("chilean")
in R, the dataset has identical values for "cX" and "inv" variables, which according to the package are supposed to be "water" and "investment", respectively.
Clearly one is wrong - and I am hoping for my students' sake it's water - otherwise their OP problem set is going to be interesting...
Best,

2-Step Optimal GMM

Hi Gabriele

Insofar as I can tell, the GMM estimators in most of the code just use a first guess for the optimal weighting matrix, is that correct?

If you want, I can add some code to compute the 2-step GMM estimator with the asymptotically optimal weighting matrix?

Best
David

Is there a way to export the results? R.

Hello.

I am wondering if is there a way I could export the coefficients and standard errors to a dataframe.

I am trying with the following code in R:

levpet <- prodestLP(base$c_y,
                    fX=base$c_l,
                    sX=base$c_k,
                    pX=base$c_m,
                    idvar=base$idvar,
                    timevar = base$year,
                    R=5)

results_levpet <- data.frame(summary(levpet)$coef)

But I just get the chart with the coefficients in the console.

By the way. Is there a way to get the p-values for each coefficient? That would be awesome.

Thanks in advance.

Option Fsresidual not working with methods other than OP or LP

Hi,
The option fsresidual(newname) does not work with methods than OP or LP in the Stata code.

This problem could be reproduced so far with two different datasets including the example dataset provided with the package.
The problem occurs somewhere between the lines 546 - 551 where the temp file gets created and saved and lines 650 - 652 where the temp file should get merged with original dataset.
The attached log file prodest_error.log shows an example session. The example dataset gets loaded and described. The version number of the package is reported and the result of creturn list is shown. Afterwards the prodest command is called for the OP and LP method without problems, while using the WRDG and ROB method results in an invalid file specification error.
If needed, I could provide an output from a command run with set trace on.

Best regards
Sven-Kristjan

Error when idvar is a string (R)

Hello.

I have an unbalanced data panel, where the firm ID is a string.

I was trying to get the Levinsohn-Petrin estimation.

This was my code

levpet <- prodestLP(base2$c_y, # log of value added
                    fX=base2$c_l, # log of wages
                    sX=base2$c_k, # log of capital
                    pX=base2$c_m, # log of materials
                    idvar=base2$ruc, # string id
                    timevar = base2$year, # numeric variable
                    R=30  )

And I got this error:

Error in `[[<-.data.frame`(`*tmp*`, i, value = c(42719L, 82109L, 82678L,  : 
  replacement has 469326 rows, data has 78221

I don´t really know what´s the error or if this counts as a bug

But I created a numeric firm id and it worked.

Gross output vs. value added

Hi Gabriele,

thank you for the awesome package!
I was wondering if it is possible to estimate a gross output production function with this package? I'm not sure since in the documentation it says input Y should be value added but in the details simply log output, and I believe in the STATA version the default is gross output.

So for example, if I have information on log sales/revenue, COGS and capital (identification issues aside),

prodestACF(Y = sales, fX = COGS , sX = capital, pX = COGS, ...)

would just be flat out wrong, no?
Thank you,
Best Matthias

Omega estimates from WRDG_GMM

Hi there

I cannot obtain the omega estimates from the example given in the package when using the Wooldridge GMM estimator.

I get the following error:
image

I am assuming that this is because we are using lags as instruments in the GMM process so we lose observations therefore the VA (Y) is 1x1944 whilst the state & free vars are 1x2544. I can manually compute the omega but I wanted to check whether this was user error on my part?

Thanks,
Abigail

Add installation description

Hi,

I think it'll be a good idea to update README.md to include a guide to installation. For example: is the package on CRAN or should it be installed from github?

Cheers,
Sebastian

FSres does not work

FSres does work for prodestACF, prodestLP and prodestOP,
but does not work for prodestROB, prodestWRDG, and prodestWRDG_GMM
please help to update it, thanks a lot.

Add community guidelines

Hi again,

Please add guidelines for third parties who wish to contribute to the software.

Cheers,
Sebastian

Control variables with ACF correction error

Hi Gabrielle,

when trying to run a ACF-corrected model with non-NULL control variables the command throws an error:

prodestACF(Y = chilean$Y, fX = chilean$fX1, sX = chilean$sX, 
    pX = chilean$pX, cX = chilean$cX, idvar = chilean$idvar, timevar = chilean$timevar, 
    R = 5, opt = 'optim', theta0 = NULL, cluster = NULL)

yields

Warning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + :longer object length is not a multiple of shorter object lengthWarning message in matrix(unlist(lapply(boot.indices, finalACF, data = data, fnum = fnum, :data length [10] is not a sub-multiple or multiple of the number of rows [4]”
Error in names(betas$betas) <- res.names: 'names' attribute [3] must be the same length as the vector [2]

The issue maybe related to line 88 prodestACF.R

theta0 <- coef(first.stage)[2:(1 + snum + fnum + cnum)] + rnorm((snum + fnum), 0, 0.01)

because this implies that length(theta0) = snum+fnum+cnum. But if length(theta0) = snum + fnum +cnum the optimization routine on throws an error on line 144, namely that Error in mX %*% theta : non-conformable arguments.

So I guess the problem is what the proper length of theta0 should be or rather if the controls matter in the second stage, no?

Thank you for the package,
Matthias

nominal (current prices) or real (constant prices) with markupest

Dear Gabriele,

I am a MSc Economics student at the University of Greenwich contributing to a research team working on Innovation, markups, total factor productivity and labor share.
Thank you for the impressive markup estimation module on Stata.
I was wondering if the output (or value-added) is nominal (current prices) or real (constant prices)?
Thank you for your time and I look forward to hearing from you soon!

Best regards,
Aditya Alex Bysack.

cannot replicate the results

Hi Gabriele,

Thank you for this powerful package!

My problem is, I ran the code twice and got different results. The problem is still here even I use your example code in the help files. Is there anything wrong so that I cannot replicate the results? BTW, I also find that estimated coefficients will also be changed if I use different reps(#). Based on my knowledge, it will only change the s.e. instead of the coeff. Please tell me if I am wrong.

Best regards,
Zhanyu

Example

Hi again,

Could you include an example of how to use the package - for example at the end of the README.md file? I know that the functions are documented in the CRAN package documentation, but a brief example would definitely increase usability.

Cheers,
Sebastian

Industry fixed effects

Dear Gabriele,
Thanks for the useful package. I would ask you how shall one use industry fixed effect in your functions.
For instance, say that Chilean data further contained a few industries of data, for example, car/textile etc.
Is there any way that your existing functions could incorporate industry fixed effect, probably encoded as a factor variable? Will you provide an example if so?
Best regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.