ts_qq_plot: Time Series Model QQ Plot

View source: R/ts-qq-plot.R

ts_qq_plotR Documentation

Time Series Model QQ Plot

Description

This takes in a calibration tibble and will produce a QQ plot.

Usage

ts_qq_plot(.calibration_tbl, .model_id = NULL, .interactive = FALSE)

Arguments

.calibration_tbl

A calibrated modeltime table.

.model_id

The id of a particular model from a calibration tibble. If there are multiple models in the tibble and this remains NULL then the plot will be returned using ggplot2::facet_grid(~ .model_id)

.interactive

A boolean with a default value of FALSE. TRUE will produce an interactive plotly plot.

Details

This takes in a calibration tibble and will create a QQ plot. You can also pass in a model_id and a boolean for interactive which will return a plotly::ggplotly interactive plot.

Value

A QQ plot.

Author(s)

Steven P. Sanderson II, MPH

See Also

https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot

Other Plot: ts_brownian_motion_plot(), ts_event_analysis_plot(), ts_scedacity_scatter_plot()

Other Utility: auto_stationarize(), calibrate_and_plot(), internal_ts_backward_event_tbl(), internal_ts_both_event_tbl(), internal_ts_forward_event_tbl(), model_extraction_helper(), ts_get_date_columns(), ts_info_tbl(), ts_is_date_class(), ts_lag_correlation(), ts_model_auto_tune(), ts_model_compare(), ts_model_rank_tbl(), ts_model_spec_tune_template(), ts_scedacity_scatter_plot(), ts_to_tbl(), util_difflog_ts(), util_doublediff_ts(), util_doubledifflog_ts(), util_log_ts(), util_singlediff_ts()

Examples

# NOT RUN
## Not run: 
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(timetk))
suppressPackageStartupMessages(library(modeltime))
suppressPackageStartupMessages(library(rsample))
suppressPackageStartupMessages(library(workflows))
suppressPackageStartupMessages(library(parsnip))
suppressPackageStartupMessages(library(recipes))

data_tbl <- ts_to_tbl(AirPassengers) %>%
  select(-index)

splits <- time_series_split(
  data_tbl,
  date_var = date_col,
  assess = "12 months",
  cumulative = TRUE
)

rec_obj <- recipe(value ~ ., training(splits))

model_spec_arima <- arima_reg() %>%
  set_engine(engine = "auto_arima")

model_spec_mars <- mars(mode = "regression") %>%
  set_engine("earth")

wflw_fit_arima <- workflow() %>%
  add_recipe(rec_obj) %>%
  add_model(model_spec_arima) %>%
  fit(training(splits))

wflw_fit_mars <- workflow() %>%
  add_recipe(rec_obj) %>%
  add_model(model_spec_mars) %>%
  fit(training(splits))

model_tbl <- modeltime_table(wflw_fit_arima, wflw_fit_mars)

calibration_tbl <- model_tbl %>%
  modeltime_calibrate(new_data = testing(splits))

ts_qq_plot(calibration_tbl)


## End(Not run)


spsanderson/healthyR.ts documentation built on Jan. 19, 2024, 10:02 p.m.