pnullSamp {Bolstad2}R Documentation

Test a one sided hypothesis using a sample from a posterior density

Description

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

Usage

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


## 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)


[Package Bolstad2 version 1.0-29 Index]