BaseMetropolisHastings

abstract class BaseMetropolisHastings[T](logLikelihoodFunc: T => Double, init: T, burnIn: Int, dropCount: Int)(implicit val rand: RandBasis) extends MetropolisHastings[T] with Process[T] with TracksStatistics
trait Process[T]
trait Rand[T]
trait Serializable
class Object
trait Matchable
class Any

Value members

Concrete methods

def aboveOneCount: Long
def acceptanceCount: Long
def draw(): T
def logLikelihood(x: T): Double
def total: Long

Inherited methods

def aboveOneFrac: Double
Inherited from
TracksStatistics
def condition(p: T => Boolean): Rand[T]
Inherited from
Rand
def drawOpt(): Option[T]

Overridden by filter/map/flatmap for monadic invocations. Basically, rejeciton samplers will return None here

Overridden by filter/map/flatmap for monadic invocations. Basically, rejeciton samplers will return None here

Inherited from
Rand
def filter(p: T => Boolean): Rand[T]
Inherited from
Rand
def flatMap[E](f: T => Rand[E]): Rand[E]

Converts a random sampler of one type to a random sampler of another type. Examples: randInt(10).flatMap(x => randInt(3 * x.asInstanceOf[Int]) gives a Rand[Int] in the range [0,30] Equivalently, for(x <- randInt(10); y <- randInt(30 *x)) yield y

Converts a random sampler of one type to a random sampler of another type. Examples: randInt(10).flatMap(x => randInt(3 * x.asInstanceOf[Int]) gives a Rand[Int] in the range [0,30] Equivalently, for(x <- randInt(10); y <- randInt(30 *x)) yield y

Value Params
f

the transform to apply to the sampled value.

Inherited from
Rand
def foreach(f: T => Unit): Unit

Samples one element and qpplies the provided function to it. Despite the name, the function is applied once. Sample usage:

Samples one element and qpplies the provided function to it. Despite the name, the function is applied once. Sample usage:

<pre> for(x &lt;- Rand.uniform) { println(x) } </pre>

Value Params
f

the function to be applied

Inherited from
Rand
def get(): T
Inherited from
Rand
def likelihood(x: T): Double
Inherited from
MetropolisHastings
def likelihoodRatio(start: T, end: T): Double
Inherited from
MetropolisHastings
def logLikelihoodRatio(start: T, end: T): Double
Inherited from
MetropolisHastings
def logTransitionProbability(start: T, end: T): Double
Inherited from
MetropolisHastings
def map[E](f: T => E): Rand[E]

Converts a random sampler of one type to a random sampler of another type. Examples: uniform.map(_2) gives a Rand[Double] in the range [0,2] Equivalently, for(x <- uniform) yield 2x

Converts a random sampler of one type to a random sampler of another type. Examples: uniform.map(_2) gives a Rand[Double] in the range [0,2] Equivalently, for(x <- uniform) yield 2x

Value Params
f

the transform to apply to the sampled value.

Inherited from
Rand
protected def nextDouble: Double
Inherited from
MetropolisHastings
def observe(x: T): Process[T]

Force the "next" draw to be x, and return a new process.

Force the "next" draw to be x, and return a new process.

Inherited from
Process
def proposalDraw(x: T): T
Inherited from
MetropolisHastings
def rejectionCount: Long
Inherited from
TracksStatistics
def rejectionFrac: Double
Inherited from
TracksStatistics
def sample(n: Int): IndexedSeq[T]

Gets n samples from the distribution.

Gets n samples from the distribution.

Inherited from
Rand
def sample(): T

Gets one sample from the distribution. Equivalent to get()

Gets one sample from the distribution. Equivalent to get()

Inherited from
Rand
def samples: Iterator[T]

An infinitely long iterator that samples repeatedly from the Rand

An infinitely long iterator that samples repeatedly from the Rand

Returns

an iterator that repeatedly samples

Inherited from
Rand
def samplesVector[U >: T](size: Int)(implicit m: ClassTag[U]): DenseVector[U]

Return a vector of samples.

Return a vector of samples.

Inherited from
Rand
def step(): (T, Process[T])

Draw a sample and the next step of the process along with it.

Draw a sample and the next step of the process along with it.

Inherited from
Process
def steps: Iterator[T]

Returns an Iterator that automatically moves the Process along as next is called

Returns an Iterator that automatically moves the Process along as next is called

Inherited from
Process
def withFilter(p: T => Boolean): Rand[T]
Inherited from
Rand

Implicits

Implicits

implicit val rand: RandBasis