问题
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