paulofelipe / cp2015

Caliendo and Parro (2015) quantitative trade model in R.
Other
9 stars 4 forks source link

Questions on Caliendo and Parro (2015) Code: Elasticities, Data, and Modifications #3

Open angelespinozae opened 1 week ago

angelespinozae commented 1 week ago

Hi Paulo,

Thank you so much for sharing your code to replicate Caliendo and Parro (2015). Your code has been very helpful as I explore the model and work on adding more Latin American countries and maybe playing adding some other shocks.

I was wondering if you could help me clarify a few things about your code:

  1. Do you estimate the trade elasticities somewhere (thetas)? Or did you just take the ones estimated by Caliendo and Parro?
  2. I noticed that on GitHub there isn’t a file named cp2015_data, but there is the processed version cp2015_nafta. Did you compile the authors’ data to fit it into your functions? If so, it would be amazing if you could share more details about what I should do to adapt my data into something similar to cp2015_data.
  3. If I wanted to modify the objective functions to introduce some variants into the model, should I focus solely on the C++ code in solve_model, or would I need to modify anything else?
  4. Are there any other suggestions you would give me when working with this model?

Thank you very much for your help! Angel Espinoza

paulofelipe commented 1 week ago

Hi Angel,

  1. The theta estimates in the package are those estimated by Caliendo and Parro (2015), but you can easily change them.

  2. Simulations can be done with users' own data. For this, you just need to create a list with 7 data.frames in the same format as the cp2015_nafta object. You can get more details about the data structure by running this code in R: ?cp2015_nafta.

  3. If you need to create a custom model, I suggest you take a look at these files:

    • R/prepare_cp2015.R
    • src/solve_model.cpp
    • R/compute_results.R
  4. Recently, I made the replication of CP2015 available in Python using the JAX library. A single script shows how the model can be solved. Perhaps from this script, it will be easier for you to develop a custom model: https://github.com/paulofelipe/cp2015-jax

angelespinozae commented 1 week ago

Thank you ver much Paulo!!

Best, Angel