Task 1: Exponential Dispersion Family
Let Y1, Y2,..., Y,, be a sample from the distribution with probability density function
This distribution is known as the inverse Gaussian distribution.
1. (2 pt) Show that the inverse Gaussian distribution belongs to the exponential dispersion family.
2. (2 pt) Find the mean, variance, and variance function of Y.
3. (1 pt) What is the canonical link function of the above distribution?
4. (1 pt) Suppose that you want to use the canonical link from the above question to fit an inverse Gaussian GLM. Name one disadvantage of the canonical link.
5. (2 pt) As we introduced during the lectures, the score function is of the form
de (B) aB
-XT DV-1 (
(y-μ).
Suppose that we would like to use the log link such that
Find out the expression of D and V.
n;= log (u)=x B.
Task 2: GLM in R
In this task, consider the inverse Gaussian distribution in Task 1. Suppose that we have observed a data set HWA1.RData (can be retrieved from Studium).
1. (2 pt) Write your own R function to fit a GLM using all explanatory variables in the data set and an intercept (This model is referred to as Model 1 hereafter). The function must return
Estimates of the regression coefficients,
Null deviance, residual deviance, and their degrees of freedoms.
In the written report, report the code and the outputs by the means of knitr or equivalent. If you write the code separately in R, you can instead tabulate the results in your report and submit the R file to Studium. Any irreproducible code will cause points deduction. Also be explicit in your report how is treated in your function. You are allowed to compare your results with the outputs from the R built-in function
glm (forumula, data, family = inverse.gaussian (link = "log"))
2. (1 pt) Will the point estimates of ẞ and their standard errors be different, if you freely estimate or fixing to any positive value? State also the reason.
3. (1 pt) Leto be estimated by
n-pestimated var (y;)"
where n is the sample size, and p is the number of covariates plus 1. Add to your R function and report its value in your report.
4. (2 pt) Add the standard errors to your R function. Report the standard errors given & that you obtained above.
5. (1 pt) Let = 1 be known. Suppose that you want to build another GLM (Model 2) using only the intercept and the first three regressors. Compare this model with the model obtained above using residual deviance. Which one would you prefer and why? You can use the built-in function in case you cannot finish the previous task. To obtain the residual deviance when = 1, use summary (object, dispersion = 1)
6. (2 pt) Compare Model 1 and Model 2 using leave-one-out cross validation (also called jack- knife). You are welcome to choose a criterion to evaluate the model performance yourself. OBS: There are functions in R performing cross validation. In this task, you need to write your own function to perform cross validation (e.g., you can use sample.int to split the data, use for-loops to loop through each validation set, etc.). But you can use the built-in function to fit the models.
Task 3: Exponential Family
It is not always the case that the distribution belongs to the exponential dispersion family. Even though a distribution belongs to the exponential dispersion family, the built-in function glm may not include such distribution. Some examples are negative binomial distribution, beta distribution, Lindley distribution, unit-Lindley distribution, unit-gamma distribution, etc. But we still want to
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