import pandas as pd
import regression as reg
import sys


data = pd.read_pickle(sys.argv[1])
# now we run the regressions
end = "c_mn_group"
ind = list(data["c_mn_group"].drop_duplicates().values)
keys0 = ["immediate_ret", "option_val"]
keys1 = keys0 + ["cum_net_immediate_ret", "cum_net_option_val"]
keys2 = keys0 + ["cur_net_immediate_ret", "cur_net_option_val"]
keys3 = keys1 + ["com_net_immediate_ret", "com_net_option_val"]
mcmc0, betas0 = reg.genModel(data, keys0, ind)
mcmc1, betas1 = reg.genModel(data, keys1, ind)
mcmc2, betas2 = reg.genModel(data, keys2, ind)
mcmc3, betas3 = reg.genModel(data, keys3, ind)
ll0 = reg.genLogLikelihood(data, keys0, ind, betas0)
ll1 = reg.genLogLikelihood(data, keys1, ind, betas1)
ll2 = reg.genLogLikelihood(data, keys2, ind, betas2)
ll3 = reg.genLogLikelihood(data, keys3, ind, betas3)
p0, coef0, sd0, t0 = reg.genPValue(mcmc0, data)
p1, coef1, sd1, t1 = reg.genPValue(mcmc1, data)
p2, coef2, sd2, t2 = reg.genPValue(mcmc2, data)
p3, coef3, sd3, t3 = reg.genPValue(mcmc3, data)
print "Basic model: ", ll0, p0, coef0, sd0, t0, "\n"
print "Cumulative model: ", ll1, p1, coef1, sd1, t1, "\n"
print "Current model: ", ll2, p2, coef2, sd2, t2, "\n"
print "Combination model: ", ll3, p3, coef3, sd3, t3, "\n"
