find_cp_linreg: Find the change point in count data using linear regression...

Description Usage Arguments Examples

View source: R/cp_functions.R

Description

Find the change point in count data using linear regression models

Usage

1
2
3
4
5
6
7
8
9
find_cp_linreg(
  data,
  var_name = "n_miss_visits",
  method = "lm",
  eval_criteria = "AIC",
  return_miss_only = FALSE,
  specify_cp = NULL,
  week_period = FALSE
)

Arguments

data

A dataset of visit counts

var_name

The name of the count variable to find the change-point for

method

The method used to fit curves before and after the changepoint. Options include "lm", "lm_quad", "lm_cube", "quad", "cube", "exp", "spline"

eval_criteria

The evaluation criteria used to find change points

return_miss_only

Logical argument to only return the tibbles of miss visit counts

specify_cp

Set a specific change point you want to use instead of searching for optimal change point. Enter a postive integer value repersenting 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)

week_period

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

Examples

1
2
3
cp_result_original <- final_time_map %>%
count_prior_events_truven(event_name = "any_ssd", start_day = 1, by_days = 1) %>%
find_cp_linreg(var_name="n_miss_visits", method="lm_cube")

aarmiller/delayDX documentation built on July 11, 2021, 4:01 p.m.