build_model: Build a Model for E.Coli

Description Usage Arguments Details Value Functions Examples

View source: R/build_model.R

Description

Functions for modelbuilding \n build_model: takes the riverdata, handles the other functions and invokes stan_lm

Usage

1
2
3
4
5
6
7
8
build_model(riverdata, variables = ask_for_variables(riverdata),
  with_interaction = TRUE)

ask_for_variables(riverdata)

process_model_riverdata(riverdata, variables)

create_formula(variables, with_interaction = FALSE)

Arguments

riverdata

a list with riverdata (hygiene + physical data)

variables

character. Selected variables for the model

with_interaction

logical. Formula with interactions? Default set to TRUE

Details

Build the model from hygiene data and physical data like flow, rain, wwtp. Asks for user input to select variables. Computes the data.frame with data for hygiene and chosen variables and creates a formula of the form: Q*(K + R) while multiple Qs will be multiplied, multiple Ks and Rs will be added.

Value

Returns a model of the riverdata.

Returns a character-vector with the chosen model variables

Returns a data.frame with data for hygiene and chosen variables

Returns parsed model-formula. (Like model$formula)

Functions

Examples

1
2
3
4
5
6
7
## Not run: variables <- c("e.coli","q_havel",...)
lm(formula = eval(create_formula(variables)),
data = process_model_riverdata(riverdata, variables))
## End(Not run)

create_formula(c("log_e.coli","q_havel","ka_ruhleben","r_berlin"))
create_formula(c("e.coli","r_mitte","r_charlottenburg","r_spandau"))

KWB-R/kwb.flusshygiene documentation built on Oct. 30, 2019, 8:08 p.m.