von Mises Distribution (冯·米赛斯分布)的随机模拟与参数估计的笔记(二)
von Mises Distribution (冯·米赛斯分布)的随机模拟与参数估计的笔记(二)
1.参数估计算子分析
在上一节中,我们讨论了von Mises Distribution的概率分布函数PDF和累计分布函数CDF,并给出了von Mises Distribution的随机模拟和参数估计matlab程序,其中在此我们就参数估计的细节进行补充。其基于最大似然参数估计算子,如下表:

来源于《Statistical Distributions》
利用如下改进贝塞尔函数的关系求解参数\(\kappa\),如下表达:
\]
\]
1.1 \(\mu\)参数估计分析matlab代码
function mu=circ_mean(alpha, w, dim)
%
% mu = circ_mean(alpha, w)
% Computes the mean direction for circular data.
%
% Input:
% alpha sample of angles in radians
% [w weightings in case of binned angle data]
% [dim compute along this dimension, default is 1]
%
% If dim argument is specified, all other optional arguments can be
% left empty: circ_mean(alpha, [], dim)
%
% Output:
% mu mean direction
%
% PHB 7/6/2008
%
% References:
% Statistical analysis of circular data, N. I. Fisher
% Topics in circular statistics, S. R. Jammalamadaka et al.
% Biostatistical Analysis, J. H. Zar
%
% Circular Statistics Toolbox for Matlab
% By Philipp Berens, 2009
% berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
if nargin < 3
dim = 1;
end
if nargin < 2 || isempty(w)
% if no specific weighting has been specified
% assume no binning has taken place
w = ones(size(alpha));
else
if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1)
error('Input dimensions do not match');
end
end
% compute weighted sum of cos and sin of angles
r = sum(w.*exp(1i*alpha),dim);
% obtain mean by
mu = angle(r);
1.2 \(\kappa\)参数估计的matlab代码
function kappa = circ_kappa(alpha,w)
%
% kappa = circ_kappa(alpha,[w])
% Computes an approximation to the ML estimate of the concentration
% parameter kappa of the von Mises distribution.
%
% Input:
% alpha angles in radians OR alpha is length resultant
% [w number of incidences in case of binned angle data]
%
% Output:
% kappa estimated value of kappa
%
% References:
% Statistical analysis of circular data, Fisher, equation p. 88
%
% Circular Statistics Toolbox for Matlab
% By Philipp Berens, 2009
% berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
alpha = alpha(:);
if nargin<2
% if no specific weighting has been specified
% assume no binning has taken place
w = ones(size(alpha));
else
if size(w,2) > size(w,1)
w = w';
end
end
N = length(alpha);
if N>1
R = circ_r(alpha,w);
else
R = alpha;
end
if R < 0.53
kappa = 2*R + R^3 + 5*R^5/6;
elseif R>=0.53 && R<0.85
kappa = -.4 + 1.39*R + 0.43/(1-R);
else
kappa = 1/(R^3 - 4*R^2 + 3*R);
end
if N<15 && N>1
if kappa < 2
kappa = max(kappa-2*(N*kappa)^-1,0);
else
kappa = (N-1)^3*kappa/(N^3+N);
end
end
function r = circ_r(alpha, w, d, dim)
% r = circ_r(alpha, w, d)
% Computes mean resultant vector length for circular data.
%
% Input:
% alpha sample of angles in radians
% [w number of incidences in case of binned angle data]
% [d spacing of bin centers for binned data, if supplied
% correction factor is used to correct for bias in
% estimation of r, in radians (!)]
% [dim compute along this dimension, default is 1]
%
% If dim argument is specified, all other optional arguments can be
% left empty: circ_r(alpha, [], [], dim)
%
% Output:
% r mean resultant length
%
% PHB 7/6/2008
%
% References:
% Statistical analysis of circular data, N.I. Fisher
% Topics in circular statistics, S.R. Jammalamadaka et al.
% Biostatistical Analysis, J. H. Zar
%
% Circular Statistics Toolbox for Matlab
% By Philipp Berens, 2009
% berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
if nargin < 4
dim = 1;
end
if nargin < 2 || isempty(w)
% if no specific weighting has been specified
% assume no binning has taken place
w = ones(size(alpha));
else
if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1)
error('Input dimensions do not match');
end
end
if nargin < 3 || isempty(d)
% per default do not apply correct for binned data
d = 0;
end
% compute weighted sum of cos and sin of angles
r = sum(w.*exp(1i*alpha),dim);
% obtain length
r = abs(r)./sum(w,dim);
% for data with known spacing, apply correction factor to correct for bias
% in the estimation of r (see Zar, p. 601, equ. 26.16)
if d ~= 0
c = d/2/sin(d/2);
r = c*r;
end
2 代码效果分析
clc
clear all
close all
theta=pi/2; %设置模拟参数
kappa=50;
n=3000;
alpha=circ_vmrnd(theta,kappa,n); %生成制定参数的von-Mises分布的随机数
[thetahat1 kappa1]=circ_vmpar(alpha); %对其进行分布参数进行估计分析
%绘制模拟数据直方图
figure(1)
hist(alpha,100);
xlabel('Angle(弧度)');
ylabel('Frequency');
X = categorical({'Really value','Estimate value'});
%估计参数与模型参数对比
figure(2)
subplot(1,2,1)
bar(X,[theta,thetahat1]);
ylabel('theta');
subplot(1,2,2)
bar(X,[kappa,kappa1]);
ylabel('kappa');


von Mises Distribution (冯·米赛斯分布)的随机模拟与参数估计的笔记(二)的更多相关文章
- Gamma 函数与exponential power distribution (指数幂分布)
1. Γ(⋅) 函数 Γ(α)=∫∞0tα−1e−tdt 可知以下基本性质: Γ(α+1)=αΓ(α) Γ(1)=1 ⇒ Γ(n+1)=n! Γ(12)=π√ 2. 指数幂分布(exponential ...
- Python模块:Random(未完待续)
本文基于Python 3.6.5的官文random编写. random模块简介 random为各种数学分布算法(distributions)实现了伪随机数生成器. 对于整数,是从一个范围中均匀选择(u ...
- Python标准库3.4.3-random
9.6. random — Generate pseudo-random numbers Source code: Lib/random.py 翻译:Z.F. This module impleme ...
- 【论文阅读】CVPR2021: MP3: A Unified Model to Map, Perceive, Predict and Plan
Sensor/组织: Uber Status: Reading Summary: 非常棒!端到端输出map中间态 一种建图 感知 预测 规划的通用框架 Type: CVPR Year: 2021 引用 ...
- 【python】函数之内置函数
Python基础 内置函数 今天来介绍一下Python解释器包含的一系列的内置函数,下面表格按字母顺序列出了内置函数: 下面就一一介绍一下内置函数的用法: 1.abs() 返回一个数值的绝对值,可以是 ...
- PRML读书笔记——2 Probability Distributions
2.1. Binary Variables 1. Bernoulli distribution, p(x = 1|µ) = µ 2.Binomial distribution + 3.beta dis ...
- 转:Python获取随机数(英文)
Random - Generate pseudo-random numbers Source code: Lib/random.py This module implements pseudo-ran ...
- python模块:random
"""Random variable generators. integers -------- uniform within range sequences ----- ...
- python3之模块random随机数
1.random.random() 随机生成一个大于0小于1的随机数. print(random.random()) 0.03064765450719098 2.random.uniform(a,b) ...
- 6.6 random--伪随机数的生成
本模块提供了生成要求安全度不高的随机数.假设须要更高安全的随机数产生.须要使用os.urandom()或者SystmeRandom模块. random.seed(a=None, version=2) ...
随机推荐
- 【服务器】npm配置国内镜像源
[服务器]npm配置国内镜像源 零.问题 配置Node.js的HTTPS的时候,下载不了 一.解决 这里使用的是淘宝的镜像: npm config set registry https://regis ...
- STM32_RTOS_V2编程模板1-消息队列
#pragma region QUEUE1 // 1DEFINE osMessageQueueId_t queueDemo1 = NULL; // 2INIT queueDemo1 = osMessa ...
- Avalnoia跨平台实战记录(一),Avalonia初始化
前言: 记录一下小菜鸟程序员从WPF一知半解转向Avalonia跨平台桌面端开发的一点记录和感想,我个人是比较喜欢用.NET来开发的,当然,这也和我的技术栈有很大关系,本人只是从大专出来的,在学校里学 ...
- 多模态自动驾驶混合渲染HRMAD:将NeRF和3DGS进行感知验证和端到端AD测试
基于3DGS和NeRF的三维重建技术在过去的一年中取得了快速的进步,动态模型也变得越来越普遍,然而这些模型仅限于处理原始轨迹域内的对象. HRMAD作为一种混合方案,将传统的基于网格的动态三维神经重建 ...
- 89.4K star!这个开源LLM应用开发平台,让你轻松构建AI工作流!
嗨,大家好,我是小华同学,关注我们获得"最新.最全.最优质"开源项目和高效工作学习方法 Dify 是一款开源的 LLM 应用开发平台,通过直观的可视化界面整合 AI 工作流.RAG ...
- TDesign腾讯高保真Axure RP中后台交互模板及元件组件库
TDesign腾讯Axure RP中后台交互模板部件及元件组件库素材基于腾讯TDesign素材库,进行二次创作,并非官网的免费静态版.具体内容,可以看右侧的预览按钮,确认内容. 在线演示及下载:htt ...
- .NET程序启动就报错,如何截获初期化时的问题json
一:背景 1. 讲故事 前几天训练营里的一位朋友在复习课件的时候,程序一跑就报错,截图如下: 从给出的错误信息看大概是因为json格式无效导致的,在早期的训练营里曾经也有一例这样的报错,最后定位下来是 ...
- Django中自定义错误处理
1.将项目中的settings.py中的DEBUG=False,ALLOWED_HOSTS = ['localhost'] 2.在项目settings.py中TEMPLATES列表中的DIR定义的路径 ...
- Web前端入门第 58 问:JavaScript 运算符 == 和 === 有什么区别?
运算符 JavaScript 运算符是真的多,尤其是 ES6 之后还在不停的加运算符,其他编程语言看 JS 就像怪物一样,各种骚操作不断~~ 运算符分类 1.算术运算符 算术运算符的作用就是用来基础计 ...
- 2025 CCPC打铁记
Day -? 报名参加 \(CCPC\) Day -1 周天比赛,周六签到. 早上依旧是在 \(lyyz\) 打练习赛. 中午 \(12:30\) 上车,结果教练忘了通知我,再加上我把北门认成南门,导 ...