buildRegressionEstimateTable: Run DHS analysis at a top level

View source: R/library--analysis_tools--DHS_methods--regression_algo.R

buildRegressionEstimateTableR Documentation

Run DHS analysis at a top level

Description

buildRegressionEstimateTable is used to create a data frame that has the predicted categorization as laid out by the DHS. For each RunOn var supplied It uses the var to create a 5 day lm fit and uses the percent change to bin the results into 5 categories, "major decrease", "moderate decrease", "fluctuating", "moderate increase", and "major increase". If the model P-value if over .3 the category is replaced with "no change"

Usage

buildRegressionEstimateTable(
  DataMod,
  RunOn = "sars_cov2_adj_load_log10",
  SplitOn = "site",
  DaysRegressed = 5,
  verbose = FALSE,
  PSigTest = TRUE
)

Arguments

DataMod

The DF containing the col RunOn + date

RunOn

The col names of the values we wish to run

SplitOn

A category to separate to create independent TS data

DaysRegressed

number of days used in each regression

verbose

Bool on whether it should print out what group it is on

PSigTest

When categorizing if it should reject high pVals

Value

A DF with the associated Date and DHS analysis

Examples

library(dplyr)
data(Example_data, package = "Covid19Wastewater")
Example_data <- Example_data[Example_data$site == 'Janesville',]
Example_log_data <- mutate(Example_data, log_geo_mean = log10(geo_mean + 1))
head(buildRegressionEstimateTable(Example_log_data, SplitOn = "site", 
                                           RunOn = "log_geo_mean"))

Covid19Wastewater documentation built on Aug. 25, 2023, 1:07 a.m.