pnullSamp: Test a one sided hypothesis using a sample from a posterior...

Description Usage Arguments Details Value Examples

View source: R/pnullSamp.r

Description

Calculates the probability of a one sided null hypothesis from a sample from a posterior density.

Usage

1
pnullSamp(theta, theta0 = 0, type = 'upper')

Arguments

theta

a sample of values from a posterior density

theta0

the hypothesized value, i.e. H0: theta <= theta0

type

the type of probability to return, 'lower' = Pr(theta <= theta0) or 'upper' = Pr(theta >= theta0). It is sufficient to use 'l' or 'u'

Details

This function uses linear interpolation to calculate bounds for points that may not be specified by CDF

Value

a list containing the element prob which will be the upper or lower tail probability depending on type

Examples

1
2
3
4
5
## The posterior density is N(3,1)
theta <- rnorm(1000,3)

## test whether the true mean is greater than 0 (it is obviously!)
pnullSamp(theta)

Bolstad2 documentation built on May 2, 2019, 2:16 a.m.