twosamples {relevance} | R Documentation |
Relevance and Significance for One or Two Samples
Description
Inference for a difference between two independent samples or for a single sample: Collect quantities for inference, including Relevance and Significance measures
Usage
twosamples(x, ...)
onesample(x, ...)
## Default S3 method:
twosamples(x, y = NULL, paired = FALSE, table = NULL,
hypothesis = 0,var.equal = TRUE,
testlevel=getOption("testlevel"), log = NULL, standardize = NULL,
rlv.threshold=getOption("rlv.threshold"), ...)
## S3 method for class 'formula'
twosamples(x, data = NULL, subset, na.action, log = NULL, ...)
## S3 method for class 'table'
twosamples(x, ...)
Arguments
x |
a formula or the data for the first or the single sample |
y |
data for the second sample |
table |
A |
paired |
logical: In case |
hypothesis |
the null effect to be tested, and anchor for the relevance |
var.equal |
logical: In case of two samples, should the variances be assumed equal? Only applies for quantitative data. |
testlevel |
level for the test, also determining the confidence level |
log |
logical...: Is the target variable on log scale? – or character: either "log" or "log10" (or "logst"). If so, no standardization is applied to it. By default, the function examines the formula to check whether the left hand side of the formula contains a log transformation. |
standardize |
logical: Should the effect be standardized (for quantiative data)? |
rlv.threshold |
Relevance threshold, or a vector of thresholds
from which the element |
For the formula
method:
formula |
formula of the form y~x giving the target y and condition x variables. For a one-sample situation, use y~1. |
data |
data from which the variables are obtained |
subset , na.action |
subset and na.action to be applied to
|
... |
further arguments, ignored |
Details
Argument log
: If log10
(or logst
from
package plgraphics
) is used, rescaling is done
(by log(10)
) to obtain the correct relevance.
Therefore, log
needs to be set appropriately in this case.
Value
an object of class
'inference'
, a
vector with elements
effect
:for quantitative data: estimated difference between expectations of the two samples, or mean in case of a single sample.
For binary data: log odds (for one sample or paired samples) or log odds ratio (for two samples)
se
:standard error of
effect
teststatistic
:test statistic
p.value
:p value for test against 0
Sig0
:significance measure for test or 0 effect
ciLow, ciUp
:confidence interval for the effect
Rle, Rls, Rlp
:relevance measures: estimated, secured, potential
Sigth
:significance measure for test of
effect
== relevance threshold
In addition to the columns/components, it has attributes
type
:type of relevance: simple
method
:problem and inference method
effectname
:label for the effect
hypothesis
:the null effect
n
:number(s) of observations
estimate
:estimated parameter, with standard error or confidence interval, if applicable; in the case of 2 independent samples: their means
teststatistic
:test statistic
V
:single observation variance
df
:degrees of freedom for the t distribution
data:
if paired, vector of differences; if single sample, vector of data; if two independent samples, list containing the two samples
rlv.threshold
:relevance threshold
Note
onesample
and twosamples
are identical.
twosamples.table(x,...)
just calls
twosamples.default(table=x, ...)
.
Author(s)
Werner A. Stahel
References
see those in relevance-package
.
See Also
t.test, binom.test, fisher.test,
mcnemar.test
Examples
data(sleep)
t.test(sleep[sleep$group == 1, "extra"], sleep[sleep$group == 2, "extra"])
twosamples(sleep[sleep$group == 1, "extra"], sleep[sleep$group == 2, "extra"])
## Two-sample test, wilcox.test example, Hollander & Wolfe (1973), 69f.
## Permeability constants of the human chorioamnion (a placental membrane)
## at term and between 12 to 26 weeks gestational age
d.permeabililty <-
data.frame(perm = c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46,
1.15, 0.88, 0.90, 0.74, 1.21), atterm = rep(1:0, c(10,5))
)
t.test(perm~atterm, data=d.permeabililty)
twosamples(perm~atterm, data=d.permeabililty)
## one sample
onesample(sleep[sleep$group == 2, "extra"])
## plot two samples
pltwosamples(extra ~ group, data=sleep)