I am using python and trying to create a residual plot of my data. Yesterday it worked today everything I try is giving an error message.
This works fine:
#Reduced OLS model
medical_df[‘intercept’]=1
lm_days_red = sm.OLS(medical_df[‘Initial_days’], medical_df[[‘intercept’, ‘HighBlood_Yes’,
‘Arthritis_Yes’, ‘BackPain_Yes’, ‘Reflux_esophagitis_Yes’, ‘Asthma_Yes’]]).fit()
print(lm_days_red.summary())
But when I go to plot the residuals, nothing.
#Residual Plot
medical_df[‘intercept’]=1
residuals = medical_df[‘Initial_days’]- lm_days_red.predict(medical_df[[‘HighBlood_Yes’,
‘Arthritis_Yes’, ‘BackPain_Yes’,’Reflux_esophagitis_Yes’, ‘Asthma_Yes’]])
sns.scatterplot(x=medical_df[‘HighBlood_yes’], y=residuals)
print(residuals)
When I run this no error messages but nothing pops up.
I attempted to map the predict as:
days = lm_days_red.predict(medical_df[['HighBlood_Yes', 'Arthritis_Yes',
'BackPain_Yes','Reflux_esophagitis_Yes', 'Asthma_Yes']])
I get this error message:
ValueError: shapes (10000,5) and (6,) not aligned: 5 (dim 1) != 6 (dim 0)
Please help.