analyse_var: Analyse variable by AB test group

Description Usage Arguments Value Author(s) Examples

View source: R/analyse_var.R

Description

If you have 2 columns, one representing variable of interest, and another group for that observation, this function analyses distribution of variable in each group in a way that is easy to compare. It calculates mean and confidence intervals, quantiles and density plots.

Usage

1
2
3
4
5
6
7
analyse_var(
  df,
  var_chr,
  group_variable = "ab_test_group",
  quant_focus = "mid",
  confidence_interval = 0.9
)

Arguments

df

Data frame with both variables of interest.

var_chr

(character) Column name of variable you want to be analysed as string.

group_variable

Variable to group by.

quant_focus

("up", "mid", "down") Controls on which quantiles to focus more. "up" focuses more on median and upper quantiles, "down" is the opposite and "mid" is balanced.

confidence_interval

Probability of confidence interval range.

Value

list of two tibbles:

quant_data

Contains quantiles.

mean_data

Contains means, standard errors and confidence interval bounds.

Author(s)

Elio Bartoš

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#library(tidyverse) #For tribble and pipe %>% notation
library(tibble) #For tribble
library(magrittr) # For pipe %>%

df <- tribble(
  ~x, ~group,
  1, 1,
  3.2, 1,
  2.4, 1,
  3.1, 1,
  5, 2,
  6, 2,
  4.7, 2
)

df %>%
  analyse_var("x", "group")

eliobartos/misc documentation built on Oct. 8, 2021, 1:10 a.m.