class_docstr: Diagnostic plots to identify potential problems in a linear regression fit.
  Mainly,
      a. non-linearity of data
      b. Correlation of error terms
      c. non-constant variance 
      d. outliers
      e. high-leverage points
      f. collinearity
  
  Author:
      Prajwal Kafle (p33ajkafle@gmail.com, where 3 = r)
      Does not come with any sort of warranty. 
      Please test the code one your end before using.
class_docstr_tok: ["Diagnostic","plots","to","identify","potential","problems","in","a","linear","regression","fit",".","Mainly",",","a.","non-linearity","of","data","b",".","Correlation","of","error","terms","c.","non-constant","variance","d.","outliers","e.","high-leverage","points","f.","collinearity","Author",":","Prajwal","Kafle","(","p33ajkafle","@","gmail.com",",","where","3","=","r",")","Does","not","come","with","any","sort","of","warranty",".","Please","test","the","code","one","your","end","before","using","."]
docstr: Residual vs Leverage plot
  
  Points falling outside Cook's distance curves are considered observation that can sway the fit
  aka are influential.
  Good to have none outside the curves.
docstr_tok: ["Residual","vs","Leverage","plot","Points","falling","outside","Cook","'s","distance","curves","are","considered","observation","that","can","sway","the","fit","aka","are","influential",".","Good","to","have","none","outside","the","curves","."]
code: def leverage_plot(self, ax=None):
      """
      Residual vs Leverage plot
  
      Points falling outside Cook's distance curves are considered observation that can sway the fit
      aka are influential.
      Good to have none outside the curves.
      """
      if ax is None:
          fig, ax = plt.subplots()
  
      ax.scatter(self.leverage, self.residual_norm, alpha=0.5)
  
      sns.regplot(
          x=self.leverage,
          y=self.residual_norm,
          scatter=False,
          ci=False,
          lowess=True,
          line_kws={"color": "red", "lw": 1, "alpha": 0.8},
          ax=ax,
      )
  
      # annotations
      leverage_top_3 = np.flip(np.argsort(self.cooks_distance), 0)[:3]
      for i in leverage_top_3:
          ax.annotate(
              i,
              xy=(self.leverage[i], self.residual_norm[i]),
              color="C3",
          )
  
      xtemp, ytemp = self.__cooks_dist_line(0.5)  # 0.5 line
      ax.plot(
          xtemp,
          ytemp,
          label="Cook's distance",
          lw=1,
          ls="--",
          color="red",
      )
      xtemp, ytemp = self.__cooks_dist_line(1)  # 1 line
      ax.plot(xtemp, ytemp, lw=1, ls="--", color="red")
  
      ax.set_xlim(0, max(self.leverage) + 0.01)
      ax.set_title("Residuals vs Leverage", fontweight="bold")
      ax.set_xlabel("Leverage")
      ax.set_ylabel("Standardized Residuals")
      ax.legend(loc="upper right")
      return ax
  
file_path: statsmodels/examples/python/linear_regression_diagnostics_plots.py
imports: import statsmodels
  import statsmodels.formula.api
  import pandas
  import numpy
  import seaborn
  from statsmodels.tools.tools import maybe_unwrap_results
  from statsmodels.graphics.gofplots import ProbPlot
  from statsmodels.stats.outliers_influence import variance_inflation_factor
  import matplotlib.pyplot
  from typing import Type
label_desc: Use image node_id 6 for calling the Linear_Reg_Diagnostic obj's underlying member method code with example usage: obj.leverage_plot(ax) and returns: ax