T Copula Calibration
- To: mathgroup at smc.vnet.net
- Subject: [mg78530] T Copula Calibration
- From: dwstrickler at tx.rr.com
- Date: Tue, 3 Jul 2007 05:44:15 -0400 (EDT)
All,
In the interest of full disclosure and genuine humility, I don't code
in Mathematica so much as I wrestle it into submission from time to
time. Accordingly, I've come up against an optimization problem in
which Mathematica flatly refuses to see things my way. In a nutshell,
I have an n x 3 table of interdependent log-delta price data (to the
extent it matters, I have a corresponding table of alpha-Stable
standardized log-delta price data), and I'm trying to construct a
simulation algorithm that will effectuate a Student T copula
relationship between the three variables. (FWIW, I've managed to
create Clayton and Gumbel copula RNGs for similar data; they work
fine).
The problem is the Student T copula density function, and in
particular, the Student T DOF parameter, v. I've tried NMinimize,
FindMinimum, and FindRoot, and I simply cannot get Mathematica to return a
numerical value for v. In fact, the problem is broader than that - I
can't get Mathematica to optimize ANY function that contains a Sum or Product
term - but I digress.
In terms of the density function, here's an example of what I've
tried:
tCopulaPDF[y__,v_,R_]:=Module[{dims,ret},dims=Length[Transpose[y]];ret=((Gamma
[(v+dims)/2]*(Gamma[v/2])^dims-1)/(Gamma[(v+1)/
2]^dims)*(Det[R])^1/2)*NProduct[(1+
(y[[i]]^2/v))^v+1/2,{i,1,dims}]*(1+y.R^-1*y/v)^-v+dims/2;Return[ret]];
where y is the n x 3 table, v is the DOF parameter, and R is the
correlation matrix for y. Gamma[] is Mathematica's built-in Euler Gamma
function.
Then I try to optimize with something like:
NMinimize[{tCopulaPDF[data,v,corrmat],v>0},v]
No luck. Mathematica gives me the standard NAN warning, and then returns the
function unevaluated.
Thinking the source of the problem might be the NProduct term, I also
tried expressing the density function a different way:
tCopulaPDF[y__,v_,R_]:=Module[{dims,ret,cols,a,b,c},dims=Length[Transpose[y]];cols=y/.
{a_,b_,c_}:>Apply[Times,(1+a^2/v)^v+1/2]+Apply[Times,(b^2/v)^v
+1/2]+Apply[Times,(c^2/v)^v
+1/2];ret=((Gamma[(v+dims)/2]*(Gamma[v/2])^dims-1)/(Gamma[(v+1)/
2]^dims)*(Det[R])^1/2)
*cols*(1+y.R^-1*y/v)^-v+dims/2;Return[ret]];
Same result. Any suggestions? I apologize in advance if the solution
is blindingly obvious to everyone but me.
- Follow-Ups:
- Re: T Copula Calibration
- From: dwstrickler@tx.rr.com
- Re: T Copula Calibration
- From: Carl Woll <carlw@wolfram.com>
- Re: T Copula Calibration