###chapter 1 problem 1 #a.{HHH,HHT,HTH,THH,HTT,THT,TTH,TTT} #b.(1)A={HHH,HHT,HTH,THH} #b.(2)B={HHH,HHT} #b.(3)C={HHT,HTT,THT,TTT} #c.(1)A complement={HTT,THT,TTH,TTT} #c.(2)A interssection B=B={HHH,HHT} #c.(3)A union C={HHH,HHT,HTH,THH,HTT,THT,TTT}

###1.2 #a.{11,12,13,14,…,65,66} totally 36 elements #b.(1)A={14,41,15,51,16,61,23,32,24,42,25,52,26,62,33,34,43,35,53,36,63,43,44,45,54,46,64,55,56,65,66} #b.(2)B={21,31,41,51,61,32,42,52,62,43,53,63,54,64,65} #c.C={41,42,43,44,45,46} #find the probability associated with the event A assuming fair dice.31/36=

###1.5

cat("Union: \u222A\n")
## Union: ∪
cat("Intersection: \u2229\n")
## Intersection: ∩

C=A∪B-A∩B

###1.9 The weather forecaster says that the probability of rain on Saturday is 25% and that the probability of rain on Sunday is 25%. Is the probability of rain during the weekend 50%? Why or why not? No, the probability of rain during the weekend is not necessarily 50%. Because rain on Saturday and Sunday are not independent event, the probability of rain on the weekend can’t simply add the probability on Saturday and Sunday together. Probability of Rain on Saturday P(Sa)=25% or 0.25 Probability of Rain on Sunday P(Su)=25% or 0.25 Assume the events are independent (i.e., the occurrence of rain on Saturday does not affect the occurrence of rain on Sunday), we can use the following formula: The probability of rain on both Saturday and Sunday is P(Sa∩Su)=P(Sa)P(Su)=0.250.25=0.0625 The probability of rain on either day (Saturday or Sunday) is P(Sa∪Su)=P(Sa)+P(Su)-P(Sa∩Su)=0.25+0.25-0.0625=0.4375 As a result, the probability of rain during the weekend is 43.75%, not 50% because the occurrence of rain on Saturday and on Sunday is not independent event.

###other problem 1 P(A) = 1/3 means the probability of event A occurring is 1 out of 3. P(B complement) = 1/4 means the probability of the complement of event B is 1 out of 4, and the probability of event B is 3 out 4. For events A and B to be disjoint, it means that they cannot occur simultaneously. In other words, if one event happens, the other event cannot happen at the same time. The probability that two disjoint events occur simultaneously is always zero, which means A intersection B is empty. However, there is no information that shows that A intersection B is empty. So, Without more information about the relationship between A, B, and B complement, I cannot definitively conclude whether A and B are disjoint.

###other problem 2. Explain the general idea of statistical inference and the role that probability plays. Statistical inference is a process used in statistics to make conclusions or predictions about a population based on sample data. It involves using probability theory and statistical methods to draw inferences about the characteristics of a population from which the sample is drawn. Probability distributions describe the likelihood of different outcomes in a random experiment. They are used to model uncertainty and variability in data. The sampling distribution is a probability distribution that describes the variability of a statistic (like the mean or standard deviation) calculated from different samples taken from the same population, which helps in making inferences about population parameters. Probability is used to assess the likelihood of observing a particular outcome under a null hypothesis. The p-value in hypothesis testing represents the probability of obtaining results as extreme as observed, assuming the null hypothesis is true. Probability is used to construct confidence intervals, which provide a range of values within which the population parameter is likely to lie with a certain level of confidence. Overall, statistical inference uses probability concepts and techniques to make informed decisions and draw reliable conclusions about populations based on sample data.

###other problem 3.

#Set seed to make example repeatable

set.seed(12)

Set the number of simulations

num_simulations <- 10000

Simulate two dice rolls num_simulations times

dice_rolls <- replicate(num_simulations, {
  toss1 <- sample(1:6, 1)
  toss2 <- sample(1:6, 1)
  c(toss1, toss2)
})

Calculate the sum of each pair of tosses

sums <- colSums(dice_rolls)

Count the number of sums that are at least 5

num_at_least_5 <- sum(sums >= 5)

Calculate the probability

probability <- num_at_least_5 / num_simulations