Statistics/Forestry/Horticulture 572 Discussion 8Course website http://www.stat.wisc.edu/courses/st572-larget/TA Xu He(Mario)Email [email protected] of TA www.stat.wisc.edu/∼hexuOffice 1275F, MSCOffice hour Th 11:00-12:00, 4:00-6:00Phone (608)334-97921 A Simulation problem for a gameIt’s a sort of gambling game. The players should pay $2 first, and then pull 5 balls out of a bag.The bag contains 10 balls, all identical expect that 5 are red, 5 are green. The player are notallowed to see the bag while picking balls, i.e., balls will be picked randomly without replacement.The player will be r ewarded some money right after the game if certain number of red balls werepicked.0 or 5 red balls: $ 100 prize1 or 4 red balls: $ 5 prize(actually $3 gain)2 to 3 red balls: no prize(a) Write a function to generate 5 balls automatically. Use that function to p ick balls for 3 times.Also, write a function to generate the dollars gain from a single game.(b) If we play the game for sufficiently many times. Will we win in the last? Answer this questionby simulate the game for 10000 times, and calculate the mean of gain or lose.(c) If we only play once, what’s the possibility we win? What if playing 10 times? Answer thisquestion by simulate the game for 10000 times and record how many times we shall win.(d) Continue with (c), what’s the 5%, 15%, ... , 95% quantile of dollars gain if we play 10 times?Draw a count histogram to see the distribution.(e) Extra problem: What is the possibility we get 4 red balls in a single game?12 Simulation for coefficients from a linear modelThe following data is collected to study the relationship between frequency of chirps made bya ground cricket and the corresponding ground temperatur e. The frequency is measured as thenumber of wing vibrations per second.chirps (/second) 20.0 16.0 19.8 18.4 17.1 15.5 14.7 17.1 15.4 16.2 15.0 17.2 16.0 17.0 14.1temperature (F) 88.6 71.6 93.3 84.3 80.6 75.2 69.7 82.0 69.4 83.3 78.6 82.6 80.6 83.5 76.3(a) Fit the data by a simple linear model. Another model would be chirps ∼ 1. Which model isbetter? Do an ANOVA test and report the null and alternative hypotheses and p-value.(b) Simulate 1000 reasonable values of β an d σ from the model chirps ∼ temp. Find the 95%confidence interval for the slope of the line. Compare this interval with one you can fin d fromdisplay().(c) Do 4 groups of simulations. E ach group contains 10 simulations. Each simulation is of size 10,100, 1000 or 10000. I.e., take ten simulations of size 10, ten for size 100, ten for size 1000, ten forsize 10000. For each group of simulations, calculate the mean and s tandard error of the standarderror of those 10, 100, 1000, or 10000 simulations for coefficient of the slope. What’s the p ropersimulation s ize so that we get a good simulation of coefficient of the slope?(d) Find 0.01 quantile of the distribution for co efficient corresponding to temp. What simulationsize do we need to have a standard smaller than 0.002?(e) Have a 95% prediction interval for the chirp of temp erature 70F. compare this interval with theone you can find using
View Full Document