Publications by aardvarkfunnyxia

Document

27.11.2023

When a certain driver parks their car in the evenings, they are equally likely to remember or to forget to switch off the headlights. Giving your answers in their simplest index form, find the probability that on the next 16 occasions that they park their car in the evening, they forget to switch off the headlights: a) 14 more times than they rem...

2471 sym 4 img

Document

27.11.2023

set.seed(12345) Generate 4 sets of 100 points from the N(0, 1) distribution random_normal_1 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_2 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_3 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_4 <- rnorm ( n = 100, mean = 0, sd = 1 ) compare each of the sets using histogram par (mfrow ...

953 sym 4 img

Document

27.11.2023

Exercise 8.1. x_values = seq ( -3, 3, length.out = 100000) plot ( x_values, dnorm (x_values, mean = 0, sd = 1), type = "l") abline ( v = c (-3, 3), col = "red", lty = 2, lwd = 2) total_area <- pnorm (Inf, mean = 0, sd = 1) area_below_3 <- pnorm (3, mean = 0, sd = 1) area_between <- ((2 * area_below_3 - 1) / total_area ) *100 print...

1320 sym 5 img

Document

27.11.2023

Exercise 8.4 – an optional one set.seed(12345) Generate 4 sets of 100 points from the N(0, 1) distribution random_normal_1 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_2 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_3 <- rnorm ( n = 100, mean = 0, sd = 1 ) random_normal_4 <- rnorm ( n = 100, mean = 0, sd = 1 ) compare each of the...

986 sym 4 img

Document

26.11.2023

Using sample() in R allows you to take a random sample of elements from a dataset or a vector,either with or without replacement The basic syntax is the following sample (x, size, replace = FALSE, prob = NULL) (see ?sample) Generating a sample from a Vector Suppose we have a vector with 10 elements vector <- c (seq (1:10)) # to generate a random ...

559 sym Python (1809 sym/13 pcs)

Document

21.11.2023

poi5 <- dpois(0:20, lambda = 5) plot (poi5, pch = 20, xlab = "value of x", ylab = "probability", main = "Lines of mean = 5", ylim = c(0,0.25)) lines(poi5, lwd = 2) ## the mean of the distribution Poi(5) mean_poi5 <- sum (0:20 * poi5) mean_poi5 ## [1] 4.999998 ## add the following lines (3): ### bin(10,0.5) distribution in red bin10_0....

13 sym 1 img

Publish Document

21.11.2023

Exercise 7.1. ############################################### ### Expectation: (Note: in all of the following questions, p = 0.2, days = 365) days <- 365 p <- 0.2 E <- p * days print(E) ## [1] 73 ### Probability that I wear an ironed shirt 16 days or fewer: sum (dbinom (x = 1:16, size = days, prob = p)) ## [1] 4.096763e-18 Exercise 7.2. ###########...

1178 sym Python (8078 sym/76 pcs) 8 img

Publish Document

21.11.2023

Exercise 7.1. ############################################### ### Expectation: (Note: in all of the following questions, p = 0.2, days = 365) days <- 365 p <- 0.2 E <- p * days print(E) ## [1] 73 ### Probability that I wear an ironed shirt 16 days or fewer: sum (dbinom (x = 1:16, size = days, prob = p)) ## [1] 4.096763e-18 Exercise 7.2. ###########...

1178 sym Python (8078 sym/76 pcs) 8 img

Document

20.11.2023

## Given that we have a normal distribution X ~ N (2, 4) show that P (X < 4) = 0.8413447 pnorm (4, mean= 2, sd = sqrt(4)) ## [1] 0.8413447 What are qX1 such that P(X < qX1) = 0.95 and qX2 such that P(X < qX2) = 0.975? qx1 <- qnorm (0.95, mean = 2, sd = sqrt(4)) qx1 ## [1] 5.289707 qx2 <- qnorm (0.975, mean = 2, sd = sqrt (4)) qx2 ## [1] 5.919928 Dr...

388 sym 2 img

Document

20.11.2023

Exercise 7.11. Create a QQ plot for the Handspan data with an appropriate heading. Do you think that the data appear normal? Why? qanda <- read.csv("selective_affinities.csv") qanda_modified <- read.csv("selective_affinities_aftermodified.csv") attach (qanda_modified) qqnorm (y = Handspan, pch = 20) qqline (Handspan, col = "red", lwd = 2) detach(...

244 sym 1 img