| ttest_num {exams.forge} | R Documentation |
T-tests
Description
Computes all results for a t-test. Note that the results may differ from stats::t.test(), see the "Details".
Either named parameters can be given, or a list with the parameters.
You must provide either x or mean, sd and n. If x is given then any values
given for mean, sd and n will be overwritten. Also either sd or sigma or both must be given.
-
xsample (default:numeric(0)) -
meansample mean (default:mean(x)) -
nsample size (default:length(x)) -
sdsample standard deviation (default:sd(x)) -
sigmapopulation standard deviation (default:NA= unknown) -
mu0true value of the mean (default:0) -
alternativea string specifying the alternative hypothesis (default:"two.sided"), otherwise"greater"or"less"can be used -
alphasignificance level (default:0.05) -
normis the population normal distributed? (default:FALSE) -
n.cltwhen the central limit theorem holds (default:getOption("n.clt", 30)) -
t2normdoes the approximationt_n \approx N(0;1)hold?(default: NA= uset2norm' function)
Usage
ttest_num(..., arglist = NULL)
Arguments
... |
named input parameters |
arglist |
list: named input parameters, if given |
Details
The results of ttest_num may differ from stats::t.test(). ttest_num is designed to return results
when you compute a t-test by hand. For example, for computing the test statistic the approximation t_n \approx N(0; 1)
is used if n>n.tapprox. The p.value is computed from the cumulative distribution function of the normal or
the t distribution.
Value
A list with the input parameters and the following:
-
Xbardistribution of the random sampling function\bar{X}, only available ifsigmagiven -
Statisticdistribution of the test statistics -
statistictest value -
criticalcritical value(s) -
criticalxcritical value(s) in x range -
acceptance0acceptance interval for H0 -
acceptance0xacceptance interval for H0 in x range -
accept1is H1 accepted? -
p.valuep value for test
Examples
x <- runif(100)
ttest_num(x=x)
ttest_num(mean=mean(x), sd=sd(x), n=length(x))
ret <- ttest_num(x=x)
ret$alternative <- "less"
ttest_num(arglist=ret)