test_means_within: Test two means against each other for a "within-subjects"...

Description Usage Arguments Details Value See Also Examples

View source: R/test_means_within-function.R

Description

test_means_within() compares two sample means obtained from the same group of users and performs a two-sided statistical test to determine if the means differ from each other.

test_means_within, ab_test_within, and test_times_within are synonyms.

Usage

1
2
3
4
5
6
7
8
9
test_means_within(.x, ...)

ab_test_within(.x, ...)

## S3 method for class 'numeric'
test_means_within(.x, .sd, .n, ..., .alpha = 0.05)

## S3 method for class 'data.frame'
test_means_within(.x, .var1, .var2, ..., .alpha = 0.05)

Arguments

.x

A single numeric value (i.e., the difference of two means) or a long-format data frame with named columns of numeric data corresponding to the variables being tested. 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 representing the mean of the variable differences, .sd should be a single numeric value representing the standard deviation of the diferences. See Details.

.n

If .x is a single numeric value representing the mean of the variable differences, .sd should be a single numeric value representing the total number of trials. See Details.

.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.

.var1

If .x is a long-format data frame, the (unquoted) name of a data frame column containing the values representing the first sample.

.var2

If .x is a long-format data frame, the (unquoted) name of a data frame column containing the values representing the second sample.

Details

Note that NAs are automatically dropped in all calculations.

Value

A tibble with the results of a test of two means, with confidence interval information, and other information.

See Also

Other tests comparing means: test_means_between()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# When you have computed difference metrics in advance:
test_means_within(45,9.2,18)

.ux_data <-
 data.frame(
  "id" = rep(seq(1,20,1),2),
  "task" = c(rep(1,20),rep(2,20)),
  "score1"  = sample(1:7,40,TRUE),
  "score2"  = sample(1.5:7.5,40,TRUE)
  )

test_means_within(.ux_data, score1, score2, task, .alpha=0.1)

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