Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit



MATH70071 Applied Statistics – Assessed Coursework 3


Submit no more than 8 pages. Keep any R code concise and present it inline as part ofthe report. Considerable emphasis will be put on clarity of expression and a clean presentation. Only detailed, well-written answers will score highly.


Question 1

Recall from Assessed Coursework 2 we ftted a generalized linear model to count data from the R fleglmxy.Rposted on Blackboard, which contained a data frame called dfrm with 500 observed counts (dfrm$y) and a single associated predictor (dfrm$x) associated with each observed count. The data were later revealed to have been generated from

a negative-binomial regression model with r = 2, using a logarithmic link function and intercept and slope parameters (−0.5, −2.5).

a) Fit a Poisson regression GLM to these data using the canonical link function (denoted g), assuming the presence of an intercept term. Report the ftted regression coefcients β'.

b) Using the ft from part a), plot the response values yi against the inverse link function of the estimated linear predictors, g−1 ( i). Draw the ftted regression line on this plot, and comment on the apparent goodness of ft.

c) Add another (dashed) line showing the true regression function on these axes. (You can just include one plot in your submission.) Compare and comment on the diference between the two regression lines.

d) Under the ftted Poisson regression model from part a), calculate an approximate 99% confdence interval for the mean response value for the covariate value x = 0.5.

e)  Plot the deviance residuals di against the predictor values xi. What proportion of these residuals are negative?

f) Suppose now that we are interested in modelling the conditional distribution ofx given y. Fit a linear model for x with the variable y treated as a factor variable. Explain the magnitude of the p-values observed in the summary, and com- ment on the regression coefcient estimates corresponding to each level ofy. Fit the same model a second time treating the factors as random efects. Compare the estimated coefcients obtained under these two approaches. Considering the difering the assumptions of the two approaches, which estimated coefcients are you more inclined to trust?

25 Marks


Question 2

The R fle xyz.R posted on Blackboard contains a data frame called xyz with 480 observations of a continuous

valued response variable y, with an associated integer-valued predictor (x) and a category label A–H (z) indicating

membership of the observation to one of eight groups. Load the data using the command source("xyz.R").

a) Make scatter plot of the response variable y against the predictor variable x, using a diferent mark/symbol for each category A–H. Fit a normal linear model for y against the single predictor x with the inclusion of a global intercept term, and add the ftted regression line to the plot. From this plot, comment on two aspects of the data which make this simple linear model appear to be inappropriate.

b) Make box plots of the response variable y for each z category, commenting on the between category comparison. Calculate the sample mean response value for each group.

c) Assume a normal linear mixed model for y assuming a fxed efect for x together with an intercept, and random efect intercept terms corresponding to membership of the z categories A–H. Report restricted maximum likelihood estimated values for the error variance and the variance of the random efects.

d) Now remove observations from categories A, C, D, E and G from the data. Calculate the value of the maximised unrestricted log-likelihood function from the normal linear mixed model on this reduced data set.

e)  On the same reduced data set, ft a simple linear model for y by excluding the random efects. Report the maximised log-likelihood, and the deviance between the two models (with and without inclusion of the random efects).

f) Perform a parametric permutation test to investigate the signifcance of the category labels in the mixed linear model, reporting an estimated p-value after 1000 simulations. Interpret the p-value, and explain this result.

20 Marks