Arima_drop_state: fit ARIMA model to US data dropping one state

Description Usage Arguments Value Note Examples

View source: R/Arima.R

Description

fit ARIMA model to US data dropping one state

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Arima_drop_state(
  src_us,
  src_st,
  state.in = "New York",
  MAorder = 2,
  Difforder = 1,
  basedate = "2020-02-15",
  lookback_days = 29,
  ARorder = 0,
  max_date = NULL
)

Arguments

src_us

tibble for national level data like that of enriched_jhu_data()

src_st

tibble for state level data like that of nytimes_state_data()

state.in

character(1) state name

MAorder

numeric(1) order of moving average component

Difforder

numeric(1) differencing order d of ARIMA(p,d,q)

basedate

character(1) used by lubridate::as_date to filter away all earlier records

lookback_days

numeric(1) only uses this many days from most recent in src

ARorder

order of autoregressive component

max_date

a date from which to start lookback ... defaults to NULL in which case the latest available date is used

Value

instance of S3 class Arima_sars2pack

Note

Apparent discrepancies in counts in vicinity of April 15 between NYT and JHU for full US incidence lead us to employ the two sources for the example. If NYT alone is used, summing to obtain USA overall, the resulting USA incidence trend is extravagantly variable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ej = enriched_jhu_data()
usa_full = Arima_nation(ej)
plot(usa_full)
nyd = nytimes_state_data()
drny = Arima_drop_state(ej, nyd)
drny
plot(drny)
opar = par(no.readonly=TRUE)
par(mar=c(4,3,2,2), mfrow=c(1,2))
plot(usa_full, main="all states", ylim=c(17000,38000))
plot(drny, main="excluding NY", ylim=c(17000,38000))
par(opar)

vjcitn/sars2app documentation built on Jan. 3, 2022, 12:19 a.m.