Publications by RJM

Data605_Discussion9

24.03.2024

Number of rolls num_rolls <- 24 Mean and standard deviation of a single roll of a fair six-sided die mu <- (1+2+3+4+5+6)/6 sigma <- sqrt((1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2)/6 - mu^2) Calculate the mean and standard deviation of the sum of n_rolls rolls mu_sum <- num_rolls * mu sigma_sum <- sqrt(num_rolls) * sigma Calculate the z-scores for 84 an...

989 sym

Data605_Discussion8

18.03.2024

Load the stats package for gamma distribution functions library(stats) Parameters of the gamma distribution k <- 10 # shape parameter theta <- 2 # scale parameter Calculate the probability P(X > 22) using the gamma distribution CDF prob_x_gt_22 <- 1 - pgamma(22, shape = k, scale = theta) Print the probability cat(“Probability that X > 22 minut...

432 sym

Data605_Discussion 7

10.03.2024

Function to calculate the factorial of a number factorial <- function(n) { if (n == 0) { return(1) } else { return(n * factorial(n - 1)) } } Function to calculate the binomial coefficient binomial_coefficient <- function(n, k) { return(factorial(n) / (factorial(k) * factorial(n - k))) } Function to calculate the Poisson approximation poisson_appr...

1423 sym

Data_605_Discussion6

03.03.2024

Define a function to calculate the number of ways calculate_ways <- function() { Calculate the factorial of a number factorial <- function(n) { if (n == 0) { return(1) } else { return(n * factorial(n - 1)) } } Calculate the number of ways ways <- factorial(8) / (factorial(3) * factorial(3) * factorial(2)) return(ways) } Call the function to ...

394 sym

Data_605_Discussion5

26.02.2024

Function to simulate a single volley play_volley <- function(you_serve) { if (you_serve) { # If you are serving, calculate if you win the volley with probability 0.6 win_volley <- runif(1) < 0.6 } else { # If your opponent is serving, calculate if you win the volley with probability 0.5 win_volley <- runif(1) < 0.5 } return(win_volley) } Function ...

2285 sym

Discussion3_Data_605_v2

12.02.2024

Problem C25 Define the 3x3 identity matrix I3 <- diag(3) Compute eigenvalues and eigenvectors eigen_data <- eigen(I3) Extract eigenvalues and eigenvectors eigenvalues <- eigen_data\(values eigenvectors <- eigen_data\)vectors Print the results cat(“Eigenvalues:”, eigenvalues, “”) cat(“Eigenvectors:”, eigenvectors, “”) Eigenvalue...

642 sym

Test1

05.02.2024

R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the...

591 sym 1 img

Data_605_Discussion1

05.02.2024

Defining the vectors b <- matrix(c(-1, 0, 4), nrow = 3, byrow = TRUE) c <- matrix(c(3, 4, 2), nrow = 3, byrow = TRUE) a_coefficient <- matrix(c(1, 2, -1), nrow = 3, byrow = TRUE) Calculate the right-hand side using matrix operations rhs <- b - 4 * c Solve for ‘a’ using element-wise division a <- rhs / a_coefficient Print the solution print(�...

381 sym

Data_605_Discussion2

05.02.2024

Defininge the matrix A A <- matrix(c(2, 3, 0, 2, 1, 0, 1, 1, 1, 2, 0, 0, 1, 2, 3, 0, 1, 2, 1, 0, 0, 0, 0, 1, 2), nrow = 5, byrow = TRUE) Calculate the determinant of A det_A <- det(A) Print the result cat(“Determinant of matrix A:”, det_A, “”) Determinant of matrix A: 2...

282 sym

DATA606 Lab8 RJM

07.05.2020

Batter up The movie Moneyball focuses on the “quest for the secret of success in baseball”. It follows a low-budget team, the Oakland Athletics, who believed that underused statistics, such as a player’s ability to get on base, betterpredict the ability to score runs than typical statistics like home runs, RBIs (runs batted in), and batting...

10816 sym R (6535 sym/42 pcs) 14 img