1. a. The Gamma distribution with mean and variance 2/ has density function
(i) Show that this may be written in the form of an exponential family i.e generalized linear model (GLM).
(ii) Use the properties of exponential families to confirm that the mean and variance of the distribution are and 2/.
b. For each of the three distributions (Normal, Binomial and Poisson), given that the data follow a Y~.
(i) Show that Y belongs to the exponential family of distributions, specifying each component of the generalized linear model.
(ii) State the canonical link function on each of those cases.
(iii) For each of these distributions, verify the mean and variances
Note: For this question feel free to use the general formulae given in Appendix A.
2. The total amounts claimed each year from a portfolio of insurance policies over n years were x1, x2 ,.., xn. The insurer believes that annual claims have a normal distribution with mean 𝜇 and variance 𝜎2 where 𝜇 is unknown. The prior distribution of 𝜇 is assumed to be normal with mean 𝜇0 and variance 𝜎20
(a) Derive the posterior distribution of 𝜇
(b) Using the answer in (a), write down the Bayesian point estimate of 𝜇 under quadratic loss.
(c) Show that the answer in (b) can be expressed in the form of a credibility estimate and derive the credibility factor.
The claims experience over five years for two companies was as follows:
Year 1 2 3 4 5
Company A Amount 421 417 438 456 463
Company B Amount 343 335 356 366 380
(d) Determine the Bayes credibility estimate of the premiums the insurer should charge for each company based on the modelling assumptions of part (a), a profit loading of 25% and the following parameters:
Company A Company B
𝜇0 400 300
𝜎2 500 350
𝜎20 800 600
(e) Calculate the two posterior means and the two posterior variances using any Bayesian software of your choice using the data shown on (d) above.
3. The number, X, of claims on a given medical aid policy over one year has probability distribution given by
P( X = k ) = k (1 ) k = 0, 1, 2,… where is an unknown parameter with 0 1.
Independent observations x1,…, xn are available for the number of claims in the previous n years. Prior beliefs about are described by a distribution with density
for some constant 0 .
(a) Derive the posterior distribution of given the data x1,…, xn .
(b) Derive the Bayesian estimate of under quadratic loss and show that it takes the form of a credibility estimate where is a quantity you should specify from the prior distribution of .
(c) Explain what happens to Z as the number of years of observed data increases.
(d) Determine the variance of the prior distribution of .
(e) Explain the implication for the quality of prior information of increasing the value of . Give an interpretation of the prior distribution in the special
case = 1
(f) Calculate the Bayesian estimate of under quadratic loss if n = 3,
x1 = 3, x2 = 3, x3 =5 and
(i) = 5
(ii) = 2
(g) Calculate the above question using any Bayesian modelling software of your choice
4. a. The truncated exponential distribution on the interval (0, c) is defined by the
b. Let X1, X2, . . . , Xn be a random form a probability distribution
f(x) = 3x2; 0 ≤ x ≤ 1
Use the Monte Carlo Integration approximation to estimate P (0.25 < x ≤ 0.75). Give your answer to an error margin of 0.001.
5. For a simple linear regression, yi = β0 + β1xi + ei, where our interest is to estimate βˆ0, βˆ1, and Var(yi) = φˆ using Bayesian methods through a Gibbs sampler simulation algorithm, let:
where the distributions for β0, β1, and φ are prior distributions with all hyperparameters m0, m1, τ0, τ1, α, β known and the τ s are precision parameters.
a. Write the likelihood for y
b. Write the full posterior for this model ie P(β0, β1, φ |y, m0, m1, τ0, τ1, α, β) to some proportionality constant.
c. Derive the conditionals for β0, β1, φ and write a brief Gibbs sampling algorithm that you can implement to draw samples for estimation and inference for each of these parameters.
d. Use a small data with 5 y values and 5 x values to demonstrate this on estimating the parameters β0 and β1 using any Bayesian software of your choice.
6. The case fatality rate for COVID-19 cases is a very useful indicator of how the disease contributes to the deaths experienced in a given period of time at a given place.
Use this link below to import World wide based data from the web on the last day in December 2020 (data are also provided as bayes2021_world_covid.dta import delimited "https://raw.githubusercontent.com/CSSEGISandData/COVID- 19/master/csse_covid_19_data/csse_covid_19_daily_reports/12-31-2020.csv", clear
The overall aim is to model the case fatality rate for African countries only based data using all three Poisson distributions as detailed on the tutorial “Bayesian using Stata Day 1”. So you will need to perform some data management prior to undertaking your analyses.
a) Clean out all the data that are not part of these 54 countries in Africa based on the this link https://www.worldometers.info/geography/how-many-countries-in- africa/.
b) Also include the data from the 54 countries on the given link to the so that you end up with the data for the Population in 2020 and the sub-region merged to the cleaned data on a) above. Make sure that you names the merging variables in exactly the same way to avoid missing any of the nations.
c) Write down the posterior distribution which arises from a Poisson regression model with 1 covariate. Derive the full conditional distributions of the parameters.
d) Use the given data on the COVID-19 cases to determine whether there are differences between sub-regions on the case fatality rates of the cases.
(i) The maximum likelihood estimation (MLE) approach was initially used and the Stata commands are shown on Appendix B, shown below. Comment on what you notice from the subregions data summaries and IRR results from the Poison regression.
(ii) Can you compare the three Poisson types (Poisson, Zero truncated Poisson and Generalized Poisson) of models discussed on the above mentioned tutorial, and choose your best fitting model using STATA for a no covariates model as was done on the tutorial. Clearly state how you arrived at choosing the best model
(iii) Compare at your Poisson model (only) done in STATA with what you get from OpenBugs/WinBugs.
(iv) Now include the covariate subregion to answer the question asked. Use only one Bayesian based software. Credit will be given for good modelling practice such as use of chains, burning, thinning, inspections of parameter convergence and good use of nuisance parameters
(v) Interpret your final selected model from the Bayesian modelling.
NB: Submit all the documentation used to arrive at the final selected model electronically attach your main answer document separate alone under Part A on Ulwazi and the rest as support documents under Part B.
Type your equations using RMarkdown or Stata Markdown on the same document as your responses to your other answers.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme