print.MarkovMix {markovmix}R Documentation

Print MarkovMix object

Description

print.MarkovMix prints MarkovMix object in a user-friendly form, including component priors and transition matrices.

Usage

## S3 method for class 'MarkovMix'
print(x, sep = "->", print_max = 20L, print_min = 10L, ...)

Arguments

x

MarkovMix object.

sep

Character (1L) used as separator between states in the row names of transition matrix.

print_max, print_min

Integers as the numbers of rows to print each transition matrix. See pillar_options for details.

...

Currently ignored for this method.

Value

Input x, invisibly.

Note

Change log:

Author(s)

Xiurui Zhu

See Also

Other MarkovMix methods: predict.MarkovMix()

Examples

# Generate a list of integer sequences of different lengths with 4 states
test_states <- seq_len(4L)
test_maxlen <- 10L
set.seed(1111L)
test_seq <- purrr::map(
  seq_len(100L),
  ~ sample(test_states, sample.int(test_maxlen, 1L), replace = TRUE)
)

# Fit a 1-order Markov chain
markov_fit <- fit_markov_mix(
  seq_list = test_seq,
  order. = 1L,
  states = test_states
)
print(markov_fit)

# Fit a mixture of 2-order Markov chain with 3 components
test_n_comp <- 3L
test_clusters <- matrix(
  runif(length(test_seq) * test_n_comp),
  nrow = length(test_seq),
  ncol = test_n_comp
)
markov_mix_fit <- fit_markov_mix(
  seq_list = test_seq,
  order. = 2L,
  states = test_states,
  clusters = test_clusters
)
print(markov_mix_fit)

[Package markovmix version 0.1.3 Index]