class_docstr: Find candidate seasonality parameter using autocorrelation function LB q-stat.
  
  Uses `statsmodels.tsa.stattools.act` for computing the autocorrelation function,
  and uses its testing functionality to determine candidate seasonality parameters.
  ("seasonality parameter" are integer lags, and abbreviated by sp, below)
  
  Obtains Ljung-Box q-statistic to test for candidate sp at `candidate_sp`.
  
  Then applies `statsmodels.stats.multitest.multipletests` to correct multiple tests.
  Fitted attributes returned are significant sp and the most significant sp.
  These can be used in conditional or unconditional deseasonalization.
  
  Note: this should be applied to stationary series.
      Quick stationarity transformation can be achieved by differencing.
      See also: Differencer
  
  Parameters
  ----------
  candidate_sp : None, int or list of int, optional, default = None
      candidate sp to test, and to restrict tests to; ints must be 2 or larger
      if None, will test all integer lags between 2 and `nlags` (inclusive)
  p_threshold : float, optional, default=0.05
      significance threshold to apply in testing for seasonality
  p_adjust : str, optional, default="fdr_by" (Benjamini/Yekutieli)
      multiple testing correction applied to p-values of candidate sp in acf test
      multiple testing correction is applied to Ljung-Box tests on candidate_sp
      values can be "none" or strings accepted by `statsmodels` `multipletests`
      "none" = no multiple testim correction is applied, raw p-values are used
      "fdr_by" = Benjamini-Yekutieli FDR control procedure
      for other possible strings, see `statsmodels.stats.multitest.multipletests`
  adjusted : bool, optional, default=False
      If True, then denominators for autocovariance are n-k, otherwise n.
  nlags : int, optional, default=None
      Number of lags to compute autocorrelations for and select from.
      At default None, uses `min(10 * np.log10(nobs), nobs - 1)`.
      Will be ignored if `candidate_sp` is provided.
  fft : bool, optional, default=True
      If True, computes the ACF via FFT.
  missing : str, ["none", "raise", "conservative", "drop"], optional, default="none"
      Specifies how NaNs are to be treated.
      "none" performs no checks.
      "raise" raises an exception if NaN values are found.
      "drop" removes the missing observations and treats non-missing as contiguous.
      "conservative" computes the autocovariance using nan-ops so that nans are
          removed when computing the mean and cross-products that are used to
          estimate the autocovariance. When using "conservative",
          n is set to the number of non-missing observations.
  
  Attributes
  ----------
  sp_ : int, seasonality period at lowest p-level, if any sub-threshold, else 1
      if `candidate_sp` is passed, will be in `candidate_sp` or 1
  sp_significant_ : list of int, seasonality periods with sub-threshold p-levels
      ordered increasingly by p-level. Empty list, not [1], if none are sub-threshold
  
  Examples
  --------
  >>> from sktime.datasets import load_airline
  >>> from sktime.param_est.seasonality import SeasonalityACFqstat
  >>> X = load_airline().diff()[1:]
  >>> sp_est = SeasonalityACFqstat(candidate_sp=[3, 7, 12])  # doctest: +SKIP
  >>> sp_est.fit(X)  # doctest: +SKIP
  SeasonalityACFqstat(...)
  >>> sp_est.get_fitted_params()["sp_significant"]  # doctest: +SKIP
  array([12,  7,  3])
class_docstr_tok: ["Find","candidate","seasonality","parameter","using","autocorrelation","function","LB","q-stat",".","Uses","`","statsmodels.tsa.stattools.act","`","for","computing","the","autocorrelation","function",",","and","uses","its","testing","functionality","to","determine","candidate","seasonality","parameters",".","(","``","seasonality","parameter","''","are","integer","lags",",","and","abbreviated","by","sp",",","below",")","Obtains","Ljung-Box","q-statistic","to","test","for","candidate","sp","at","`","candidate_sp","`",".","Then","applies","`","statsmodels.stats.multitest.multipletests","`","to","correct","multiple","tests",".","Fitted","attributes","returned","are","significant","sp","and","the","most","significant","sp",".","These","can","be","used","in","conditional","or","unconditional","deseasonalization",".","Note",":","this","should","be","applied","to","stationary","series",".","Quick","stationarity","transformation","can","be","achieved","by","differencing",".","See","also",":","Differencer","Parameters","--","--","--","--","--","candidate_sp",":","None",",","int","or","list","of","int",",","optional",",","default","=","None","candidate","sp","to","test",",","and","to","restrict","tests","to",";","ints","must","be","2","or","larger","if","None",",","will","test","all","integer","lags","between","2","and","`","nlags","`","(","inclusive",")","p_threshold",":","float",",","optional",",","default=0.05","significance","threshold","to","apply","in","testing","for","seasonality","p_adjust",":","str",",","optional",",","default=","''","fdr_by","''","(","Benjamini\/Yekutieli",")","multiple","testing","correction","applied","to","p-values","of","candidate","sp","in","acf","test","multiple","testing","correction","is","applied","to","Ljung-Box","tests","on","candidate_sp","values","can","be","``","none","''","or","strings","accepted","by","`","statsmodels","`","`","multipletests","`","``","none","''","=","no","multiple","testim","correction","is","applied",",","raw","p-values","are","used","``","fdr_by","''","=","Benjamini-Yekutieli","FDR","control","procedure","for","other","possible","strings",",","see","`","statsmodels.stats.multitest.multipletests","`","adjusted",":","bool",",","optional",",","default=False","If","True",",","then","denominators","for","autocovariance","are","n-k",",","otherwise","n.","nlags",":","int",",","optional",",","default=None","Number","of","lags","to","compute","autocorrelations","for","and","select","from",".","At","default","None",",","uses","`","min","(","10","*","np.log10","(","nobs",")",",","nobs","-","1",")","`",".","Will","be","ignored","if","`","candidate_sp","`","is","provided",".","fft",":","bool",",","optional",",","default=True","If","True",",","computes","the","ACF","via","FFT",".","missing",":","str",",","[","``","none","''",",","``","raise","''",",","``","conservative","''",",","``","drop","''","]",",","optional",",","default=","''","none","''","Specifies","how","NaNs","are","to","be","treated",".","``","none","''","performs","no","checks",".","``","raise","''","raises","an","exception","if","NaN","values","are","found",".","``","drop","''","removes","the","missing","observations","and","treats","non-missing","as","contiguous",".","``","conservative","''","computes","the","autocovariance","using","nan-ops","so","that","nans","are","removed","when","computing","the","mean","and","cross-products","that","are","used","to","estimate","the","autocovariance",".","When","using","``","conservative","''",",","n","is","set","to","the","number","of","non-missing","observations",".","Attributes","--","--","--","--","--","sp_",":","int",",","seasonality","period","at","lowest","p-level",",","if","any","sub-threshold",",","else","1","if","`","candidate_sp","`","is","passed",",","will","be","in","`","candidate_sp","`","or","1","sp_significant_",":","list","of","int",",","seasonality","periods","with","sub-threshold","p-levels","ordered","increasingly","by","p-level",".","Empty","list",",","not","[","1","]",",","if","none","are","sub-threshold","Examples","--","--","--","--",">",">",">","from","sktime.datasets","import","load_airline",">",">",">","from","sktime.param_est.seasonality","import","SeasonalityACFqstat",">",">",">","X","=","load_airline","(",")",".diff","(",")","[","1",":","]",">",">",">","sp_est","=","SeasonalityACFqstat","(","candidate_sp=","[","3",",","7",",","12","]",")","#","doctest",":","+SKIP",">",">",">","sp_est.fit","(","X",")","#","doctest",":","+SKIP","SeasonalityACFqstat","(","...",")",">",">",">","sp_est.get_fitted_params","(",")","[","``","sp_significant","''","]","#","doctest",":","+SKIP","array","(","[","12",",","7",",","3","]",")"]
docstr: Fit estimator and estimate parameters.
  
  private _fit containing the core logic, called from fit
  
  Writes to self:
      Sets fitted model attributes ending in "_".
  
  Parameters
  ----------
  X : guaranteed to be of a type in self.get_tag("X_inner_mtype")
      Time series to which to fit the estimator.
  
  Returns
  -------
  self : reference to self
docstr_tok: ["Fit","estimator","and","estimate","parameters",".","private","_fit","containing","the","core","logic",",","called","from","fit","Writes","to","self",":","Sets","fitted","model","attributes","ending","in","``","_","''",".","Parameters","--","--","--","--","--","X",":","guaranteed","to","be","of","a","type","in","self.get_tag","(","``","X_inner_mtype","''",")","Time","series","to","which","to","fit","the","estimator",".","Returns","--","--","--","-","self",":","reference","to","self"]
code: def _fit(self, X):
      """Fit estimator and estimate parameters.
  
      private _fit containing the core logic, called from fit
  
      Writes to self:
          Sets fitted model attributes ending in "_".
  
      Parameters
      ----------
      X : guaranteed to be of a type in self.get_tag("X_inner_mtype")
          Time series to which to fit the estimator.
  
      Returns
      -------
      self : reference to self
      """
      from statsmodels.stats.multitest import multipletests
      from statsmodels.tsa.stattools import acf
  
      p_threshold = self.p_threshold
      p_adjust = self.p_adjust
      adjusted = self.adjusted
  
      p_threshold = self.p_threshold
      adjusted = self.adjusted
  
      nlags = self.nlags
      if nlags is None:
          nobs = len(X)
          nlags = min(10 * np.log10(nobs), nobs - 1)
          nlags = int(nlags)
  
      candidate_sp = self.candidate_sp
      if candidate_sp is None:
          candidate_sp = range(2, nlags + 1)
      elif isinstance(candidate_sp, int):
          candidate_sp = [candidate_sp]
  
      fft = self.fft
      missing = self.missing
  
      acf_series, confint, qstat, pvalues = acf(
          x=X,
          adjusted=adjusted,
          nlags=nlags,
          fft=fft,
          missing=missing,
          alpha=p_threshold,
          qstat=True,
      )
      self.acf_ = acf_series
      self.confint_ = confint
      self.qstat_ = qstat
      self.pvalues_ = pvalues
  
      if candidate_sp is not None:
          qstat_cand = qstat[candidate_sp]
          pvalues_cand = pvalues[candidate_sp]
      else:
          qstat_cand = qstat
          pvalues_cand = pvalues
          candidate_sp = range(2, nlags + 1)
  
      self.qstat_cand_ = qstat_cand
      self.pvalues_cand = pvalues_cand
  
      if p_adjust != "none":
          reject_cand, pvals_adj, _, _ = multipletests(
              pvals=pvalues_cand, alpha=p_threshold, method=p_adjust
          )
          self.pvalues_adjusted_ = pvals_adj
      else:
          self.pvalues_adjusted_ = pvalues_cand
          reject_cand = pvalues_cand > p_threshold
  
      sorting = np.argsort(pvalues_cand)
      reject_ordered = reject_cand[sorting]
      sp_ordered = np.array(candidate_sp)[sorting]
      sp_significant = sp_ordered[reject_ordered]
  
      if len(sp_significant) > 0:
          self.sp_ = sp_significant[0]
          self.sp_significant_ = sp_significant
      else:
          self.sp_ = 1
          self.sp_significant_ = []
  
      return self
  
file_path: sktime/sktime/param_est/seasonality.py
imports: import numpy
  from sktime.param_est.base import BaseParamFitter
label_desc: Use image node_id 2 for calling the SeasonalityACFqstat obj's underlying member method code with example usage: obj._fit(X) and returns: self