compare_eff: Graphically Compare Classical with Robust GMWM Models

Description Usage Arguments Constraints on gmwm objects How to change CI.color and facet.label How to change other graphical aesthetics Other details Author(s) Examples

Description

Creates a table of graphs to compare GMWM models constructed by classical and robust methods.

Usage

1
2
3
4
5
6
7
8
compare_eff(..., display.eff = T, order.eff = T, facet.label = NULL,
  background = "white", transparence = 0.05, CI.color = NULL,
  line.color = NULL, line.type = NULL, point.size = NULL,
  point.shape = NULL, title = NULL, title.size = 18,
  axis.label.size = 16, axis.tick.size = 11, facet.label.size = 13,
  facet.label.background = "#003C7D33",
  axis.x.label = expression(paste("Scale ", tau)),
  axis.y.label = expression(paste("Wavelet Variance ", nu)))

Arguments

...

Several gmwm objects, and they must be constrcuted by the same data and same model. Or one rgmwm object created by rgmwm function.

display.eff

A boolean indicating whether the classical/robust method with efficiency should be displayed in the facet label. It is only used when facet.label is NULL.

order.eff

A boolean indicating whether the object should be ordered by their efficiency value.

facet.label

A character vector indicating what should be displayed in the facet labels.

background

A string that determines the graph background. It can be 'grey' or 'white'.

transparence

A double between 0 to 1 that controls the transparency of confidence interval.

CI.color

A character vector that indicates the color of the confidence interval (e.g. 'black', 'red', '#003C7D', etc.)

line.color

A character vector that indicates the color of lines.

line.type

A character vector that indicates the type of lines.

point.size

A integer vector that indicates the size of points on lines.

point.shape

A integer vector that indicates the shape of points on lines.

title

A string that indicates the title of the graph.

title.size

An integer that indicates the size of title.

axis.label.size

An integer that indicates the size of label.

axis.tick.size

An integer that indicates the size of tick mark.

facet.label.size

An integer that indicates the size of facet label.

facet.label.background

A string that indicates the background color of the facet label.

axis.x.label

A string that indicates the label on x axis.

axis.y.label

A string that indicates the label on y axis.

Constraints on gmwm objects

This function is designed to compare the gmwm objects with different computation methods and efficiency values. Therefore, gmwm objects supplied to this function are assumed to have different efficiency values and are constructed by the same data and same model. The function will check the constraint before generating the graph.

How to change CI.color and facet.label

To change CI.color and facet.label, the user must supply a vector. If the user compares N gmwm objects, then he/she must supply a vector of length N to CI.color and facet.label. Please check examples for help. Additionally, order.eff will change the order how objects are plotted. User is recommended to plot the graph without changing the aesthetics firstly. Then, the user can generate the graph by supplying elements to graphical parameters, e.g. CI.color, facet.label, in left-to-right order.

How to change other graphical aesthetics

line.type, line.color, point.size, point.size must be a vector. If the user compares N gmwm objects, then a vector of length 4 x N must be supplied to these parameters. For example, if the user wants to compare gmwm1 with gmwm2, the order to change the graphical aesthetics is: "gmwm1 Empirical WV, gmwm2 Empirical WV, gmwm1 lower bound of CI, gmwm2 lower bound of CI, gmwm1 higher bound of CI, gmwm2 higher bound of CI, gmwm1 Implied WV, gmwm2 Implied WV."

Please check examples for help.

Other details

melt() is used to convert the data frame from wide format to long format. However, melt() cannot deal with expressions, so the user cannot supply expressions to the parameter facet.label. Users should convert expressions into characters via as.character().

If you meet the error "polygon edge not found", it is complaining that you don't have enough space to plot the graph. If you are using RStudio, you can adjust the plot window. You can also open graphical window by using quartz() (Mac/Linux) or windows() (Windows PC).

Author(s)

Wenchao

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
#Simulate data
set.seed(8836)
n = 1000
x = gen_gts(n, AR1(phi = .1, sigma2 = 1) + AR1(phi = 0.95, sigma2 = .1))
x[1] = 1000 #Robust gmwm works better for contaminated data
GMWM1 = gmwm(2*AR1()+RW(), data = x, robust  = TRUE, eff = 0.9)
GMWM2 = gmwm(2*AR1()+RW(), data = x, robust  = TRUE, eff = 0.6)
GMWM3 = gmwm(2*AR1()+RW(), data = x, robust  = FALSE)

# How order.eff works:
compare_eff(GMWM1, GMWM2, GMWM3, order.eff = FALSE)
compare_eff(GMWM1, GMWM2, GMWM3, order.eff = TRUE) 
# order.eff=TRUE: The objects are plotted in descending order of model efficiency.


# How to modify facet.label
compare_eff(GMWM2, GMWM3, order.eff = FALSE, facet.label = c('Rob. eff. 0.6', 'Cla.') )
compare_eff(GMWM2, GMWM3, order.eff = TRUE, facet.label = c('Cla.', 'Rob. eff. 0.6') )

# How to modify graph aesthetics
compare_eff(GMWM2, GMWM3, order.eff = FALSE, CI.color = c("#003C7D", "#F47F24"),
           line.color = rep(c("#003C7D", "#F47F24"), 4) )
compare_eff(GMWM2, GMWM3, order.eff = TRUE, CI.color = c("#F47F24", "#003C7D"),
           line.color = rep(c("#F47F24", "#003C7D"), 4) )

## End(Not run)

SMAC-Group/gmwm documentation built on Sept. 11, 2021, 10:06 a.m.