Stat 992 Assignment – Presentation Day 1 - MATLAB Question 1. Adapt the Matlab program in Code 6.2 to illustrate the Beta (α, β) distribution where α = 2 and β = 3. Question 2: Adapt the matlab program in Code 6.2 to illustrate the Binomial (N, θ) distribution where N = 10 and θ = 0.7. Question 3: Write a demonstration program to sample 10 values from a Bernoulli(θ) distribution with θ = 0.3. Recall that there are only two possible outcomes, 0 and 1. With probability θ, the outcome is 1, and with probability 1 − θ, the outcome is 0. In other words, p(X = 1) = θ, and p(X = 0) = 1 − θ. In Matlab, you can simulate the Bernoulli distribution using the binomial distribution with N = 1. However, for the purpose of this exercise, please write the code needed to randomly sample Bernoulli distributed values that does not make use of the built-in binomial distribution. Using a seed of 21, verify that the first four observations agree with 1, 1, 0 and 1 respectively. Your MATLAB code could use the following line for the seeding: >> seed=21; rand(’state’,seed); randn(’state’,seed); Question 4: In this exercise, we want to generate the random variable x=(x1, x2) from Beta(1, 𝛽) by inverse transform method. a) Write down the algorithm for generating x. b) Use MATLAB to construct two sets of N=1000 observations each from Beta (1,4). Set seed =131. Plot histograms of both sets on the same graph and print out the first 5 observations from each set. Observe that the first observations are x1=0.0251 and x2 = 0.0348. c) Find the mean of each set generated.