0% found this document useful (0 votes)
26 views16 pages

Bain

Game theory research

Uploaded by

NEEL KAITH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views16 pages

Bain

Game theory research

Uploaded by

NEEL KAITH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Package ‘bain’

July 22, 2025


Type Package
Title Bayes Factors for Informative Hypotheses
Version 0.2.11
Description Computes approximated adjusted fractional Bayes factors for
equality, inequality, and about equality constrained hypotheses.
For a tutorial on this method, see Hoijtink, Mulder, van Lissa, & Gu,
(2019) <doi:10.1037/met0000201>. For applications in structural equation
modeling, see: Van Lissa, Gu, Mulder, Rosseel, Van Zundert, &
Hoijtink, (2021) <doi:10.1080/10705511.2020.1745644>. For the statistical
underpinnings, see Gu, Mulder, and Hoijtink (2018) <doi:10.1111/bmsp.12110>;
Hoijtink, Gu, & Mulder, J. (2019) <doi:10.1111/bmsp.12145>; Hoijtink, Gu,
Mulder, & Rosseel, (2019) <doi:10.31234/osf.io/q6h5w>.
License GPL (>= 3)
Encoding UTF-8
LazyData true

URL https://informative-hypotheses.sites.uu.nl/software/bain/

BugReports https://github.com/cjvanlissa/bain/
NeedsCompilation yes
RoxygenNote 7.3.1
Depends R (>= 3.0.0), stats
Imports lavaan
Suggests MASS, testthat, knitr, rmarkdown
VignetteBuilder knitr
Author Xin Gu [aut],
Herbert Hoijtink [aut],
Joris Mulder [aut],
Caspar J van Lissa [aut, cre],
Van Zundert Camiel [ctb],
Jeff Jones [ctb],
Niels Waller [ctb]

1
2 bain

Maintainer Caspar J van Lissa <[email protected]>


Repository CRAN
Date/Publication 2024-06-12 11:50:02 UTC

Contents
bain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
bain_sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
kuiper2013 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
pbf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
seBeta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
sesamesim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
synthetic_dk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
synthetic_nl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
synthetic_us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
t_test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Index 16

bain Bayes factors for informative hypotheses

Description
bain is an acronym for "Bayesian informative hypotheses evaluation". It uses the Bayes fac-
tor to evaluate hypotheses specified using equality and inequality constraints among (linear com-
binations of) parameters in a wide range of statistical models. A tutorial by Hoijtink, Mul-
der, van Lissa, and Gu (2018), was published in Psychological Methods. The preprint of that
tutorial is available on PsyArxiv (doi:10.31234/osf.io/v3shc) or on the bain website at https:
//informative-hypotheses.sites.uu.nl/software/bain/ Users are advised to read the tu-
torial AND the vignette that is provided with this package before using bain.

Usage
bain(x, hypothesis, fraction = 1, ...)

Arguments
x An R object containing the outcome of a statistical analysis. Currently, the fol-
lowing objects can be processed: lm(), t_test(), lavaan objects created with
the sem(), cfa(), and growth() functions, and named vector objects. See the
vignette for elaborations.
hypothesis A character string containing the informative hypotheses to evaluate. See the
vignette for elaborations.
fraction A number representing the fraction of information in the data used to construct
the prior distribution. The default value 1 denotes the minimal fraction, 2 de-
notes twice the minimal fraction, etc. See the vignette for elaborations.
bain 3

... Additional arguments. See the vignette for elaborations.

Value
The main output resulting from analyses with bain are Bayes factors and posterior model probabil-
ities associated with the hypotheses that are evaluated. See the tutorial and the vignette for further
elaborations.

Author(s)
The main authors of the bain package are Xin Gu, Caspar van Lissa, Herbert Hoijtink and Joris
Mulder with smaller contributions by Marlyne Bosman, Camiel van Zundert, and Fayette Klaassen.
Contact information can be found on the bain website at https://informative-hypotheses.
sites.uu.nl/software/bain/

References
For a tutorial on this method, see:
Hoijtink, H., Mulder, J., van Lissa, C., & Gu, X. (2019). A tutorial on testing hypotheses using the
Bayes factor. Psychological methods, 24(5), 539. doi:10.1037/met0000201
For applications in structural equation modeling, see:
Van Lissa, C. J., Gu, X., Mulder, J., Rosseel, Y., Van Zundert, C., & Hoijtink, H. (2021). Teacher’s
corner: Evaluating informative hypotheses using the Bayes factor in structural equation mod-
els. Structural Equation Modeling: A Multidisciplinary Journal, 28(2), 292-301. doi:10.1080/
10705511.2020.1745644.
For the statistical underpinnings, see:
Gu, Mulder, and Hoijtink (2018). Approximated adjusted fractional Bayes factors: A general
method for testing informative hypotheses. British Journal of Mathematical and Statistical Psy-
chology, 71(2), 229-261. doi:10.1111/bmsp.12110.
Hoijtink, H., Gu, X., & Mulder, J. (2019). Bayesian evaluation of informative hypotheses for
multiple populations. British Journal of Mathematical and Statistical Psychology, 72(2), 219-243.
doi:10.1111/bmsp.12145.
Hoijtink, H., Gu, X., Mulder, J., & Rosseel, Y. (2019). Computing Bayes factors from data with
missing values. Psychological Methods, 24(2), 253. doi:10.31234/osf.io/q6h5w

Examples
# Evaluation of informative hypotheses for an ANOVA
# make a factor of variable site
sesamesim$site <- as.factor(sesamesim$site)
# execute an analysis of variance using lm() which, due to the -1, returns
# estimates of the means of postnumb per group
anov <- lm(postnumb~site-1,sesamesim)
# take a look at the estimated means and their names
coef(anov)
# set a seed value
set.seed(100)
# use the names to formulate and test hypotheses with bain
4 bain_sensitivity

results <- bain(anov, "site1=site2=site3=site4=site5; site2>site5>site1>


site3>site4")
#
# SEE THE TUTORIAL AND VIGNETTE FOR MANY ADDITIONAL EXAMPLES

bain_sensitivity Sensitivity analysis for bain

Description
Conducts a sensitivity analysis for bain.

Usage
bain_sensitivity(x, hypothesis, fractions = 1, ...)

Arguments
x An R object containing the outcome of a statistical analysis. Currently, the fol-
lowing objects can be processed: lm(), t_test(), lavaan objects created with
the sem(), cfa(), and growth() functions, and named vector objects. See the
vignette for elaborations.
hypothesis A character string containing the informative hypotheses to evaluate. See the
vignette for elaborations.
fractions A number representing the fraction of information in the data used to construct
the prior distribution. The default value 1 denotes the minimal fraction, 2 de-
notes twice the minimal fraction, etc. See the vignette for elaborations.
... Additional arguments passed to bain.

Details
The Bayes factor for equality constraints is sensitive to a scaling factor applied to the prior dis-
tribution. The argument fraction adjusts this scaling factor. The function bain_sensitivity
is a wrapper for bain, which accepts a vector for the fractions argument, and returns a list of
bain results objects. A table with a sensitivity analysis for specific statistics can be obtained using
the summary() function, which accepts the argument summary(which_stat = ...). The avail-
able statistics are elements of the $fit table (Fit_eq, Com_eq, Fit_in, Com_in, Fit, Com, BF,
PMPa, and PMPb), and elements of the BFmatrix, which can be accessed by matrix notation, e.g.:
summary(bain_sens, which_stat = "BFmatrix[1,2]").

Value
A data.frame of class "bain_sensitivity".
kuiper2013 5

Examples
sesamesim$site <- as.factor(sesamesim$site)
res <- lm(sesamesim$postnumb~sesamesim$site-1)
set.seed(4583)
bain_sens <- bain_sensitivity(res, "site1=site2;
site2>site5",
fractions = c(1,2,3))
summary(bain_sens, which_stat = "BF.c")
summary(bain_sens, which_stat = "BFmatrix[1,2]")

kuiper2013 The Effect of Prior Interaction on Trust

Description

These data were published in Kuiper and colleagues (2013), who set out to aggregate evidence for
the effect of prior interactions between partners on trust in (economic) exchange relations across
four heterogeneous replication studies. Batenburg et al. (2003) analyzed survey data using linear
regression with covariates; Buskens and Raub (2002) analyzed experimental data using linear re-
gression; Buskens and Weesie (2000) used an experimental design with a binary outcome, analyzed
using probit regression; and Buskens, Raub, and Van der Veer (2010) used a longitudinal experi-
mental design, analyzing the data with a three-level logistic regression. These studies each provide
a regression coefficient (beta) assessing the effect of past experience on trust, and its estimated
sampling variance (squared standard error). The sample sizes (n) were derived from the original
publications.

Usage

data(kuiper2013)

Format

A data frame with 4 rows and 4 variables.

Details

Study character Reference of the original publication.


beta numeric Regression coefficient for the effect of prior interaction on trust.
vi numeric Sampling variance of ‘beta‘.
n integer Sample size.
6 pbf

References
Kuiper, R. M., Buskens, V., Raub, W., & Hoijtink, H. (2013). Combining Statistical Evidence From
Several Studies: A Method Using Bayesian Updating and an Example From Research on Trust
Problems in Social and Economic Exchange. Sociological Methods & Research, 42(1), 60–81.
<doi:10.1177/0049124112464867>
Batenburg, R. S., W. Raub, and C. Snijders. 2003. Contacts and Contracts: Temporal Embedded-
ness and the Contractual Behavior of Firms. Research in the Sociology of Organizations 20:135-88.
Buskens, V. and W. Raub. 2002. Embedded Trust: Control and Learning. Advances in Group
Processes 19:167-202.
Buskens, V., W. Raub, and J. van der Veer. 2010. Trust in Triads: An Experimental Study. Social
Networks 32:301-12.
Buskens, V. and J. Weesie. 2000. An Experiment on the Effects of Embeddedness in Trust Situa-
tions: Buying a Used Car. Rationality and Society 12:227-53.

pbf Product Bayes Factor

Description
The product Bayes factor (PBF) aggregates evidence for an informative hypothesis across concep-
tual replication studies without imposing assumptions about heterogeneity.

Usage
pbf(...)

## Default S3 method:
pbf(x, ...)

## S3 method for class 'numeric'


pbf(yi, vi, ni, hypothesis = "y = 0", ...)

Arguments
... Additional arguments passed to ‘bain‘.
x An object for which a method exists, see Details.
yi Numeric vector with the observed effect sizes.
vi Numeric vector with the observed sampling variances.
ni Integer vector with the sample sizes.
hypothesis A character string containing the informative hypotheses to evaluate.

Details
Currently, the argument ‘x‘ accepts either: * A list of ‘bain‘ objects, resulting from a call to ‘bain‘.
* A list of model objects for which a ‘bain‘ method exists; in this case, ‘pbf‘ will call ‘bain‘ on
these model objects before aggregating the Bayes factors.
seBeta 7

Value
A ‘data.frame‘ of class ‘pbf‘.

References
Van Lissa, C. J., Kuiper, R. M., & Clapper, E. (2023, April 25). Aggregating evidence from con-
ceptual replication studies using the product Bayes factor. doi:10.31234/osf.io/nvqpw

Examples
pbf(yi = c(-.33, .32, .39, .31),
vi = c(.085, .034, .016, .071),
ni = c(7, 10, 13, 20))

seBeta Standard Errors and CIs for Standardized Regression Coefficients

Description
Computes Normal Theory and ADF Standard Errors and CIs for Standardized Regression Coeffi-
cients

Usage
seBeta(
X = NULL,
y = NULL,
cov.x = NULL,
cov.xy = NULL,
var.y = NULL,
Nobs = NULL,
alpha = 0.05,
estimator = "ADF"
)

Arguments
X Matrix of predictor scores.
y Vector of criterion scores.
cov.x Covariance or correlation matrix of predictors.
cov.xy Vector of covariances or correlations between predictors and criterion.
var.y Criterion variance.
Nobs Number of observations.
alpha Desired Type I error rate; default = .05.
estimator ’ADF’ or ’Normal’ confidence intervals - requires raw X and raw y; default =
’ADF’.
8 seBeta

Value

cov.Beta Normal theory or ADF covariance matrix of standardized regression coeffi-


cients.
se.Beta standard errors for standardized regression coefficients.
alpha desired Type-I error rate.
CI.Beta Normal theory or ADF (1-alpha) intervals for standardized regression coeffi-
cients.
estimator estimator = "ADF" or "Normal".

Author(s)

Jeff Jones and Niels Waller

References

Jones, J. A, and Waller, N. G. (2015). The Normal-Theory and Asymptotic Distribution-Free (ADF)
covariance matrix of standardized regression coefficients: Theoretical extensions and finite sample
behavior. Psychometrika, 80, 365-378.

Examples

set.seed(123)

R <- matrix(.5, 3, 3)
diag(R) <- 1
X <- sesamesim[, c("peabody", "prenumb", "postnumb")]
y <- sesamesim$age
results <- seBeta(X, y, Nobs = nrow(sesamesim), alpha = .05, estimator = 'ADF')
print(results, digits = 3)

library(MASS)

set.seed(123)

R <- matrix(.5, 3, 3)
diag(R) <- 1
X <- mvrnorm(n = 200, mu = rep(0, 3), Sigma = R, empirical = TRUE)
Beta <- c(.2, .3, .4)
y <- X %*% Beta + .64 * scale(rnorm(200))
results <- seBeta(X, y, Nobs = 200, alpha = .05, estimator = 'ADF')
print(results, digits = 3)
sesamesim 9

sesamesim Simulated Sesame Street Data

Description
This is a simulated counterpart of part of the Sesame Street data presented by Stevens (1996, Ap-
pendix A) concerning the effect of the first year of the Sesame street series on the knowledge of 240
children in the age range 34 to 69 months. We will use the following variables: sex; site of child’s
origin; setting in which Sesame Street is watched; age; whether or not the child is encouraged to
watch; Peabody metal age score; score on numbers test before, after and in a follow up measure-
ment; and scores on knowledge of body parts, letters, forms, numbers, relations, and classifications,
both before and after watching Sesame Street for a year.

Usage
data(sesamesim)

Format
A data frame with 240 rows and 21 variables.

Details

sex integer Sex of the child; 1 = boy, 2 = girl


site integer Site of the child’s origin; 1 = disadvantaged inner city, 2 = advantaged suburban , 3 = advantaged rura
setting integer Setting in which the child watches Sesame Street; 1 = at home, 2 = at school
age integer Age of the child in months
viewenc integer Whether or not the child is encouraged to watch Sesame Street; 0 = no, 1 = yes
peabody integer Peabody mental age score of the child; the higher the score the higher the mental age
prenumb integer score on a numbers test before watching Sesame Street for a year
postnumb integer score on a numbers test after watching Sesame Street for a year
funumb integer follow up numbers test score measured one year after postnumb
Bb integer Knowledge of body parts before
Bl integer Knowledge of letters before
Bf integer Knowledge of forms before
Bn integer Knowledge of numbers before
Br integer Knowledge of relations before
Bc integer Knowledge of classifications before
Ab integer Knowledge of body parts after
Al integer Knowledge of letters after
Af integer Knowledge of forms after
An integer Knowledge of numbers after
Ar integer Knowledge of relations after
Ac integer Knowledge of classifications after
10 synthetic_dk

References
Stevens, J. (1996). Applied Multivariate Statistics for the Social Sciences. Mahwah NJ: Lawrence
Erlbaum.

synthetic_dk Simulated data about morality and politics in Denmark

Description
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concern-
ing associations between moral dispositions (measured using the Morality As Cooperation ques-
tionnaire, MAC; see Curry et al., 2019) and political orientation.

Usage
data(synthetic_dk)

Format
A data frame with 552 rows and 31 variables.

Details

sepa_soc_1 numeric Item 1 of the Policy Attitudes social (PA-social) scale.


sepa_soc_2 numeric Item 2 of the Policy Attitudes social (PA-social) scale.
sepa_soc_3 numeric Item 3 of the Policy Attitudes social (PA-social) scale.
sepa_soc_4 numeric Item 4 of the Policy Attitudes social (PA-social) scale.
sepa_soc_5 numeric Item 5 of the Policy Attitudes social (PA-social) scale.
sepa_eco_1 numeric Item 1 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_2 numeric Item 2 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_3 numeric Item 3 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_4 numeric Item 4 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_5 numeric Item 5 of the Policy Attitudes economic (PA-economic) scale.
fam_1 numeric Item 1 of the MAC (family subscale) scale.
fam_2 numeric Item 2 of the MAC (family subscale) scale.
fam_3 numeric Item 3 of the MAC (family subscale) scale.
grp_1 numeric Item 1 of the MAC (group subscale) scale.
grp_2 numeric Item 2 of the MAC (group subscale) scale.
grp_3 numeric Item 3 of the MAC (group subscale) scale.
rec_1 numeric Item 1 of the MAC (reciprocity subscale) scale.
rec_2 numeric Item 2 of the MAC (reciprocity subscale) scale.
rec_3 numeric Item 3 of the MAC (reciprocity subscale) scale.
her_1 numeric Item 1 of the MAC (heroism subscale) scale.
her_2 numeric Item 2 of the MAC (heroism subscale) scale.
her_3 numeric Item 3 of the MAC (heroism subscale) scale.
def_1 numeric Item 1 of the MAC (deference subscale) scale.
synthetic_nl 11

def_2 numeric Item 2 of the MAC (deference subscale) scale.


def_3 numeric Item 3 of the MAC (deference subscale) scale.
fai_1 numeric Item 1 of the MAC (fairness subscale) scale.
fai_2 numeric Item 2 of the MAC (fairness subscale) scale.
fai_3 numeric Item 3 of the MAC (fairness subscale) scale.
pro_1 numeric Item 1 of the MAC (property subscale) scale.
pro_2 numeric Item 2 of the MAC (property subscale) scale.
pro_3 numeric Item 3 of the MAC (property subscale) scale.

References
Van Leeuwen, F., Van Lissa, C. J., Papakonstantinou, T., Petersen, M., & Curry, O. S. (2022, May
25). Morality as Cooperation, Politics as Conflict. <doi:10.31234/osf.io/wm6rk>
Curry, O. S., Chesters, M. J., & Van Lissa, C. J. (2019). Mapping morality with a compass: Testing
the theory of ’morality-as-cooperation’ with a new questionnaire. Journal of Research in Personal-
ity, 78, 106-124.

synthetic_nl Simulated data about morality and politics in The Netherlands

Description
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concern-
ing associations between moral dispositions (measured using the Morality As Cooperation ques-
tionnaire, MAC; see Curry et al., 2019) and political orientation.

Usage
data(synthetic_nl)

Format
A data frame with 401 rows and 38 variables.

Details

sepa_soc_1 numeric Item 1 of the Policy Attitudes social (PA-social) scale.


sepa_soc_2 numeric Item 2 of the Policy Attitudes social (PA-social) scale.
sepa_soc_3 numeric Item 3 of the Policy Attitudes social (PA-social) scale.
sepa_soc_4 numeric Item 4 of the Policy Attitudes social (PA-social) scale.
sepa_soc_5 numeric Item 5 of the Policy Attitudes social (PA-social) scale.
sepa_eco_1 numeric Item 1 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_2 numeric Item 2 of the Policy Attitudes economic (PA-economic) scale.
12 synthetic_us

sepa_eco_3 numeric Item 3 of the Policy Attitudes economic (PA-economic) scale.


sepa_eco_4 numeric Item 4 of the Policy Attitudes economic (PA-economic) scale.
sepa_eco_5 numeric Item 5 of the Policy Attitudes economic (PA-economic) scale.
secs_soc_1 numeric Item 1 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_2 numeric Item 2 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_3 numeric Item 3 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_4 numeric Item 4 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_5 numeric Item 5 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_6 numeric Item 6 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_7 numeric Item 7 of the Social and Economic Conservatism Scale (social subscale) scale.
fam_1 numeric Item 1 of the MAC (family subscale) scale.
fam_2 numeric Item 2 of the MAC (family subscale) scale.
fam_3 numeric Item 3 of the MAC (family subscale) scale.
grp_1 numeric Item 1 of the MAC (group subscale) scale.
grp_2 numeric Item 2 of the MAC (group subscale) scale.
grp_3 numeric Item 3 of the MAC (group subscale) scale.
rec_1 numeric Item 1 of the MAC (reciprocity subscale) scale.
rec_2 numeric Item 2 of the MAC (reciprocity subscale) scale.
rec_3 numeric Item 3 of the MAC (reciprocity subscale) scale.
her_1 numeric Item 1 of the MAC (heroism subscale) scale.
her_2 numeric Item 2 of the MAC (heroism subscale) scale.
her_3 numeric Item 3 of the MAC (heroism subscale) scale.
def_1 numeric Item 1 of the MAC (deference subscale) scale.
def_2 numeric Item 2 of the MAC (deference subscale) scale.
def_3 numeric Item 3 of the MAC (deference subscale) scale.
fai_1 numeric Item 1 of the MAC (fairness subscale) scale.
fai_2 numeric Item 2 of the MAC (fairness subscale) scale.
fai_3 numeric Item 3 of the MAC (fairness subscale) scale.
pro_1 numeric Item 1 of the MAC (property subscale) scale.
pro_2 numeric Item 2 of the MAC (property subscale) scale.
pro_3 numeric Item 3 of the MAC (property subscale) scale.

References
Van Leeuwen, F., Van Lissa, C. J., Papakonstantinou, T., Petersen, M., & Curry, O. S. (2022, May
25). Morality as Cooperation, Politics as Conflict. <doi:10.31234/osf.io/wm6rk>
Curry, O. S., Chesters, M. J., & Van Lissa, C. J. (2019). Mapping morality with a compass: Testing
the theory of ‘morality-as-cooperation’with a new questionnaire. Journal of Research in Personality,
78, 106-124.

synthetic_us Simulated data about morality and politics in the USA


synthetic_us 13

Description
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concern-
ing associations between moral dispositions (measured using the Morality As Cooperation ques-
tionnaire, MAC; see Curry et al., 2019) and political orientation.

Usage
data(synthetic_us)

Format
A data frame with 518 rows and 33 variables.

Details

secs_soc_1 numeric Item 1 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_2 numeric Item 2 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_3 numeric Item 3 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_4 numeric Item 4 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_5 numeric Item 5 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_6 numeric Item 6 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_soc_7 numeric Item 7 of the Social and Economic Conservatism Scale (social subscale) scale.
secs_eco_1 numeric Item 1 of the Social and Economic Conservatism Scale (economic subscale) scale.
secs_eco_2 numeric Item 2 of the Social and Economic Conservatism Scale (economic subscale) scale.
secs_eco_3 numeric Item 3 of the Social and Economic Conservatism Scale (economic subscale) scale.
secs_eco_4 numeric Item 4 of the Social and Economic Conservatism Scale (economic subscale) scale.
secs_eco_5 numeric Item 5 of the Social and Economic Conservatism Scale (economic subscale) scale.
fam_1 numeric Item 1 of the MAC (family subscale) scale.
fam_2 numeric Item 2 of the MAC (family subscale) scale.
fam_3 numeric Item 3 of the MAC (family subscale) scale.
grp_1 numeric Item 1 of the MAC (group subscale) scale.
grp_2 numeric Item 2 of the MAC (group subscale) scale.
grp_3 numeric Item 3 of the MAC (group subscale) scale.
rec_1 numeric Item 1 of the MAC (reciprocity subscale) scale.
rec_2 numeric Item 2 of the MAC (reciprocity subscale) scale.
rec_3 numeric Item 3 of the MAC (reciprocity subscale) scale.
her_1 numeric Item 1 of the MAC (heroism subscale) scale.
her_2 numeric Item 2 of the MAC (heroism subscale) scale.
her_3 numeric Item 3 of the MAC (heroism subscale) scale.
def_1 numeric Item 1 of the MAC (deference subscale) scale.
def_2 numeric Item 2 of the MAC (deference subscale) scale.
def_3 numeric Item 3 of the MAC (deference subscale) scale.
fai_1 numeric Item 1 of the MAC (fairness subscale) scale.
fai_2 numeric Item 2 of the MAC (fairness subscale) scale.
fai_3 numeric Item 3 of the MAC (fairness subscale) scale.
pro_1 numeric Item 1 of the MAC (property subscale) scale.
pro_2 numeric Item 2 of the MAC (property subscale) scale.
pro_3 numeric Item 3 of the MAC (property subscale) scale.
14 t_test

References
Van Leeuwen, F., Van Lissa, C. J., Papakonstantinou, T., Petersen, M., & Curry, O. S. (2022, May
25). Morality as Cooperation, Politics as Conflict. <doi:10.31234/osf.io/wm6rk>
Curry, O. S., Chesters, M. J., & Van Lissa, C. J. (2019). Mapping morality with a compass: Testing
the theory of ‘morality-as-cooperation’with a new questionnaire. Journal of Research in Personality,
78, 106-124.

t_test Student’s t-test

Description
This function is a wrapper for the function t.test, which returns group-specific sample sizes and
variances, in addition to the usual output of t.test.

Usage
t_test(x, ...)

Arguments
x An object for which an S3 method of t.test exists (vector or formula).
... arguments passed to t.test.

Details
This wrapper allows users to enjoy the functionality of bain with the familiar interface of the stats-
function t.test.
For more documentation, see t.test.

Value
A list with class "t_test" containing the following components:
statistic the value of the t-statistic.
parameter the degrees of freedom for the t-statistic.
p.value the p-value for the test.
conf.int a confidence interval for the mean appropriate to the specified alternative hy-
pothesis.
estimate the estimated mean or difference in means depending on whether it was a one-
sample test or a two-sample test.
null.value the specified hypothesized value of the mean or mean difference depending on
whether it was a one-sample test or a two-sample test.
t_test 15

alternative a character string describing the alternative hypothesis.


method a character string indicating what type of t-test was performed.
data.name a character string giving the name(s) of the data.
v The variance or group-specific variances.
n The sample size, or group-specific sample size.

See Also
t.test

Examples
tmp <- t_test(extra ~ group, data = sleep)
tmp$n
tmp$v
tmp2 <- t_test(extra ~ group, data = sleep)
tmp2$n
tmp2$v
tmp <- t_test(Pair(sleep$extra[sleep$group == 1], sleep$extra[sleep$group == 2]) ~ 1)
tmp$n
tmp$v
t_test(sesamesim$postnumb)
tmp <- t_test(sesamesim$prenumb)
tmp$n
tmp$v
tmp2 <- t_test(sesamesim$prenumb)
tmp2$n
tmp2$v
tmp <- t_test(sesamesim$prenumb, sesamesim$postnumb)
tmp$n
tmp$v
tmp2 <- t_test(sesamesim$prenumb, sesamesim$postnumb)
tmp2$n
tmp2$v
tmp <- t_test(sesamesim$prenumb, sesamesim$postnumb, paired = TRUE)
tmp$n
tmp$v
tmp2 <- t_test(sesamesim$prenumb, sesamesim$postnumb, paired = TRUE)
tmp2$n
tmp2$v
Index

∗ Statistics
seBeta, 7
∗ datasets
kuiper2013, 5
sesamesim, 9
synthetic_dk, 10
synthetic_nl, 11
synthetic_us, 12
∗ htest
t_test, 14

bain, 2, 4
bain_sensitivity, 4

kuiper2013, 5

pbf, 6

seBeta, 7
sesamesim, 9
synthetic_dk, 10
synthetic_nl, 11
synthetic_us, 12

t.test, 14, 15
t_test, 14

16

You might also like