predict_trend

predict_trend(fit_result: Dict[str, Union[lmfit.model.ModelResult, pandas.core.frame.DataFrame]], days_to_predict: int = 30, func_options: dict = {}, param_inverted_stderr: Iterable[str] = [], brute_force_extrema: bool = False) → pandas.core.frame.DataFrame[source]

Generic function to predict a trend from fitted data

Parameters
  • fit_result (Dict[str, Union[lmfit.model.ModelResult, pd.DataFrame]]) – result of fit_data_model or its implementation

  • days_to_predict (int, optional) – number of days to predict a trend for, by default 30

  • func_options (dict, optional) – options for the function of model, by default {}

  • param_inverted_stderr (Iterable[str], optional) – iterable of parameternames with should be inverted, to calculate the extrema. , by default []

  • brute_force_extrema (bool, optional) – Whether or not to calculate supremum and infimum from all permutations of adding and subtracting the errors from the parameters. For some functions, i.e. the logistic curve, this is needed, since simply adding or subtracting the errors from the parameter can lead to supremum and/or infimum to cross the result with the exact parameters., by default False

Returns

DataFrame with columns “date”, “trend”, “trend_sup” and “trend_inf”

date: pd.Datetime

date of the values

trend: float

predicted trend

trend_sup: float

supremum of the trend

trend_inf: float

infimum of the trend

Return type

pd.DataFrame

See also

fit_data_model(), calc_extrema(), params_to_df()