Skip to content

Commit

Permalink
negate indipendence
Browse files Browse the repository at this point in the history
  • Loading branch information
bertiqwerty committed Aug 10, 2023
1 parent 2acc224 commit 3c4f64f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub fn random_walk(
let rv = d.sample(&mut rv_rng);
res[i] = (res[i - 1] * rv).max(1e-1);

if is_return_indpendent && sigma - sigma_mean > 0.0 {
if !is_return_indpendent && sigma - sigma_mean > 0.0 {
let actual_total_return: f64 = (1..=i).map(|j| res[j] / res[j - 1]).product::<f64>().powf(1.0/(n_months-i) as f64);
let expected_total_return = expected_monthly_return.powf(n_months as f64 / (n_months-i) as f64);
mu = expected_total_return / actual_total_return;
Expand Down

0 comments on commit 3c4f64f

Please sign in to comment.