0

In the BAYESAB package, the below example is provided:

A_norm <- rnorm(100, 6, 1.5)
B_norm <- rnorm(100, 5, 2.5)

AB2 <- bayesTest(A_norm, B_norm,
             priors = c('mu' = 5, 'lambda' = 1, 'alpha' = 3, 'beta' = 1),
             distribution = 'normal')'

from the two distributions A_norm an dB_norm - how is the values for mu, lambda, alpha and beta generated?

Many thanks.

Dave2e
  • 22,192
  • 18
  • 42
  • 50

1 Answers1

0

From ?bayesTest (bold-face mine)

• Normal: If your data is well modeled by the normal  
          distribution, with parameters mu, sigma^2 controlling mean  
          and variance of the underlying distribution  

            • Data _can_ be negative if it makes sense for your
              experiment

            • Uses a conjugate ‘NormalInverseGamma’ distribution for
              the parameters *mu* and *sigma^2* in the Normal
              Distribution.

            • ‘mu’, ‘lambda’, ‘alpha’, and ‘beta’ must be set for prior
              distributions over *mu, sigma^2* in accordance with the
              parameters of the conjugate prior distributions:

                • mu, sigma^2 ~ NormalInverseGamma(mu, lambda, alpha,
                  beta)

            • This is a bivariate distribution (commonly used to model
              mean and variance of the normal distribution).  You may
              want to experiment with both this distribution and the
              ‘plotNormal’ and ‘plotInvGamma’ outputs separately before
              arriving at a suitable set of priors for the Normal and
              LogNormal ‘bayesTest’

So to summarise, mu, lambda, alpha, beta denote the (hyper)parameters of the priors on (mu, sigma^2) of the normal distribution. How to choose parameters for your priors is a very broad question, and usually requires domain-specific knowledge. What priors (and in turn which parameter values) to choose is a critical question in Bayesian inference, and you can find a plethora of literature on this.

In this case, you are assuming an Normal-inverse-gamma distribution, where mu is the location parameter, lambda a scaling parameter, and alpha and beta are the parameters of an inverse Gamma distribution that defines the prior on sigma^2. With an understanding of the underlying probability distribution of the prior(s) and taking into account your/any prior knowledge, you choose parameters according to whether you want to consider an informative or non-informative (weak) prior on the parameters mu and sigma^2 of your normal distribution.

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68
  • thanks thats very helpful - and i think its the domain specific knowledge i am trying to get my head around. is there any material that you recommend that provides a good intro? thanks – ManyQsFewAs Sep 01 '18 at 01:32
  • @ManyQsFewAs Domain-specific knowledge is something only you (as the domain expert) can deliver. Concerning Bayesian modelling in general, I would recommend a good Bayesian statistical modelling textbook; my favourites are "Data Analysis Using Regression and Multilevel/Hierarchical Models" by Gelman and Hill, and "Bayesian Data Analysis" by Gelman et al. – Maurits Evers Sep 03 '18 at 06:02
  • Thanks - I have read up on Bayes AB testing etc but am yet to find an example that uses data drawn from Normal distribution. i will have a look at the book. cheers – ManyQsFewAs Sep 04 '18 at 03:36