| Title: | User Experience Research |
|---|---|
| Description: | Provides convenience functions for user experience research with an emphasis on quantitative user experience testing and reporting. The functions are designed to translate statistical approaches to applied user experience research. |
| Authors: | Joe Chelladurai [aut, cre] (ORCID: <https://orcid.org/0000-0001-8477-3753>) |
| Maintainer: | Joe Chelladurai <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-05-16 05:57:29 UTC |
| Source: | https://github.com/joe-chelladurai/uxr |
Compare Probability of an Event with Benchmark
benchmark_event( data, column, benchmark, event, count, total, event_type = "", remove_missing = TRUE, notes = "minimal", input = "long", output = "console" )benchmark_event( data, column, benchmark, event, count, total, event_type = "", remove_missing = TRUE, notes = "minimal", input = "long", output = "console" )
data |
dataset |
column |
name of column |
benchmark |
benchmark |
event |
specify event as given in column (example: 0, "pass", "success") |
count |
number of times event has occurred. Use only when using input = "values" |
total |
total number of all events. Use only when using input = "values" |
event_type |
Optional: a string describing the type of event. For example, success, failure, etc. |
remove_missing |
TRUE/FALSE (Default is TRUE) |
notes |
whether output should contain minimal or technical type of notes. Defaults to "minimal". Use "none" to turn off. |
input |
Default: "long" - long form of data, "values" to pass values directly. If using this option, must specify count and total. |
output |
Default: "console" - prints output in console and returns tibble invisibly. |
Dataframe of results when saved to an object. Show console output by default
data <- data.frame(task_1 = c("y", "y", "y", "y", "n", "n", "n", NA, NA, NA, NA, NA, NA, NA), task_2 = c(0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1)) # With dataframe columns benchmark_event(data, column = task_1, benchmark = 0.8, event = "y") benchmark_event(data, column = task_2, benchmark = 0.3, event = 1, event_type = "success") # Also pipeable data |> benchmark_event(column = task_2, benchmark = 0.3, event = 1, event_type = "success") # With direct values benchmark_event(benchmark = 0.8, count = 4, total = 7, input = "values")data <- data.frame(task_1 = c("y", "y", "y", "y", "n", "n", "n", NA, NA, NA, NA, NA, NA, NA), task_2 = c(0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1)) # With dataframe columns benchmark_event(data, column = task_1, benchmark = 0.8, event = "y") benchmark_event(data, column = task_2, benchmark = 0.3, event = 1, event_type = "success") # Also pipeable data |> benchmark_event(column = task_2, benchmark = 0.3, event = 1, event_type = "success") # With direct values benchmark_event(benchmark = 0.8, count = 4, total = 7, input = "values")
Compare Score with a Benchmark
benchmark_score( data, column, benchmark, mean, sd, n, tail = "one", remove_missing = TRUE, input = "long", output = "console" )benchmark_score( data, column, benchmark, mean, sd, n, tail = "one", remove_missing = TRUE, input = "long", output = "console" )
data |
dataframe |
column |
a column of scores from the dataframe |
benchmark |
benchmark |
mean |
if input = "values", enter mean value |
sd |
if input = "values", enter standard deviation value |
n |
if input = "values", enter total number of scores |
tail |
one-tailed or two-tailed test |
remove_missing |
TRUE/FALSE (Default is TRUE) |
input |
Default: "long" - long form of data, "values" to pass values directly. If using this option, must specify mean, sd, and n. |
output |
Default: "console" - prints output in console and returns tibble invisibly. |
dataframe of results when saved to an object. show console output by default
scores <- 80 + 23 * scale(rnorm(172)) # 80 = mean, 23 = sd data <- data.frame(scores = scores) benchmark_score(data, scores, 67) data |> benchmark_score(scores, 67) benchmark_score(mean = 80, sd = 23, n = 172, benchmark = 67, input = "values")scores <- 80 + 23 * scale(rnorm(172)) # 80 = mean, 23 = sd data <- data.frame(scores = scores) benchmark_score(data, scores, 67) data |> benchmark_score(scores, 67) benchmark_score(mean = 80, sd = 23, n = 172, benchmark = 67, input = "values")
Compare Time with a Benchmark
benchmark_time( data, column, benchmark, alpha, remove_missing = FALSE, input = "long", output = "console" )benchmark_time( data, column, benchmark, alpha, remove_missing = FALSE, input = "long", output = "console" )
data |
dataframe |
column |
a column or vector of time values |
benchmark |
benchmark |
alpha |
alpha |
remove_missing |
TRUE/FALSE (Default is TRUE) |
input |
Default: "long" - long form of data, "values" to pass values directly. If using this option, must specify count and total. |
output |
Default: "console" - prints output in console and returns tibble invisibly. |
lower_ci, upper_ci, t, probability
data <- data.frame(time = c(60, 53, 70, 42, 62, 43, 81)) benchmark_time(data, column = time, benchmark = 60, alpha = 0.05)data <- data.frame(time = c(60, 53, 70, 42, 62, 43, 81)) benchmark_time(data, column = time, benchmark = 60, alpha = 0.05)
Compare Means Between Groups
compare_means_between_groups( data, var1, var2, variable, grouping_variable, groups, test = "Welch", input = "wide", output = "console" )compare_means_between_groups( data, var1, var2, variable, grouping_variable, groups, test = "Welch", input = "wide", output = "console" )
data |
data |
var1 |
variable 1 |
var2 |
variable 2 |
variable |
variable |
grouping_variable |
Group |
groups |
Specify groups from grouping variable |
test |
Default: "Welch", choose between "student" and "Welch" |
input |
Default: "wide", choose between "long" and "wide". "wide" requires data var1 var2. "long" requires data, variable, grouping_variable groups |
output |
Default: "console" - prints output in console and returns tibble invisibly. |
results
# Wide data - default data_wide <- data.frame(A = c(4, 2, 5, 3, 6, 2, 5), B = c(5, 2, 1, 2, 1, 3, 2)) compare_means_between_groups(data_wide, var1 = A, var2 = B) # Long data data_long <- data_wide |> tibble::rowid_to_column("id") |> tidyr::pivot_longer(cols = -id, names_to = "group", values_to = "variable") compare_means_between_groups(data_long, variable = variable, grouping_variable = group, groups = c("A", "B"), input = "long")# Wide data - default data_wide <- data.frame(A = c(4, 2, 5, 3, 6, 2, 5), B = c(5, 2, 1, 2, 1, 3, 2)) compare_means_between_groups(data_wide, var1 = A, var2 = B) # Long data data_long <- data_wide |> tibble::rowid_to_column("id") |> tidyr::pivot_longer(cols = -id, names_to = "group", values_to = "variable") compare_means_between_groups(data_long, variable = variable, grouping_variable = group, groups = c("A", "B"), input = "long")
Compare Means Within Groups
compare_means_within_groups( data, var1, var2, input = "wide", output = "console" )compare_means_within_groups( data, var1, var2, input = "wide", output = "console" )
data |
dataframe |
var1 |
variable 1 |
var2 |
variable 2 |
input |
Default: "long" - long form of data, "values" to pass values directly. If using this option, must specify mean, sd, and n. |
output |
Default: "console" - prints output in console and returns tibble invisibly. |
results
data <- data.frame(id = c(1:7), task1 = c(4, 1, 2, 3, 8, 4, 4), task2 = c(7, 13, 9, 7, 18, 8, 10)) compare_means_within_groups(data, task1, task2)data <- data.frame(id = c(1:7), task1 = c(4, 1, 2, 3, 8, 4, 4), task2 = c(7, 13, 9, 7, 18, 8, 10)) compare_means_within_groups(data, task1, task2)
Compare Rates Between Groups
compare_rates_between_groups( data, group, event, test, input = "long", output = "console" )compare_rates_between_groups( data, group, event, test, input = "long", output = "console" )
data |
data |
group |
column in dataframe : group |
event |
column in dataframe : event |
test |
Type of test (fisher, n-1 two prop) |
input |
Defaults to "long" |
output |
"console" prints output to console; "tibble" returns tibble |
results
design = c("A","B") complete = c(34, 24) incomplete = c(317, 301) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) compare_rates_between_groups(data, group = design, event = rate)design = c("A","B") complete = c(34, 24) incomplete = c(317, 301) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) compare_rates_between_groups(data, group = design, event = rate)
Compare Rates Within Groups
compare_rates_within_groups( data, x, y, conf_level = 0.95, input, output = "console" )compare_rates_within_groups( data, x, y, conf_level = 0.95, input, output = "console" )
data |
data |
x |
var 1 |
y |
var 2 |
conf_level |
Confidence level |
input |
input type currently only accepts "wide" |
output |
Default is "console", also accepts "tibble" |
results
A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) compare_rates_within_groups(data, A, B, input = "wide")A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) compare_rates_within_groups(data, A, B, input = "wide")
T Distribution
dist_t(t, df, tail)dist_t(t, df, tail)
t |
t |
df |
degrees of freedom |
tail |
'one' or 'two' |
value
dist_t(1.4, 2, "one") dist_t(1.4, 2, "two")dist_t(1.4, 2, "one") dist_t(1.4, 2, "two")
Get concordant and discordant pairs for two variables
get_concordant_discordant_pairs(data, x, y)get_concordant_discordant_pairs(data, x, y)
data |
= data |
x |
variable 1 |
y |
variable 2 |
a data frame
mtcars$id <- seq.int(nrow(mtcars)) get_concordant_discordant_pairs(mtcars, x = vs, y = am)mtcars$id <- seq.int(nrow(mtcars)) get_concordant_discordant_pairs(mtcars, x = vs, y = am)
Get Confidence Intervals for Event Rate
get_confidence_intervals_event(event, total, confidence_level)get_confidence_intervals_event(event, total, confidence_level)
event |
event |
total |
total |
confidence_level |
confidence level as z value |
lower_ci, upper_ci
get_confidence_intervals_event(event = 80, total = 100, confidence_level = 1.96)get_confidence_intervals_event(event = 80, total = 100, confidence_level = 1.96)
Get Confidence Intervals Within Groups
get_confidence_intervals_within_groups(data, x, y, conf_level = 0.95)get_confidence_intervals_within_groups(data, x, y, conf_level = 0.95)
data |
data |
x |
var 1 |
y |
var 2 |
conf_level |
Confidence level |
results
A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) get_confidence_intervals_within_groups(data, A, B)A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) get_confidence_intervals_within_groups(data, A, B)
Mean Confidence Intervals
stat_mean_ci(x, alpha)stat_mean_ci(x, alpha)
x |
values |
alpha |
alpha |
lower_ci, upper_ci
stat_mean_ci(c(1, 2, 3, 4, 5, 6, 7), 1.96) stat_mean_ci(c(2, 4, 6, 8), 1.96)stat_mean_ci(c(1, 2, 3, 4, 5, 6, 7), 1.96) stat_mean_ci(c(2, 4, 6, 8), 1.96)
Mean Confidence Intervals (Large Samples)
stat_mean_ci_2(x, z)stat_mean_ci_2(x, z)
x |
values |
z |
z value |
lower_ci, upper_ci
stat_mean_ci_2(c(1, 2, 3, 4, 5, 6, 7), 1.96) stat_mean_ci_2(c(2, 4, 6, 8), 1.96)stat_mean_ci_2(c(1, 2, 3, 4, 5, 6, 7), 1.96) stat_mean_ci_2(c(2, 4, 6, 8), 1.96)
Observed Expected Table
table_observed_expected(data, x, y)table_observed_expected(data, x, y)
data |
data |
x |
x |
y |
y |
results
Chi-squared One Sample
test_chisq_one(data, x)test_chisq_one(data, x)
data |
data |
x |
x |
results
data <- tibble::tribble(~fruit, ~count, "Apple" , 29, "Banana" , 24, "Cucumber" , 22, "Dragon Fruit" , 19 ) data <- data |> tidyr::uncount(weights = count) |> tibble::rowid_to_column("id") test_chisq_one(data, fruit)data <- tibble::tribble(~fruit, ~count, "Apple" , 29, "Banana" , 24, "Cucumber" , 22, "Dragon Fruit" , 19 ) data <- data |> tidyr::uncount(weights = count) |> tibble::rowid_to_column("id") test_chisq_one(data, fruit)
Chi-squared Two Sample
test_chisq_two(data, x, y)test_chisq_two(data, x, y)
data |
data |
x |
x |
y |
y |
results
data <- tibble::tribble(~fruit, ~count, "Apple" , 29, "Banana" , 24, "Cucumber" , 22, "Dragon Fruit" , 19 ) data <- data |> tidyr::uncount(weights = count) |> tibble::rowid_to_column("id") test_chisq_one(data, fruit)data <- tibble::tribble(~fruit, ~count, "Apple" , 29, "Banana" , 24, "Cucumber" , 22, "Dragon Fruit" , 19 ) data <- data |> tidyr::uncount(weights = count) |> tibble::rowid_to_column("id") test_chisq_one(data, fruit)
Fisher's Test
test_fisher(data, x, y)test_fisher(data, x, y)
data |
data |
x |
x |
y |
y |
results
design = c("A","B") complete = c(11, 5) incomplete = c(1, 5) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) test_fisher(data, design, rate)design = c("A","B") complete = c(11, 5) incomplete = c(1, 5) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) test_fisher(data, design, rate)
McNemar Test
test_mcnemar(data, x, y)test_mcnemar(data, x, y)
data |
data |
x |
var 1 |
y |
var 2 |
results
A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) test_mcnemar(data, A, B)A <- c(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1) B <- c(0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0) data <- data.frame(A, B) test_mcnemar(data, A, B)
N-1 Two Proportions Test
test_n_1_prop(data, x, y, conf_level = 0.95)test_n_1_prop(data, x, y, conf_level = 0.95)
data |
data |
x |
x |
y |
y |
conf_level |
Confidence Level (default = 0.95) |
results
design = c("A","B") complete = c(37, 22) incomplete = c(418, 416) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) test_n_1_prop(data, design, rate, conf_level = 0.95)design = c("A","B") complete = c(37, 22) incomplete = c(418, 416) data <- data.frame(design, complete, incomplete) data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |> tidyr::uncount(n) test_n_1_prop(data, design, rate, conf_level = 0.95)
T-test
test_t(x, y, ...)test_t(x, y, ...)
x |
x |
y |
y |
... |
other arguments passed to t-test |
results
test_t(mtcars$mpg, mtcars$am)test_t(mtcars$mpg, mtcars$am)
Paired t-test
test_t_paired(x, y, ...)test_t_paired(x, y, ...)
x |
x |
y |
y |
... |
other arguments passed to paired t-test |
results
Wald Confidence Intervals
test_wald(success, total, conf_level = 0.95)test_wald(success, total, conf_level = 0.95)
success |
success |
total |
total |
conf_level |
conf_level (default: 0.95) |
lower_ci, upper_ci
test_wald(10, 12, 0.95) test_wald(5, 7, 0.95)test_wald(10, 12, 0.95) test_wald(5, 7, 0.95)
Adjusted Wald Confidence Intervals
test_wald_adj(success, total, conf_level = 0.95)test_wald_adj(success, total, conf_level = 0.95)
success |
success |
total |
total |
conf_level |
conf_level (default: 0.95) |
lower_ci, upper_ci
test_wald_adj(10, 12, 0.95) test_wald_adj(5, 7, 0.95)test_wald_adj(10, 12, 0.95) test_wald_adj(5, 7, 0.95)