Starting from:

$25

MTH201 - Tutorial Script Questions - Solved

Q1) Generate 100 samples that are uniformly distributed over (0,1). Plot a histogram of the samples. Also, plot an empirical CDF.

Q2) Generate 100 samples that are uniformly distributed over (75, 110). Plot a histogram of the samples. Also, plot an empirical CDF.

Q3) Write a function that uses the uniform distribution (0,1) to generate m samples from a Bernoulli RV with parameter p as input.

Q4) Write a function (starting from uniform rand (0,1) or preferably the Q3 implementation of the Bern RV) that generates m samples from a geometric RV with parameter p as input.

Q5) Write a function that generates m samples from a binomial RV with parameters (n,p) as inputs. Starting from uniform rand (0,1) or preferably the Q3 implementation of the Bern RV.

Q6) Write a function that generates m samples from a Poisson RV with parameter \alpha as input.

Q7) Write a function that generates m samples from a Gaussian RV with mean and std deviation as input.

Q8) Write a function that generates m samples from an exponential RV with the rate parameter as input.

Q9) Generate m=1, 2,..., 1000 samples from the Bernoulli RV (use the function created for the question above) and plot the sample mean for each m. Alongside also plot the parameter p of the Bernoulli RV. Do you see the sample mean converge to the expected value of the Bernoulli RV? For what smallest value of m has the sample mean more or less converged to the parameter of the Bernoulli RV?

More products