Learn R Programming

hdMTD (version 0.1.4)

perfectSample: Perfectly samples an MTD Markov chain

Description

Samples an MTD Markov Chain from the stationary distribution.

Usage

perfectSample(object, N, ...)

Value

Returns a size N sample from an MTD model (the first element is the most recent).

Arguments

object

An object of class "MTD" or "MTDest".

N

Positive integer. Sample size to generate. Must be > max(Lambda(object)).

...

Additional arguments passed to methods.

Details

This perfect sample algorithm requires that the MTD model has an independent distribution (p0) with a positive weight (i.e., lambdas(object)["lam0"]>0 which means \(\lambda_0>0\)).

Examples

Run this code
M <- MTDmodel(Lambda = c(1, 3, 4), A = c(0, 2))
perfectSample(M, N = 200)

M <- MTDmodel(Lambda = c(2, 5), A = c(1, 2, 3))
perfectSample(M, N = 300)

Run the code above in your browser using DataLab