DMM.dmm#

main module

class DMM(k, interval=None, sigma=None)#

Bases: object

class for denoised method of moments

Args: sigma: float, default None standard deviation. If sigma == None, will estimate sigma.

interval =[a,b]: floats, default [-10, 10] represents the interval of means [a,b]

num_components: int, required number of postulated components

estimate(samples)#

estimate a model from given samples use two-step estimate: 1.(a) prelimnary estimation with identity weight matrix

  1. estimation of optimal weight matrix (require all samples)

  1. reestimate parameters using esimated weight matrix

Args: samples: array of float, required samples collected

Returns: an estimated ModelGM

estimate_from_moments(moments, wmat=None)#

estimate a discrete random variable from moments estimate

Args: moments: array of length 2k-1 estimated moments of U of degree 1 to 2k-1

wmat: matrix of shape (k, k) weight matrix for moment projection, default identity matrix

Returns: an estimated latent distribtuion on at most k points

estimate_latent_moments(samples)#

estimate moments of latent distribution (deconvolution) model: X=U+sigma*Z sigma must be given

Args: samples: array of length n

Return: array of length 2k-1 estimated moments of U from degree 1 to 2k-1

estimate_online(samples_new)#

update the estimate a model from more samples only store a few moments and correlations

Args: samples_new: array of floats new samples

Returns: an estimated ModelGM

estimate_select(samples, threhold=1)#

estimate with selected number of components

estimate_with_wmat(samples, wmat=None)#

estimate a model from given samples using given weight matrix model: X=U+sigma*Z sigma must be given

Args: samples: array of float, required samples collected

wmat: array of shape (k,k) weight matrix, default identity

Returns: latent distribtuion

sample_moment_cov(samples)#

return the sample covariance matrix of moments estimates

select_num_comp(samples, threhold=1)#

select the number of components according to sample variance of moments estimate

estimate_weight_matrix(m_estimate, model)#

estimate weight matrix: inverse of the estimated covariance matrix ref: [Bruce E. Hansen] Econometrics. Chapter 11.

Args: m_estimate: matrix of size (k,n) power of n samples from degree of 1 to k

model: discrete_rv

Return: consistent estimation for the optimal weight matrix