View New Posts
12
  1. #1
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Post Simultaneous-bet Kelly staking -- the simplest case

    In case anyone's interested, following is the closed-form solution for simultaneous bet Kelly staking, given the simplest case where the single-bet Kelly stakes for each simultaneous bet are equivalent, all bets are uncorrelated, and the only bound on wagers is the size of the bankroll.

    I've yet to work out the closed-form solution for the general case of correlation and differing single-bet Kelly stakes (if it even exists). That would obviously be considerably more difficult, and probably better left calculated by an optimizer.

    If anyone's really interested in seeing the proof (not that I expect that), I could probably write it up. I've also created a Kelly calculator as proof of concept.



    Given n uncorrelated binary bets, we define the Kelly-optimal allocation as the set of weightings for each of the 2n-1 n-or-fewer-team parlays (where a single bet is considered a 1-team parlay) that can be created from the n-single bets, which maximizes the expected logarithm of the bankroll.

    Let oi = decimal odds on the ith bet,
    Let pi = win probability of the ith bet,
    Let ki = ith single-bet Kelly stake = pi + (1 - pi)/(1 - oi),

    If ki = kj for all i,j on the interval [1,n],

    then the Kelly-optimal weighting of each and every m-team parlay (as a percentage of the total bankroll), Knm, is given by:
    Code:
           n
     Knm =  combin(n-m, m-i) * k1+n-m * (-1)m-i
           i=n-m+1

    SBR Founder Join Date: 8/28/2005


  2. #2

    Default

    Err....

    Interested, but is there a way to say this in plain English?

    SBR Founder Join Date: 12/14/2005


  3. #3
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by Dark Horse
    Err....

    Interested, but is there a way to say this in plain English?
    I'm sure there is ... I just can't think of anything right now.

    Basically, I'm saying that if you're looking at a bunch of ucnorrelated bets where all the single-bet Kelly stakes would be the same, then the simultaneous bet Kelly stake will be a collection of single bets and parlays where the weightings are the same for any two parlays of the same size. The summation above represents the simultaneous n-bet Kelly weighting (call it Knm) for all parlays of size m.

    The linked spreadsheet might shed some light.

    SBR Founder Join Date: 8/28/2005


  4. #4

    Default

    I have turned off my antivirus... I am scared of Ganchvirus that causes that everytime I switch on my compy I will see only strange hieroglyphs

    SBR Founder Join Date: 12/20/2005


  5. #5

    Default

    LOL

    --------------------------------
    Thanks, Ganch. Much appreciated.

    SBR Founder Join Date: 12/14/2005


  6. #6

    Default

    OK, I downloaded it... 2 MB for excel file with 2 columns and 9 rows??

    Ganch I hope you enjoy my porn anthology... But my passwords are on a list of paper

    SBR Founder Join Date: 12/20/2005


  7. #7
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default Simultaneous-bet Kelly staking -- the general case (unconstrained and uncorrelated)

    This is the more general case where we relax the constraint that all single-bet Kelly stakes need to be equal. For the sake of sanity, the weightings are defined recursively.



    Given n uncorrelated binary bets, the "Kelly-optimal allocation" is the set of weightings for each of the 2n-1 n-or-fewer-team parlays (where a single bet is considered a 1-team parlay) that can be created from the n-single bets, which maximizes the expected logarithm of the bankroll.

    Let oi = decimal odds on the ith bet,
    Let pi = win probability of the ith bet,
    Let ki = ith single-bet Kelly stake = MAX[(pi*oi-1)/(oi-1), 0],

    Define κ(n,m,**B**) as the sum of the Kelly optimal weights for all m-team parlays made up of all bets included the set **B**, then

    Code:
                           n 
    κ(n,m,**B**) =  ki  -   κ(n,i,**B**)
               i Є **B**   i=m+1

    Example:
    Code:
    given: k1 = 1% k2 = 2% k3 = 3% k4 = 4% k5 = 5% κ(5,5,**1,2,3,4,5**) = (weighting of the 5-team parlay as % of bankroll) = k1*k2*k3*k4*k5 = 1%*2%*3%*4%*5% = 0.0000012% κ(5,4,**1,2,3,4**) = (weighting of the 4-team parlay consisting of bets {1,2,3,4** as % of bankroll) = k1*k2*k3*k4 - κ(5,5,**1,2,3,4**) = 1%*2%*3%*4% - κ(5,5,**1,2,3,4,5**) = 0.0000228% κ(5,4,**1,2,3,5**) = (weighting of the 4-team parlay consisting of bets {1,2,3,5** as % of bankroll) = k1*k2*k3*k5 - κ(5,5,**1,2,3,5**) = 1%*2%*3%*5% - κ(5,5,**1,2,3,4,5**) = 0.0000288% κ(5,3,**1,2,3**) = (weighting of the 3-team parlay consisting of bets {1,2,3** as % of bankroll) = k1*k2*k3 - κ(5,4,**1,2,3**) - κ(5,5,**1,2,3**) = 1%*2%*3% - κ(5,4,**1,2,3,4**) - κ(5,4,**1,2,3,5**) - κ(5,5,**1,2,3,4,5**) = 0.00054720% etc.
    And now a non-recursive statement of the same. Please forgive the abuse of notation.




    Given n uncorrelated binary bets, define the "Kelly-optimal allocation" is the set of weightings for each of the 2n-1 n-or-fewer-team parlays (where a single bet is considered a 1-team parlay) that can be created from the n-single bets, which maximizes the expected logarithm of the bankroll.

    Let oi = decimal odds on the ith bet,
    Let pi = win probability of the ith bet,
    Let **k** = the set of all n single-bet Kelly stakes,
    where ki = ith single-bet Kelly stake = MAX[(pi*oi-1)/(oi-1), 0],

    Define {P(k)** = the power set of **k**

    Define {S({B**,i)** = the set of all sets, {s** Є {P(k)** such that |{s**| = i, {S**k**B**,
    where k**B** is the set of the single-bet Kelly weights associated with the elements of {B**

    Define κ(n,m,{B**) as the Kelly optimal weight for the m-team parlay made up of all bets included in the set **B** (where |**B**| = m).

    Code:
                 n
    κ(n,m,{B**) = ∑( (-1)i-m *  kj)
                 i = m              j Є {S({B**,i)**

    SBR Founder Join Date: 8/28/2005


  8. #8

    Default

    So in practical terms, how does someone apply this to, say, a night of NBA action without spending way too much time on math?

  9. #9

    Default

    this aint fun anymore

    SBR Founder Join Date: 10/30/2005


  10. #10
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by Arilou
    So in practical terms, how does someone apply this to, say, a night of NBA action without spending way too much time on math?
    Write some software implementing either the above recursion or the methodology I outlined here.

    SBR Founder Join Date: 8/28/2005


  11. #11

  12. #12

  13. #13
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by Big Razorback View Post
    What is this in VERY simple terms..
    My Kelly calculator does these calculations for you.

    SBR Founder Join Date: 8/28/2005


  14. #14

    Default thanks

    thats a hell of a lot easier to understand the main purpose without the derivitives and ECT...


    I sent it to a friend that is into math to try to explain to me...lol

  15. #15

    Default

    Just going over this again, and it'd be really sweet if you could take into account a bet already made, such that say I find a single +EV bet that I wager on at the optimal wager size, and then later I find say three +EV bets I wish to bet on, while the first single +EV bet is still pending. Obviously you can't re-bet the single one at a lower amount, but it'd be nice to take that into account too.

  16. #16
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by rjp View Post
    Just going over this again, and it'd be really sweet if you could take into account a bet already made, such that say I find a single +EV bet that I wager on at the optimal wager size, and then later I find say three +EV bets I wish to bet on, while the first single +EV bet is still pending. Obviously you can't re-bet the single one at a lower amount, but it'd be nice to take that into account too.
    When you get into these more complicated boundary problems, you need to start using a nonlinear optimizer to approximate glabal solutions.

    I think if you search around you can find a post where I outlined this procedure as it relates to hedging and line movements. And some point I'll write an article explaining it in the more general case.

    SBR Founder Join Date: 8/28/2005


  17. #17

  18. #18

    Default

    Code:
                           n 
    κ(n,m,{B**) = ∏ ki  -  ∑ κ(n,i,{B**)
               i Є {B**   i=m+1
    Ganchrow, I'm attempting to code up a program using the recursive method you outline above, but when trying to relate your examples to the single bet scenario (a 1-team parlay as you say), the examples you show aren't making it clear for me.

    I understand how the method is supposed work when I'm trying to perform the calculations for two wagers, but I'm a bit confused when this goes to 3 or higher.

    To me it seems like what I really need is to understand how you're passing the sets to the recursive calls. From your parlay examples it seems like you change the set for different calls?

    I also tried to use the non-recursive approach (assuming it would be easier to implement) but the abuse of notation did put me for a loop.

    Thanks!

  19. #19

    Default

    rjp- Be careful, Ganch is going to fall in love with you. You speak his language.

  20. #20
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by rjp View Post
    Code:
                           n 
    κ(n,m,{B**) = ∏ ki  -  ∑ κ(n,i,{B**)
               i Є {B**   i=m+1
    Ganchrow, I'm attempting to code up a program using the recursive method you outline above, but when trying to relate your examples to the single bet scenario (a 1-team parlay as you say), the examples you show aren't making it clear for me.

    I understand how the method is supposed work when I'm trying to perform the calculations for two wagers, but I'm a bit confused when this goes to 3 or higher.

    To me it seems like what I really need is to understand how you're passing the sets to the recursive calls. From your parlay examples it seems like you change the set for different calls?

    I also tried to use the non-recursive approach (assuming it would be easier to implement) but the abuse of notation did put me for a loop.

    Thanks!
    The idea is relatively straightforward. To find the weighting for a particular parlay one simply takes the product of the single stake Kelly numbers of those events included in that parlay and then subtract from that the stakes of each larger parlays that includes all of the single events.

    So given 5 simultaneous events:
    • The weighting for the 5-team parlay would be the product of all 5 single-stake Kelly weightings.
    • The weighting for each 4-team parlay would be the product of the four underlying single-stake Kelly weightings minus the weighting of the one 5-team parlay.
    • The weighting for each 3-team parlay would be the product of the three underlying single-stake Kelly weightings minus the weighting of the two 4-team parlays that contain the 3 underlying events minus the weighting of the one 5-team parlay.
    • The weighting for each 2-team parlay would be the product of the two underlying single-stake Kelly weightings minus the weighting of the three 3-team parlays that contain the 2 underlying events minus the weighting of the three 4-team parlays that contain the 2 underlying events minus the weighting of the one 5-team parlay.
    • The weighting for each 1-team parlay (i.e., each single) would be the underlying's single-stake Kelly weightings minus the weighting of the four 2-team parlays that contain the underlying event minus the weighting of the six 3-team parlays that contain the underlying event minus the weighting of the four 4-team parlays that contain the underlying event minus the weighting of the one 5-team parlay.

    If you're still stuck you might also want to check out the source code of my JavaScript Kelly calculator. The calcKelly() function illustrates the recursive approach for multiple simultaneous independent events.

    Let let me know if this helps.

    SBR Founder Join Date: 8/28/2005


  21. #21

    Default

    i assume all this is named after someone named "Kelly" who started these equations.

  22. #22

    Default

    Ganchrow, thank you very much, this clears it up.

    I guess the only thing I'm left wondering now is what if I don't bet the parlays? Are these still the optimal wager sizes for each straight bet?

  23. #23
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by rjp View Post
    what if I don't bet the parlays? Are these still the optimal wager sizes for each straight bet?
    No, the parlays are part of the solution. If you don't bet the parlays then these will not represent optimal wager sizes. Parlays are necessary to ensure a Kelly-optimal allocation for simultaneous bets.

    To see how much skipping the parlays this will impact your expectations, in the portion of the calculator labeled "Stakes for parlays of size:" modify the listed sizes (setting to 0%, for example) for the appropriate parlay or parlays and click the "Calculate Expectations" button.

    You'll find that in most typical cases you won't be giving up much by skipping the larger parlays (say of size 3 and higher), but that the 2-team parlays generally represent a non-trivial amount of expectation.

    For example, assuming full-Kelly, and 10 simultaneous bets at -110 each with 55% win probabilities:
    all singles and parlays => 2.7843% expected value, 1.3875% expected growth
    Singles and 2-team parlays only => 2.5430% expected value, 1.3770% expected growth
    no parlays (singles only) => 1.6556% expected value, 1.1615% expected growth

    SBR Founder Join Date: 8/28/2005


  24. #24

    Default

    I understand that parlays are part of the solution, but I bet a lot of derivative markets that can't be parlayed with anything. As such, the optimal solution including parlays is useless for me.

    So, if I use the method you describe above to calculate the optimal wager size for each of these simultaneous bets am I properly allocating my money, or should I actually be risking more on the straight bets? If so, is this something that I'll need to try and derive myself?

    (BTW, I'm just getting to partial derivatives in Calc III, so a lot of your Kelly posts are becoming clearer and clearer.)

    Thanks again for the help.

  25. #25

    Default

    wow big head ache....I feel like I just got done watching an episode of numbers.....

  26. #26
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by rjp View Post
    I understand that parlays are part of the solution, but I bet a lot of derivative markets that can't be parlayed with anything. As such, the optimal solution including parlays is useless for me.

    So, if I use the method you describe above to calculate the optimal wager size for each of these simultaneous bets am I properly allocating my money, or should I actually be risking more on the straight bets? If so, is this something that I'll need to try and derive myself?

    (BTW, I'm just getting to partial derivatives in Calc III, so a lot of your Kelly posts are becoming clearer and clearer.)

    Thanks again for the help.
    This solution deals solely with the unconstrained case where there are no bounds on any of the variables other than non-negativity (i.e., no "short-selling") and the budget constraint (i.e., no buying "on margin"). Insofar as this is not the case (e.g., in the face of sufficiently low maximum bets or in the example you've given where maximum parlay sizes on some subset of the available bets are binding) the solution will obviously depart from optimality.

    One difficulty with highly constrained nonlinear problems of this sort is that they don't typically lend themselves to closed-form solutions. Check out the allocation problem for basic strategy teasers I outlined here. Note that this only represents 3 variables and assumes the player isn't placing any other bets. Another example of constrained optimization is with Asian Handicap bet allocations outlined here.

    What you'll typically see is that as your problem diverges from unconstrained it's probably best to look for a computational solution using some sort of optimization package (Excel Solver is probably the most widely available example -- but far from the most robust). The JavaScript calculator, which implements the methodology I outlined above, is only designed to solve the generic class of problem (i.e., 1-14 single bets, with no constraints on parlayability or on bet sizes), and while it may be helpful in approximating solutions to more complex constrained problems it won't be exact.

    SBR Founder Join Date: 8/28/2005


  27. #27

    Default

    Ganchrow,

    If 1. all your bets have the same EV; and 2. all bets are 0% correlated, here is a simplification I sometimes use.

    Assume I have X bets with an optimal bet size of 2%. If I lose all of them sequentially, I should have 0.98^x of my old bankroll left. So I bet 2 * 0.98 % x on each play. If I had 20 plays, I would end up betting 1.33% on each play instead of 2%.

    I know this overadjusts - with that example, there should be almost no reduction in bet sizing. But it's easy and conservative.

  28. #28
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by Justin7 View Post
    Ganchrow,

    If 1. all your bets have the same EV; and 2. all bets are 0% correlated, here is a simplification I sometimes use.

    Assume I have X bets with an optimal bet size of 2%. If I lose all of them sequentially, I should have 0.98^x of my old bankroll left. So I bet 2 * 0.98 % x on each play. If I had 20 plays, I would end up betting 1.33% on each play instead of 2%.

    I know this overadjusts - with that example, there should be almost no reduction in bet sizing. But it's easy and conservative.
    If your intent were to bet full Kelly you're giving up way too much using this approximation. There's no way around it -- if you want to bet Kelly with simultaneous bets you really need to bet parlays.

    If you plan to do this frequently I'd certainly suggest using my Kelly calculator. It's quick and it's easy and it gives it exact full solutions to any desired level of precision.

    Anyway here's a comparison for 10 simultaneous bets at +100 odds with a win probability of 51% (full single Kelly stake=2%). I look at exact full Kelly, exact full Kelly constrained to only singles and 2-team parlays, exact full Kelly constrained to only singles, calculator output truncated to only singles and 2-team parlays, calculator output truncated to only singles, and the k*(1-k)n approximation:

    10 simultaneous bets, full Kelly, exact
    EG: 0.20021%, EV: 0.40072%
    10 simultaneous bets, full Kelly, only 1&2 team parlays, exact
    EG: 0.20021%, EV: 0.40072%
    10 simultaneous bets, full Kelly, only 1&2 team parlays, truncated
    EG: 0.20017%, EV: 0.39537%
    10 simultaneous bets, full Kelly, only singles, exact
    EG: 0.19985%, EV: 0.39856%
    10 simultaneous bets, full Kelly, only singles, truncated
    EG: 0.19448%, EV: 0.33350%
    10 simultaneous bets, 2%*98%10=1.634% per bet
    EG: 0.19333%, EV: 0.32683%

    I think the most interesting point to be made from this is that by limiting yourself only to singles and 2-team parlays your EXP(utility) isn't impacted at the degree of precision displayed above. This is typical of bets placed at odds fairly near even with edges sufficiently close to zero -- generally the higher order parlayed with little to no impact on one's bottom line. Of course if you're going to be betting huge favorites or "sure things" the situation will change and the higher order parlays will become progressively more important.

    SBR Founder Join Date: 8/28/2005


  29. #29

    Default

    Quote Originally Posted by Sam Odom View Post
    this aint fun anymore
    Well then Sam maybe it would be if you read it throughly, and start making some coin from this useful knowledge.

    SBR Founder Join Date: 8/10/2005


  30. #30

    Default parsing the single bets from the parlays

    I also have the issue of not betting on parlays but doing simultaneous single event bets.

    when you are truncating your data? are you just setting 0% for wager% in your calculator section for parlays and re-adjusting. How do you determine exact kelly state versus the "truncated"?

    It also seems that if you were to eliminate parlays from the calculator you should change your % bankroll bet per single bet.

    Looking at 5 simultaneous events, each with 2 outcomes, and a winning probability of 60% for each event. Betting on the 5 winners has a probability of winning combined of 68.24%.

    Given an even payout, the stake for this wager should be 2 X 0.6824 - 1. 36.48% of my bankroll.

    The multivariable calculator gives a percentage of 40.9% even after adjusting the parlays to 0. Am i using the calculator wrong or is there a way to calculate the initial kelly wagering percentages without taking into account the parlays?

    Also, i know the IDEAL use of the kelly formula includes parlays. If one must exclude parlays, is there a better system.

  31. #31
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by Alex K View Post
    The problem seems to be fully resolved by the new theorem which was published by XXXXXXXXXXX

    Maximum possible value of an average factor of fund growth Z is achieved by the optimal distribution of a bankroll amongst 2^N-1 possible simultaneous stakes,
    and is determined by the following expression:

    ln Z ave = Sum[pi * ln(pi/qi) + (1-pi) * ln((1-pi)/(1-qi)), i = 1..N]

    where

    ln Z ave - mathematical expectation of ln Z;
    pi - probability of i-th event, equal to 1/Fi, Fi - fair odds;
    qi - sportsbook's 'probability' of i-th event, equal to 1/Li, Li -
    payout coefficients (aka line odds);
    N - number of chosen independent events.

    Possible stakes comprise N system bets (combinations) of type (m, N), where m = 1..N. Each system bet contains C(m,N) m-fold accumulator bets. In particular, possible stakes include N single ordinary bets, and one N-fold accumulator bet. In general case, optimal system bets are not equipartitioned.

    The above theorem was implemented in the XXXXXXXXXX software.
    Right. This follows directly from the above. This identity is in fact how the value for Kelly utility in the simultaneous-bet Kelly calculator is determined.

    The maximal utility from some number of properly Kelly-sized simultaneous bets will just be the same as the theoretical maximal utility that would be attained were the bets sequential in nature and Kelly-sized strictly based on single bet Kelly stakes. (It was by using this identity that the solution detailed in the preceding posts of this thread were in fact derived.)

    So the expected utility for the ith bet would be:
    E(Ui) = p*K(1+edgei) + (1-p)*K(1-edgei/(oddsi-1))

    Where K(·) refers to fractional Kelly utility for any given Kelly multiplier,
    edgei refers to the edge on the ith bet, and
    oddsi refers to the decimal odds on the ith bet.
    and the total expected utility for all N bets would just be:

    E(Ui) = ΣNi=1E(Ui)
    You'll see that this is simply a restatement of your "ln Z ave" expression above.

    Note that while this does provide the theoretical maximal utility, it by itself is of no use in determining a purely computational solution to the simultaneous bet Kelly problem, which was the stated purpose of this thread.

    SBR Founder Join Date: 8/28/2005


  32. #32

    Default

    Quote Originally Posted by Ganchrow View Post
    If you're still stuck you might also want to check out the source code of my JavaScript Kelly calculator. The calcKelly() function illustrates the recursive approach for multiple simultaneous independent events.

    Let let me know if this helps.
    I'd be very interested in checking out the source code, but it seems to be encrypted. Am I missing something?

  33. #33
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by gdaley View Post
    I'd be very interested in checking out the source code, but it seems to be encrypted. Am I missing something?
    Yeah I needed to encrypt it because someone had thought it a good idea to lift the source code and post all the calculators on his own site without attribution.

    Anyone wanting the source code now needs to PM or e-mail me, telling me why they want the code and what they plan to do with it.

    SBR Founder Join Date: 8/28/2005


  34. #34

    Default Combining mutually exclusive bets with independent outcome bets

    How could this method be adapted to handle situations where a combination of independent outcome and mutually exclusive outcome bets need to be made?

    For example, if I am betting on a particular horse race, I may find overlays on 3 horses for win bets, and also 2 overlays for trifectas in the same race.

    How much should I bet on each one?

  35. #35
    Ganchrow's Avatar Become A Pro!
    Join Date: 08-28-05
    Posts: 5,014
    SBR Points: 125
    Message Me

    Default

    Quote Originally Posted by gdaley View Post
    How could this method be adapted to handle situations where a combination of independent outcome and mutually exclusive outcome bets need to be made?

    For example, if I am betting on a particular horse race, I may find overlays on 3 horses for win bets, and also 2 overlays for trifectas in the same race.

    How much should I bet on each one?
    This post details the JavaScript function that calculates full-Kelly for mutually exclusive outcome win-only events, and this post provides a plain English description thereof.

    I'm unaware of a closed form solution to the problem you've described, which isn't vto say one doesn't exist.

    Your best bet to solve a Kelly problems such as this is to enumerate each outcome and probability vector take the dot product of the two (this is the complete utility function) and then use a nonlinear optimizer (such as, if you're desperate, Microsoft Excel Solver) to maximize with respect to the decision variables.

    SBR Founder Join Date: 8/28/2005


12 Last
Top