% function Entropies=Markov_Entropies(vSignal,iDim,iTao,rParam)
% 
% This function estimates a set of Markov Models-based entropies from a reconstructed 
% attractor using the embedding dimension iDim and the time delay iTao. 
% The estimator uses a discrete hidden Markov model whose codebook was set
% using the Subspace Constrained Mean Shift (SCMS) method for finding principal
% curves, which is used in this context as a "profile trajectory". 
%
% Please cite: Julián D. Arias-Londoño, Juan I. Godino-Llorente, "Entropies 
% from Markov Models as Complexity Measures of Embedded Attractors", 
% Entropy, vol. 17, no. 6, pp 3595-3620, 2015.
%
% Inputs:
%
%           vSignal: vector containing the time series to be analyzed.
%           iDim: Embedding dimension. Default 2.
%           iTao: Time delay. Default 1.
%           rParam: Window size for the kernel density estimator. Default 
%                   0.2*std(vSignal).
%
% Outputs: 
%
%           Entropies: Struct containing:
%
%           Set of entropies estimated over the attractor with dimension
%           iDim.
%
%           Entropies.OriginalDim.EMcs: Markov chain entropy:Shannon
%           Entropies.OriginalDim.EMcr: Markov chain entropy:Renyi 2
%           Entropies.OriginalDim.EhmmsN: Conditional Markov entropy (Normalized): Shannon
%           Entropies.OriginalDim.EhmmrN: Conditional Markov entropy
%                                         (Normalized): Renyi 2
%           Entropies.OriginalDim.EhmmsU: Conditional Markov entropy (Unnormalized): Shannon
%           Entropies.OriginalDim.EhmmrU: Conditional Markov entropy
%                                         (Unnormalized): Renyi 2
%           Entropies.OriginalDim.EMrds: Markov recurrence density: Shannon
%           Entropies.OriginalDim.EMrdr: Markov recurrence density: Renyi 2
%
%           ---------------------------------------------------------------
%
%           Set of entropies estimated as the average of the measures for 
%           the attractor with dimension iDim and iDim + 1.
%
%           Entropies.AverageDim.EMcs: Markov chain entropy:Shannon
%           Entropies.AverageDim.EMcr: Markov chain entropy:Renyi 2
%           Entropies.AverageDim.EhmmsN: Conditional Markov entropy (Normalized): Shannon
%           Entropies.AverageDim.EhmmrN: Conditional Markov entropy
%                                         (Normalized): Renyi 2
%           Entropies.AverageDim.EhmmsU: Conditional Markov entropy (Unnormalized): Shannon
%           Entropies.AverageDim.EhmmrU: Conditional Markov entropy
%                                         (Unnormalized): Renyi 2
%           Entropies.AverageDim.EMrds: Markov recurrence density: Shannon
%           Entropies.AverageDim.EMrdr: Markov recurrence density: Renyi 2