View source: R/difference_asymmetry_plot.R
| plot_diff_asym | R Documentation |
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.
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 )
data |
A list of data frames generated by |
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. |
A list of ggplot objects.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.