ttest_num | R Documentation |
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.
x
sample (default: numeric(0)
)
mean
sample mean (default: mean(x)
)
n
sample size (default: length(x)
)
sd
sample standard deviation (default: sd(x)
)
sigma
population standard deviation (default: NA
= unknown)
mu0
true value of the mean (default: 0
)
alternative
a string specifying the alternative hypothesis (default: "two.sided"
), otherwise "greater"
or "less"
can be used
alpha
significance level (default: 0.05
)
norm
is the population normal distributed? (default: FALSE
)
n.clt
when the central limit theorem holds (default: getOption("n.clt", 30)
)
t2norm
does the approximation t_n \approx N(0;1)
hold? (default:
NA= use
t2norm' function)
ttest_num(..., arglist = NULL)
... |
named input parameters |
arglist |
list: named input parameters, if given |
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.
A list with the input parameters and the following:
Xbar
distribution of the random sampling function \bar{X}
, only available if sigma
given
Statistic
distribution of the test statistics
statistic
test value
critical
critical value(s)
criticalx
critical value(s) in x range
acceptance0
acceptance interval for H0
acceptance0x
acceptance interval for H0 in x range
accept1
is H1 accepted?
p.value
p value for test
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.