On this page:
build-transitions-matrices
transition-matrix->table
transition-matrix->dot
transition-matrix->pict
files-table->transition-matrices
8.0

3 Event Transition Functions

Functions for analysis of transitions between behavioral events

 (require "../event-transitions.rkt") package: base

procedure

(build-transitions-matrices #:ts-hash event-timestamps-hash)

  hash?
  event-timestamps-hash : hash?
timestamp lists are lists of (start-timestamp . end-timestamp) pairs given a hash of timestamp lists (keyed by eventtype names) make a n+2 x n+2 matrix using hashes, with "interval" added on for transitions from event to "interval" ibi’s, and "total" for summation of transitions.

Three matrices are returned, with keys "all", "<IEI", ">IEI"

"all" is transition of every event to every other event, regardless of interevent interval; transitions to inactive intervals are not included "<IEI" is transition of events to other events only if the inter-event interval is less than kInactiveInterval; transitions between events with intervals greater than kInactiveInterval are coded as event1 -> "interval", "interval" -> event2 ">IEI" is transition of events to other events only if the inter-event interval is greater than kInactiveInterval; this allows quantification of events on either side of an inactive period

Matrices have an added "total" row and column for summing event transitions across rows and columns, which should be helpful for

procedure

(transition-matrix->table matrix)  list?

  matrix : hash?
given one of the matrices produced by build-transitions-matrices, return the matrix in a list-of-list-format

header row = ’("From \u2193 \\ To \u2192" <event-names>1-k "interval" "total") each row1-j: ’( <event-name>j [transitions j->k]1-k [j->inactive] <row-total>)

procedure

(transition-matrix->dot matrix [#:expt expt])  digraph?

  matrix : hash?
  expt : (or/c null? list?) = null
given one of the matrices produced by build-transitions-matrices, return the matrix as a graphviz-dot string

which can then be used to plot a pict.

If expt is provided the colors of eventypes are assigned to the nodes

procedure

(transition-matrix->pict matrix    
  [#:expt expt])  pict?
  matrix : hash?
  expt : (or/c null? list?) = null
given one of the matrices produced by build-transitions-matrices, return the matrix as a pict,

as generated by transition-matrix->graphviz

If expt is provided the colors of eventypes are assigned to the nodes

procedure

(files-table->transition-matrices #:expt expt 
  #:files-table file-table) 
  hash?
  expt : list?
  file-table : query-table?
given a query-table listing individual files (which may not come from the same subject) compile the transition matrices by loading the event-records from each file’s data rows, computing each files transition matrices, then summing the transition matrices across all files.

NB: results are slightly different from ethogram transitions. This routine analyses each file separately then sums results, but transitions between files (ie across file boundaries) are NOT included When working with a single subject’s ethogram, the event records of individual files are concatenated into continuous event records that span all files for that subject. So ethogram has a few more transitions ( + (number of files - 1)) than the sum of transitions from individual files