Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fit a mixture of von Mises distributions in R

Tags:

r

statistics

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. Distribution of data

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?

like image 454
weitzner Avatar asked Sep 13 '13 14:09

weitzner


1 Answers

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))

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

like image 144
weitzner Avatar answered Sep 25 '22 11:09

weitzner