本次作业代写主要内容是R语言统计分析相关

Winter Term 2021

2021年冬季学期

广义线性模型MATH 523作业2

A3 R练习

从MASS库加载数据Boston:

该数据集具有波士顿附近郊区506个社区的自有住房中位数(medv)的多个预测因子。为简单起见,只关注最后253​​个观察值,并仅考虑以下输入:犯罪率(按城镇划分的人均犯罪率),氮氧化物(氮氧化物的浓度(每千万人口的份数)),年龄(在此之前建造的自有住房的比例) 1940年)和chas(查尔斯河虚拟变量(如果区域限制河流,则为1;否则为0))。

这是您可以进行子设置的方法:

lm(medv〜crim + nox + chas + crim:nox + crim:chas,data =波士顿[254:506,])

(a)使用带有日志链接的Gamma GLM分析这些数据。描述使用偏差分析的模型构建过程。

(b)在(a)部分中选择的模型与使用其他选择的标准(例如AIC或BIC)选择的模型相比如何(请查看RClass6-HousingData.Rmd以了解如何使用R完成此操作) ?

(c)根据您在(a)和(b)部分中的工作,选择您喜欢的模型。证明您的选择。

(d)解释在(c)部分中选择的模型。

(e)显示(c)部分中所选模型的残差图并评论拟合质量。

(f)拟合线性回归模型,其预测因子与(c)部分中的模型相同。你更倾向哪个?您可以查看AIC,BIC诊断图等-由您决定!

Generalized Linear Models MATH 523 Assignment 2

A3 R Exercise

Load the data Boston from the MASS library:

This data set has several predictors of the median value of owner-occupied homes (medv), for 506 neighbourhoods in the suburbs near Boston. For simplicity, focus on the last 253 observations and consider only the following inputs: crim (per capita crime rate by town), nox (nitrogen oxides concentration (parts per 10 million)), age (proportion of owner-occupied units built prior to 1940), and chas (Charles River dummy variable (= 1 if tract bounds river; 0 otherwise)).

Here is how you can do the subsetting:

     lm(medv ~ crim + nox + chas + crim:nox + crim:chas,data=Boston[254:506,])
  1. (a)  Analyze these data with a Gamma GLM with the log link. Describe a model building process using the analysis of deviance.
  2. (b)  How does the model selected in part (a) compare to a model selected using an- other criterion of your choice, such as AIC or BIC (look at RClass6-HousingData.Rmd to see how this can be done with R)?
  3. (c)  Based on your work in parts (a) and (b), select your favourite model. Justify your choice.
  4. (d)  Interpret the model selected in part (c).
  5. (e)  Display a residual plot for the model selected in part (c) and comment on the quality of the fit.
  6. (f)  Fit a linear regression model with the same predictors as your model in part (c). Which one do you prefer? You can look at AIC, BIC diagnostic plots etc – up to you!