**
Fill This Form To Receive Instant Help**

Homework answers / question archive / University of Glasgow School of Physics and Astronomy Session 2021-22 SUPA Advanced Data Analysis PHYS5001: Advanced Data Analysis for Physics and Astronomy Assignment 3 For submission and assessment 8

University of Glasgow School of Physics and Astronomy Session 2021-22 SUPA Advanced Data Analysis PHYS5001: Advanced Data Analysis for Physics and Astronomy Assignment 3 For submission and assessment 8. A coin is tossed 100 times, with 58 heads and 42 tails obtained. (a) Assuming that the probability of obtaining a head on any given coin toss is equal to the parameter θ, and assuming that the probability of obtaining r heads from n independent coin tosses follows a binomial distribution, write down an expression for the likelihood function of the data obtained. (b) Consider model M1, where θ = 0.5. Use Stirling’s approximation for the factorial function in the form to compute the probability of obtaining 58 heads, given that M1 is the correct model. (c) Using the normal approximation to the binomial distribution, compute the p-value for the null hypothesis that the coin is fair, given that from 100 tosses 58 heads were obtained. (d) Now consider another model M2 where θ is unknown. Assuming again a binomial pdf for the likelihood of obtaining r heads from n coin tosses, and a uniform prior on [0,1] for θ, write down an integral expression for the posterior probability of obtaining 58 heads from 100 coin tosses – marginalising over the unknown parameter θ. (e) Using the approximate expression for the Beta function compute the probability of obtaining 58 heads given that M2 is the correct model. (f) Hence compute the posterior odds ratio . (g) Contrast your results for part (c) and part (f); are the Bayesian and frequentist tests of the fairness of the coin consistent with each other? If not, explain briefly why not. [30 marks] n e n n n ÷ ø ö ç è æ !~ 2p ( ) ( ) 2 1 2 1 2 1 B( ) 1 ~ 2 1 1 0 1 + - - - - - + = - ò x y x y x y x y x y x,y t t dt p ?"# = prob ?"|58 heads prob ?#|58 heads 8. Consider the random variable x with pdf p(x) given by (where C is a constant) p(x) = C x3 , for 0 < x < 5, and zero otherwise (a) Determine the value of C required to make p(x) a properly normalised pdf. (b) Determine an expression for the cumulative distribution function, P(x), of the random variable x, and also determine the mean and variance of x. (c) Using e.g. MATLAB, Python or any other programming language of your choice, generate a set of 1000 uniformly random numbers between 0 and 1. Use the Probability Integral Transform (PIT) method to transform these uniformly random numbers into a sample of random numbers drawn from the pdf given in part (a) above. (d) Compute the sample mean and sample variance of your random sample and compare them with the mean and variance that you determined in part (b). (e) Generate a histogram of your random sample and compare it with the predicted number of sampled values in each histogram bin for the pdf given in part (a). Construct an appropriate χ2 statistic that compares the observed and predicted numbers of sampled values in each histogram bin, and use your χ2 statistic to test the hypothesis that the random numbers you generated following the PIT method are indeed drawn from the pdf given in part (a). State clearly any assumptions that you make. [25 marks] 9.

Already member? Sign In