Step-by-step example of Bayesian t-test?

This page summarizes the projects mentioned and recommended in the original post on /r/AskStatistics

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • stan

    Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.

    The ` sigma ~ x` part specifies that sigma should be estimated separately for each group. Note that I'm also using scaled data, since then I can go by the Stan team's [prior choice recommendations](https://github.com/stan-dev/stan/wiki/Prior-Choice-Recommendations). We also specified ` family = gaussian` , which is telling the model to treat ` y` , the difference between the two variables, as normally distributed. In other words, this is the likelihood! There are [lots](https://cran.r-project.org/web/packages/brms/vignettes/brms_families.html) of "families" in brms. In particular, if you use a Student's t distribution instead, your model will be more robust against outliers!

  • brms

    brms R package for Bayesian generalized multivariate non-linear multilevel models using Stan

    Okay so first off, I recommend that you read [this](https://link.springer.com/article/10.3758/s13423-016-1221-4) article about "The Bayesian New Statistics", which highlights estimation rather than hypothesis testing from a Bayesian perspective (see Fig. 1, second row, second column). Instead of a t-test, then, we can *estimate the difference* between two groups/variables. If you want to go deeper than JASP etc, I recommend that you use [brms](https://paul-buerkner.github.io/brms/), or, if you want to go even deeper, [Stan](https://mc-stan.org/) (brms is a front-end to Stan).

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • tests-as-linear

    Common statistical tests are linear models (or: how to teach stats)

    Second, one thing that is often overlooked is that most models can be seen as [variants of linear regression](https://lindeloev.github.io/tests-as-linear/), including t-tests. To estimate the difference between two variables using linear regression (in R), you use `lm(y ~ x, data = data), where `x` is the group variable (factor coded) and `y` is the variable of interest. If you suppress the intercept, you directly estimate the means of the two variables: `lm(y ~ 0 + x, data = data)`` . Finally, the t-test assumes equal variance between groups, which is often [a weird assumption](https://www.rips-irsp.com/articles/10.5334/irsp.82/). Thus we'll make sure to allow variance to differ.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts