Question 1

Consider the set of numbers \([8,9,10,11,12,13,14]\). The largest value, 14, is changed to 35 (every other value stays the same). How does the mean and median change?

  1. Compute descriptive statistics for 8 to 14.
# install.packages("summarytools")
library(summarytools)
nums_set1 <- 8:14 # 8 to 14 inclusive
descr(nums_set1)
## Descriptive Statistics  
## nums_set1  
## N: 7  
## 
##                     nums_set1
## ----------------- -----------
##              Mean       11.00
##           Std.Dev        2.16
##               Min        8.00
##                Q1        9.00
##            Median       11.00
##                Q3       13.00
##               Max       14.00
##               MAD        2.97
##               IQR        3.00
##                CV        0.20
##          Skewness        0.00
##       SE.Skewness        0.79
##          Kurtosis       -1.71
##           N.Valid        7.00
##                 N        7.00
##         Pct.Valid      100.00

I get a mean of 11 and a median of 11.

  1. Compute descriptive statistics for 8 to 13, change 14 to 35.
# install.packages("summarytools")
library(summarytools)
nums_set2 <- c(8:13,35)
descr(nums_set2)
## Descriptive Statistics  
## nums_set2  
## N: 7  
## 
##                     nums_set2
## ----------------- -----------
##              Mean       14.00
##           Std.Dev        9.42
##               Min        8.00
##                Q1        9.00
##            Median       11.00
##                Q3       13.00
##               Max       35.00
##               MAD        2.97
##               IQR        3.00
##                CV        0.67
##          Skewness        1.51
##       SE.Skewness        0.79
##          Kurtosis        0.58
##           N.Valid        7.00
##                 N        7.00
##         Pct.Valid      100.00

I get a mean of 14 and a median of 11.

  1. Discussion

I found that the median stays the same and the mean increases.

Question 2

Evaluate the following limit.

\[\lim_{x \to \infty} \frac{\sqrt{x^2 + 4x}}{x}\]

# install.packages("caracas")
library(caracas)
## Warning: package 'caracas' was built under R version 4.5.2
## 
## Attaching package: 'caracas'
## The following objects are masked from 'package:base':
## 
##     %*%, det, diag, diag<-
x <- symbol("x")
f <- sqrt(x^2 + 4 * x) / x
result <- lim(f = f,var = x,val = Inf) # Inf: positive infinity
result
## c: 1

Question 3

There are 2 dice. Each die has 8 rectangular faces, each with a number 1 to 8, and two octagonal faces at the ends. Sonya rolls the two dice on a flat surface until they settle with numbers on the top faces. Because the dice are rolled, they cannot land on the octagonal faces. She then adds the two numbers on the top face. SHe rolls the two dice together 64 times. What is the probability that the sum of the two scores is 9?

die1 <- 1:8 # first die
die2 <- 1:8 # second die
counter <- 0 # number of times the sum is 9
N <- 64 # 64 trials
for (i in 1:N) {
  roll1 <- sample(x = die1,size = 1,replace = T)
  roll2 <- sample(x = die2,size = 1,replace = T)
  if (roll1 + roll2 == 9) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability that the sum of the two scores is 9 is:",probability,"\n")
## The probability that the sum of the two scores is 9 is: 0.234375

Question 4

Charley is practicing hard to qualify for the national gymnastics team. She has a regular weekly routine, training for 6 hours a day on some days and 4 hours a day on other days. She trains altogether for 38 hours in a seven day week. Let the number of “6 hour” days be \(s\), and the number of “4 hour” days be \(t\), Write out and solve two equations that can be used to find \(s\) and \(t\).

  1. Write out the system of equations.

\[6s + 4t = 38 \\ s + t = 7\]

  1. Solve the system of equations.
q4_data <- data.frame(s = c(6,1),
                      t = c(4,1),
                      constants = c(38,7))
q4_model <- lm(constants ~ . - 1,data = q4_data) # . includes everything but response variable, -1 excludes the intercept
coef(q4_model)
## s t 
## 5 2

We find that \(s = 5\) and \(t = 2\).