Skip to content

Commit 9535176

Browse files
author
Alen John
committed
Rename variable - Set 1 - done
1 parent a0ff0fb commit 9535176

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main/java/net/finmath/timeseries/models/parametric/ARMAGARCH.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,35 +73,35 @@ public double getLogLikelihoodForParameters(final double[] parameters)
7373
double logLikelihood = 0.0;
7474

7575
final double volScaling = 1;
76-
double evalPrev = 0.0;
77-
double eval = volScaling * (Math.log((timeSeries.getValue(1))/(timeSeries.getValue(0))));
78-
if(Double.isInfinite(eval) || Double.isNaN(eval)) {
79-
eval = 0;
76+
double evaluationPrev = 0.0;
77+
double evaluation = volScaling * (Math.log((timeSeries.getValue(1))/(timeSeries.getValue(0))));
78+
if(Double.isInfinite(evaluation) || Double.isNaN(evaluation)) {
79+
evaluation = 0;
8080
}
8181
double h = omega / (1.0 - alpha - beta);
8282
double m = 0.0; // xxx how to init?
8383

84-
logLikelihood += - Math.log(h) - 2 * Math.log((Math.abs(timeSeries.getValue(1)))/volScaling) - eval*eval / h;
84+
logLikelihood += - Math.log(h) - 2 * Math.log((Math.abs(timeSeries.getValue(1)))/volScaling) - evaluation*evaluation / h;
8585

8686
final int length = timeSeries.getNumberOfTimePoints();
8787
for (int i = 1; i < length-1; i++) {
88-
m = -mu -theta * m + eval - phi * evalPrev;
88+
m = -mu -theta * m + evaluation - phi * evaluationPrev;
8989
h = (omega + alpha * m * m) + beta * h;
9090

91-
final double value1 = timeSeries.getValue(i);
92-
final double value2 = timeSeries.getValue(i+1);
91+
final double currentValue = timeSeries.getValue(i);
92+
final double nextValue = timeSeries.getValue(i+1);
9393

94-
double evalNext = volScaling * (Math.log((value2)/(value1)));
94+
double evalNext = volScaling * (Math.log((nextValue)/(currentValue)));
9595
if(Double.isInfinite(evalNext) || Double.isNaN(evalNext)) {
9696
evalNext = 0;
9797
}
98-
final double mNext = -mu - theta * m + evalNext - phi * eval;
98+
final double mNext = -mu - theta * m + evalNext - phi * evaluation;
9999

100100
// We need to take abs here, which corresponds to the assumption that -x is lognormal, given that we encounter a negative values.
101-
logLikelihood += - Math.log(h) - 2 * Math.log((Math.abs(value2))/volScaling) - mNext* mNext / h;
101+
logLikelihood += - Math.log(h) - 2 * Math.log((Math.abs(nextValue))/volScaling) - mNext* mNext / h;
102102

103-
evalPrev = eval;
104-
eval = evalNext;
103+
evaluationPrev = evaluation;
104+
evaluation = evalNext;
105105
}
106106
logLikelihood += - Math.log(2 * Math.PI) * (length-1);
107107
logLikelihood *= 0.5;

0 commit comments

Comments
 (0)