### 统计代写|广义线性模型代写generalized linear model代考|STA441H5

statistics-lab™ 为您的留学生涯保驾护航 在代写广义线性模型generalized linear model方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写广义线性模型generalized linear model代写方面经验极为丰富，各种代写广义线性模型generalized linear model相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|广义线性模型代写generalized linear model代考|Estimation Problems

Estimation of the logistic regression model using the Fisher scoring algorithm, described in Section 8.2, is usually fast. However, difficulties can sometimes arise. When convergence fails, it is sometimes due to a problem exhibited by the following dataset. We take a subset of the famous Fisher Iris data to consider only two of the three species of Iris and use only two of the potential predictors:
ibrary (dplyr)
irisr <- filter(iris, Species ! “virginica”) to ? select (Sepal. Width,
$\rightarrow$ Sepal. Length, Species)
We plot the data using a different shape of plotting symbol for the two species:
(p <- ggplot(irisr, aes (x=Sepa1. Width, y=Sepal. Length, shape=Species))
$\hookrightarrow$ tgeom point ())
We now fit a logistic regression model to see if the species can be predicted from the two sepal dimensions.

$n-100 p-3$ Deviance $-0.000$ Null Deviance $-138.629$ (Difference $-138.629$ ) Notice that the residual deviance is zero indicating a perfect fit and yet none of the predictors are significant due to the high standard errors. A look at the data reveals the reason for this. We see that the two groups are linearly separable so that a perfect fit is possible. We suffer from an embarrassment of riches in this example – we can fit the data perfectly. Unfortunately, this results in unstable estimates of the parameters and their standard errors and would (probably falsely) suggest that perfect predictions can be made. An alternative fitting approach might be considered in such cases called exact logistic regression. See Cox (1970) or Mehta and Patel (1995). Implementations can be found in the elrm and logistix packages in R.

## 统计代写|广义线性模型代写generalized linear model代考|Binomial Regression Model

Suppose the response variable $Y_{i}$ for $i=1, \ldots, n$ is binomially distributed $B\left(m_{i}, p_{i}\right)$ so that:
$$P\left(Y_{i}=y_{i}\right)=\left(\begin{array}{c} m_{i} \ y_{i} \end{array}\right) p_{i}^{y_{i}}\left(1-p_{i}\right)^{m_{i}-y_{i}}$$
We further assume that the $Y_{i}$ are independent. The individual outcomes or trials that compose the response $Y_{i}$ are all subject to the same $q$ predictors $\left(x_{i 1}, \ldots, x_{i q}\right)$. The group of trials is known as a covariate class. For example, we might record whether customers of a particular type make a purchase or not. Conventionally, one outcome is labeled a success (say, making purchase in this example) and the other outcome is labeled as a failure. No emotional meaning should be attached to success and failure in this context. For example, success might be the label given to a patient death with survival being called a failure. Because we need to have multiple trials for each covariate class, data for binomial regression models is more likely to result from designed experiments with a few predictors at chosen values rather than observational data which is likely to be more sparse.
As in the binary case, we construct a linear predictor:
$$\eta_{i}=\beta_{0}+\beta_{1} x_{i 1}+\cdots+\beta_{q} x_{i q}$$
We can use a logistic link function $\eta_{i}=\log \left(p_{i} /\left(1-p_{i}\right)\right)$. The log-likelihood is then given by:
$$l(\beta)=\sum_{i=1}^{n}\left[y_{i} \eta_{i}-m_{i} \log \left(1+e_{i}^{\eta}\right)+\log \left(\begin{array}{c} m_{i} \ y_{i} \end{array}\right)\right]$$
Let’s work through an example to see how the analysis differs from the binary response case.

In January 1986, the space shuttle Challenger exploded shortly after launch. An investigation was launched into the cause of the crash and attention focused on the rubber O-ring seals in the rocket boosters. At lower temperatures, rubber becomes more brittle and is a less effective sealant. At the time of the launch, the temperature was $31^{\circ} \mathrm{F}$. Could the failure of the O-rings have been predicted? In the 23 previous shuttle missions for which data exists, some evidence of damage due to blow by and erosion was recorded on some O-rings. Each shuttle had two boosters, each with three O-rings. For each mission, we know the number of $\mathrm{O}$-rings out of six showing some damage and the launch temperature. This is a simplification of the problem see Dalal et al. (1989) for more details.

## 统计代写|广义线性模型代写generalized linear model代考|Inference

We use the same likelihood-based methods as in Section $2.3$ to derive the binomial deviance:
$$D=2 \sum_{i=1}^{n}\left{y_{i} \log y_{i} / \hat{y}{i}+\left(m{i}-y_{i}\right) \log \left(m_{i}-y_{i}\right) /\left(m_{i}-\hat{y}{i}\right)\right}$$ where $\hat{y}{i}$ are the fitted values from the model.
Provided that $Y$ is truly binomial and that the $m_{i}$ are relatively large, the deviance is approximately $\chi^{2}$ distributed with $n-q-1$ degrees of freedom if the model is correct. Thus we can use the deviance to test whether the model is an adequate fit. For the logit model of the Challenger data, we may compute:
pchisq (deviance (1mod), df . residual (1mod), lower FALSE)
[1] $0.71641$
Since this $p$-value is well in excess of $0.05$, we conclude that this model fits sufficiently well. Of course, this does not mean that this model is correct or that a simpler model might not also fit adequately. Even so, for the null model:
pchisq $(38.9,22$, lower FALSE)
[1] $0.014489$
We see that the fit is inadequate, so we cannot ascribe the response to simple variation not dependent on any predictor. Note that a $\chi_{d}^{2}$ variable has mean $d$ and standard deviation $\sqrt{2 d}$ so that it is often possible to quickly judge whether a deviance is large or small without explicitly computing the $p$-value. If the deviance is far in excess of the degrees of freedom, the null hypothesis can be rejected.

The $\chi^{2}$ distribution is only an approximation that becomes more accurate as the $m_{i}$ increase. The approximation is very poor for small $m_{i}$ and fails entirely in binary cases where $m_{i}=1$. Although it is not possible to say exactly how large $m_{i}$ should be for an adequate approximation, $m_{i} \geq 5 \forall i$ has often been suggested. Permutation or bootstrap methods might be considered as an alternative.

We can also use the deviance to compare two models, with smaller model $S$ representing a subspace (usually a subset) of a larger model $L$. The likelihood ratio test statistic becomes $D_{S}-D_{L}$. This test statistic is asymptotically distributed $\chi_{l-s}^{2}$, assuming that the smaller model is correct and the distributional assumptions hold. We can use this to test the significance of temperature by computing the difference in the deviances between the model with and without temperature. The model without temperature is just the null model and the difference in degrees of freedom or parameters is one:
pchisq (38.9-16.9,1, lower=FALSE)
[1] $2.7265 \mathrm{e}-06$

## 统计代写|广义线性模型代写generalized linear model代考|Estimation Problems

ibrary (dplyr)
irisr <- filter(iris, Species ! “virginica”) to ? 选择（萼片。宽度，
→萼片。长度，物种）

（p <- ggplot(irisr, aes (x=Sepa1. Width, y=Sepal.Length, shape=Species)）
tgeom point ())

n−100p−3偏差−0.000零偏差−138.629（区别−138.629) 请注意，残差为零表示完美拟合，但由于高标准误差，所有预测变量均不显着。看一下数据就可以发现其中的原因。我们看到这两组是线性可分的，因此可以完美拟合。在这个例子中，我们遭受了财富的尴尬——我们可以完美地拟合数据。不幸的是，这会导致参数及其标准误差的估计不稳定，并且会（可能错误地）表明可以做出完美的预测。在这种情况下，可以考虑另一种拟合方法，称为精确逻辑回归。参见 Cox (1970) 或 Mehta 和 Patel (1995)。可以在 R 的 elrm 和 logistix 包中找到实现。

## 统计代写|广义线性模型代写generalized linear model代考|Binomial Regression Model

l(b)=∑一世=1n[是一世这一世−米一世日志⁡(1+和一世这)+日志⁡(米一世 是一世)]

1986 年 1 月，挑战者号航天飞机在发射后不久爆炸。对坠机原因进行了调查，并将注意力集中在火箭助推器中的橡胶 O 形密封圈上。在较低温度下，橡胶变得更脆，并且是一种不太有效的密封剂。发射时气温为31∘F. O 形圈的故障是否可以预测？在有数据的之前的 23 次航天飞机任务中，一些 O 形环上记录了一些因吹漏和腐蚀而损坏的证据。每个航天飞机有两个助推器，每个助推器有三个 O 形环。对于每个任务，我们知道○- 六环显示一些损坏和发射温度。这是对问题的简化，请参见 Dalal 等人。(1989) 了解更多详情。

## 统计代写|广义线性模型代写generalized linear model代考|Inference

D=2 \sum_{i=1}^{n}\left{y_{i} \log y_{i} / \hat{y}{i}+\left(m{i}-y_{i}\右) \log \left(m_{i}-y_{i}\right) /\left(m_{i}-\hat{y}{i}\right)\right}D=2 \sum_{i=1}^{n}\left{y_{i} \log y_{i} / \hat{y}{i}+\left(m{i}-y_{i}\右) \log \left(m_{i}-y_{i}\right) /\left(m_{i}-\hat{y}{i}\right)\right}在哪里是^一世是模型的拟合值。

pchisq (deviance (1mod), df .residual (1mod), lower FALSE)
[1]0.71641

pchisq(38.9,22, 下 FALSE)
[1]0.014489

pchisq (38.9-16.9,1, lower=FALSE)
[1]2.7265和−06

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。