package to fit mixtures of student-t distributions

狂风中的少年 提交于 2020-01-05 08:27:52

问题


I am looking for a piece of software (python preferred, but really anything for which a jupyter kernel exists) to fit a data sample to a mixture of t-distributions.

I searched quite a while already and it seems to be that this is a somehwat obscure endeavor as most search results turn up for mixture of gaussians (what I am not interested here).

TThe most promising candidates so far are the "AdMit" and "MitSEM" R packages. However I do not know R and find the description of these packages rather comlple and it seems their core objective is not the fitting of mixtures of t’s but instead use this as a step to accomplish something else.

This is in a nutshell what I want the software to accomplish:

Fitting a mixture of t-distributions to some data and estimate the "location" "scale" and "degrees of freedom" for each.

I hope someone can point me to a simple package, I can’t believe that this is such an obscure use case.


回答1:


This seems to work (in R):

Simulate example:

 set.seed(101)
 x <- c(5+ 3*rt(1000,df=5),
        10+1*rt(10000,df=20))

Fit:

 library(teigen)
 tt <- teigen(x,
        Gs=2,   # two components
        scale=FALSE,dfupdate="numeric",
        models=c("univUU")  # univariate model, unconstrained scale and df
        # (i.e. scale and df can vary between components)
 )

The parameters are all reasonably close (except for the df for the second component, but this is a very tough thing to estimate ...)

 tt$parameters[c("df","mean","sigma","pig")]
 ## $df    ## degrees of freedom
 ## [1]  3.578491 47.059841  
 ## $mean  ## ("location")
 ##           [,1]
 ## [1,]  4.939179
 ## [2,] 10.002038
 ## $sigma    ## reporting variance rather than sd (I think?)
 ## , , 1
 ##          [,1]
 ## [1,] 8.763076
 ## , , 2
 ##          [,1]
 ## [1,] 1.041588
 ## $pig     ## mixture probabilities
 ## [1] 0.09113273 0.90886727


来源:https://stackoverflow.com/questions/44825529/package-to-fit-mixtures-of-student-t-distributions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!