



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of exercises focused on probability and statistics, solved using the r programming language. it covers topics such as calculating probabilities from probability density functions (pdfs), cumulative distribution functions (cdfs), expected values, and variances. The exercises provide practical applications of statistical concepts and demonstrate how to use r for statistical computations. each problem is clearly defined, and the solutions are detailed, making it a valuable resource for students learning probability and statistics.
Typology: Exercises
1 / 6
This page cannot be seen from the preview
Don't miss anything!




> integrand <- function(x) x * (1 - x) > > # Compute the integral > integral <- integrate(integrand, lower = 0, upper = 1)$value > > # Solve for k > k <- 1 / integral > k [1] 6
> pdf <- function(x) 6 * x * (1 - x) > > # Compute the probability > prob <- integrate(pdf, lower = 0.4, upper = 1)$value > prob [1] 0.
> pdf <- function(x) 6 * x * (1 - x) > > # Compute P(X < 0.4) > prob_less_than_0.4 <- integrate(pdf, lower = 0, upper = 0.4)$value > > # Compute P(X < 0.8) > prob_less_than_0.8 <- integrate(pdf, lower = 0, upper = 0.8)$value > > # Compute conditional probability > conditional_prob <- prob_less_than_0.4 / prob_less_than_0. > conditional_prob [1] 0.
> mean_integrand <- function(x) x * 6 * x * (1 - x) > > # Compute the mean > mean_value <- integrate(mean_integrand, lower = 0, upper = 1)$value > mean_value [1] 0.
> E_X_squared_integrand <- function(x) x^2 * 6 * x * (1 - x) > > # Compute E[X^2] > E_X_squared <- integrate(E_X_squared_integrand, lower = 0, upper = 1)$value > > # Compute the variance > variance <- E_X_squared - mean_value^ > variance [1] 0.
> pdf <- function(x) 1 / (x * log(1.5)) > > # Compute the total area > total_area <- integrate(pdf, lower = 4, upper = 6)$value > total_area [1] 1
> prob <- integrate(pdf, lower = 4, upper = 5)$value > prob [1] 0.
> expected_value_integrand <- function(x) x * pdf(x) > > # Compute the expected value > expected_value <- integrate(expected_value_integrand, lower = 4, upper = 6)$value > expected_value [1] 4.
> E_X_squared_integrand <- function(x) x^2 * pdf(x) > > # Compute E[X^2] > E_X_squared <- integrate(E_X_squared_integrand, lower = 4, upper = 6)$value > > # Compute the variance > variance <- E_X_squared - expected_value^ > variance [1] 0.
> standard_deviation <- sqrt(variance) > standard_deviation [1] 0.
> cdf <- function(x) x^2 / 16 > > # Create a sequence of x values > x_values <- seq(0, 4, length.out = 100) > > # Compute the CDF values
> expected_value_integrand <- function(x) x * pdf(x) > > # Compute the expected value > expected_value <- integrate(expected_value_integrand, lower = 0, upper = 4)$value > expected_value [1] 2.
> median <- sqrt(0.5 * 16) > median [1] 2.