Question 1

A financial analyst models the relationship between investment return \(R\) (as a decimal) and risk level \(x\) using \(R(x) = 0.03 + 0.08 \ln(1 + 2x)\), where \(x \geq 0\) represents the risk factor. If an investor requires a minimum return of 15%, what is the minimum risk level they must accept, rounded to the nearest hundredth?

# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
R <- function(x) {
  0.03 + 0.08 * log(1 + 2 * x)
}
minimum_risk <- uniroot(function(x) R(x) - 0.15,c(0,10))$root
x_values <- seq(1.5,2,length.out = 500)
y_values <- R(x_values)
q1_data <- data.frame(x = x_values,y = y_values)
ggplot(q1_data,aes(x = x,y = y)) +
  geom_line(col = "black",lwd = 1.25) +
  geom_hline(aes(yintercept = 0.15),col = "red",linetype = "dashed",lwd = 1.25) + # minimum investment return line
  annotate("point",x = minimum_risk,y = R(minimum_risk),col = "blue",size = 5) + # plotting minimum risk level
  labs(title = "Investment Graph",
       subtitle = "R(x) = 0.03 + 0.08 log(1 + 2x)",
       caption = paste("The minimum risk level they must accept is:",round(minimum_risk,2)),
       x = "Risk Factor",
       y = "Investment Return") +
  theme_gray(base_size = 14)

Question 2

Which of the following numbers is 14,553 NOT divisible by?

A. 3

B. 8

C. 7

D. 11

# install.packages("tidyverse")
library(tidyverse)
q2_data <- data.frame(Choice = LETTERS[1:4],
                      Number = rep(14553,4),
                      Divisible = c(3,8,7,11))
answer <- q2_data %>%
  mutate(Correct = Number %% Divisible != 0) %>% # checking for divisibility
  filter(Correct == TRUE) %>% # finding where the mutate statement is TRUE
  pull(Choice) # extracting the correct answer choice
cat("The correct answer is:",answer,"\n")
## The correct answer is: B

Question 3

Consider a spinner with the numbers \([1,5,3,5,2,1,5,3]\). The spinner is spun twice - each time, until the arrow stops and points to a number. Which one of the following events is most likely?

A. 1 followed by 2

B. 2 followed by 2

C. 3 followed by 5

D. 3 followed by 1

# install.packages("tidyverse")
library(tidyverse)
set.seed(123) # for reproducibility
spinner <- c(1,5,3,5,2,1,5,3)
N <- 1e6 # 1 million trials
spin1 <- sample(x = spinner,size = N,replace = T)
spin2 <- sample(x = spinner,size = N,replace = T)
results <- tibble(spin1,spin2)
events <- tibble(
  event = c("1 then 2","2 then 2","3 then 5","3 then 1"),
  spin1 = c(1,2,3,4),
  spin2 = c(2,2,5,1)
)
probabilities <- events %>%
  rowwise() %>%
  mutate(Probability = mean(results$spin1 == spin1 & results$spin2 == spin2)) %>%
  ungroup()
result <- probabilities %>%
  arrange(desc(Probability)) %>%
  slice(1) %>% # finding most likely event
  pull(event)
cat("The event that is most likely to happen is:",result,"\n")
## The event that is most likely to happen is: 3 then 5