Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates the power, sample size, difference of means, standard deviation, or significance level of a one sample t-test with options for one and two sided testing.
1 2 |
delta |
The difference of means to be tested. This may also be
specified using |
n |
The sample size |
sd |
The standard deviation of the difference |
alpha |
The significance level |
power |
The power of the test |
two.tail |
Logical. Determines if the calculations assume one or two
sided testing. This may be a vector (ie, |
mu0,mu1 |
Group means for calculating |
Exactly one of the parameters delta
, n
, sd
,
alpha
, and power
must be passed as NULL
. The only
exception is that delta
may be passed as a second NULL
when
mu0
and mu1
are specified.
The parameters are combined via expand.grid
, so all combinations
of the inputs are evaluated.
Returns a data frame with the columns listed below.
mu0 The hypothesized mean (only if mu0
is not NA
)
mu1 The alternative mean (only if mu1
is not NA
)
delta The difference of means
sd The standard deviation of the difference of means
alpha The significance level of the test.
power The power of the test
two.tail a logical indicating if the test assumes one or two tails
n_est The exact estimated sample size. This will equal n
whenever n
is not NULL
n The integer sample size obtained by ceiling(n_est)
.
Benjamin Nutter
Hogg RV, McKean JW, Craig AT, Introduction to Mathematical Statistics, Pearson Prentice Hall 6th ed., 2005. ISBN: 0-13-008507-3
power.t.test
, optimize
, uniroot
,
vignette("TTestOneSample", package="StudyPlanning")
1 2 3 4 5 6 7 8 9 10 11 12 13 | test_t1(delta=1, n=20, sd=1, two.tail=TRUE)
#* Compare to one-sample version of example from the \code{stats} package
power.t.test(n = 20, delta = 1, type="one.sample")
#* Illustrate the multiple inputs
test_t1(delta=1, sd=1, power=0.90, two.tail=c(TRUE, FALSE))
#* Compare with the examples from stats package
power.t.test(power = .90, delta = 1, type="one.sample")
power.t.test(power = .90, delta = 1, type="one.sample", alternative = "one.sided")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.