Learn R Programming

MultivariateTrendAnalysis (version 0.1.3)

plotTrend: Trend Tests Plots

Description

Informative plots on the given data series in regards to univariate and multivariate trend testing.

Usage

plotTrend(
  data,
  covar = NULL,
  width,
  graph = c("summary", "variable1", "variable2", "window"),
  color = c("blue", "dark", "green", "warm")
)

Value

The specified plot.

Arguments

data

Numeric matrix, a two dimensional data set where each column is a variable.

covar

Numeric vector, optional covariate vector, must be the same length as data. Default is NULL.

width

Integer, the width to be used for the moving window algorithm. Should be bigger than 1 and smaller than the number of observations.

graph

Character vector, what will be plotted. Options are:

  • "summary", creates line plots of each variable, Kendall tau with moving window, and the results from the tests.

  • "variable1", creates a line plot of the first variable.

  • "variable2", creates a line plot of the second variable.

  • "window", creates scatter plot of Kendall tau using moving window.

Default is "summary".

color

Character vector, plot color theme. Options are: "blue", "dark", "green", and "warm".

Details

The function is able to do three plots: "window" returns the scatter plot of Kendall \(\tau\) with the moving window technique, "variable1" and "variable2" return the line plots for each variable against the covariate or "Time", finally "summary" returns the previous plot combined in the same display. Four color profiles are available .

References

Goutali, D., and Chebana, F. (2024). Multivariate overall and dependence trend tests, applied to hydrology, Environmental Modelling & Software, 179, tools:::Rd_expr_doi("10.1016/j.envsoft.2024.106090")

See Also

  • kendall.tau : Function from the package VGAM used for computing the bivariate Kendall's \(\tau\).

  • rollapply : Function from the package zoo used to apply the moving window technique.

Examples

Run this code

# \donttest{
# Sample data:
dataDependenceStructure <- generate_data("dependenceStructure", 50)
dataMarginalTrend <- generate_data("marginalTrend", 50)
dataNoTrend <- generate_data("noTrend", 50)

# Plot Trend summary:
plotTrend(dataDependenceStructure, covar = NULL, width = 10, graph = "summary", color = "blue")

plotTrend(dataMarginalTrend, covar = NULL, width = 10, graph = "summary", color = "green")

plotTrend(dataNoTrend, covar = NULL, width = 10, graph = "summary", color = "warm")

# Plot a variable
plotTrend(dataMarginalTrend, width = 10, graph = "variable1", color = "green")

# Plot the evolution of Kendall tau
plotTrend(dataDependenceStructure, width = 10, graph = "window", color = "warm")
# }


Run the code above in your browser using DataLab