crossrunauto {crossrun}R Documentation

Joint Distribution for Crossings and Runs, autocorrelated Sequence

Description

Joint probability distribution for the number of crossings C and the longest run L in a sequence of n autocorrelated Bernoulli observations with success probability p. To enhance precision, results are stored in mpfr arrays and the probabilities are multiplied by m^{n-1} for a multiplier m.

Usage

crossrunauto(
  nmax = 100,
  prob = 0.5,
  changeprob = 0.5,
  mult = 2,
  prec = 120,
  printn = FALSE
)

Arguments

nmax

max sequence length.

prob

success probability p.

changeprob

unrestricted change probability. If p \geq 0.5, probability of changing to success, if not probability of changing to failure.

mult

multiplier for joint probabilities.

prec

mpft precision.

printn

logical for progress output.

Value

list of joint probabilities.

Examples

# p=0.6, independence
cr10.6 <- crossrunbin(nmax=10, prob=0.6, printn=TRUE)
cra10.6 <- crossrunauto(nmax=10, prob=0.6, changeprob=.6, printn=TRUE)
Rmpfr::asNumeric(cr10.6$pt[[10]])
Rmpfr::asNumeric(cr10.6$pt[[10]])
Rmpfr::asNumeric(cr10.6$pt[[10]]) - Rmpfr::asNumeric(cra10.6$pt[[10]]) # equal


# p=0.6, some dependence
cr10.6 <- crossrunbin(nmax=10, prob=0.6, printn=TRUE)
cra10.6.u.5 <- crossrunauto(nmax=10, prob=0.6, changeprob=.5, printn=TRUE)
round(Rmpfr::asNumeric(cr10.6$pt[[10]]),1)
round(Rmpfr::asNumeric(cra10.6.u.5$pt[[10]]),1) # not the same

[Package crossrun version 0.1.1 Index]