ratings_vs_bench: Compare ratings to a benchmark

Description Usage Arguments Details Value See Also Examples

View source: R/ratings_vs_bench-function.R

Description

ratings_vs_bench() tests a sample mean of continuous data (e.g., ratings) against a given benchmark using a one-sample t-test.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ratings_vs_bench(.x, ...)

## S3 method for class 'numeric'
ratings_vs_bench(
  .x,
  .sd,
  .n,
  .m,
  ...,
  .alt = c("greater", "less", "twotailed"),
  .alpha = 0.05
)

## S3 method for class 'data.frame'
ratings_vs_bench(.x, .var, .m, ..., .alt = "greater", .alpha = 0.05)

Arguments

.x

A single numeric value, a vector of values, or a long-format data frame with a named column of numeric data corresponding to ratings or another continuous metric. See Details.

...

(Optional) If .x is a long-format data frame, you can pass the name of one or more grouping variables as unquoted, comma-separated column names (without naming the ... argument) to compute stats by groups.

.sd

If .x is a single numeric value, .sd should be a single numeric value indicating the sample standard deviation. See Details

.n

If .x is a single numeric value, .n should be a single numeric value indicating the sample size. See Details.

.m

The test (benchmark) mean.

.alt

(Optional) For test alternatives, one of c("greater","less","twotailed"). Defaults to "greater" for a one-sided test.

.alpha

(Optional) A positive number (where 0 < .alpha < 1) specifying the significance level to be used. Defaults to .alpha = 0.05. To set a different significance level, the argument must be named (i.e., .alpha=0.001) or else the function may yield unexpected results.

.var

If .x is a long-format data frame, the (unquoted) name of a data frame column containing task ratings (or values from another continuous metric).

Details

ratings_vs_bench assumes that you want to test the hypothesis that the observed outcome exceeds the benchmark, and therefore, defaults to a one-tailed test. This means that setting .alpha = 0.05 (the default) produces a 90% confidence interval.

Note that NAs are automatically dropped in all calculations.

Value

A tibble with data summaries and test results

See Also

Other benchmark comparison stats: success_vs_bench(), time_vs_bench()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Comparing a sample ratings mean of 79 (sd = 20) from 160 users
# against a benchmark mean of 75
ratings_vs_bench(.x=79,.sd=20,.n=160,.m=75)

# Comparing values from a data frame against a benchmark of 70.
.ux_data <-
 data.frame(
  "id" = rep(seq(1,10,1),2),
  "task" = c(rep(1,10),rep(2,10)),
  "ratings"  = runif(20,0,100))

ratings_vs_bench(.ux_data, ratings, .m=70, task)

darrellpenta/uxstats documentation built on Jan. 18, 2022, 8:06 p.m.