jmbejara / comp-econ-sp19

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

Dealing with NaN Values #59

Closed IshaanW closed 5 years ago

IshaanW commented 5 years ago

I'm working on Q1 and am generating lots of NaN values for the log-probabilities because of near-zero and negative probabilities (see the log-probabilities array in the attached picture). I'm wondering if this indicates a problem with my earlier code or if I just have to deal with these values in a similar way to the -inf values generated by np.log

Screen Shot 2019-05-19 at 8 29 46 PM
jmbejara commented 5 years ago

Hi! Something is definitely going wrong. log probabilities should be negative, by definition. (log of a number between zero and one (non-inclusive), should be a negative real number.

IshaanW commented 5 years ago

These are the values I'm getting for profit_bar for each N.

Screen Shot 2019-05-20 at 10 30 17 AM

I'm a little confused by what they mean - is the value calculated using equation (8) total profits for the N firms in a market or is it the market entry threshold. My numbers don't seem to follow the assumption below:

Screen Shot 2019-05-20 at 10 32 43 AM

Is there an additional step to take like dividing by the number of firms in the market or finding marginal profits (i.e., subtracting pi_(n-1) from pi_n)?

IshaanW commented 5 years ago

Never mind, I figured out the fundamental flaw in my understanding of the paper!