Sale!

STAT 1500 FINAL EXAMINATION Solved

Original price was: $35.00.Current price is: $28.00.

Download Details:

  • Name: FINAL-EXAM-wgujgm.zip
  • Type: zip
  • Size: 706.22 KB

Category:

Description

5/5 - (1 vote)

Question 1.
A previous consultant had created a chart for a movie review website which is illustrated below. However, the
R code used to create the diagram has since been lost and cannot be recovered. Your task is to come up with
the code that will re-create the same chart making it look as close as possible to the original. A new dataset
has been supplied – MovieReviewData.csv.
Question 2.
One very early method for pseudo random number generation is von Neumann’s middle square method (von
Neumann, 1951). The method works as follows: starting with 𝑋0 ∈ {0, 1, … , 99}, define 𝑋𝑛 for 𝑛 ∈ β„• to be the
middle two digits of the four-digit number π‘‹π‘›βˆ’1
2
. If π‘‹π‘›βˆ’1
2 does not have four digits, it is padded with leading
zeros.
(a) Write a function which computes 𝑋𝑛 from π‘‹π‘›βˆ’1. Call this function middle.square.1500
(b) The output of the middle square method has loops. For example, once we have 𝑋𝑁 = 0, we will have 𝑋𝑛 =
0 for all 𝑛 β‰₯ 𝑁. Write a program to find all cycles of the middle square method.
(c) Comment on the quality of the middle square method as a PRNG.
Question 3.
Its 9am on a Friday when your boss, Todd, comes into the office demanding that you have two reports on his
desk by end of day. His demands today are particularly frustrating to you as you scheduled months ago a meet
up with your friends that’s taking place at 6pm. Now, for better or worse, you want to keep your job, but you
also don’t want to miss out on the event that is in just 9 hours. You ask yourself what is the chance that you
could even finish two reports in time for the party and how could you actually even go about computing that
chance?
Using a Monte Carlo simulation, what is the probability that you will not make it to the party? Perform at least
10000 simulations. You may assume that report 1 takes between 2 to 6 hours to complete and report 2 takes
between 3 to 7 hours to complete and your performance on one report has no bearing on the other. Perform
exactly 10123 simulations.
Question 4.
Using the bisection method, show that 𝑓(π‘₯) = π‘₯
3 βˆ’ sin2
(π‘₯)
(a) Has a root between [0.5,1] and a root between [2,5]
(b) Determine an approximation to the root that is accurate to at least within 10βˆ’4
.
(c) Determine the maximum number of iterations necessary to solve 𝑓(π‘₯) = 0 with 10βˆ’4
. How does this
compare with (b).
Question 5.
Alice has two favorite foods: pasta and salad. If she has pasta one night, there is a 40% chance she will have
pasta again the next night. If she has salad, there is a 70% chance she will have salad the next night.
(a) If Alice has pasta for dinner on Monday night, what is the probability that she will have salad on Thursday?
(b) In the long run, what percentage of her dinners will be salad? Start with probability 10% and 90%.
(c) Use a Monte Carlo simulation to numerically determine the distribution of dinner choices on day 5.
(d) Analytically compute the distribution of dinner choices on day 5. Then do day 6.
Question 6.
The Spooky Boogie Costume Salon makes and sells four different Halloween costumes: the witch, the ghost,
the goblin, and the werewolf. Each witch costume uses 3 yards of material and takes 3 hours to sew. Each
ghost costume uses 2 yards of material and takes 1 hour to sew. Each goblin costume uses 2 yards of material
and takes 3 hours to sew. Each werewolf costume uses 2 yards of material and takes 4 hours to sew. The
profits for each costume are as follows: $10 for the witch, $8 for the ghost, $12 for the goblin, and $16 for the
werewolf.
If they have 600 yards of material and 510 sewing hours available before the holiday, how many of each
costume should they make to maximize profit, assuming they sell everything they make? There can be at most
2 werewolf costumes.
Question 7.
(a) Use the bootstrap method to estimate the median and 95% confidence interval of the following dataset:
data <- c(22.5, 24.3, 21.7, 23.8, 22.0, 25.1, 24.6, 23.1, 22.9, 21.9)
Write an R function to perform bootstrap resampling and calculate the median for each resample. Perform 10,000
bootstrap resamples.
(b) Construct a histogram of the bootstrap medians and calculate the 95% confidence interval for the median based on
the bootstrap samples.
(c) Compare the bootstrap confidence interval with the theoretical confidence interval for the median based on the
binomial distribution. Discuss any differences.
(d) Investigate the effect of varying the number of bootstrap resamples on the confidence interval by repeating the
bootstrap process with 1,000, 5,000, and 20,000 resamples. Compare the results and discuss any observed trends.
Question 8.
(a) Consider the following dataset where each value represents a success (1) or failure (0):
data <- c(1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0)
Use the bootstrap method to estimate the proportion of successes and the 95% confidence interval for the proportion.
(b) Perform 10,000 bootstrap resamples and calculate the proportion for each resample.
(c) Construct a histogram of the bootstrap proportions and calculate the 95% confidence interval.
(d) Compare the bootstrap confidence interval with the theoretical confidence interval based on the normal
approximation to the binomial distribution. Discuss any differences.
(e) Assess the stability of the bootstrap confidence intervals by calculating the bootstrap confidence intervals for
different numbers of resamples (e.g., 1,000, 5,000, and 20,000). Compare the intervals and discuss how the number of
resamples affects the precision and stability of the bootstrap estimates.