normaltest: Bayesian hypothesis testing with Normal distribution

Description Usage Arguments Value Source Examples

Description

The Bayesian hypothesis testing is based on the posterior distribution π(θ | x), and the decision is to reject or accept the null hypothesis according to which decision provides the smaller losses. The loss of rejecting the null hypothesis is a times the probability of the null is true, where a is the loss due to type I error. The loss of accepting the null hypothesis is b times the probability of the null is false, where b is the loss due to type II error.

Usage

1
normaltest(x, theta, a, b)

Arguments

x

results from the normnorm with known variance.

theta

the parameter for hypothesis testing.

a

loss due to type I error.

b

loss due to typp II error.

Value

hypothesis testing result and expected posterior loss

Source

The slides 9 of STATG012 on Moodle

Examples

1
2
3
4
5
6
7
8
## generate a sample of 16 from a normal distribution with sd=4
y <- rnorm(16, mean = 5.2, sd=4)
## the observed sample mean is 5.2
yy <- y- mean(y)+5.2
## find the posterior density
exmp1 <- normnorm(yy, m = 4.5, s = sqrt(10), sigma = 4)
## make the hypothesis testing
normaltest(exmp1, 5, 1, 1)

yijin71/statg012 documentation built on May 23, 2019, 4:04 p.m.