Merge Successive Events

<< Click to Display Table of Contents >>

Navigation:  STRUCTURE Data Files > Optimize Events >

Merge Successive Events

This routine can be helpful for various scenarios:

oConvert Intervals into Events - If you have data that was collected in fixed intervals, you can turn repetitive Codes - that last for more than one interval in a row - into a single, coherent Event for that Code.

oConvert Repetitive Markers into Events - If you have coded various repetitive activities with a simple Marker for Frequency counts (e.g. placed a marker for every time a dog says "woof"), but discover during analysis that it would be good to have those activities converted into Events with duration whenever die repetition took place within a specific interval.
E.g. turn "woof" - "woof" - "woof" into an Event labeled "Barking" .

oMerge Repetitive Events - If you have observed many rather short behaviors, but figure out that those activities actually belong to a more generic, longer lasting Event, whenever they occur within a specific time frame. E.g. turn "chewing" .... "chewing" ... "Chewing" ... "chewing" into an Event named "food intake", whenever the chewing was observed within 30 seconds and the pauses in-between should be ignored.

oConsolidate Overlapping Events - Multiple subjects coded in a single DataSet (using lexical chains and a subject code per line) results in overlapping behaviors, because multiple subjects can perform the same behavior at the same time.
In statistics, these overlapping times are all counted for per Event holding that particular Code.
To get the consolidated duration of this behavior (for example 'Playing time' in a Class named 'Activity') without the overlaps - thus independent of the subject, use the Merge successive Events routine.
 

For all mentioned scenarios the same command is used, which can be applied either for a single code or for all codes at once.

Note: All original Codes and Events are kept as well, so you need to pay attention to what you select while calling what statistics.

Merge Successions of a Specific Code

The merge example with the barking dog, that has been coded with single 'barks' initially, is a typical case for this routine.

Select the command Transform - Events - Merge Btn_MergeEvents> Create Events for specific repetitive Codes.

Select the Class and the Code you want to merge in the upcoming dialog.

Confirm with OK.

ConsolidateEvents_Dialog 1dog

Enter the maximum distance between two "Woof" Events that should be considered as the same "Barking" period.
Only events that occur within this time range will be merged:

ConsolidateEvents_Dialog 2dog

In this example all single "Woof" Events are merged if they are less than 2 Seconds apart.

Confirm with OK.

The results appear as new Events within the original DataSet. Each Event holds the original Code within a new Class.
The name of that new Class is extended by '_merged_in_xxxx ms', allowing you to merge the same Code with different distances between the Events and still be able to tell them apart.

In this example the new Events hold the Code 'Woof' in a Class named 'Dog_merged_in_2000ms':

ConsolidateEvents_TLC merged events

If you run the same command using a max gap of 3 seconds, an additional Class with the extension '_merged_in_3000ms' is added:

MergeEvents_TLC_secondPass
TIP:You can tripple-click the Class header to rename that Class and use the command Edit – Find & Replace - Replace btn_replace to rename the Codes 'Woof' with 'Barking'.

Replace Original Events

The merge function does not overwrite any of the original data, which is fine in the example above and always allows you to first verify the results, but there are situations were you might want to replace the original Events with the merged-version.

Example: You coded 3 different types of 'smile' in a Class named 'Emotion' but now decide that you want to convert all types to just 'Smile'.
- You started the process by renaming all three smile types with the Replace command.
After doing so, you notice that your data now contains repetitive sequences with the Code 'Smile', that should be turned into a single Event.
- Running the Merge Events for a specific Code routine does create the merged Events, but the Codes are in the new 'Merged' column.

There is no simple Replace Events command (that works only for Codes) because the time information differs for all these Events.

TIP:If you have Events with identical time information, you can use the Consolidate Events command to merge these.

In this 'smile'-example, we can either keep all Events and re-organize our Codes in two different Classes, or delete the Events that are no longer needed and move the merged Code to its original Class.

Keep Original Data

If you want to use the merged version mainly for certain statistics or visualizations, it is wise to keep the original data as coded.
You can of course create a copy of the original file and remove the original data (like described next). Alternatively, you can keep all data in the same file and just use the new Class for those statistics and visualizations.

All you need to do to realize that, is to copy the remaining Codes from the original 'Emotion' Class into the new 'Merged' Class:

ClickTransform - Codes - Move and Combine btn_movecodes to open the Move & Combine dialog.

Select all Codes from the Class Emotion, EXCEPT the original 'Smile'-types.

Select the new 'Merged' Class as your Target Class.

Verify that the option Wipe source is DEACTIVATED.

Click OK to perform the routine.

Now all additional Codes from the original 'Emotion' Class are copied into the new 'Merged' Class.

For better understanding, you should now rename the new 'Merged' Class to something like 'Expression' so it looks better in statistics.

Delete Original Data

If you are sure you no longer need the original Codes with the 3 different 'Smile'-Types (make sure you hold a backup copy somewhere), you should first delete all Events holding those Codes:

Select Edit – Find & Replace - Find Btn_Find and select the first 'Smile'-type from the original 'Emotions' Class, to select all Events with that Code.

Click Edit - Selected - Delete to remove all Events with that Code.

Repeat those steps to remove the Events for the other two 'smile'-types.

After all 'Smile'-type Events are deleted, it is time to move the Code 'Smile' from the new 'Merged' Class back into the original Emotions Class:

ClickTransform - Codes - Move and Combine btn_movecodes to open the Move & Combine dialog.

Select the 'Smile' Code from the new 'Merged' Class.

Select the original 'Emotions' Class as your Target Class.

Verify that the option Wipe source is DEACTIVATED.

Click OK to perform the routine.

Now all merged smile Codes are copied into the Emotions Class again.

All that is left to do, is to delete the new 'Merged'-Class, as it is no longer needed.

Merge All Successive Codes

If your data contains many successions (and or overlaps) for all Codes, as described in the most likely scenarios at the beginning of this topic, you can perform the Event-Merging routine for all Codes at once.

Select Transform - Events - Merge Btn_MergeEvents > Create Events for all repetitive Codes.

Enter the maximum distance between two Events that should be merged into one coherent period.
Only events that occur within this time range are merged:

ConsolidateEvents_Dialog 2dog

TIP:To merge Intervals, specify a distance of a single frame (00:00:00:01)

INTERACT now checks all Events per Class and whenever an identical Code was detected within the given interval, those Events are merged as described before...

IMPORTANT: This routine works its way through you data per Class and only looks for re-occurrences of an identical Code within the specified time frame, INDEPENDENT of the fact that another Code might have been coded in-between!