means_test {quest} | R Documentation |
Test for Multiple Sample Means Against Mu (one-sample t-tests)
Description
means_test
computes sample means and compares them against specified
population mu
values. These are sometimes referred to as one-sample
t-tests. It provides the same results as t.test
, but
provides the confidence intervals for the mean differences from mu rather
than the mean itself. The function also calculates the descriptive statistics
and the standardized mean differences (i.e., Cohen's d) based on the sample
standard deviations.
Usage
means_test(
data,
vrb.nm,
mu = 0,
d.ci.type = "tdist",
ci.level = 0.95,
check = TRUE
)
Arguments
data |
data.frame or data. |
vrb.nm |
character vector of colnames specifying the variables in
|
mu |
numeric vector of length = |
d.ci.type |
character vector with length 1 of specifying the type of
confidence intervals to compute for the standardized mean differences
(i.e., Cohen's d). There are currently two options: 1. "tdist" which
calculates the confidence intervals based on the t-distribution using the
function |
ci.level |
numeric vector of length 1 specifying the confidence level. It must be between 0 and 1. |
check |
logical vector of length 1 specifying whether the input
arguments should be checked for errors. For example, checking whether
|
Value
list of data.frames containing statistical information about the
sample means (the rownames of the data.frames are vrb.nm
): 1)
nhst = one-sample t-test stat info in a data.frame, 2) desc = descriptive
statistics stat info in a data.frame, 3) std = standardized mean difference
stat info in a data.frame
1) nhst = one-sample t-test stat info in a data.frame
- est
mean - mu estimate
- se
standard error
- t
t-value
- df
degrees of freedom
- p
two-sided p-value
- lwr
lower bound of the confidence interval
- upr
upper bound of the confidence interval
2) desc = descriptive statistics stat info in a data.frame
- mean
mean of
x
- mu
population value of comparison
- sd
standard deviation of
x
- n
sample size of
x
3) std = standardized mean difference stat info in a data.frame
- d_est
Cohen's d estimate
- d_se
Cohen's d standard error
- d_lwr
Cohen's d lower bound of the confidence interval
- d_upr
Cohen's d upper bound of the confidence interval
See Also
mean_test
one-sample t-test for a single variable,
t.test
same results,
means_diff
independent two-sample t-tests for multiple variables,
means_change
dependent two-sample t-tests for multiple variables,
Examples
# one-sample t-tests
means_test(data = attitude, vrb.nm = names(attitude), mu = 50)
means_test(data = attitude, vrb.nm = c("rating","complaints","privileges"),
mu = c(60, 55, 50))
means_test(data = attitude, vrb.nm = names(attitude), mu = 50, ci.level = 0.90)
means_test(airquality, vrb.nm = names(airquality)) # different df and n due to missing data
# compare to t.test
means_test(data = attitude, vrb.nm = "rating", mu = 50, ci.level = .99)
t.test(attitude$"rating", mu = 50, conf.level = .99)
# same as intercept-only regression
means_test(data = attitude, vrb.nm = "rating")
lm_obj <- lm(rating ~ 1, data = attitude)
coef(summary(lm_obj))