Learn R Programming

PACBO (version 0.1.0)

transition_probability: State Transition Probability

Description

This function computes the transition probability from current state x to the proposal state z belonging to the neighbor of x (i.e., $z \in {x-1, x, x+1}$).

Usage

transition_probability(x, z, K_max, prob = 1/3)

Arguments

x
positive integer indicating the current state.
z
positive integer indicating the proposal state.
K_max
positive integer indicating the maximum value allowed for x and z.
prob
probability of jumping from state x to state x if x doesn't equal to K_max nor 1.

Value

A transition probability from state x to state z.

Details

This function computes the transition probability from current state x to the proposal state z. If x doesn't equal to K_max nor 1 and z belongs to the neighbor of x (i.e., x-1,x,x+1), then the transition probability is prob, else 0. If x equals to 1 or K_max, then the transition probability from x to z belongs to 1,2 or K_max-1, K_max is 0.5, else 0.

Examples

Run this code
transition_probability(2, 3, 50, 1/3)

Run the code above in your browser using DataLab