jmbejara / comp-econ-sp19

Main Course Repository for Computational Methods in Economics (Econ 21410, Spring 2019)
48 stars 26 forks source link

Questions for Bresnahan HW #75

Open sicelyli opened 5 years ago

sicelyli commented 5 years ago

I have two questions for the HW6:

  1. In Q6, we have a = [S_vals[i+1]/S_vals[i] * ((i+1)/(i+2)) for i in range(4)]. I'm wondering that why we have to multiply the ((i+1)/(i+2)) ?
  2. I'm trying to construct the constraint function for Q7. It says that "These constraints puts constraints on the parameter values. You will need to write a separate constraint function for each equality in each particular hypothesis to implement these constraints. This constraint function will be passed on to the optimizer." May I have some hint on how to construct such separate constraint function so that we have get the theta to make s4=s5? Below is what I have so far. Thank you! Screen Shot 2019-06-10 at 9 34 32 PM
jmbejara commented 5 years ago

S_vals in my code gives S_N in the paper. For the table, we're interested in s_N = S_N / N.

The constraints need to be written as functions that return the number zero when the constraint holds. Recall how we did this when we solved the portfolio optimization problem earlier in the quarter. To make things easy, I would write a function that takes in the parameters theta and returns the value for s_N. That way, you can easily write functions for each constraint. Each constraint is a function of s_N.