R/kwb.flusshygiene.R
kwb.flusshygiene.RdThe kwb.flusshygiene package provides functions in three major categories: model handling, model creation and model prediction.
river_model_predictionis the main function in this package. It uses all of the following functions from within.
get_pathsreads a serverpath library for easy directory accessing
search_existing_modelssearches saved R-objects in the river directories.
build_new_modelagain a overhead function for model creation. Asks the user whether or not the new model shall be saved as R-object.
import_riverdatareads all river data from a directory.
build_modelis a small function
handling model creation and invokes stan_lm for
model building.
ask_for_variablesasks the user which variables shall be included in the model. Creates plots as a side effect.
process_model_riverdataprocesses a data.frame with
the necessary data for the data argument in
stan_lm
create_formulacreates a hygiene formula out of the
variables with the form e.coli ~ Q * (R + Ka)
predict_qualityis
the overhead function for the prediction. It also invokes
posterior_predict.stanreg
get_newdatagathers the latest data for prediction.
print_latestprints the prediction of the latest day.
plot_predicted_qualityplots a whole season with quality assessment.
unroll_physical_dataunrolls a list with data with lagday combinations to 5 days (default)
correlation_scatterplotplots a scatterplot matrix of the unrolled physical data together with correlation values.
plot_stan_modelplots a stan_lm posterior predction with quality assessment.
plot_data_overviewplot data overview
plot_hygiene_overviewa statistical hygiene data overview
plot_q_overviewplot a overview of all q values
plot_rain_overviewplot a monthly overview of all rain gauges