Title: | Bayes Factors for Informative Hypotheses |
---|---|
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>. |
Authors: | 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] |
Maintainer: | Caspar J van Lissa <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.11 |
Built: | 2024-11-10 06:18:14 UTC |
Source: | CRAN |
bain
is an acronym for "Bayesian informative hypotheses evaluation".
It uses the Bayes factor to evaluate hypotheses specified using equality and
inequality constraints among (linear combinations of) parameters in a wide
range of statistical models. A tutorial by Hoijtink, Mulder, 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 tutorial AND the vignette that is provided
with this package before using bain
.
bain(x, hypothesis, fraction = 1, ...)
bain(x, hypothesis, fraction = 1, ...)
x |
An R object containing the outcome of a statistical analysis.
Currently, the following objects can be processed: |
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 denotes twice the minimal fraction, etc. See the vignette for elaborations. |
... |
Additional arguments. See the vignette for elaborations. |
The main output resulting from analyses with bain
are
Bayes factors and posterior model probabilities associated with the
hypotheses that are evaluated. See the tutorial and the
vignette for further elaborations.
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/
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 models. 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 Psychology, 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
# 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 results <- bain(anov, "site1=site2=site3=site4=site5; site2>site5>site1> site3>site4") # # SEE THE TUTORIAL AND VIGNETTE FOR MANY ADDITIONAL 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 results <- bain(anov, "site1=site2=site3=site4=site5; site2>site5>site1> site3>site4") # # SEE THE TUTORIAL AND VIGNETTE FOR MANY ADDITIONAL EXAMPLES
Conducts a sensitivity analysis for bain
.
bain_sensitivity(x, hypothesis, fractions = 1, ...)
bain_sensitivity(x, hypothesis, fractions = 1, ...)
x |
An R object containing the outcome of a statistical analysis.
Currently, the following objects can be processed: |
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 denotes twice the minimal fraction, etc. See the vignette for elaborations. |
... |
Additional arguments passed to |
The Bayes factor for equality constraints is sensitive to a
scaling factor applied to the prior distribution. 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 available 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]")
.
A data.frame
of class "bain_sensitivity"
.
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]")
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]")
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 regression; 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 experimental 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.
data(kuiper2013)
data(kuiper2013)
A data frame with 4 rows and 4 variables.
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. |
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 Embeddedness 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 Situations: Buying a Used Car. Rationality and Society 12:227-53.
The product Bayes factor (PBF) aggregates evidence for an informative hypothesis across conceptual replication studies without imposing assumptions about heterogeneity.
pbf(...) ## Default S3 method: pbf(x, ...) ## S3 method for class 'numeric' pbf(yi, vi, ni, hypothesis = "y = 0", ...)
pbf(...) ## Default S3 method: pbf(x, ...) ## S3 method for class 'numeric' pbf(yi, vi, ni, hypothesis = "y = 0", ...)
... |
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. |
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.
A 'data.frame' of class 'pbf'.
Van Lissa, C. J., Kuiper, R. M., & Clapper, E. (2023, April 25). Aggregating evidence from conceptual replication studies using the product Bayes factor. doi:10.31234/osf.io/nvqpw
pbf(yi = c(-.33, .32, .39, .31), vi = c(.085, .034, .016, .071), ni = c(7, 10, 13, 20))
pbf(yi = c(-.33, .32, .39, .31), vi = c(.085, .034, .016, .071), ni = c(7, 10, 13, 20))
Computes Normal Theory and ADF Standard Errors and CIs for Standardized Regression Coefficients
seBeta( X = NULL, y = NULL, cov.x = NULL, cov.xy = NULL, var.y = NULL, Nobs = NULL, alpha = 0.05, estimator = "ADF" )
seBeta( X = NULL, y = NULL, cov.x = NULL, cov.xy = NULL, var.y = NULL, Nobs = NULL, alpha = 0.05, estimator = "ADF" )
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'. |
cov.Beta |
Normal theory or ADF covariance matrix of standardized regression coefficients. |
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 coefficients. |
estimator |
estimator = "ADF" or "Normal". |
Jeff Jones and Niels Waller
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.
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)
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)
This is a simulated counterpart of part of the Sesame Street data presented by Stevens (1996, Appendix 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 measurement; and scores on knowledge of body parts, letters, forms, numbers, relations, and classifications, both before and after watching Sesame Street for a year.
data(sesamesim)
data(sesamesim)
A data frame with 240 rows and 21 variables.
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 rural, 4 = disadvantaged rural, 5 = disadvantaged Spanish speaking |
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 |
Stevens, J. (1996). Applied Multivariate Statistics for the Social Sciences. Mahwah NJ: Lawrence Erlbaum.
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concerning associations between moral dispositions (measured using the Morality As Cooperation questionnaire, MAC; see Curry et al., 2019) and political orientation.
data(synthetic_dk)
data(synthetic_dk)
A data frame with 552 rows and 31 variables.
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. |
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. |
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.
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concerning associations between moral dispositions (measured using the Morality As Cooperation questionnaire, MAC; see Curry et al., 2019) and political orientation.
data(synthetic_nl)
data(synthetic_nl)
A data frame with 401 rows and 38 variables.
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. |
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. |
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.
This is a simulated counterpart of data presented by Van Leeuwen and colleagues (2022) concerning associations between moral dispositions (measured using the Morality As Cooperation questionnaire, MAC; see Curry et al., 2019) and political orientation.
data(synthetic_us)
data(synthetic_us)
A data frame with 518 rows and 33 variables.
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. |
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.
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
.
t_test(x, ...)
t_test(x, ...)
x |
An object for which an S3 method of t.test exists (vector or formula). |
... |
arguments passed to |
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
.
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 hypothesis. |
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. |
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. |
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
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