class_docstr: Test for stationarity via the Kwiatkowski-Phillips-Schmidt-Shin Test.
  
  Uses ``statsmodels.tsa.stattools.kpss`` as a test for trend-stationarity,
  and derives a boolean statement whether a series is (trend-)stationary.
  
  Also returns test results for the trend-stationarity test as fitted parameters.
  
  Parameters
  ----------
  p_threshold : float, optional, default=0.05
      significance threshold to apply in testing for stationarity
  regression : str, one of {"c","ct","ctt","n"}, optional, default="c"
      Constant and trend order to include in regression.
  
      * "c" : constant only (default).
      * "ct" : constant and trend.
      * "ctt" : constant, and linear and quadratic trend.
      * "n" : no constant, no trend.
  
  nlags : str or int, optional, default="auto". If int, must be positive.
      Indicates the number of lags to be used internally in `kpss`.
      If "auto", lags is calculated using the data-dependent method of Hobijn et al
      (1998). See also Andrews (1991), Newey & West (1994), and Schwert (1989).
      If "legacy", uses int(12 * (n / 100)**(1 / 4)) , as outlined in Schwert (1989).
      If int, uses that exact number.
  
  Attributes
  ----------
  stationary_ : bool
      whether the series in ``fit`` is stationary according to the test
      more precisely, whether the null of the KPSS test is accepted at ``p_threshold``
  test_statistic_ : float
      The KPSS test statistic, of running ``kpss`` on ``y`` in ``fit``
  pvalue_ : float : float
      The p-value of the KPSS test, of running ``kpss`` on ``y`` in ``fit``.
      The p-value is interpolated from Table 1 in Kwiatkowski et al. (1992),
      and a boundary point is returned if the test statistic is outside the table of
      critical values, that is, if the p-value is outside the interval (0.01, 0.1).
  lags_ : int
      The truncation lag parameter.
  
  Examples
  --------
  >>> from sktime.datasets import load_airline
  >>> from sktime.param_est.stationarity import StationarityKPSS
  >>>
  >>> X = load_airline()  # doctest: +SKIP
  >>> sty_est = StationarityKPSS()  # doctest: +SKIP
  >>> sty_est.fit(X)  # doctest: +SKIP
  StationarityKPSS(...)
  >>> sty_est.get_fitted_params()["stationary"]  # doctest: +SKIP
  False
class_docstr_tok: ["Test","for","stationarity","via","the","Kwiatkowski-Phillips-Schmidt-Shin","Test",".","Uses","``","statsmodels.tsa.stattools.kpss","``","as","a","test","for","trend-stationarity",",","and","derives","a","boolean","statement","whether","a","series","is","(","trend-",")","stationary",".","Also","returns","test","results","for","the","trend-stationarity","test","as","fitted","parameters",".","Parameters","--","--","--","--","--","p_threshold",":","float",",","optional",",","default=0.05","significance","threshold","to","apply","in","testing","for","stationarity","regression",":","str",",","one","of","{","``","c","''",",","''","ct","''",",","''","ctt","''",",","''","n","''","}",",","optional",",","default=","''","c","''","Constant","and","trend","order","to","include","in","regression",".","*","``","c","''",":","constant","only","(","default",")",".","*","``","ct","''",":","constant","and","trend",".","*","``","ctt","''",":","constant",",","and","linear","and","quadratic","trend",".","*","``","n","''",":","no","constant",",","no","trend",".","nlags",":","str","or","int",",","optional",",","default=","''","auto","''",".","If","int",",","must","be","positive",".","Indicates","the","number","of","lags","to","be","used","internally","in","`","kpss","`",".","If","``","auto","''",",","lags","is","calculated","using","the","data-dependent","method","of","Hobijn","et","al","(","1998",")",".","See","also","Andrews","(","1991",")",",","Newey","&","West","(","1994",")",",","and","Schwert","(","1989",")",".","If","``","legacy","''",",","uses","int","(","12","*","(","n","\/","100",")","*","*","(","1","\/","4",")",")",",","as","outlined","in","Schwert","(","1989",")",".","If","int",",","uses","that","exact","number",".","Attributes","--","--","--","--","--","stationary_",":","bool","whether","the","series","in","``","fit","``","is","stationary","according","to","the","test","more","precisely",",","whether","the","null","of","the","KPSS","test","is","accepted","at","``","p_threshold","``","test_statistic_",":","float","The","KPSS","test","statistic",",","of","running","``","kpss","``","on","``","y","``","in","``","fit","``","pvalue_",":","float",":","float","The","p-value","of","the","KPSS","test",",","of","running","``","kpss","``","on","``","y","``","in","``","fit","``",".","The","p-value","is","interpolated","from","Table","1","in","Kwiatkowski","et","al",".","(","1992",")",",","and","a","boundary","point","is","returned","if","the","test","statistic","is","outside","the","table","of","critical","values",",","that","is",",","if","the","p-value","is","outside","the","interval","(","0.01",",","0.1",")",".","lags_",":","int","The","truncation","lag","parameter",".","Examples","--","--","--","--",">",">",">","from","sktime.datasets","import","load_airline",">",">",">","from","sktime.param_est.stationarity","import","StationarityKPSS",">",">",">",">",">",">","X","=","load_airline","(",")","#","doctest",":","+SKIP",">",">",">","sty_est","=","StationarityKPSS","(",")","#","doctest",":","+SKIP",">",">",">","sty_est.fit","(","X",")","#","doctest",":","+SKIP","StationarityKPSS","(","...",")",">",">",">","sty_est.get_fitted_params","(",")","[","``","stationary","''","]","#","doctest",":","+SKIP","False"]
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.tsa.stattools import kpss
  
      p_threshold = self.p_threshold
  
      res = kpss(
          x=X,
          regression=self.regression,
          nlags=self.nlags,
      )
      self.test_statistic_ = res[0]
      self.pvalue_ = res[1]
      self.stationary_ = res[1] > p_threshold
      self.lags_ = res[2]
  
      return self
  
file_path: sktime/sktime/param_est/stationarity/_statsmodels.py
imports: from sktime.param_est.base import BaseParamFitter
label_desc: Use image node_id 2 for calling the StationarityKPSS obj's underlying member method code with example usage: obj._fit(X) and returns: self