Performs a cyclical linear regression model
fluserf(data=NULL, outc=NULL, epi, time=NULL, period=52, echo=F, alpha=.05)
data | A dataframe class object, must contain time variable, epidemic indicator, and measure of influenza morbidity |
---|---|
outc | an unquoted name of a column in data which corresponds to the outcome variable of interest |
epi | an unquoted name of a column in data object (e.g. epi) or if null will default to Sept - May. |
time | an unquoted name of a column in data object, must be a numeric/integer class variable in dataframe which corresponds to a unit of time, must be unique (i.e. non-repeating) |
period | a numeric vector indicating period length, i.e. 52 weeks in year |
echo | A logical parameter, if T. Will print variables used in model. |
alpha | Specify level for one-sided test to compute upper limit interval. default is 0.05 |
an object of class data.frame, input + y0 (fitted values), y0_ul the upper serfling threshold
Serfling RE. Methods for current statistical analysis of excess pneumonia-influenza deaths. Public Health Rep. 1963 Jun; 78(6): 494 - 506. /urlhttps://www.ncbi.nlm.nih.gov/pmc/articles/PMC1915276/
require(flumodelr) fludta <- flumodelr::fludta flu_fit <- fluserf(fludta, outc = fludeaths, time = yrweek_dt) head(flu_fit)#> # A tibble: 6 x 12 #> year week fludeaths alldeaths perc_fludeaths yrweek_dt fluyr prop_flupos #> <int> <int> <int> <int> <dbl> <date> <int> <dbl> #> 1 1962 1 646 13033 4.96 1961-12-31 1961 NA #> 2 1962 2 663 13238 5.01 1962-01-07 1961 NA #> 3 1962 3 701 13324 5.26 1962-01-14 1961 NA #> 4 1962 4 646 13241 4.88 1962-01-21 1961 NA #> 5 1962 5 614 13044 4.71 1962-01-28 1961 NA #> 6 1962 6 609 13163 4.63 1962-02-04 1961 NA #> # ... with 4 more variables: week_in_order <int>, epi <lgl>, y0 <dbl>, #> # y0_ul <dbl>