Я пытаюсь использовать функцию seaborn coefplot
, но она не показывает вывод.Вместо этого я получаю сообщение об ошибке:
AttributeError: модуль 'seaborn' не имеет атрибута 'coefplot'.
myresultsmyresult .env_corr(env_vars)
def env_corr(self, env_vars, coeff_plot=False, qq_plot=False):
"""
Determine correlations with environmental/non-discretionary variables
using a logit regression. Tobit will be implemented when available
upstream in statsmodels.
Takes:
env_vars: A pandas dataframe of environmental variables
Returns:
corr_mod: the statsmodels' model instance containing the inputs
and results from the logit model.
Note that there can be no spaces in the variables' names.
"""
import matplotlib.pyplot as plt
from statsmodels.regression.linear_model import OLS
from statsmodels.graphics.gofplots import qqplot
import seaborn as sns
env_data = _to_dataframe(env_vars)
corr_data = env_data.join(self['Efficiency'])
corr_mod = OLS.from_formula(
"Efficiency ~ " + " + ".join(env_vars.columns), corr_data)
corr_res = corr_mod.fit()
#plot coeffs
if coeff_plot:
coefplot("Efficiency ~ " + " + ".join(env_vars.columns),
data=corr_data)
plt.xticks(rotation=45, ha='right')
plt.title('Regression coefficients and standard errors')
#plot qq of residuals
if qq_plot:
qqplot(corr_res.resid, line='s')
plt.title('Distribution of residuals')
print(corr_res.summary())
return corr_res
Пожалуйста, помогите.