statsmodels.tsa.tsatools.add_trend#
- statsmodels.tsa.tsatools.add_trend(x, trend='c', prepend=False, has_constant='skip')[source]#
Add a trend and/or constant to an array
- Parameters:
- xarray_like
Original array of data.
- trend{‘n’, ‘c’, ‘t’, ‘ct’, ‘ctt’},
optional The trend to add.
‘n’ add no trend.
‘c’ add constant only.
‘t’ add trend only.
‘ct’ add constant and linear trend.
‘ctt’ add constant and linear and quadratic trend.
- prependbool,
optional If True, prepends the new data to the columns of X.
- has_constant{‘raise’, ‘add’, ‘skip’},
optional Controls what happens when trend is ‘c’ and a constant column already exists in x. ‘raise’ will raise an error. ‘add’ will add a column of 1s. ‘skip’ will return the data without change. ‘skip’ is the default.
- Returns:
See also
statsmodels.tools.tools.add_constantAdd a constant column to an array.
Notes
Returns columns as [‘ctt’,’ct’,’c’] whenever applicable. There is currently no checking for an existing trend.