s_displaymlerecursionfort.m

来自「经济学专业代码」· M 代码 · 共 31 行

M
31
字号
% this script demonstrates the recursive ML estimation of the location and scatter
% parameters of a multivariate Student t distribution
% see Section 4.3.1 in "Risk and Asset Allocation" - Springer (2005), by A. Meucci


clear; clc; close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% inputs
N=5;
T=1000;

nu=8;
Mu=rand(N,1);
A=rand(N,N)-.5;
Sigma=A*A';
    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
s=sqrt(diag(Sigma));
C=diag(1./s)*Sigma*diag(1./s);
X=ones(T,1)*Mu'+ mvtrnd(C,nu,T)*diag(s);

Tolerance=10^(-10);
[Mu_hat,Sigma_hat] = MleRecursionForT(X,nu,Tolerance);

Mu
Mu_hat

Sigma
Sigma_hat

⌨️ 快捷键说明

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