Cody

Problem 1132. Create a recurrence matrix for a vector of data

In conversation analysis, it's often useful to track the contributions from each speaker to see who talks when. One measurement of engagement between a pair of conversants is to see if they talk to each other more than they talk to other people; for example, at a double date, two old friends might talk to each other more than they talk to their spouses.

Assuming we've coded up the conversation data (e.g. using Gail Jefferson's transcription methods) and assigned a unique number to each participant, MATLAB makes an excellent tool to quickly gather some of these statistics.

Given a vector of speaker observations V, where element V(i) indicates who spoke sentence i in the data, find how many times each element occurs directly after each other element. Note that since we may only be analyzing a part of a larger transcripts, not all speaker numbers may appear in the vector.

Return a matrix containing this data, as well as the list of (ordered) unique elements.

E.g., if V = [1 3 5 3 5 5], then

[R, U] = recurrence(V)
R =
     0     1     0
     0     0     2
     0     1     1
U =
     1     3     5

Such a tool will have other uses, of course.

Solution Stats

68.97% Correct | 31.03% Incorrect
Last solution submitted on May 21, 2018

Problem Comments

Recent Solvers14

Suggested Problems

More from this Author3

Tags