Learn R Programming

lestat (version 1.9)

posteriornormal2: Compute a Posterior Distribution for Parameters of Two Normal Distributions

Description

Given a vectors data1 and data2 of data, this function assumes data1 is a sample from one normal distribution while data2 is a sample from another, while both distributions are assumed to have the same logged scale. The bivariate posterior for the difference between the expectations of the two distributions and the common logged scale of the distributions is computed, assuming a flat prior.

Usage

posteriornormal2(data1, data2)

Arguments

data1

A vector with data values. Assumed to be a sample from the first normal distribution.

data2

Another vector with data values. Assumed to be a sample from the second normal distribution.

Value

An object representing a Normal-ExpGamma distribution.

See Also

posteriornormal1, linearmodel

Examples

Run this code
# NOT RUN {
data1 <- simulate(normal(3.3, log(2)), 9)
data2 <- simulate(normal(5.7, log(2)), 4)
posteriornormal2(data1, data2)
marginal(linearmodel(c(data1, data2), 
designTwoGroups(length(data1), length(data2))), 2:3) #Gives same result
# }

Run the code above in your browser using DataLab