⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monteback.m

📁 统计工具软件
💻 M
字号:
function [mn,mvar,vp] = monteback(X,RF,RC,legame,valuta,vm,p,rendimento,campione,dati,tipo,l,lambda,datidelta)%DELTABACK	backtesting for Monte Carlo VaR.%%	[mn,mvar,vp] = monteback(X,RF,RC,legame,valuta,vm,p,rendimento,campione,dati,tipo,l,lambda,datidelta) %   calculates the number of outlier in Monte Carlo VaR portfolio%   backtesting. Campione is the number of simulation (for Basel 250), dati%   is the number of data used for VaR calculation, and l is the number of%   monate Carlo simulations.%	Lambda is the weight in EWMA volatility forecast.%   If Datidelta = 0 the mapping procedure is calculated over all X,%   = 1 only with defined data.%%	All data must be in columns.%%	See MONTEVAR%%	Copyright (c) 2004 by Flavio Bazzana%   Department of Computer and Management Sciences%   University of Trento%   38100 - Trento ITALY%   flavio.bazzana@economia.unitn.itn=size(X,1);m=length(valuta);[DX,DR,cambi,fattori,prezzi] = rendimenti(X,RF,RC,rendimento);[deltax,dev,cor,C] = semplicecorr(DX,DR,legame);cp = vm./prezzi;cp = vm./prezzi;for i=1:campione+1home; disp(i)% VaR interval	X1=X(n-dati-i:n-i,:);	RF1=RF(n-dati-i:n-i,:);	RC1=RC(n-dati-i:n-i,:);	% calculation of montevar over such interval		[DX,DR,cambi,fattori,prezzi] = rendimenti(X1,RF1,RC1,rendimento);	if lambda==1		[delta,dev,cor,C] = semplicecorr(DX,DR,legame);		else [delta,dev,cor,C] = ewmacorr(DX,DR,legame,lambda);	end	if datidelta==1		[mvar(i)] = montevar(delta,C,legame,valuta,cambi,fattori,prezzi,vm,1,p,tipo,l,rendimento);		else [mvar(i)] = montevar(deltax,C,legame,valuta,cambi,fattori,prezzi,vm,1,p,tipo,l,rendimento);	end% calculation of portfolio value		for j=1:m		if valuta(j)==0			k1(j)=1;			else k1(j)=cambi(valuta(j));		end	end	k2 = prezzi.*k1';	vp(i) = k2'*cp;end% calculation of the exceptionsmn=0;for i=1:campione	if vp(i+1)-vp(i)<-mvar(i)		mn=mn+1;	end	if vp(i+1)-vp(i)>mvar(i)		mn=mn+1;	endendf=1:campione;plot(f,-mvar(1:campione),'b',f,mvar(1:campione),'b',f,diff(vp),'r')title('Monte Carlo VaR backtesting')xlabel('Sample')ylabel('VaR')

⌨️ 快捷键说明

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