Code covered by the BSD License
-
BlackScholesCall(spot,K,r,vol...
Black-Scholes price of a European call
-
BlackScholesCall(spot,K,r,vol...
Black-Scholes price of a European call
-
ChoiceOptimal(Market,Investor...
-
ComRets2Prices(Exp_Comp_Rets,...
this function computes the mean-variance inputs for stocks
-
Cost(Allocation,Market,Invest...
-
D=Delta(Time_to_Maturity,Stoc...
-
DecisionBestPerfomer(Market,I...
% find index of best performer
-
Dy2Prices(Exp_DY,Cov_DY,Times...
this function computes the mean-variance inputs for zero-coupon bonds
-
Dy2Prices(Exp_DY,Cov_DY,Times...
this function computes the mean-variance inputs for zero-coupon bonds
-
Dy2Prices(Exp_DY,Cov_DY,Times...
this function computes the mean-variance inputs for zero-coupon bonds
-
E=TwoDimEllipsoid(Location,Sq...
this function computes the location-dispersion ellipsoid
-
EfficientFrontier(NumPortf, E...
This function returns the NumPortf x 1 vector expected returns,
-
EfficientFrontier(NumPortf, E...
This function returns the NumPortf x 1 vector expected returns,
-
EfficientFrontier(NumPortf, E...
This function returns the NumPortf x 1 vector expected returns,
-
EfficientFrontierQP(NumPortf,...
this function computes the mean-variance efficient frontier by quadratic programming
-
EfficientFrontierQPRets(NumPo...
This function returns the NumPortf x 1 vector expected returns,
-
EfficientFrontierQPRetsBench(...
This function returns the NumPortf x 1 vector expected returns,
-
EntropyProg(p,A,b,Aeq,beq)
This function computes the entropy-pooling change of measure, see
-
FlexM(returns,demean,eps,df)
PURPOSE: estimate FlexM multivariate GARCH model
-
G_Hat_a(X)
-
G_Hat_b(X)
-
G_Hat_c(X)
-
G_Hat_d(X)
we use var(X,1,2) instead of var(X,0,2) to obtain the true sample estimator, which is slightly biased
-
G_Hat_e(X)
-
Goodness(Who,M)
-
IIDAnalysis(Data)
this function performs simple invariance (i.i.d.) tests on a time series
-
IIDAnalysis(Dates,Data)
this function performs simple invariance (i.i.d.) tests on a time series
-
K=Solve4Strike(Strike,Time_to...
-
MleRecursionForTFast(x,Nu,Tol...
this function computes recursively the ML estimators of location and scatter
-
NormalCopulaPDF(u,Mu,Sigma)
-
PlotDistributions(X,p,p_)
-
PlotFrontier(Portfolios)
-
PlotFrontier(Portfolios, vol)
This function plots the efficient frontier in the plane of portfolio
-
PlotFrontier(Portfolios, vol)
This function plots the efficient frontier in the plane of portfolio
-
PlotNIWMarginals(Mu_Simul,Inv...
this function plots numerically and analytically the marginal pdf of
-
Q=QuantileMixture(p,a,m_Y,s_Y...
this function computes the quantile of a mixture distirbution by linear interpolation/extrapolation of the cdf
-
RobustEfficientFrontier(Targe...
-
RunAnalysis(Dates,Data,Label)
this function performs simple invariance tests with generic time series
-
Satisfaction(Allocation,Marke...
-
TCopulaPDF(u,nu,Mu,Sigma)
-
TwoDimEllipsoid(Location,Squa...
this function computes the location-dispersion ellipsoid
-
TwoDimEllipsoid(Location,Squa...
this function computes the location-dispersion ellipsoid
-
TwoDimEllipsoid(Location,Squa...
this function computes the location-dispersion ellipsoid
-
X=GenerateUniform(J,N)
this function generates a uniform sample on the unit hypersphere
-
X=JumpDiffusionMerton(m,s,l,a...
simulate number of jumps;
-
X=MvnRnd(M,S,J)
% this function generates normal simulations whose sample moments match the population moments
-
X=MvnRnd(M,S,J)
% this function generates normal simulations whose sample moments match the population moments
-
X=MvnRnd(M,S,J)
% this function generates normal simulations whose sample moments match the population moments
-
XXX=minfro(A);
function XXX=minfro(A);
-
[BLMu,BLSigma]=BLmFormulas(Mu...
-
[E_EM, S_EM, Y, CountLoop]=EM...
this function implements the Expectation-Maximization (EM) algorithm to recover
-
[Expected_Value,Covariance,St...
-
[M,S]=Log2Lin(Mu,Sigma)
-
[Mu,Sigma,InvSigma,VecIndex]=...
this function generates a multivariate i.i.d. sample of lenght J from the
-
[Mu,Th,Sig]=FitOU(Y,tau)
this function fits a multivariate OU process at estimation step tau
-
[Who, Num, G]=AcceptByS(OutOf...
-
[Who, Num, G]=Naive(OutOfWho,...
-
[Who, Num, G]=RejectByS(OutOf...
-
[Who, g]=ExactNChooseK(OutOfW...
-
[X,F]=GenerateInvariants(mu_x...
-
[ga,mu]=SummStats(X,N)
compute central moments
-
[mu,sigma_square]=LognMoments...
-
[q,qerr,hf,hferr]=garch1f4(x,...
function [q,qerr,hf,hferr]=garch1f3(x)
-
[x_Hor,f_Hor,F_Hor]=Projectio...
this function performs the horizon projection of a t-distributed invariant
-
f=fparam(x,th)
-
h=TwoDimEllipsoid(Location,Sq...
this function computes the location-dispersion ellipsoid
-
h=pHist(X,p,nBins)
-
interpne(V,Xi,nodelist,method)
interpne: Interpolates and extrapolates using n-linear interpolation (tensor product linear)
-
interpne(V,Xi,nodelist,method)
interpne: Interpolates and extrapolates using n-linear interpolation (tensor product linear)
-
ka=Raw2Cumul(mu_)
-
mu=Raw2Central(mu_)
code to map raw moments into central moments
-
mu=Raw2Central(mu_)
code to map raw moments into central moments
-
mu_=Central2Raw(mu)
code to map central moments into raw moments
-
mu_=Central2Raw(mu)
code to map central moments into raw moments
-
mu_=Cumul2Raw(ka)
-
q=garch2f8(y,c1,a1,b1,y1,h1,c...
-
q=qparam(p,th)
-
xx=newton(M,i,b,m,aii,n,rho);
-
PlotEvaluationGeneric.m
-
S_AnalyzeLognormalCorrelation...
-
S_AnalyzeNIWPriorPosterior.m
-
S_AnalyzeNormalCorrelation.m
-
S_AutocorrelatedProcess.m
-
S_BLmBasic.m
-
S_BivariateSample.m
-
S_BondProjectionPricingNormal...
-
S_BondProjectionPricingT.m
-
S_BondResidualModel.m
-
S_BuyNHold.m
-
S_CPPI.m
-
S_CallsProjectionPricing.m
-
S_CornishFisher.m
-
S_CorrelationPriorUniform.m
-
S_DerivativesInvariants.m
-
S_DisplayCopulaPDF.m
-
S_DisplayJumpDiffusionMerton.m
-
S_DisplayNormalCopulaCDF.m
-
S_DisplayNormalCopulaPDF.m
-
S_EMexampleHighYield.m
-
S_ESContributionsFacts.m
-
S_ESContributionsT.m
-
S_EVT.m
-
S_EigenvalueDispersion.m
-
S_EllipticalNDim.m
-
S_EntropyView.m
-
S_EquitiesInvariants.m
-
S_EquityProjectionPricing.m
-
S_EstimateMomentsComboEvaluat...
-
S_EstimateQuantileEvaluation.m
-
S_EvaluationGeneric.m
-
S_FXCopulaMarginal.m
-
S_FactorAnalysisNotOK.m
-
S_FactorResidualCorrelation.m
-
S_FitSwapToT.m
-
S_FixedIncomeInvariants.m
-
S_FoDHedgeOptions.m
-
S_FoDHorizonEffect.m
-
S_FullCodependence.m
-
S_GenerateMixtureSample.m
-
S_InvestorsObjective.m
-
S_LinVsLogReturn.m
-
S_LognormalSample.m
-
S_MLEbasics.m
-
S_MVBenchmark.m
-
S_MVCalls.m
-
S_MVCallsRobust.m
-
S_MVHorizon.m
-
S_MVOptimization.m
-
S_MaxMinVariance.m
-
S_MultiVarSqrRootRule.m
-
S_NonAnalytical.m
-
S_NormalSample.m
-
S_OptionReplication.m
-
S_OrderStatisticsPDFLogn.m
-
S_OrderStatisticsPDFStudentT.m
-
S_PasturMarchenko.m
-
S_ProjSummStats.m
-
S_ProjectNPriceMvGARCH.m
-
S_ResidualAnalysisTheory.m
-
S_SelectionHeuristicsFoD.m
-
S_SemiCircular.m
-
S_ShrinkageEstimators.m
-
S_StatArbSwaps.m
-
S_StudentTSample.m
-
S_SwapPCA2Dim.m
-
S_TStatApprox.m
-
S_Toeplitz.m
-
S_UtlityMax.m
-
S_VaRContributionsUniform.m
-
S_VolatilityClustering.m
-
S_Wishart.m
-
S_WishartCorrelation.m
-
S_WishartLocationDispersion.m
-
View all files
from
Exercises in Advanced Risk and Portfolio Management
by Attilio Meucci
text and comments on solutions available at http://symmys.com/node/170
|
| S_ProjSummStats.m |
clear; clc; close all
% project summary statistics to arbitrary horizons
% see Meucci, A. (2010)
% "Annualization and General Projection of Skewness, Kurtosis and All Summary Statistics"
% GARP Risk Professional - "The Quant Classroom", pp. 52-54
% Available as "Quant Nugget 4" at http://ssrn.com/abstract=1635484
% last version of this code available at MATLAB Central File Exchange
% http://www.mathworks.com/matlabcentral/fileexchange/25010
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% inputs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=6; % focus on first N standardized summary statistics
K=100; % projection horizon
% generate arbitrary distribution
J=100000; % number of scenarios
Z=randn(J,1);
X=sin(Z)+log(cos(Z)+2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% compute single-period standardized statistics and central moments
[ga,mu]=SummStats(X,N);
% compute single-period non-central moments
mu_=Central2Raw(mu);
% compute single-period cumulants
ka=Raw2Cumul(mu_);
% compute multi-period cumulants
Ka=K*ka;
% compute multi-period non-central moments
Mu_=Cumul2Raw(Ka);
% compute multi-period central moments
Mu=Raw2Central(Mu_);
% compute multi-period standardized statistics
Ga=Mu;
Ga(2)=sqrt(Mu(2));
for n=3:N
Ga(n)=Mu(n)/(Ga(2)^n);
end
|
|
Contact us at files@mathworks.com