in order to implement mixedlm and see the intercept random effect at GEOLEVEL,which is the correct way and why ?
Code 1: fixed_formula ='Tot_retail_exfac_sales ~ Cemails_opened + Total_F2F_Events + Total_Phone_Calls + (1+GEOLEVEL1)' start_time = time.time() model = sm.MixedLM.from_formula(fixed_formula, data=Mater_data, groups='GEOLEVEL1') results = model.fit()
print(results.summary())
Code 2:
fixed_formula ='Tot_retail_exfac_sales ~ Cemails_opened + Total_F2F_Events + Total_Phone_Calls' start_time = time.time() model = sm.MixedLM.from_formula(fixed_formula, data=Mater_data, re_formula='1+GEOLEVEL1',groups='GEOLEVEL1')
results = model.fit() # Try 'lbfgs' or 'lbfgs elapsed_time = time.time() - start_time
print(results.summary())