The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Quick Start Guide to Using Prophet

Sean J. Taylor and Ben Letham

2026-01-22

This document provides a very brief introduction to the Prophet API. For a detailed guide on using Prophet, please visit the main site at https://facebook.github.io/prophet/.

Prophet uses the normal model fitting API. We provide a prophet function that performs fitting and returns a model object. You can then call predict and plot on this model object.

First we read in the data and create the outcome variable.

library(readr)
df <- read_csv('../tests/testthat/data.csv')
#> Rows: 510 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl  (1): y
#> date (1): ds
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

We call the prophet function to fit the model. The first argument is the historical dataframe. Additional arguments control how Prophet fits the data.

m <- prophet(df)
#> Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.

We need to construct a dataframe for prediction. The make_future_dataframe function takes the model object and a number of periods to forecast:

future <- make_future_dataframe(m, periods = 365)
head(future)
#>           ds
#> 1 2012-05-18
#> 2 2012-05-21
#> 3 2012-05-22
#> 4 2012-05-23
#> 5 2012-05-24
#> 6 2012-05-25

As with most modeling procedures in R, we use the generic predict function to get our forecast:

forecast <- predict(m, future)
head(forecast)
#>           ds    trend additive_terms additive_terms_lower additive_terms_upper
#> 1 2012-05-18 42.02262      -5.622539            -5.622539            -5.622539
#> 2 2012-05-21 41.44858      -6.543832            -6.543832            -6.543832
#> 3 2012-05-22 41.25723      -6.684730            -6.684730            -6.684730
#> 4 2012-05-23 41.06588      -6.797414            -6.797414            -6.797414
#> 5 2012-05-24 40.87454      -6.870814            -6.870814            -6.870814
#> 6 2012-05-25 40.68319      -7.213554            -7.213554            -7.213554
#>      weekly weekly_lower weekly_upper    yearly yearly_lower yearly_upper
#> 1 0.8968967    0.8968967    0.8968967 -6.519435    -6.519435    -6.519435
#> 2 0.6338415    0.6338415    0.6338415 -7.177673    -7.177673    -7.177673
#> 3 0.7232570    0.7232570    0.7232570 -7.407987    -7.407987    -7.407987
#> 4 0.8440252    0.8440252    0.8440252 -7.641439    -7.641439    -7.641439
#> 5 1.0054458    1.0054458    1.0054458 -7.876260    -7.876260    -7.876260
#> 6 0.8968967    0.8968967    0.8968967 -8.110451    -8.110451    -8.110451
#>   multiplicative_terms multiplicative_terms_lower multiplicative_terms_upper
#> 1                    0                          0                          0
#> 2                    0                          0                          0
#> 3                    0                          0                          0
#> 4                    0                          0                          0
#> 5                    0                          0                          0
#> 6                    0                          0                          0
#>   yhat_lower yhat_upper trend_lower trend_upper     yhat
#> 1   33.12859   40.08802    42.02262    42.02262 36.40008
#> 2   31.51841   38.25386    41.44858    41.44858 34.90475
#> 3   31.51079   38.22438    41.25723    41.25723 34.57250
#> 4   30.96947   37.76340    41.06588    41.06588 34.26847
#> 5   30.28379   37.13246    40.87454    40.87454 34.00372
#> 6   30.18588   37.10008    40.68319    40.68319 33.46964

You can use the generic plot function to plot the forecast, but you must also pass the model in to be plotted:

plot(m, forecast)

You can plot the components of the forecast using the prophet_plot_components function:

prophet_plot_components(m, forecast)
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#> ℹ Please use tidy evaluation idioms with `aes()`.
#> ℹ See also `vignette("ggplot2-in-packages")` for more information.
#> ℹ The deprecated feature was likely used in the prophet package.
#>   Please report the issue at <https://github.com/facebook/prophet/issues>.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.