set_cp_poly: set_cp_poly

View source: R/cp_functions.R

set_cp_polyR Documentation

set_cp_poly

Description

Set a change point and fit a model with a specified polynomial order on data prior to the change point to obtian expected SSD visits/calculate misses

Usage

set_cp_poly(
  data,
  var_name = "n_miss_visits",
  return_miss_only = FALSE,
  return_eval_only = FALSE,
  week_period = FALSE,
  specify_cp = NULL,
  poly_order = "linear",
  use_orthogonal_poly = FALSE
)

Arguments

data

A dataframe output by count_prior_events_truven

var_name

A character string of outcome for which to apply analysis

return_miss_only

Logical to only return miss information

return_eval_only

Logical to only return model evaluation criteria info

week_period

Logical to incorporate a "day of the week" effect into model. Note this is only sensible for one-day period aggregation.

specify_cp

A postive integer value for the specific change point you want to use. The value represents the days before the index on which you you want to specify the change point. (e.g. 100 would be 100 days before the index)

poly_order

The polynomial order you want to apply (i.e. 'linear', 'quadratic', 'cubic', 'quartic', 'quintic', or 'sextic')

use_orthogonal_poly

A logical to use raw or orthogonal polynomials. TRUE uses orthogonal polynomials. not raw

Value

A list containing miss information, changepoint information, predictions, the model itself, and a plot of the middle finger curve and model


aarmiller/delaySim documentation built on Jan. 2, 2023, 11:23 p.m.