A math problem

Discussion in 'Risk Management' started by earth_imperator, Aug 8, 2023.

  1. A math problem

    N is the number of intervals in a time period (for example 10 bars in 60 days).
    It gets used in calculating s from volatility, ie. the stddev for that period.
    s is one of the parameters for a generator function (see below St=...).
    The results of the generator function are off by a varying percent value (depending on N; column "yOffPct" in table below).
    To fix this, the D term of the generator function must be set to a correct value (>= 1.0):
    St = S * D * exp(s * rndSND)
    where St is the generated new value, S is the initial value, D is the sought value >= 1.0,
    s is the said stddev for the period, rndSND is a random value from a standard normal distribution (mu=0, s=1).
    The values of S, s, and rndSND, as well St, are irrelevant to know (one can use some constants for testing).
    A formula for D is sought: how to define a correct value for D (depending on N, ie. as a function of N), to bring yOffPct down to 0.0 for each N ?
    Code:
    N     yOffPct
    1     0.00        (N=1 is correct, N>1 is off by that pct)
    2     20.58
    3     31.58
    4     38.91
    5     44.11
    6     48.08
    7     51.45
    8     54.15
    9     56.32
    10    58.19
    15    64.89
    20    69.23
    25    71.94
    30    74.09
    35    75.58
    40    76.88
    45    78.10
    50    79.01
    60    80.63
    70    81.77
    80    82.40
    90    83.30
    100   83.84
    125   85.28
    150   86.28
    175   86.81
    200   87.38
    225   88.00
    250   87.92
    300   88.63
    350   89.24
    400   89.35
    450   89.78
    500   89.93
    600   90.11
    700   90.39
    800   90.61
    900   90.76
    1000  90.70
    
     
    Last edited: Aug 9, 2023
  2. To clarify: originally there was no D in the above generator equation.
    To fix the yOffPct in the table, D has been introduced.
    So one can say that previously it was implicitly D=1.0 for all N,
    but now seeking an individual D value for each N.
    To be mathematically correct, D obviously has to be >= 1.0.
    D must be a function of N, which implies also the delta time (ie. dt), since N divides the time into N intervalls...

    One has to study the yOffPct curve (together with N) to find a function for it.
    Unfortunately I've not much experience in this field of maths (nonlinear regression etc.,
    incl. the details of the exponential function exp(x)), maybe someone else has and can come up with an idea.
     
    Last edited: Aug 9, 2023
  3. Real Money

    Real Money

    You need to define "yOffPct" before you can do anything like you are saying.
     
  4. Found a workaround method: since N=1 gives always the correct result (cf. table), then first run for N=1 and note the result, then for other N optimize (ie. search for) D for getting the same end result as for N=1. This does not mean they both are producing identical output of generated prices, it just means the distribution is similar.
    The optimization process would make use of interval-halving (ie. bsearch) to find the correct D quickly.

    As can be seen from the said generator function, this is related to GBM, and on top of it a so-called probability-weighted payoff curve (cf. https://robotwealth.com/efficiently-simulating-geometric-brownian-motion-in-r/ ).


     
    Last edited: Aug 9, 2023
  5. It's defined as "off percent" from the believed correct value.