plot_diff_asym: Plot difference asymmetry functions

View source: R/difference_asymmetry_plot.R

plot_diff_asymR Documentation

Plot difference asymmetry functions

Description

Plot one or more difference asymmetry functions generated by asymhd or asymdhd. The function returns a list of ggplot objects, which can be customised using the ggplot2 package - see details here.

Usage

plot_diff_asym(
  data = df,
  symb_col = NULL,
  symb_fill = NULL,
  symb_size = 5,
  symb_shape = 21,
  diffint_col = NULL,
  diffint_size = 0.5,
  q_line_col = NULL,
  q_line_alpha = 0.5,
  q_line_size = 1.5
)

Arguments

data

A list of data frames generated by asymhd or asymdhd.

symb_col

Contour colour of quantile symbol.

symb_fill

Fill colour(s) of quantile symbol. Defaults are "white" for theme 1, c("darkviolet","darkorange2") for theme 2, c("white", "grey") for theme 3.

symb_size

Size of quantile symbol - default = 5.

symb_shape

Shape of the quantile symbol - default = 21 (disc).

diffint_col

Colour of the lines marking the quantile difference intervals.

diffint_size

Size of the lines marking the quantile difference intervals - default = .5.

q_line_col

Colour of the line joining the quantiles.

q_line_alpha

Alpha of the line joining the quantiles - default = .5.

q_line_size

Size of the line joining the quantiles - default = 1.5.

Value

A list of ggplot objects.

Examples

# using asymhd
set.seed(21) # generate data
n <- 100 # sample size
df <- tibble(gr = factor(c(rep("group1",n),rep("group2",n),rep("group3",n))),
             obs= c(rnorm(n)+6, rnorm(n)+4, rnorm(n)*1.5+6)) # make tibble
out <- asymhd(df, obs ~ gr, doall = TRUE, nboot = 100) # compute all comparisons
plist <- plot_diff_asym(out)

# using asymdhd
set.seed(21) # generate data
n <- 100 # sample size per condition
C1 <- rnorm(n) # condition 1
C2 <- C1 + rnorm(n) + 2 # condition 2
# Data with 3 independent groups and 2 dependent conditions per group
library(tibble)
df <- tibble(gr = factor(c(rep("group1",n),rep("group2",n),rep("group3",n))),
  cond1 = c(C1, C1+rnorm(n), C1+rnorm(n)),
  cond2 = c(C2, C2 + 1, C2 + 3) ) # make tibble
library(dplyr)
df <- mutate(df, diff = cond1 - cond2)
out <- asymdhd(data = df, formula = diff ~ gr, nboot = 100, doall = TRUE)
plist <- plot_diff_asym(data = out)
plist


GRousselet/rogme documentation built on Nov. 12, 2022, 4:38 a.m.