程序代写案例-MATH 523-Assignment 1

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
Johanna G. Nešlehová
Generalized Linear Models MATH 523
McGill University, Winter Term 2022
Assignment 1 due on January 28 at noon.
Q1 Lecture
2b
Consider the exponential distribution with density
f(y;λ) =
1
λ
e−x/λ, x ≥ 0,
and parameter λ > 0.
(1) Determine whether the exponential family of distributions is an exponential dis-
persion family. If it is not, explain why. If it is, identify the canonical and the
dispersion parameters, and the functions a, b, and c.
(2) Using the methods discussed in Lecture 2b, calculate the mean and variance of
an exponential random variable.
(3) Determine the mean-variance relationship.
(4) Consider the location extension of the exponential distribution, viz.
f(y;λ, µ) =
1
λ
e−(x−µ)/λ, x ≥ µ.
and parameters λ > 0 and µ ∈ R. Is this family an exponential dispersion family?
Why or why not?
Q2 Lecture 3a
Consider the Negative Binomial distribution with parameters µ > 0 and θZ > 0; the
corresponding probability mass function is given by
f(y;µ, θz) =
Γ(y + θz)
Γ(y + 1)Γ(θz)
(
θz
µ+ θz
)θz ( µ
µ+ θz
)y
, y = 0, 1, . . . ,
where Γ(·) denotes the Gamma function. Assume throughout that θZ, the “number of
successes until the experiment is stopped”, is known.
(1) Show that the Negative Binomial family with known θZ is an exponential disper-
sion family. Identify the functions a, b, and c, and the canonical and dispersion
parameters.
(2) Using the formulas derived in class, calculate E(Y ) and var(Y ) of a Negative
Binomial random variable Y .
(3) Find the mean-variance relationship.
(4) Find the canonical link for a Negative Binomial GLM and discuss its pros and
cons.
Johanna G. Nešlehová
Generalized Linear Models MATH 523
McGill University, Winter Term 2022
Assignment 1 due on January 28 at noon.
(5) Can you think of another link function that might be more appropriate than the
canonical link?
Q3 Lecture 4a Consider a Negative Binomial GLM with known θZ , viz. Q2. Suppose
the model contains the intercept and one factor predictor, A, with three levels, viz.
A ∈ {1, 2, 3}. This means that
g(µi) = α + β11(Ai = 2) + β21(Ai = 3).
To simplify notation, suppose that Ai = 1 for i = 1, . . . , n1, Ai = 2 for i = n1 +
1, . . . , n1 + n2 and Ai = 3 for i = n1 + n2 + 1, . . . , n for some n1, n2 ∈ {1, . . . , n} such
that n1 + n2 < n.
(1) Write down the log-likelihood for α, β1, β2 when (i) the canonical link is used and
(ii) when the log link is used.
(2) Write down the likelihood equations for α, β1, β2 when (i) the canonical link is
used and (ii) when the log link is used.
(3) Solve the likelihood equations in part (2) explicitly (it’s indeed possible to do
this in this case) when (i) the canonical link is used and (ii) when the log link is
used.
Q4 Lecture 4b
Consider again the Negative Binomial GLM with known θZ and one factor predictor
with three levels described in Q3.
(1) Calculate the Fisher Information Matrix when (i) the canonical link is used and
(ii) when the log link is used.
(2) Calculate the Hessian when (i) the canonical link is used and (ii) when the log
link is used.
Johanna G. Nešlehová
Generalized Linear Models MATH 523
McGill University, Winter Term 2022
Assignment 1 due on January 28 at noon.
Q5 R Excercise
Load the data crabs2.txt available on myCourses in the Assignments unit under
Content. These data were collected with the goal to explore the effect of various
characteristics of a female horseshoe crab on the number of her satellites, i.e., male
mates attached to her nest. The data contain the following variables:
• satell: number of satellites
• color: color of the female crab, with values 1=light, 2=light medium, 3=medium,
4=dark medium, 5=dark
• spine: condition of the two spines of the female horseshoe crab, with values
1=both good, 2=one worn or broken, 3=both worn or broken
• width: carapace width of the female horseshoe crab in cm
• weight: weight of the female horseshoe crab in g
Analyze these data with linear regression models, using satell as the response, using
the following steps:
(1) Explain which explanatory variables are factors and which are continuous. Cal-
culate the correlation between width and weight and explain why it is advisable
to keep only one of these variables in the model (and keep width henceforth).
(2) Using satell as the explanatory variable and color, spine, and width as inputs,
build the most suitable linear regression model for these data. Don’t forget that
you can include interactions between the inputs.
(3) Redo the analysis in part (2), but treating color and spine as continuous ex-
planatory variables this time. Explain why this makes sense. Do you obtain a
different model than in part (2)?
(4) Using your analyses in parts (2) and (3), single out a linear regression model that
you find the most appropriate for these data. Using various model diagnostics,
comment on the quality of the fit. Interpret your final model and formulate which
drawbacks it has, in your opinion.
Due on January 28 at noon.

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: Fudaojun0228