help sdentropy

Title

sdentropy -- Calculate the Shannon entropy of a sequence

Syntax

sdentropy varlist , generate(string) cdstub(string) nstates(int)

Description

sdentropy creates a new variable holding the Shannon entropy
of the sequence, given by the generate() option. As a side
effect, it creates variables containing the relative cumulated duration
(named by the cdstub() option, as in cumuldur).
nstates tells Stata how many states there are. States must be
numbered from 1 up.

Shannon entropy takes no account of sequence order, and is just
based on the relative cumulated duration in the different states, with the formula:

- Sum [ p_i * log_2(p_i) ]

Author

Brendan Halpin, brendan.halpin@ul.ie

Examples

. sdentropy m1-m40, gen(ent) cd(dur) nstates(3)