在 R 中拟合 von Mises 分布的混合 [英] Fit a mixture of von Mises distributions in R

查看:38
本文介绍了在 R 中拟合 von Mises 分布的混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组角度数据,我想将两个 von Mises 分布的混合拟合到其中.如下所示,数据聚集在大约 0 和 ±π 处,因此这种情况需要有一个周期性的边界.

I have a set of angular data that I'd like to fit a mixture of two von Mises distributions to. As shown below, the data are clustered at about 0 and ±π, so having a periodic boundary is required for this case.

我曾尝试使用 movMF 包来拟合这些数据的分布,但似乎它正在对每一行进行归一化,而且由于这是一组一维数据,结果是一个 ±1 的向量.其他人如何在 R 中拟合这样的混合分布?

I have tried using the movMF package to fit a distribution to these data but it seems that it is normalizing each row, and since this is a set of 1D data, the result is a vector of ±1. How are others fitting a mixture of distributions like this in R?

推荐答案

问题在于使用角度向量作为 movMF 函数的输入.相反,角度必须转换为单位圆上的点

The problem lies with using a vector of angles as the input to the movMF function. Instead, the angles must be converted to points on the unit circle

pts_on_unit_circle <- cbind(cos(angle_in_degrees * pi / 180), 
                            sin(angle_in_degrees * pi / 180))
d <- movMF(pts_on_unit_circle, number_of_mixed_vM_fxns)
mu <- atan2(d$theta[,2], d$theta[,1])
kappa <- sqrt(rowSums(d$theta^2))

来源:联系了 movMF 包的作者 Kurt Hornik.

Source: Contacted Kurt Hornik, the author of the movMF package.

这篇关于在 R 中拟合 von Mises 分布的混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆