reject.samp.norm: Perform rejection sampling for normally distributed data with...

Description Usage Arguments Value Examples

Description

Given a sample of data from a normal distribution with known variance / standard deviation, and a normal prior for the expectation of the data, draw samples from the posterior by rejection sampling.

Usage

1
2
reject.samp.norm(z, known.sd = 1, prior.mean = 0, prior.sd = 1,
  nsamps = 10000)

Arguments

z

A numeric vector (assumed to be drawn from a normal distribution with known variance / standard deviation)

known.sd

The known standard deviation of the data distribution.

prior.mean

The expectation of the normal prior.

prior.sd

The standard devation of the normal prior.

nsamps

The number of observations to draw from the posterior by rejection sampling.

Value

A numeric vector of length nsamps containing simulated data from the posterior distribution.

Examples

1
reject.samp.norm(rnorm(100), 1, 2, 4, nsamps = 50)

mdedge/stfspack documentation built on May 9, 2019, 8:17 a.m.