Data science URGENT (1 Viewer)

sunshine_c22

Member
Joined
Nov 23, 2021
Messages
40
Gender
Female
HSC
N/A
The rules of a game are:
  • The game costs $10 dollars to play
  • You get to throw a fair die 20 times
  • Every time you throw a 5 or 6 you win $1
What is the maximum profit you could make?
Hint: You could run a simulation of this game to see how it works.

I got 10 but I dont know if its right?
 

dav53521

Well-Known Member
Joined
Mar 23, 2022
Messages
317
Gender
Male
HSC
2022
By running it do you mean that you have the code already written in R lang and all you need to do is just execute the code? Because here's the documentation to execute code that has been written in RStudio.
 

sunshine_c22

Member
Joined
Nov 23, 2021
Messages
40
Gender
Female
HSC
N/A
By running it do you mean that you have the code already written in R lang and all you need to do is just execute the code? Because here's the documentation to execute code that has been written in RStudio.
Sorry I meant if anyone knows how to do the question in RStudio
 

Sam14113

Member
Joined
Aug 22, 2021
Messages
93
Gender
Male
HSC
2023
Look I'm not sure how you'd simulate it, but the maximum profit for one game would just be the profit that you'd earn if you got a 5 or 6 with every roll.
 

dav53521

Well-Known Member
Joined
Mar 23, 2022
Messages
317
Gender
Male
HSC
2022
Would a simulation of the game be that you generate a random number between and inclusive of 1-6 20 times and count how many times you get 5 or 6 and then minus 10 from the total number of 5s and 6s, and the result would be how much profit you would have made from one simulated game? Although this'll be quite useless as there's no point in doing this to see how it works as wouldn't it be better to just straight up figure out the maximum profit.
 
Last edited:

Sam14113

Member
Joined
Aug 22, 2021
Messages
93
Gender
Male
HSC
2023
Would a simulation of the game be that you generate a random number between and inclusive of 1-6 20 times and count how many times you get 5 or 6 and then minus 10 from the total number of 5s and 6s, and the result would be how much profit you would have made from one simulated game?
I guess where I'm not sure is what we're trying to do with a simulation - you may get unlucky and never earn the maximum profit. Are we just trying to see statistically what's most likely?
 

brent012

Webmaster
Webmaster
Joined
Feb 26, 2008
Messages
5,290
Gender
Male
HSC
2011
Sorry I meant if anyone knows how to do the question in RStudio
I would assume the question wants you to simulate it as a hint to build intuition on how the game works. I think once you "get" the game, as Sam has pointed out, there's not much value in simulating it.

The simulation with that intuition would simply involve starting with $-10 and looping for 20 iterations assuming the optimal case of winning $1 each time. It should be simple to write this in R.

If you didn't have that intuition, the simulation would instead randomly add 1 at a probability of 1/3 to simulate getting a 5 or 6 - or you could more directly simulate a dice roll. You'd repeatedly do this and track the maximum profit in a round. The catch to this simulation (especially as a system gets more complicated) is that the optimal result could in theory not get hit often or at all, so you would want to do many rounds to ensure it.

That approach is called monte carlo simulation and usually it would be used to track and converge on the average (expected value) rather than the extreme values. But it's still error prone compared to purely analytical approaches, consider simulating a lottery with 1/10m odds - you'd have to run tens of millions of rounds of a simulation to get accurate averages.

This game is simple, so an average and the maximum can be calculated analytically quite simply, but monte carlo simulation is good for more complex systems with lots more variables and non-linear relationships.
 

cossine

Well-Known Member
Joined
Jul 24, 2020
Messages
627
Gender
Male
HSC
2017
The rules of a game are:
  • The game costs $10 dollars to play
  • You get to throw a fair die 20 times
  • Every time you throw a 5 or 6 you win $1
What is the maximum profit you could make?
Hint: You could run a simulation of this game to see how it works.

I got 10 but I dont know if its right?
You do not need simulation as the question quite simple.

It cost $10 to play.

You can win at most $20

Therefore profit = 20 -10 = $10
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top