csCompare {condir}  R Documentation 
Compare CRs towards two CSs within a frequentist and a Bayesian framework.
csCompare(
cs1,
cs2,
group = NULL,
data = NULL,
alternative = "two.sided",
conf.level = 0.95,
mu = 0,
rscale = 0.707,
descriptives = TRUE,
out.thres = 3,
boxplot = TRUE
)
cs1 
a numeric vector of values. If the 
cs2 
a numeric vector of values. If the 
group 
column index or name that contain the group data. See

data 
numeric matrix or data frame that contains the relevant data. 
alternative 
a character string for the specification of
the alternative hypothesis. Possible values: 
conf.level 
Interval's confidence level. 
mu 
a numeric value for the mean value or mean difference. 
rscale 
the scale factor for the prior used in the Bayesian t.test. 
descriptives 
Returns basic descriptive statistics for 
out.thres 
The threshold for detecting outliers (default is 3). If set
to 0, no outliers analysis will be performed. See 
boxplot 
Should a boxplot of the variables be produced (default is TRUE)? 
csCompare
performs both a student ttest (using the
stats::t.test
function) and a Bayesian ttest (using the
BayesFactor::ttest.tstat
). If cs1
and/or cs2
are or refer to multiple columns of a matrix or a data.frame, then
the row means are computed before the ttests are performed.
In case group
is NULL
,
pairedsamples ttests will be run. In case the group
is different
than NULL
, then the csCompare first computes difference scores between
the cs1 and the cs2 (i.e., cs1  cs2).
In case the group argument is defined
but, after removal of NA's (stats::na.omit
), only one group
is present, a paired samples ttest is run.
In case of independent samples ttest, the function runs
a Welch's ttest.
Regarding outliers, those are detected based on the deviations from the
standardized residuals of each test. For example, in case of a pairedsamples
ttest, the csCompare
function will run an additional regression for
detecting deviations (defined in the out.thres
argument)
from the standardized residuals. The detected outliers are removed from both
the frequentists and Bayesian analyses.
The function returns (at least) 3 list objects. These are: descriptives
,
freq.results
, and bayes.results
. In case outliers are detected,
then the outlier analyses are returned as well with the name res.out
as prefix to all list objects. For example, the descriptive statistics of
the outlier analyses, can be indexed by using
obj$res.out$descriptives
, with obj being the object of the csCompare
results.
The values of the descriptives
are described in
psych::describe
.
The values of the freq.results
are:
method
: which test was run.
alternative
: the alternative hypothesis.
WG1, WG2
: the Shapiro test values, separately for group 1 and group 2.
In case of a pairedsamples ttest, the WG2 is 0.
WpG1, WpG2
: the pvalues of Shapiro test, separately for group 1
and group 2. In case of a pairedsamples ttest, the WpG2 is 0.
null.value
: The value defined by mu
(see above).
LCI, HCI
: The low (LCI
) and high (HCI
) bounds
of the confidence intervals.
t.statistic
: Logical.
df
: The degrees of freedom of the ttest performed.
p.value
: The pvalue of the performed ttest.
cohenD
: The Cohen's d for the performed ttest.
cohenDM
: The magnitude of the resulting Cohen's d.
hedgesG
: The Hedge's g for the performed ttest.
hedgesGM
: The magnitude of the resulting Hedge's g.
The values of the bayes.results
are:
LNI, HNI
: The low (LNI
) and high (HNI
) intervals of the
hypothesis to test.
rscale
: The used scale (see rscale
argument above).
bf10
: The BF10.
bf01
: The BF01.
propError
: The proportional error of the computed Bayes factor.
Krypotos, A. M., Klugkist, I., & Engelhard, I. M. (2017). Bayesian hypothesis testing for human threat conditioning research: An introduction and the condir R package. European Journal of Psychotraumatology, 8.
Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., & Iverson, G. (2009). Bayesian ttests for accepting and rejecting the null hypothesis. Psychonomic Bulletin & Review, 16, 225237
set.seed(1000)
csCompare(cs1 = rnorm(n = 100, mean = 10), cs2 = rnorm(n = 100, mean = 9))