Learn R Programming

hdMTD (version 0.1.1)

freqTab: A tibble containing sample sequence frequencies and estimated probabilities

Description

This function returns a tibble containing the sample sequences, their frequencies and the estimated transition probabilities.

Usage

freqTab(S, j = NULL, A, countsTab, complete = TRUE)

Value

A tibble where each row represents a sequence of elements from A. The initial columns display each sequence symbol separated into columns corresponding to their time indexes. The remaining columns show the sample frequencies of the sequences and the MLE (Maximum Likelihood Estimator) of the transition probabilities.

Arguments

S

A numeric vector of positive integers or NULL. Represents a set of past lags that must be present within the columns of the countsTab argument and are to be considered while estimating the transition probabilities. Both S and j cannot be NULL at the same time.

j

An integer or NULL. Typically represents a lag j in the \(complement\) of S. Both S and j cannot be NULL at the same time. Both S and j cannot be NULL at the same time. See Details for further information.

A

A vector with nonnegative integers. Must have at least two different entries. A represents the state space.

countsTab

A tibble or a data frame with all sequences of length d+1 that appear in the sample, and their absolute frequency. This tibble is typically generated by the function countsTab(). If using a custom data frame not generated by countsTab(), make sure its format and column names match the expected structure; otherwise, errors may occur in freqTab().

complete

Logical. If TRUE all sequences that did not appear in the sample will be included in the output with frequency equal to 0 .

Details

The parameters S and j determine which columns of countsTab are retained in the output. Specifying a lag j is optional. All lags can be specified via S, while leaving j = NULL (default). The output remains the same as when specifying S and j separately. The inclusion of j as a parameter improves clarity within the package's algorithms. Note that j cannot be an element of S.

Examples

Run this code
freqTab(S=c(1,4),j=2,A=c(1,2,3),countsTab = countsTab(testChains[,2],d=5))
#Equivalent to freqTab(S=c(1,2,4),j=NULL,A=c(1,2,3),countsTab = countsTab(testChains[,2],d=5))

Run the code above in your browser using DataLab