Jump to content
IGNORED

Generating Scatter Plots


iacas
Note: This thread is 3719 days old. We appreciate that you found this thread instead of starting a new one, but if you plan to post here please make sure it's still relevant. If not, please start a new topic. Thank you!

Recommended Posts

  • Administrator

I'm hoping that someone I tag at the bottom of this thread - or someone else - can help me out with something.

I'd like a way to generate a scatter plot on a cartesian coordinate system that obeys a bell curve but lets me set the standard deviation (the same would apply in both X and Y directions).

If it generates 100 "random" (fitting the standard deviation I set) points, that'd be perfect. I should be able to press a button to get a different set of 100 "random" dots.

The alternative would simply be a random number generator that obeys the bell curve and can kick out 100 (or 200, if I have to pair them) numbers that follow the standard deviation I set.

Can Excel or something else do this?

@jamo @boogielicious @Lihu @saevel25 @Golfingdad

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator

http://www.random.org/gaussian-distributions/ ?

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator

I hate when I research something, then when I write it up, I use a word or something that triggers a slightly different search, and then I find the answer. :P

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

Yea I don't think Excel can handle that with out some fancy excel work.

f(x,\mu ,\sigma )={\frac  {1}{\sigma {\sqrt  {2\pi }}}}e^{{-{\frac  {(x-\mu )^{2}}{2\sigma ^{2}}}}}

The only thing I could think of would be, set two cells in excel to be your standard deviation, and mean.

Then you can do something like

1 / ($A$1*SQRT(2*PI())) * EXP (- ((RANDBETWEEN(0,???) - $A$2)^2)/(2*$A$1^2)))

Were ??? Is the max random number you want. Not sure if that works out for ya. Just drag and click. Every time you edit something on the worksheet it should update the values, RANDBETWEEN is active like that. Not sure if that is correct or not, or if that is what you want.

Matt Dougherty, P.E.
 fasdfa dfdsaf 

What's in My Bag
Driver; :pxg: 0311 Gen 5,  3-Wood: 
:titleist: 917h3 ,  Hybrid:  :titleist: 915 2-Hybrid,  Irons: Sub 70 TAIII Fordged
Wedges: :edel: (52, 56, 60),  Putter: :edel:,  Ball: :snell: MTB,  Shoe: :true_linkswear:,  Rangfinder: :leupold:
Bag: :ping:

Link to comment
Share on other sites

Awards, Achievements, and Accolades

Excel has the inverse CDF for a few common distributions, including the normal.  With the inverse CDF, you can just plug in a uniform random number (ie RAND()), and get a random number distributed by the PDF of the distribution you used the inverse CDF for.

So, for a random number distributed normally with mean 0 and SD 1, you can just use NORMINV(RAND(); 0; 1)

One of the other built in inverse CDFs in Excel is the log-normal.  That might be useful Erik if you want to plot non-symmetric landing spot scatters.  Most players definitely have a skewed distribution of distance (we all chunk one 2/3 of the way there but do we ever airmail the green by 33% of the distance we meant to hit it).  And many players have a skewed miss distribution.  As I've been trying to learn to draw the ball my left/right misses have gotten more equal in percentage terms, but it used to be my shot either hit the green/fairway or went right, with a long tail off to the right.  You could try using the lognormal (LOGINV) or gamma (GAMMAINV) to get skewed miss distributions (though those are both only defined on positive numbers, so you'd have to, say, subtract the mean to get misses left and right of 0).

Matt

Mid-Weight Heavy Putter
Cleveland Tour Action 60˚
Cleveland CG15 54˚
Nike Vapor Pro Combo, 4i-GW
Titleist 585h 19˚
Tour Edge Exotics XCG 15˚ 3 Wood
Taylormade R7 Quad 9.5˚

Link to comment
Share on other sites

Awards, Achievements, and Accolades

Excel has the inverse CDF for a few common distributions, including the normal.  With the inverse CDF, you can just plug in a uniform random number (ie RAND()), and get a random number distributed by the PDF of the distribution you used the inverse CDF for.

So, for a random number distributed normally with mean 0 and SD 1, you can just use NORMINV(RAND(); 0; 1)

One of the other built in inverse CDFs in Excel is the log-normal.  That might be useful Erik if you want to plot non-symmetric landing spot scatters.  Most players definitely have a skewed distribution of distance (we all chunk one 2/3 of the way there but do we ever airmail the green by 33% of the distance we meant to hit it).  And many players have a skewed miss distribution.  As I've been trying to learn to draw the ball my left/right misses have gotten more equal in percentage terms, but it used to be my shot either hit the green/fairway or went right, with a long tail off to the right.  You could try using the lognormal (LOGINV) or gamma (GAMMAINV) to get skewed miss distributions (though those are both only defined on positive numbers, so you'd have to, say, subtract the mean to get misses left and right of 0).

COOL!!! Learn something new.

Matt Dougherty, P.E.
 fasdfa dfdsaf 

What's in My Bag
Driver; :pxg: 0311 Gen 5,  3-Wood: 
:titleist: 917h3 ,  Hybrid:  :titleist: 915 2-Hybrid,  Irons: Sub 70 TAIII Fordged
Wedges: :edel: (52, 56, 60),  Putter: :edel:,  Ball: :snell: MTB,  Shoe: :true_linkswear:,  Rangfinder: :leupold:
Bag: :ping:

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator
So, for a random number distributed normally with mean 0 and SD 1, you can just use NORMINV(RAND(); 0; 1)

One of the other built in inverse CDFs in Excel is the log-normal.  That might be useful Erik if you want to plot non-symmetric landing spot scatters.  Most players definitely have a skewed distribution of distance (we all chunk one 2/3 of the way there but do we ever airmail the green by 33% of the distance we meant to hit it).  And many players have a skewed miss distribution.  As I've been trying to learn to draw the ball my left/right misses have gotten more equal in percentage terms, but it used to be my shot either hit the green/fairway or went right, with a long tail off to the right.  You could try using the lognormal (LOGINV) or gamma (GAMMAINV) to get skewed miss distributions (though those are both only defined on positive numbers, so you'd have to, say, subtract the mean to get misses left and right of 0).

Like this?

I added a 0.2 multiplier on the right column: if you miss left, the shot will tend to be a little longer, and if you miss right, a bit shorter.

The actual standard deviation is kind of irrelevant since I can just scale the image up or down to fit anyway.

One of the other built in inverse CDFs in Excel is the log-normal.  That might be useful Erik if you want to plot non-symmetric landing spot scatters.  Most players definitely have a skewed distribution of distance (we all chunk one 2/3 of the way there but do we ever airmail the green by 33% of the distance we meant to hit it).  And many players have a skewed miss distribution.  As I've been trying to learn to draw the ball my left/right misses have gotten more equal in percentage terms, but it used to be my shot either hit the green/fairway or went right, with a long tail off to the right.  You could try using the lognormal (LOGINV) or gamma (GAMMAINV) to get skewed miss distributions (though those are both only defined on positive numbers, so you'd have to, say, subtract the mean to get misses left and right of 0).

Feel free to modify my Excel file and re-post, but… so far as I can tell we can just drag the scatter plot around a bit to get a fairly good representation. I don't want to make it too complex - chunking a shot now and then just won't factor, because you can't really "plan" for those anyway. So these are shots hit reasonably well.

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

There is another factor to consider, for a right-hander, long left, short right, I'm sure you get what I mean.

Yeah, but this gets more complicated because you can't generate independent random numbers for the X and Y dimensions.  You need to create numbers from a 2-dimensional distribution where there is correlation between the dimensions.  This is relatively easy to do in a stats language (e.g. R), but is a huge pain in the ass in excel.

Matt

Mid-Weight Heavy Putter
Cleveland Tour Action 60˚
Cleveland CG15 54˚
Nike Vapor Pro Combo, 4i-GW
Titleist 585h 19˚
Tour Edge Exotics XCG 15˚ 3 Wood
Taylormade R7 Quad 9.5˚

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator

Yeah, but this gets more complicated because you can't generate independent random numbers for the X and Y dimensions.  You need to create numbers from a 2-dimensional distribution where there is correlation between the dimensions.  This is relatively easy to do in a stats language (e.g. R), but is a huge pain in the ass in excel.

I dunno. I feel like I did it reasonably well. :)

I take the shot's value on X (left/right) and use it to create a value for Y by setting the mean to -0.2X.

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

I dunno. I feel like I did it reasonably well. :)

I take the shot's value on X (left/right) and use it to create a value for Y by setting the mean to -0.2X.

So why the 0.2 for the vertical?

Matt Dougherty, P.E.
 fasdfa dfdsaf 

What's in My Bag
Driver; :pxg: 0311 Gen 5,  3-Wood: 
:titleist: 917h3 ,  Hybrid:  :titleist: 915 2-Hybrid,  Irons: Sub 70 TAIII Fordged
Wedges: :edel: (52, 56, 60),  Putter: :edel:,  Ball: :snell: MTB,  Shoe: :true_linkswear:,  Rangfinder: :leupold:
Bag: :ping:

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator
So why the 0.2 for the vertical?

Because shots hit left (pulls) go farther. Shots hit right go shorter. It's actually -0.2 to account for this.

So a shot "10" left will have its mean set to "2" long.

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Moderator

Looks like the way I would have done it in Excel.  I used to use MathCad and software from the MathWorks for work.  It had these functions.  But that was a dozen years ago.  I haven't touched in since maybe 2002.

Scott

Titleist, Edel, Scotty Cameron Putter, Snell - AimPoint - Evolvr - MirrorVision

My Swing Thread

boogielicious - Adjective describing the perfect surf wave

Link to comment
Share on other sites

Awards, Achievements, and Accolades

I dunno. I feel like I did it reasonably well. :)

I take the shot's value on X (left/right) and use it to create a value for Y by setting the mean to -0.2X.

Great solution for getting a reasonable looking scatter plot.  Was thinking it would be a pain in the ass to exactly generate a bivariate distribution with exactly the covariance and means you want, especially for anything non-normal, but this is obviously the right solution for getting a good looking scatter plot!  Reduction of SD for Y variable was a nice touch too, giving it more of a look of a bivariate correlated distribution.

As I noted above, one thing you could play with is skewed distributions to give, say, some of the way short or big push-slice shots common among most everyone except low-mid single digit or better players.  Attached is an edited excel sheet using two gamma distributions to get this effect.  It's more of a hack than with the normals, but you can play around with it to get it to look like you want.  The two parameters to the Gamma variable in column A are alpha and beta.  Those are the second and third args to the GAMMAINV fxn.  The mean of a gamma distribution is alpha/beta, and the standard deviation is sqrt(alpha / beta^2).  So you can play around with alpha and beta and the very ad hoc stuff I put in for alpha and beta in column B to shift how it looks if you feel like it.

https://dl.dropboxusercontent.com/u/101944576/200PointPlot_Gamma.xlsx

How do I add a non-pic, non-video attachment?

Matt

Mid-Weight Heavy Putter
Cleveland Tour Action 60˚
Cleveland CG15 54˚
Nike Vapor Pro Combo, 4i-GW
Titleist 585h 19˚
Tour Edge Exotics XCG 15˚ 3 Wood
Taylormade R7 Quad 9.5˚

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Administrator
How do I add a non-pic, non-video attachment?

The paper clip icon.

Thanks. I'll download that and try it out. I don't know if we care too much about the weird outliers. People tend not to factor those in or believe that they hit those as often as they do anyway, so if we can make our case with a normal distribution (skewed slightly that long left/short right is in there too), then we should be okay.

Erik J. Barzeski —  I knock a ball. It goes in a gopher hole. 🏌🏼‍♂️
Director of Instruction Golf Evolution • Owner, The Sand Trap .com • AuthorLowest Score Wins
Golf Digest "Best Young Teachers in America" 2016-17 & "Best in State" 2017-20 • WNY Section PGA Teacher of the Year 2019 :edel: :true_linkswear:

Check Out: New Topics | TST Blog | Golf Terms | Instructional Content | Analyzr | LSW | Instructional Droplets

Link to comment
Share on other sites

Awards, Achievements, and Accolades

The paper clip icon.

Thanks. I'll download that and try it out. I don't know if we care too much about the weird outliers. People tend not to factor those in or believe that they hit those as often as they do anyway, so if we can make our case with a normal distribution (skewed slightly that long left/short right is in there too), then we should be okay.

Yeah, fair enough.  If you're just trying to make the aim where you scatter plot scatters around the center of the green point, then you probably don't need to worry about the skewed distribution.  Could make an interesting newer players' add-on point where if your right-left distribution in particular is skewed with a fat tail off to the right (lots of fades and slices, a few pulls, no hooks), where you want to aim the heaviest part of the scatter plot changes depending on what's off to the right.  Something like if missing at all to the right is super penal, maybe OB is just to the right of the green, then maybe you actually want your median shot left center or even left edge of the green, accepting that a good number of decent shots will be off the green left in exchange for many fewer OB shots.

Ah.  I never actually noticed the "More" option off the right of the comment box.  I swear I'm on top of shit...

Matt

Mid-Weight Heavy Putter
Cleveland Tour Action 60˚
Cleveland CG15 54˚
Nike Vapor Pro Combo, 4i-GW
Titleist 585h 19˚
Tour Edge Exotics XCG 15˚ 3 Wood
Taylormade R7 Quad 9.5˚

Link to comment
Share on other sites

Awards, Achievements, and Accolades

  • Moderator

Thanks @mdl for the great info. My only issue is when reading your posts, I imagine the bear avatar speaking. :-\

Scott

Titleist, Edel, Scotty Cameron Putter, Snell - AimPoint - Evolvr - MirrorVision

My Swing Thread

boogielicious - Adjective describing the perfect surf wave

Link to comment
Share on other sites

Awards, Achievements, and Accolades

Note: This thread is 3719 days old. We appreciate that you found this thread instead of starting a new one, but if you plan to post here please make sure it's still relevant. If not, please start a new topic. Thank you!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Want to join this community?

    We'd love to have you!

    Sign Up
  • TST Partners

    TourStriker PlaneMate
    Golfer's Journal
    ShotScope
    The Stack System
    FlightScope Mevo
    Direct: Mevo, Mevo+, and Pro Package.

    Coupon Codes (save 10-15%): "IACAS" for Mevo/Stack, "IACASPLUS" for Mevo+/Pro Package, and "THESANDTRAP" for ShotScope.
  • Posts

    • Day 107 - More pitching practice, playing around with trajectory. 
    • Yea Club Rat said it. I really enjoyed the Senator and the Judge, then over to Grand National where there a couple good courses plus a fun par 3. The one I do play whenever I visit there is Ross Bridge; something about this course that is just good fun. I hope to play more of the courses in the future, but tomorrow is promised to no one, so hope is the key word. Have Fun, iSank
    • Holy Crap! Wordle 1,035 1/6 🟩🟩🟩🟩🟩
    • Eh. He broke ONE of Tiger's records. Youngest to be ranked #1 in AJGA. It didn't help that Tiger's birthday is in late December, or that Tiger didn't play many AJGA events before he was 15. Did he do any of these things? TIGER WOODS' AMATEUR VICTORIES YEAR WIN(S) 1984 10-and- under Junior World Golf Championships Boys    1985 10-and- under Junior World Golf Championships Boys    1988 Boy's 11-12 Junior World Golf Championships   1989 Boy's 13-14 Junior World Golf Championships   1990 Boy's 13-14 Junior World Golf Championships, Insurance Youth Golf Classic   1991 U.S. Junior Amateur, Boys 15–17 Junior World Golf Championships, Orange Bowl International Junior Look at some other AJGA Players of the Year. How many of these names do you recognize? A few, for sure. I assure y'all, I'm not trying to pee in your Cheerios. I just don't get what the point is. Okay. I get that, then. Thanks.
    • Day 56: 4/19/2024 Okay, even though I'll be teeing it up in a tournament in less than a week. I couldn't find time to get to the range today.  I spent time on the indoor putting mat.  And I spent time in front of the mirror with my 7 iron. Then again later with the driver.  I also thoroughly cleaned all my clubs. 
×
×
  • Create New...

Important Information

Welcome to TST! Signing up is free, and you'll see fewer ads and can talk with fellow golf enthusiasts! By using TST, you agree to our Terms of Use, our Privacy Policy, and our Guidelines.

The popup will be closed in 10 seconds...