Question
Problem: If the first game is played in Boston, the second game is played in New York, and the third game (if it becomes necessary)
Problem:
If the first game is played in Boston, the second game is played in New York, and the third game (if it becomes necessary) is in Boston, then complete parts (i)-(v) below.
(i) Calculate the probability that the Red Sox will win the series. (ii) Construct a probability distribution for your net win (X) in the series. Calculate your expected net win (the mean of X) and the standard deviation of X. (iii) Use Excel or R to create 10,000 random values for X. Let these random values be denoted by Y. Use these Y values to estimate your expected net win by using a 95% confidence interval. Does this confidence interval contain E(X)? (iv) Construct a frequency distribution for Y. Next, use the Chi-squared goodness of fit test to verify how closely the distribution of Y has estimated the distribution of X. (v) Use your observations of parts (ii) and (iii) above to describe whether your betting strategy is favorable to you. Write a summary of your observations and analyses in the Word document.
___________
I have problem in part (iv) for Chi-squared goodness of fit test, it get me error and I don't know how to solve it in R.
here is my codes:
# Calculate the expected frequencies probabilities <- c(0.125, 0.375, 0.375, 0.125) # replace with your own probabilities expected_freq <- probabilities * 10000
# Generate 10,000 random values for Y set.seed(123) # for reproducibility Y <- sample(c(-1, 0, 1, 2), size = 10000, replace = TRUE, prob = probabilities)
# Create a frequency table for Y observed_freq <- table(Y)
# Example probabilities probs <- c(0.2, 0.3, 0.5)
# Rescale probabilities probs_rescaled <- probs/sum(probs)
# Check if they add up to 1 sum(probs_rescaled)
# Perform the Chi-squared goodness of fit test chisq.test(observed_freq, p = expected_freq)
_________
it get me this error: Error in chisq.test(observed_freq, p = expected_freq) : probabilities must sum to 1.
how should I recall it and added to 1? can you get me its code in R to solve this error?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started