Home » excel » How to determine a formula for execution time given quantitative data, Excel, trendlines, monte carlo simulation

# How to determine a formula for execution time given quantitative data, Excel, trendlines, monte carlo simulation

Questions:

Can I get your help on some Maths and possibly Excel?

I have benchmarked my app increasing the number of iterations and number of obligors recording the time taken in seconds with the following result:

``````        200 400 600 800 1000    1200    1400    1600    1800    2000
20000   15.627681   30.0968663  44.7592684  60.9037558  75.8267358  90.3718977  105.8749983 121.0030672 135.9191249 150.3331682
40000   31.7202111  62.3603882  97.2085204  128.8111731 156.2443206 186.6374271 218.324317  249.2699288 279.6008184 310.9970803
60000   47.0708635  92.4599437  138.874287  186.0576007 231.2181381 280.541207  322.9836878 371.3076757 413.4058622 459.6208335
80000   60.7346238  120.3216303 180.471169  241.668982  300.4283548 376.9639188 417.5231669 482.6288981 554.9740194 598.0394434
100000  76.7535915  150.7479245 227.5125656 304.3908046 382.5900043 451.6034296 526.0730786 609.0358776 679.0268121 779.6887277
120000  90.4174626  179.5511355 269.4099593 360.2934453 448.4387573 537.1406039 626.7325734 727.6132992 807.4767327 898.307638
``````

How can I now come up with a function for T (time taken in seconds) as an expression of number of obligors O and number of iterations I

Thanks

I’m not quite sure of the data involved due to the question construction/presentation.

Assuming you’re looking for `y = f(x)`. If you load the data into Excel, you can use the methods `SLOPE` and `INTERCEPT` on the data ranges to derive an expression of the form

``````y = mx+c
``````

and thus a linear function.

If you want a quadratic or cubic, you can use `LINEST` with a column of time data squared/cubed etc. to give you quadratic/cubic parameters, and thus derive an appropriate higher order function.

Spoke to one of the quants here the function is of the from T = KNO, where T is time, K some constant, N iterations, O obligors.

Rearrange for K = T/(NO), plug this into my sample data, take the average of all sample points, use the Std dev for the error

I did this for my data and get:

T = 3.81524E-06 * N * O (with 1.9% error), this is a pretty good approximation.

Create a chart in Excel, add a trendline, and select to have the equation displayed on the chart.

``````        200          400         600         800         1000        1200        1400        1600        1800        2000