Problem 3

Problem 3.a

knitr::opts_chunk$set(echo = TRUE)

#According to a survey, the fraction of the population which likes science-fiction movies is 0.2 and the fraction of the population which likes role-playing games is 0.1. Also, the proportion of people who are not interested in science-fiction movies and are also not interested in role-playing games is 0.75. For the following problems, define events carefully and show all steps.
#a.What is the probability that a person likes both science-fiction movies and role-playing games?
#This is P (SFmovie intersection RPgames) 
SFmovie <- 0.2
RPgames <- 0.1
NotSFmovie_NotRPGames <- 0.75

#Consider sample size as 1
#Complement of P(NotSFmovie_NotRPGames) is P(SFmovie intersection RPgames) 

SFmovie_AND_RPGames <- 1- NotSFmovie_NotRPGames
print (SFmovie_AND_RPGames)
## [1] 0.25

Problem 3.b

knitr::opts_chunk$set(echo = TRUE)

#According to a survey, the fraction of the population which likes science-fiction movies is 0.2 and the fraction of the population which likes role-playing games is 0.1. Also, the proportion of people who are not interested in science-fiction movies and are also not interested in role-playing games is 0.75. For the following problems, define events carefully and show all steps.
#b. What is the conditional probability that a person likes science-fiction movies given that (s)he like role-playing games?
#This is P(SFmovie given RPGames) = P(SFMovie intersection RPGames)/P(RPGames) 
SFmovie <- 0.2
RPgames <- 0.1
NotSFmovie_NotRPGames <- 0.75
#From 3a we know SFMovie intersection RPGames
#Hence P(SFmovie given RPGames)
print(SFmovie_AND_RPGames/RPgames)
## [1] 2.5

Problem 3.c

knitr::opts_chunk$set(echo = TRUE)

#According to a survey, the fraction of the population which likes science-fiction movies is 0.2 and the fraction of the population which likes role-playing games is 0.1. Also, the proportion of people who are not interested in science-fiction movies and are also not interested in role-playing games is 0.75. For the following problems, define events carefully and show all steps.
#c. Are the events liking science-fiction and liking role-playing games independent?
#SFmovie and RPgames are independent if P(SFMovie intersection RPGames) = P(SFMovie) * P(RPgames) 
SFmovie <- 0.2
RPgames <- 0.1
NotSFmovie_NotRPGames <- 0.75
#From 3a we know SFMovie intersection RPGames

print(SFmovie_AND_RPGames)
## [1] 0.25
# P(SFMovie) * P(RPgames) 
SFmovieintoRPgames <- SFmovie * RPgames
print(SFmovieintoRPgames)
## [1] 0.02
#Checkwhether the independent check passes. It would be false
trueorfalse <- SFmovieintoRPgames == SFmovie_AND_RPGames
print(trueorfalse)
## [1] FALSE