Learn R Programming

GPTCM (version 1.1.3)

metropolis_sampler: Metropolis sampler for a target density

Description

Random number generator via Metropolis-Hastings algorithm.

Usage

metropolis_sampler(
  initial_value,
  n = n,
  proposal_shape = 1,
  proposal_scale = 1,
  theta = 1,
  proportion = 0.5,
  mu = 1,
  kappas = 0.9,
  burnin = 0,
  lag = 1
)

Value

A dataframe consisting of the sampled values and acceptance rate

Arguments

initial_value

initial values

n

number of draws

proposal_shape

Weibull's shape parameter in the proposal

proposal_scale

Weibull's scale parameter in the proposal

theta

cure rate parameter (log scale)

proportion

proportions data

mu

mean survival time

kappas

Weibull's true shape parameter

burnin

length of burn-in period

lag

discarding lag-1 values in the Metropolis step

Examples

Run this code

times <- metropolis_sampler(10, 5)

Run the code above in your browser using DataLab