I want to run a sim that randomly picks rows and adds up the total value of the rows based on a set of rules. I'm new to simulations so don't know where to start.
Rules: 9 total rows picked per sim. Each sim of 9 must include the following number of "positions":
QB: 1
RB: 2
WR: 3
TE: 1
K: 1
DST: 1
I want each sim to add up the value of the group (WAR column) and the output to show percentage each player made say the top 10 percent of groups with the highest WAR. Hopefully this makes some sense. The ultimate goal here is to ID which players were most likely to be successful.
Here is a dput of ten top players from each positions as example.
dput
structure(list(player = c("Justin Tucker", "Harrison Butker",
"Wil Lutz", "Greg Zuerlein", "Matt Gay", "Brandon McManus", "Jake Elliott",
"Robbie Gould", "Stephen Hauschka", "Dan Bailey", "Patrick Mahomes",
"Lamar Jackson", "Dak Prescott", "Russell Wilson", "Kyler Murray",
"Deshaun Watson", "Matt Ryan", "Josh Allen", "Tom Brady", "Carson Wentz",
"Christian McCaffrey", "Saquon Barkley", "Ezekiel Elliott", "Alvin Kamara",
"Dalvin Cook", "Clyde Edwards-Helaire", "Derrick Henry", "Miles Sanders",
"Joe Mixon", "Josh Jacobs", "Travis Kelce", "George Kittle",
"Mark Andrews", "Zach Ertz", "Darren Waller", "Evan Engram",
"Hayden Hurst", "Tyler Higbee", "Hunter Henry", "Mike Gesicki",
"Michael Thomas", "Davante Adams", "Julio Jones", "Tyreek Hill",
"DeAndre Hopkins", "Chris Godwin", "Kenny Golladay", "Allen Robinson",
"DJ Moore", "Odell Beckham"), adp = c(3, 3, 2, 2, 1, 1, 1, 1,
1, 1, 26, 23, 12, 11, 10, 9, 5, 4, 4, 4, 66, 57, 53, 50, 45,
43, 41, 40, 40, 39, 29, 26, 18, 15, 10, 8, 7, 6, 4, 4, 48, 40,
38, 37, 36, 34, 29, 27, 27, 27), WAR = c(0.27, 0.27, 0.1, 0.23,
0.09, 0.19, -0.83, -0.3, -0.1, -0.62, 2.26, 1.41, 0.91, 1.7,
2.28, 1.74, 0.28, 2.29, 1.12, 0.06, 1.02, -0.05, 1.36, 3.57,
3.48, 1.04, 2.91, 1.13, 0.69, 1.49, 2.79, 0.71, 0.85, -0.22,
1.67, 0.07, 0.26, 0.06, 0.35, 0.64, -0.04, 2.74, 0.63, 2.35,
1.49, 0.49, 0.33, 1.17, 0.61, 0.28), position = c("K", "K", "K",
"K", "K", "K", "K", "K", "K", "K", "QB", "QB", "QB", "QB", "QB",
"QB", "QB", "QB", "QB", "QB", "RB", "RB", "RB", "RB", "RB", "RB",
"RB", "RB", "RB", "RB", "TE", "TE", "TE", "TE", "TE", "TE", "TE",
"TE", "TE", "TE", "WR", "WR", "WR", "WR", "WR", "WR", "WR", "WR",
"WR", "WR")), row.names = c(NA, -50L), groups = structure(list(
position = c("K", "QB", "RB", "TE", "WR"), .rows = structure(list(
1:10, 11:20, 21:30, 31:40, 41:50), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -5L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))