Description Usage Arguments Details Value See Also Examples
View source: R/test_means_between-function.R
test_means_between()
compares two sample means obtained from two different groups of users and performs a two-sided statistical test to determine if the means differ from each other.
test_means_between
, ab_test_between
, and test_times_between
are synonyms.
1 2 3 4 5 6 7 8 9 | test_means_between(.x, ...)
ab_test_between(.x, ...)
## S3 method for class 'numeric'
test_means_between(.x, .sd, .n, .x2, .sd2, .n2, ..., .alpha = 0.05)
## S3 method for class 'data.frame'
test_means_between(.x, .var1, .var2, ..., .alpha = 0.05)
|
.x |
A single numeric value (i.e., the mean from sample 1) or a data frame with named columns of numeric data corresponding to the variables being tested. See Details. |
... |
(Optional) If |
.sd |
If |
.n |
If |
.x2 |
If |
.sd2 |
If |
.n2 |
If |
.alpha |
(Optional) A positive number (where 0 < |
.var1 |
If |
.var2 |
If |
If .x
is a single numeric value representing the mean of the the variable for sample 1, use .sd
and .n
to provide the standard deviation and sample size. Use .x2,.sd2,.n2
to provide the equivalent information for sample 2.
If .x
is a data frame with unique variable columns for each sample,.var1
and .var2
should be the unquoted names of the columns containing the values for sample 1 and sample 2
If .x
is a data frame with only one variable column for both samples, pass the unquoted name of the column containing the values to compute means over to .var1
, set .var2 = NULL
, and use the grouping argument (...
) to provide the name of the column that contains the sample id, which should only contain two unique values. Note that if you use this option, you cannot pass other grouping variables.
You can modify the alpha level to adjust confidence intervals by including .alpha
as a named argument and providing a numeric value: e.g., .aplha = 0.001
.
If you're passing a data frame to .x
, you can optionally pass one or more grouping variables as unquoted, comma-separated column names (without naming the ...
argument) to compute stats by groups.
Note that NAs
are automatically dropped in all calculations.
A tibble with the results of a test of two means, with confidence interval information, and other information.
Other tests comparing means:
test_means_within()
1 2 3 4 5 6 7 8 9 10 11 12 13 | # When you already have summary stats:
test_means_between(.x = 45,.sd = 9.2,.n = 18,.x2 = 48, .sd2 = 8.5, .n2 = 17, .alpha = 0.01)
# If you have a data frame with a separate column of observations
# for each sample:
.ux_data<-
data.frame("sample1_ratings" = runif(20,20,50),
"sample2_ratings" = c(runif(15,20,50),rep(NA,times=5)))
test_means_between(.x = .ux_data, .var1 = sample1_ratings, .var2 = sample2_ratings, .alpha = 0.10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.