Assignment 3
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Use R for all calculations. Provide copies of your code in the assignment.
Q. 1) Consider the model
yi = θ 1 − θ2e−θ3xi + εi, 1 ≤ i ≤ n.
This is called the Mitcherlich equation, and it is often used in chemical engineering. For example, yi may be yield and xi may be reaction time.
(a) Is this a nonlinear regression model?
(b) Graph the expectation function for the parameter values θ 1 = 0.5,θ2 =
−0. 1 and θ3 = 0. 1. Discuss the shape of the function.
(c) Graph the expectation function for the parameter values θ 1 = 0.5,θ2 = 0. 1 and θ3 = 0. 1. Discuss the shape of the function. Compare the shape with the shape in part (b).
(d) The file
chlorine.table
contains the fraction of active chlorine in a chemical product as a function of time after manufacturing. Plot the data and fit the Mitcherlich law to the data, including the fitted curve on the original plot.
(e) Provide approximate confidence intervals for the parameters.
Q. 2) Consider the one-sample problem: Yi ∼ N(µ,σ2), 1 ≤ i ≤ n with the Yi’s i.i.d. The MLE is of course
.
If we constrain |µ|2 ≤ C and transform the problem to a penalized minimization problem we had to solve
n
µbλ = argminX(Yi − µ)2 + λµ2.
µ i=1
(a) Find a design matrix X such that
µ = (XtX)−1Xt Y.
b
(b) Show that
(c) Find a design matrix X(λ) and a data vector Y (λ) such that
µbλ = (X(λ)tX(λ))−1X(λ)t Y (λ).
(Hint: Y (λ) will generally have to be of length n + 1 or greater – i.e. you need to add an observation to the original Y , as well as an entry to the original X.)
(d) Generalize this to the constrained regression problem for a vector of non-negative constraints λ = (λ0,...,λp−1).
(e) Write a function in R that takes two arguments, one the output of lm, the other a vector λ of length p as above and returnsHint:
the function model.matrix will likely be useful).
Q. 3) Consider the viral load data from Assignment # 2 found at
vl.table
(a) As it seems that the variance of viral load depends on their GSS, use
weighted least squares (WLS) with appropriately chosen weights to refit the model. Has this improved the diagnostic plots for this model? (Hint: you will have to use the Pearson residuals
√
ri = (Yi −Ybi)∗ wi for the diagnostic plots. The diagnostic plots can also help you choose appropriate weights.
(b) Does this significantly affect the results compared to ordinary least
squares (OLS), in terms of confidence intervals, or p-values? Report both the “weighted” and “unweighted” confidence intervals. Which do you feel are more accurate?
Q. 4) A marketing research firm was engaged by an automibile manufacturer to conduct a pilot study to examine the feasibility of using logistic regression for ascertaining the likelihood that a family will purchase a new car during the next year. A random sample of 33 suburban families was selected. Data an annual family income and the current age of the oldest family automobile were obtained. A follow-up interview conducted 12 months later was used to determine whether the familt actually purchased a new car or did not purchase a new car. The data can be found at
car.table
(a) Using a logistic regression model, find the MLEs of the parameters
β0,βincome,βage .
(b) State the response function.
(c) Find exp(βbincome) and exp() and interpret them.
(d) What is the estimated probability that a family with annual income of 50,000$ and an oldest car of 3 years will purchase a new car next year?
(e) Plot the standard diagnostic plots – are there any outliers, anything
unusual?
(f) Use a partial deviance test to test whether the age of oldest family
automobile can be dropped from the regression model; use α = 0. 15. What is the approximate p-value?
(g) Test whether the two-factor interaction effect between annual family
income and age of oldest automobile should be added tothe regression model containing family income and age of oldest automobile as first - orer terms; use α = 0.05. What is the approximate p-value?
(h) Repest the previous test using Pearson’s X2 instead of partial deviance.
2022-06-01