jmbejara / comp-econ-sp19

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

slighly different values for Q5,6 #57

Closed rhuselid closed 5 years ago

rhuselid commented 5 years ago

Hi! I am getting fairly close results to those in the paper for the graph and df, but they seem to differ by a small, but persistent difference. I think that my error is either in how I am setting up X bar or how I am adding coefficents if N is sufficiently large;.

If you have time could you point out what is the error I am making here? I have been looking at it for a while and am missing it. Thanks!

def break_points(df, gamma, alpha, beta, N):
    Z = np.c_[df.ELD.mean(), df.PINC.mean(), df.LNHDD.mean(), df.FFRAC.mean()]  #X bar
    W = df.LANDV.mean() # gammaL mean
    X = np.c_[Z]

    base_numerand = gamma[0] + gamma[5]*W
    base_denominator = alpha[0] + X@beta

    num_add = []
    den_sub = []

    for i in range(1, N):
        num_add += [gamma[i]]
        den_sub += [alpha[i]]

    rv = (base_numerand + sum(num_add)) / (base_denominator - sum(den_sub))
    return rv

For reference here is my return:

lnl

Vs the paper:

nkn
jmbejara commented 5 years ago

Cool. Yeah, those are really close. Mine don't match the paper perfectly either. Your and mine seem close enough that it wouldn't change the results at all. I wouldn't worry about it. Could be rounding error at some point. I'm not sure.

This is what I'm getting:

image

rhuselid commented 5 years ago

Thanks!