gr_plot_tests {grwat}R Documentation

Plot change year density

Description

The function extracts change years from results of gr_test_vars() and plots their probability density. Since for every variable the change year is individual, this procedure allows finding the one most probable year, which is the mode of the distribution. This year is highlighted by the line and labeled on the plot.

Usage

gr_plot_tests(tests, type = "year", print = TRUE)

Arguments

tests

list of tests generated by gr_test_vars().

type

Character string type of the plot. Currently only 'year' is supported, which means that the distribution density of the change year detected by Pettitt test is visualized. Ignored until other types are implemented.

print

Boolean. Print plot? Defaults to TRUE. Use FALSE if you want to tweak the plot aesthetics before plotting.

Value

ggplot2 object representing the selected type of the tested variable

Examples

library(grwat)

data(spas) # example Spas-Zagorye data is included with grwat package

# separate
sep = gr_separate(spas, params = gr_get_params(reg = 'center'))

# summarize from 1965 to 1990
vars = gr_summarize(sep, 1965, 1990)

# test all variables
tests = gr_test_vars(vars)

# plot change year from Pettitt test
gr_plot_tests(tests, type = 'year')

[Package grwat version 0.0.4 Index]