code: def residual_diagnostic_plot(
      df,
      dist="norm",
      date_col="week",
      residual_col="residual",
      fitted_col="prediction",
      sparams=None,
  ):
      """
      Parameters
      ----------
  
      df : pd.DataFrame
      dist : str
      date_col : str
          column name of date
      residual_col : str
          column name of residual
      fitted_col: str
          column name of fitted value from model
      sparams : float or list
          extra parameters used in distribution such as t-dist
  
      Notes
      -----
      1. residual by time
      2. residual vs fitted
      3. residual histogram with vertical line as mean
      4. residuals qq plot
      5. residual ACF
      6. residual PACF
      """
      fig, ax = plt.subplots(3, 2, figsize=(15, 12))
  
      # plot 1 residual by time
      sns.lineplot(
          x=date_col,
          y=residual_col,
          data=df,
          ax=ax[0, 0],
          color=palette.OrbitPalette.BLUE.value,
          alpha=0.8,
          label="residual",
      )
      ax[0, 0].set_title("Residual by Time")
      ax[0, 0].legend()
  
      # plot 2 residual vs fitted
      sns.scatterplot(
          x=fitted_col,
          y=residual_col,
          data=df,
          ax=ax[0, 1],
          color=palette.OrbitPalette.BLUE.value,
          alpha=0.8,
          label="residual",
      )
      ax[0, 1].axhline(
          y=0,
          linestyle="--",
          color=palette.OrbitPalette.BLACK.value,
          alpha=0.5,
          label="0",
      )
      ax[0, 1].set_title("Residual vs Fitted")
      ax[0, 1].set_xlabel("fitted")
      ax[0, 1].legend()
  
      # plot 3 residual histogram with vertical line as mean
      sns.histplot(
          df[residual_col].values,
          kde=True,
          ax=ax[1, 0],
          color=palette.OrbitPalette.BLUE.value,
          label="residual",
          edgecolor="white",
          alpha=0.5,
          facecolor=palette.OrbitPalette.BLUE.value,
      )
      ax[1, 0].set_title("Residual Distribution")
      ax[1, 0].axvline(
          df[residual_col].mean(),
          color=palette.OrbitPalette.ORANGE.value,
          linestyle="--",
          alpha=0.9,
          label="residual mean",
      )
      ax[1, 0].set_ylabel("density")
      ax[1, 0].legend()
  
      # plot 4 residual qq plot
      if dist == "norm":
          _ = stats.probplot(
              df[residual_col].values, dist="norm", plot=ax[1, 1]
          )
      elif dist == "t-dist":
          # t-dist qq-plot
          _ = stats.probplot(
              df[residual_col].values,
              dist=stats.t,
              sparams=sparams,
              plot=ax[1, 1],
          )
  
      # plot 5 residual ACF
      sm.graphics.tsa.plot_acf(
          df[residual_col].values,
          ax=ax[2, 0],
          title="Residual ACF",
          color=palette.OrbitPalette.BLUE.value,
      )
      ax[2, 0].set_xlabel("lag")
      ax[2, 0].set_ylabel("acf")
  
      # plot 6 residual PACF
      sm.graphics.tsa.plot_pacf(
          df[residual_col].values,
          ax=ax[2, 1],
          title="Residual PACF",
          color=palette.OrbitPalette.BLUE.value,
      )
      ax[2, 1].set_xlabel("lag")
      ax[2, 1].set_ylabel("pacf")
      fig.tight_layout()
  
imports: import matplotlib.pyplot
  import seaborn
  import pandas
  import numpy
  import math
  import os
  import pkg_resources
  import statsmodels.api
  from scipy import stats
  from ..constants.constants import PredictionKeys
  from orbit.utils.general import is_empty_dataframe, is_ordered_datetime
  from ..constants.constants import BacktestFitKeys
  from ..constants.palette import PredictionPaletteClassic
  from orbit.constants import palette
  from orbit.diagnostics.metrics import smape
  from orbit.utils.plot import orbit_style_decorator
  from ..exceptions import PlotException
  import logging
label_desc: Use image node_id 7 for calling a global function with example usage: residual_diagnostic_plot(df, dist, date_col, residual_col, fitted_col, sparams) without return types