Publications by aardvarkfunnyxia
Week 2 practical
Today’s practical If you’d like to, find a group of students to work with today. It’s also fine to work alone if you’d prefer. Then move on to the task below. The data If you’ve already had a go at this week’s homework practical, you’ll have come across today’s data already. Don’t worry if you haven’t had a chance to do this y...
4784 sym 8 img
tapply & *apply()
Inside tapply() function, we need three items: tapply( X, INDEX, FUN = , …) where: X: a vector to apply a function to INDEX: A list of one or more factors FUN: the function to apply I’ll depict how to use it using an example: # We'll first have a data frame df <- data.frame( class = c ("A","A","A","B","B","B"), result = c ("1","0","1","1...
3290 sym
Exercise 8 Presentation
2024-03-05 Exercise 8.1. Create a plot which has 6 lines (in different colours), representing the pdfs for 6 \(\chi^2\) distributions, with parameters from {1, 2, 3, 4, 6, 9} over the range (0, 10]. Can you estimate from the plot how the mode relates to the parameter (it is a very simple relationship)? Compare your output with that from a well kn...
2447 sym 2 img
Exercise 7 presentation
2024-02-27 Exercise 7.1 Consider a random variable X with X ~ Bin(20, 0.4). Using R, work out P(\(X \le 13\)). Which Normal distribution would you use for Y to approximate X? Calculate the equivalent probability for Y that you calculated above for X. Now do the same for X ~ Bin(50, 0.8) and P(\(X \ge 41\)). In both cases, note how close (or other...
4137 sym Python (5634 sym/22 pcs) 11 img
Exercise 7
Exercise 7.1 Consider a random variable X with X ~ Bin(20, 0.4). Using R, work out P(\(X \le 13\)). Which Normal distribution would you use for Y to approximate X? Calculate the equivalent probability for Y that you calculated above for X. Now do the same for X ~ Bin(50, 0.8) and P(\(X \ge 41\)). In both cases, note how close (or otherwise) the ap...
3891 sym Python (5854 sym/25 pcs) 11 img
Exercise 7.4
I create a function to output the mean of samples mean.dr <- function (n, m){ mtx <- matrix (nrow = n, ncol = m) mtx[1:n,] <- replicate (m, rchisq (n = n, df = 3)) M <- colMeans (mtx) meanM <- mean(M) sdM <- sd(M) # save them as "result" result_toplot <- as.numeric (M) # plot these means as a histogram hist (result_toplot, pr...
136 sym 3 img
Exercise 7.1
Exercise 7.1 Consider a random variable X with X ~ Bin(20, 0.4). Using R, work out P(X ≤ 13). Which Normal distribution would you use for Y to approximate X? Calculate the equivalent probability for Y that you calculated above for X. Now do the same for X ~ Bin(50, 0.8) and P(X ≥ 41). In both cases, note how close (or otherwise) the approximat...
524 sym 2 img
Exercise 6 presentation
2024-02-20 Exercise 6.1. How do you quantify the monotonic relationship between Handspan and Height in the qanda dataset? Can you guess the R function to test this relationship formally? Write down explicitly your null and alternative hypotheses. Hypotheses: \(H_0\): there is no relationship between Handspan and Height. \(H_1\): there is a relat...
2857 sym 4 img
Exercise 6
qanda <- read.csv ("selective_affinitiesnew.csv") cd <- read.csv ("Country_data.csv") er <- read.csv ("Exam_results.csv") Exercise 6.1. How do you quantify the monotonic relationship between Handspan and Height in the qanda dataset? Can you guess the R function to test this relationship formally? Write down explicitly your null and alternative hy...
2811 sym 4 img