gam0_hist_ci: Plot histograms with confidence intervals

Description Usage Arguments Value

View source: R/gam0_ci_functions.R

Description

This function plots the histograms for each subject and variable with the fitted state dependent distributions overlayed and their corresponding confidence intervals. Zeros not included.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
gam0_hist_ci(
  x,
  viterbi,
  num_states,
  num_subjects,
  num_variables,
  hmm,
  state_dep_dist_pooled = FALSE,
  variable_names = c("Var 1", "Var 2", "Var 3"),
  subject_names = c("Subject 1", "Subject 2", "Subject 3", "Subject 4"),
  width = 1,
  n = 100,
  level = 0.975,
  x_step = 0.2,
  xaxis = NULL,
  yaxis = NULL
)

Arguments

x

The data to be fit with an HMM in the form of a 3D array. The first index (row) corresponds to time, the second (column) to the variable number, and the third (matrix number) to the subject number.

viterbi

A matrix with each column indicating the sequence of states decoded by gam_viterbi() that is supposed to have generated the data of the subject in the corresponding column.

num_states

The number of states in the desired HMM.

num_subjects

The number of subjects/trials that generated the data.

num_variables

The number of variables in the data.

hmm

A list of parameters that specify the gamma HMM, including num_states, num_variables, num_subjects, alpha, theta, gamma, delta.

state_dep_dist_pooled

A logical variable indiacting whether the state dependent distribution parameters alpha and theta should be treated as equal for all subjects.

variable_names

A vector containing the names of the variables in the data x.

subject_names

A vector containing the names of the subjects generating the data x.

width

The width of the histogram bins.

n

The number of samples in the Monte Carlo fitting.

level

A number indicating the level of confidence for the desired interval.

x_step

A value indicating the step length for the range of observation values.

xaxis

A list containing a list for each subject containing vectors for each variable of the desired minimum and maximum x-axis value.

yaxis

A list containing a list for each subject containing vectors for each variable of the desired minimum and maximum y-axis value.

Value

Histograms of the data with overlayed distributions and confidence intervals.


simonecollier/lizardHMM documentation built on Dec. 23, 2021, 2:24 a.m.