mvnormlpr.m

来自「马尔可夫链」· M 代码 · 共 24 行

M
24
字号
% MVNORMLPR - Multivariate Normal Distribution - Log Density Ratio% Copyright (c) 1998, Harvard University. Full copyright in the file Copyright% % [ lpr ] = mvnormlpr(x1, x2, mu, sigma)%%   mu = mean column vector, p x 1%   sigma = covariance matrix, p x p %   x1, x2 = sample values, p x 1%%   lpr = log probability ratio%% returns the log of the p(p1) / p(p2) when both% are distributed Multivariate Normal (mu,sigma).%% Useful for calculations in Metropolis-Hastings steps%% See also: METROPfunction [ lpr ] = mvnormlpr (x1, x2, mu, sigma) d1 = x1 - mu ;d2 = x2 - mu ;lpr = (-(d1'/sigma)*d1 + (d2'/sigma)*d2) / 2 ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?