## 统计代写|回归分析作业代写Regression Analysis代考|Evaluating the Linearity Assumption Using Hypothesis Testing Methods

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

## 统计代写|回归分析作业代写Regression Analysis代考|Evaluating the Linearity Assumption Using Hypothesis Testing Methods

Here, we will get slightly ahead of the flow of the book, because multiple regression is covered in the next chapter. A simple, powerful way to test for curvature is to use a multiple regression model that includes a quadratic term. The quadratic regression model is given by:
$$Y=\beta_0+\beta_1 X+\beta_2 X^2+\varepsilon$$
This model assumes that, if there is curvature, then it takes a quadratic form. Logic for making this assumption is given by “Taylor’s Theorem,” which states that many types of curved functions are well approximated by quadratic functions.

Testing methods require restricted (null) and unrestricted (alternative) models. Here, the null model enforces the restriction that $\beta_2=0$; thus the null model states that the mean response is a linear (not curved) function of $x$. So-called “insignificance” (determined historically by $p>0.05$ ) of the estimate of $\beta_2$ means that the evidence of curvature in the observed data, as indicated by a non-zero estimate of $\beta_2$ or by a curved LOESS fit, is explainable by chance alone under the linear model. “Significance” (determined historically by $p<0.05$ ) means that such evidence of curvature is not easily explained by chance alone under the linear model.

But you should not take the result of this $p$-value based test as a “recipe” for model construction. If “significant,” you should not automatically assume a curved model. Instead, you should ask, “Is the curvature dramatic enough to warrant the additional modeling complexity?” and “Do the predictions differ much, whether you use a model for curvature or the ordinary linear model?” If the answers to those questions are “No,” then you should use the linear model anyway, even if it was “rejected” by the $p$-value based test.

In addition, models employing curvature (particularly quadratics) are notoriously poor at the extremes of the $x$-range(s). So again, you can easily prefer the linear model, even if the curvature is “significant” $(p<0.05)$.

## 统计代写|回归分析作业代写Regression Analysis代考|Testing for Curvature with the Production Cost Data

The following R code illustrates the method.
ProdC $=$ read.table(“https://raw.githubusercontent.com/andrea2719/
URA-DataSets/master/ProdC.txt”)
attach(ProdC)
plot (Widgets, Cost); abline(lsfit(Widgets, Cost))
Widgets.squared = Widgets^2
Prodc $=$ read.table $($ “https $: / /$ raw.githubusercontent.com/andrea2719/
URA-Datasets/master/ProdC.txt”)
attach (ProdC)
plot (Widgets, Cost); abline(lsfit(Widgets, Cost))
Widgets.squared $=$ Widgets $^{\wedge} 2$

fit.quad $=1 \mathrm{~m}$ (Cost $~$ Widgets + Widgets.squared); summary (fit.quad)
lines(spline(Widgets, predict(fit.quad)), col = “gray”, lty=2)
Figure 4.3 shows both the linear and quadratic (curved) fit to the data. Since the linear and quadratic fits are so similar, it (again) appears that there is no need to model the curvature explicitly in this example.
Relevant lines from the summary of fit are shown as follows:
Coefficients :
(Intercept)
widgets
Widgets.squared
$\begin{array}{cccc}\text { Estimate } & \text { Std. Error } & t \text { value } & \operatorname{Pr}(>|t|) \ 4.564 e+02 & 7.493 e+02 & 0.609 & 0.546 \ 9.149 e-01 & 1.290 e+00 & 0.709 & 0.483 \ 2.923 e-04 & 5.322 e-04 & 0.549 & 0.586\end{array}$
Residual standard error: 241.3 on 37 degrees of freedom
Multiple R-squared: 0.7987 , Adjusted R-squared: 0.7878
F-statistic: 73.42 on 2 and $37 \mathrm{DF}$, p-value: $1.318 \mathrm{e}-13$
Notice the $p$-value for testing the $\beta_2=0$ restriction: Since the $p$-value is 0.586 , the difference between the coefficient 0.0002923 (2.923e-04) and 0.0 is explainable by chance alone. That is, even if the process were truly linear (i.e., even if $\beta_2=0$ ), you would often see quadratic coefficient estimates $\left(\hat{\beta}_2\right)$ as large as 0.0002923 when you fit a quadratic model to similar data. If this is confusing to you, just run a simulation from a similar linear process (where $\beta_2=0$ ), and fit a quadratic model. You will see a non-zero $\hat{\beta}_2$ in every simulated data set, and most will be within 2 standard errors of 0.0 (the $\hat{\beta}_2$ above is $T=0.549$ standard errors from 0.0 ).

# 回归分析代写

## 统计代写|回归分析作业代写Regression Analysis代考|Evaluating the Linearity Assumption Using Hypothesis Testing Methods

$$Y=\beta_0+\beta_1 X+\beta_2 X^2+\varepsilon$$

## 统计代写|回归分析作业代写Regression Analysis代考|Testing for Curvature with the Production Cost Data

ProdC $=$ read.table(“https://raw.githubusercontent.com/andrea2719/
“ura – dataset /master/ product .txt”)

plot (Widgets, Cost);abline(lsfit(Widgets, Cost))

“ura – dataset /master/ product .txt”)

plot (Widgets, Cost);abline(lsfit(Widgets, Cost))

(截语)

widgets。squared
$\begin{array}{cccc}\text { Estimate } & \text { Std. Error } & t \text { value } & \operatorname{Pr}(>|t|) \ 4.564 e+02 & 7.493 e+02 & 0.609 & 0.546 \ 9.149 e-01 & 1.290 e+00 & 0.709 & 0.483 \ 2.923 e-04 & 5.322 e-04 & 0.549 & 0.586\end{array}$
37个自由度的残差标准误差:241.3

f统计量:73.42对2和$37 \mathrm{DF}$, p值:$1.318 \mathrm{e}-13$

## 广义线性模型代考

statistics-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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|回归分析作业代写Regression Analysis代考|Simulation Study to Understand the Null Distribution of the $T$ Statistic

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

## 统计代写|回归分析作业代写Regression Analysis代考|Simulation Study to Understand the Null Distribution of the $T$ Statistic

The following $\mathrm{R}$ code generates the data under the null model. It is the same model used in the SSN/Height example above, but re-written in a way to make the constraint $\beta_1=0$ explicit. Because we did not use set.seed as in the previous code, the output is random. Your results will differ, but that is good because the point here is to understand randomness.

$\mathrm{n}=100$
beta $0=70 ;$ betal $=0 \quad #$ The null model; true betal = 0
ssn = sample $(0: 9,100$, replace=T)
height = beta + betal*ssn + rnorm $(100,0,4)$
ssn.data = data.frame (ssn, height)
fit. $1=$ lm (height ssn, data=ssn.data)
summary (fit. 1$)$
$\mathrm{n}=100$
beta $0=70 ;$ betal $=0 \quad #$ The null model; true betal $=0$
ssn $=$ sample $(0: 9,100$, replace $=T)$
height $=$ beta $0+\operatorname{beta} 1 * \operatorname{ssn}+\operatorname{rnorm}(100,0,4)$
ssn. data = data. frame (ssn, height)
fit. 1 = $\operatorname{lm}($ height ssn, datasssn. data)
summary (fit.l)
This code gives the following output (yours will vary by randomness):
Cal :
$\operatorname{lm}$ (formula $=$ height $\sim$ ssn, data $=$ ssn. data)
Residuals:
Min $1 Q$ Median $3 Q$ Max
$-9.4952-2.8261-0.3936 \quad 2.252111 .6764$
Coefficients :
Estimate std. Error $t$ value $\operatorname{Pr}(>|t|)$
(Intercept) $69.77372 \quad 0.71865 \quad 97.089<2 \mathrm{e}-16 \star \star$ $\operatorname{ssn} 0.019150 .14336 \quad 0.134 \quad 0.894$ Signif. Codes: 0 ‘‘ 0.001 ‘‘ 0.01 ‘*’ 0.05 ‘. 0.1 ‘ 1
Residual standard error: 4.155 on 98 degrees of freedom
Multiple R-squared: 0.000182 , Adjusted R-squared: 0.01002
F-statistic: 0.01784 on 1 and $98 \mathrm{DF}$, p-value: 0.894
In our simulation, the estimate $\hat{\beta}_1=0.01915$ is $T=0.134$ standard errors from zero, and you know that this difference is explained by chance alone because the data are simulated from the null model where $\beta_1=0$.

## 统计代写|回归分析作业代写Regression Analysis代考|The $p$-Value

In the example above, the thresholds to determine which real $T$ values are explainable by chance alone are the numbers that put $95 \%$ of the $T$ values that are explained by chance alone between them; these are -1.9845 and +1.9845 in the case of the $T_{98}$ distribution. If the observed $T$ statistic falls outside that range, then we can say that the difference between $\hat{\beta}_1$ and 0 is not easily explained by chance alone.

See Figure 3.7 again. Notice that there is $5 \%$ total probability outside the \pm 1.9845 range, simply because there is $95 \%$ probability inside the range. Now, if the $T$ statistic falls inside the $95 \%$ range, then there has to be more than $5 \%$ total probability outside the $\pm T$ range. See Figure 3.7 again, and suppose $T=1.7$, which is inside the range. Then there has to be more than $5 \%$ probability outside the \pm 1.7 range, right? See Figure 3.7 again, and locate \pm 1.7 on the graph. Make sure you understand this; it is not hard at all. Do not just read the words, because then you will not understand. Instead, look at Figure 3.7, put your finger on the graph at 1.7 , and think about the area outside the \pm 1.7 range. It is more than 0.05 , do you see?

Now, suppose $T=2.5$, and look at Figure 3.7 again. Then there has to be less than $5 \%$ probability outside the \pm 2.5 range, right? See Figure 3.7 again, and locate \pm 2.5 on the graph. Make sure you understand this; it is not hard at all. Look at the graph! Do not just read the words! Instead, put your finger on the graph at 2.5 and think about the area outside the \pm 2.5 range. It is less than 0.05 , do you see?

# 回归分析代写

## 统计代写|回归分析作业代写Regression Analysis代考|Simulation Study to Understand the Null Distribution of the $T$ Statistic

$\mathrm{n}=100$
beta $0=70 ;$ betal $=0 \quad #$ null模型;True betal = 0
ssn = sample $(0: 9,100$, replace=T)

ssn. ssn.Data = Data .frame (ssn, height)

$\mathrm{n}=100$
beta $0=70 ;$ betal $=0 \quad #$ null模型;真betal $=0$
SSN $=$样例$(0: 9,100$，替换$=T)$

ssn. ssn.数据=数据。框架(ssn, height)

$\operatorname{lm}$(公式$=$高度$\sim$ ssn，数据$=$ ssn。数据)

$-9.4952-2.8261-0.3936 \quad 2.252111 .6764$

## 广义线性模型代考

statistics-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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Rao-Blackwell methods for estimation and prediction

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

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Rao-Blackwell methods for estimation and prediction

Consider a Bayesian model with two parameters given by a specification of $f(y \mid \theta, \psi)$ and $f(\theta, \psi)$, and suppose that we obtain a sample from the joint posterior distribution of the two parameters, say
$$\left(\theta_1, \psi_1\right), \ldots,\left(\theta_J, \psi_J\right) \sim \text { iid } f(\theta, \psi \mid y) \text {. }$$
As we have seen, an unbiased Monte Carlo estimate of $\theta$ ‘s posterior mean, $\hat{\theta}=E(\theta \mid y)$, is $\bar{\theta}=(1 / J) \sum_{j=1}^J \theta_j$, with an associated MC $1-\alpha$ CI for $\hat{\theta}$ given by $\left(\bar{\theta} \pm z_{\alpha / 2} s_\theta / \sqrt{J}\right)$, where $s_\theta$ is the sample standard deviation of $\theta_1, \ldots, \theta_J$.

Now observe that
$$\hat{\theta}=E{E(\theta \mid y, \psi) \mid y}=\int E(\theta \mid y, \psi) f(\psi \mid y) d \psi$$
This implies that another unbiased Monte Carlo estimate of $\hat{\theta}$ is
$$\bar{e}=\frac{1}{J} \sum_{j=1}^J e_j$$
where
$$e_j=E\left(\theta \mid y, \psi_j\right)$$
and another $1-\alpha \mathrm{CI}$ for $\hat{\theta}$ is
$$\left(\bar{e} \pm z_{\alpha / 2} s_e / \sqrt{J}\right) \text {, }$$
where $s_e$ is the sample standard deviation of $e_1, \ldots, e_J$.
If possible, this second method of Monte Carlo inference is preferable to the first because it typically leads to a shorter CI. We call this second method Rao-Blackwell (RB) estimation. The first (original) method may be called direct Monte Carlo estimation or histogram estimation.

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|MC estimation of posterior predictive p-values

Recall the theory of posterior predictive $\mathrm{p}$-values whereby, in the context of a Bayesian model specified by $f(y \mid \theta)$ and $f(\theta)$, we test $H_0$ versus $H_1$ by choosing a suitable test statistic $T(y, \theta)$.
The posterior predictive $\mathrm{p}$-value is then
$$p=P(T(x, \theta) \geq T(y, \theta) \mid y)$$
(or something similar, e.g. with $\geq$ replaced by $\leq$ ), calculated under the implicit assumption that $H_0$ is true.

If the calculation of $p$ is problematic, a suitable Monte Carlo strategy is as follows:

1. Generate a random sample from the posterior,
$$\theta_1, \ldots, \theta_J \sim \text { iid } f(\theta \mid y)$$
2. Generate $x_j \sim \perp f\left(y \mid \theta_j\right), j=1, \ldots, J$ (so that $x_1, \ldots, x_J \sim$ iid $f(x \mid y)$ ).
3. For each $j=1, \ldots, J$ calculate $T_j=T\left(x_j, \theta_j\right)$ and $I_j=I\left(T_j \geq T\right)$, where $T=T(y, \theta)$.
4. Estimate $p$ by $\hat{p}=\frac{1}{J} \sum_{j=1}^J I_j$ with associated $1-\alpha \mathrm{CI}$
$$\left(\hat{p} \pm z_{\alpha / 2} \sqrt{\frac{\hat{p}(1-\hat{p})}{J}}\right) .$$

# 贝叶斯分析代考

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Rao-Blackwell methods for estimation and prediction

$$\left(\theta_1, \psi_1\right), \ldots,\left(\theta_J, \psi_J\right) \sim \text { iid } f(\theta, \psi \mid y) \text {. }$$

$$\hat{\theta}=E{E(\theta \mid y, \psi) \mid y}=\int E(\theta \mid y, \psi) f(\psi \mid y) d \psi$$

$$\bar{e}=\frac{1}{J} \sum_{j=1}^J e_j$$

$$e_j=E\left(\theta \mid y, \psi_j\right)$$
$\hat{\theta}$的另一个$1-\alpha \mathrm{CI}$是
$$\left(\bar{e} \pm z_{\alpha / 2} s_e / \sqrt{J}\right) \text {, }$$

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|MC estimation of posterior predictive p-values

$$p=P(T(x, \theta) \geq T(y, \theta) \mid y)$$
(或类似的东西，例如用$\leq$代替$\geq$)，在隐含假设$H_0$为真的情况下计算。

$$\theta_1, \ldots, \theta_J \sim \text { iid } f(\theta \mid y)$$

$$\left(\hat{p} \pm z_{\alpha / 2} \sqrt{\frac{\hat{p}(1-\hat{p})}{J}}\right) .$$

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|The inversion technique

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

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|The inversion technique

Suppose we wish to sample $x$, a value of a continuous random variable $X$ with cdf $F_X(x)$. One way to do this is using the inversion technique, defined as follows, with the underlying theorem and proof shown below.
First derive the quantile function of $X$, denoted $F_X^{-1}(p)(0<p<1)$.
(This can be done by setting $F_X(x)$ to $p$ and solving for $x$.)
Next, generate a random number $u$ from the standard uniform distribution. (It will be assumed that this can be done easily, e.g. using runif() in R.)
Then return $x=F_X^{-1}(u)$ as a value sampled from the distribution of $X$.
Theorem 5.I: Suppose that $X$ is a continuous random variable with cdf $F_X(x)$ and quantile function $F_X^{-1}(p)$. Let $U \sim U(0,1)$, independently of $X$, and define $R=F_X^{-1}(U)$. Then $R$ has the same distribution as $X$.

Proof of Theorem 5.I: Observe that $U$ has cdf $F_U(u)=u, 0<u<1$. This implies that $R$ has cdf
$$F_R(r)=P(R \leq r)=P\left(F_X\left(F_X^{-1}(U)\right) \leq F_X(r)\right)=P\left(U \leq F_X(r)\right)=F_X(r) .$$
Thus, $R$ has the same cdf as $X$ and therefore the same distribution.
Note: A complication with the inversion technique may arise if there is difficulty deriving the quantile function $F_X^{-1}(p)$. In that case, since the task is fundamentally to solve $F_X(x)=u$ for $x$, it may be useful to employ the Newton-Raphson algorithm to the problem of solving the equation $g(x)=0$, where $g(x)=F_X(x)-u$.

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Random number generation via compositions

Sometimes the most convenient way to sample from a distribution is to express it as a function (or composition) of two or more random variables which are easy to sample from. For example, to obtain two independent values from the standard normal distribution we may use the well-known Box-Muller algorithm, as follows.
Sample $u_1, u_2 \sim$ iid $U(0,1)$ and let:
\begin{aligned} & z_1=\sqrt{-2 \log u_1} \cos \left(2 \pi u_2\right) \ & z_2=\sqrt{-2 \log u_1} \sin \left(2 \pi u_2\right) . \end{aligned}
It can be shown that $z_1, z_2 \sim$ iid $N(0,1)$. If we only need one value from the standard normal distribution then we may arbitrarily discard $z_2$ and return only $z_1$.
Exercise 5.I I Sampling from the double exponential distribution
Suppose we wish to sample a value $x \sim f(x)$, where
$$f(x)=(1 / 2) e^{-|x|}, x \in \mathfrak{R} .$$
Describe how to obtain $x$ as a composition of two other values than can be easily sampled.

# 贝叶斯分析代考

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|The inversion technique

(这可以通过将$F_X(x)$设置为$p$并求解$x$来完成。)

$$F_R(r)=P(R \leq r)=P\left(F_X\left(F_X^{-1}(U)\right) \leq F_X(r)\right)=P\left(U \leq F_X(r)\right)=F_X(r) .$$

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Random number generation via compositions

\begin{aligned} & z_1=\sqrt{-2 \log u_1} \cos \left(2 \pi u_2\right) \ & z_2=\sqrt{-2 \log u_1} \sin \left(2 \pi u_2\right) . \end{aligned}

$$f(x)=(1 / 2) e^{-|x|}, x \in \mathfrak{R} .$$

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Importance sampling

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

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Importance sampling

When applying the method of MC to estimate an integral of the form
$$\psi=E g(x)=\int g(x) f(x) d x,$$
suppose it is impossible (or difficult) to sample from $f(x)$, but it is easy to sample from a distribution/density $h(x)$ which is ‘similar’ to $f(x)$.

Then we may write
$$\psi=\int\left(g(x) \frac{f(x)}{h(x)}\right) h(x) d x=\int w(x) h(x) d x$$
where
$$w(x)=g(x) \frac{f(x)}{h(x)} .$$
This suggests that we sample $x_1, \ldots, x_J \sim$ iid $h(x)$ and use MC to estimate $\psi$ by
$$\hat{\psi}=\bar{w}=\frac{1}{J} \sum_{j=1}^J w_j,$$
where
$$w_j=w\left(x_j\right)=g\left(x_j\right) \frac{f\left(x_j\right)}{h\left(x_j\right)} .$$
This techniques is called importance sampling, and there are several issues to consider. As already indicated, the method works best if $h(x)$ is chosen to be very similar to $f(x)$.

Another issue is that $f(x)$ may be known only up to a multiplicative constant, i.e. where $f(x)=k(x) / c$, where the kernel $k(x)$ is known exactly but it is too difficult or impossible to evaluate the normalising constant $c=\int k(x) d x$. In that case, we may write
\begin{aligned} \psi=\int g(x) \frac{k(x)}{c} d x & =\frac{\int g(x) k(x) d x}{\int k(x) d x} \ & =\frac{\int\left(g(x) \frac{k(x)}{h(x)}\right) h(x) d x}{\int\left(\frac{k(x)}{h(x)}\right) h(x) d x}=\frac{\int w(x) h(x) d x}{\int u(x) h(x) d x}, \end{aligned}
where:
\begin{aligned} & w(x)=g(x) \frac{k(x)}{h(x)} \ & u(x)=\frac{k(x)}{h(x)} \end{aligned}

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|MC estimation involving two or more random variables

All the examples so far have involved only a single random variable $x$. However, the method of Monte Carlo generalises easily to two or more random variables. In fact, the procedure for $\mathrm{MC}$ estimation of the mean of a function, as described above, is already valid in the case where $x$ is a vector. We will now focus on the bivariable case, but the same principles apply when three or more random variables are being considered simultaneously.

Suppose that we have a random sample from the bivariate distribution of two random variables $x$ and $y$, denoted $\left(x_1, y_1\right), \ldots,\left(x_J, y_J\right) \sim$ iid $f(x, y)$, and we are interested in some function of $x$ and $y$, say $r=g(x, y)$. Then we simply calculate $r_j=g\left(x_j, y_j\right)$ and perform MC inference on the resulting sample $r_1, \ldots, r_J \sim$ iid $f(r)$.

Note 1: This procedure applies whether or not the random variables $x$ and $y$ are independent. If they are independent then we simply sample $x_j \sim f(x)$ and $y_j \sim f(y)$.

Note 2: If $x$ and $y$ are dependent, it may not be obvious how to generate $\left(x_j, y_j\right) \sim f(x, y)$.

Then, one approach is to apply the method of composition, as detailed below. If that fails, other methods are available, in particular ones which involve Markov chain theory. Much more will be said on these methods later in the course.

# 贝叶斯分析代考

## 统计代写|贝叶斯分析代写Bayesian Analysis代考|Importance sampling

$$\psi=E g(x)=\int g(x) f(x) d x,$$

$$\psi=\int\left(g(x) \frac{f(x)}{h(x)}\right) h(x) d x=\int w(x) h(x) d x$$

$$w(x)=g(x) \frac{f(x)}{h(x)} .$$

$$\hat{\psi}=\bar{w}=\frac{1}{J} \sum_{j=1}^J w_j,$$

$$w_j=w\left(x_j\right)=g\left(x_j\right) \frac{f\left(x_j\right)}{h\left(x_j\right)} .$$

\begin{aligned} \psi=\int g(x) \frac{k(x)}{c} d x & =\frac{\int g(x) k(x) d x}{\int k(x) d x} \ & =\frac{\int\left(g(x) \frac{k(x)}{h(x)}\right) h(x) d x}{\int\left(\frac{k(x)}{h(x)}\right) h(x) d x}=\frac{\int w(x) h(x) d x}{\int u(x) h(x) d x}, \end{aligned}

\begin{aligned} & w(x)=g(x) \frac{k(x)}{h(x)} \ & u(x)=\frac{k(x)}{h(x)} \end{aligned}

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|广义线性模型代写generalized linear model代考|Weighted sandwich: Newey–West

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

## 统计代写|广义线性模型代写generalized linear model代考|Weighted sandwich: Newey–West

These variance estimators are referred to as HAC variance estimators because they are heteroskedasticity- and autocorrelation-consistent estimates of the variances (of parameter estimators). A weighted sandwich estimate of variance calculates a (possibly) different middle of the sandwich. Instead of using only the usual score contributions, a weighted sandwich estimate of variance calculates a weighted mean of score contributions and lagged score contributions.
Newey and West (1987) discuss a general method for combining the contributions for each considered lag. The specific implementation then assigns a weight to each lagged score contribution. In related sections, we present various weight functions for use with this general approach.

In the following, let $n$ be the number of observations, $p$ be the number of predictors, $G$ be the maximum lag, $C$ be an overall scale factor, and $q$ be the prespecified bandwidth (number of lags for which the correlation is nonzero). The overall scale factor is usually defined as one but could be defined as $n /(n-p)$ to serve as a small sample scale factor adjustment.

\begin{aligned} \widehat{V}{\mathrm{NW}} & =\widehat{V}_H^{-1} \widehat{B}{\mathrm{NW}} \widehat{V}H^{-1} \ \widehat{B}{\mathrm{NW}} & =C\left{\widehat{\Omega}0+\sum{j=1}^G \omega\left(\frac{j}{q+1}\right)\left(\widehat{\Omega}j+\widehat{\Omega}_j^{\prime}\right)\right} \ \widehat{\Omega}_j & =\sum{i=j+1}^n x_i \widehat{r}i^S \widehat{T}{i-j}^S x_i^T \ \omega(z) & =\text { sandwich weights } \ \widehat{r}_i^S & =\text { score residuals (see section 4.4.9) }=\nabla_i\left(y_i-\mu_i\right) / v_i\end{aligned}

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

The jackknife estimate of variance estimates variability in fitted parameters by comparing results from leaving out one observation at a time in repeated estimations. Jackknifing is based on a data resampling procedure in which the variability of an estimator is investigated by repeating an estimation with a subsample of the data. Subsample estimates are collected and compared with the full sample estimate to assess variability. Introduced by Quenouille (1949) , an excellent review of this technique and extensions is available in Miller (1974).
The sandwich estimate of variance is related to the jackknife. Asymptotically, it is equivalent to the one-step and iterated jackknife estimates, and as shown in Efron (1981), the sandwich estimate of variance is equal to the infinitesimal jackknife.
There are two general methods for calculating jackknife estimates of variance. One approach is to calculate the variability of the individual estimates from the full sample estimate. We supply formulas for this approach. A less conservative approach is to calculate the variability of the individual estimates from the average of the individual estimates. You may see references to this approach in other sources. Generally, we prefer the approach outlined here because of its more conservative nature.

# 广义线性模型代考

## 统计代写|广义线性模型代写generalized linear model代考|Weighted sandwich: Newey–West

Newey和West(1987)讨论了一种综合考虑每个滞后的贡献的一般方法。然后，具体的实现为每个滞后的分数贡献分配一个权重。在相关章节中，我们将介绍与这种通用方法一起使用的各种权重函数。

\begin{aligned} \widehat{V}{\mathrm{NW}} & =\widehat{V}_H^{-1} \widehat{B}{\mathrm{NW}} \widehat{V}H^{-1} \ \widehat{B}{\mathrm{NW}} & =C\left{\widehat{\Omega}0+\sum{j=1}^G \omega\left(\frac{j}{q+1}\right)\left(\widehat{\Omega}j+\widehat{\Omega}_j^{\prime}\right)\right} \ \widehat{\Omega}_j & =\sum{i=j+1}^n x_i \widehat{r}i^S \widehat{T}{i-j}^S x_i^T \ \omega(z) & =\text { sandwich weights } \ \widehat{r}_i^S & =\text { score residuals (see section 4.4.9) }=\nabla_i\left(y_i-\mu_i\right) / v_i\end{aligned}

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

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

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

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

In developing a model, we hope to generate fitted values $\widehat{\mu}$ that are close to the data $y$. For a dataset with $n$ observations, we may consider candidate models with one to $n$ parameters. The simplest model would include only one parameter. The best one-parameter model would result in $\widehat{\mu}_i=\mu$ (for all $i$ ). Although the model is parsimonious, it does not estimate the variability in the data. The saturated model (with $n$ parameters) would include one parameter for each observation and result in $\widehat{\mu}_i=y_i$. This model exactly reproduces the data but is uninformative because there is no summarization of the data.

We define a measure of fit for the model as twice the difference between the log likelihoods of the model of interest and the saturated model. Because this difference is a measure of the deviation of the model of interest from a perfectly fitting model, the measure is called the deviance. Our competing goals in modeling are to find the simplest model (fewest parameters) that has the smallest deviance (reproduces the data).
The deviance, $D$, is given by
$$D=\sum_{i=1}^n 2\left[y_i\left{\theta\left(y_i\right)-\theta\left(\mu_i\right)\right}-b\left{\theta\left(y_i\right)\right}+b\left{\theta\left(\mu_i\right)\right}\right]$$
where the equation is given in terms of the mean parameter $\mu$ instead of the canonical parameter $\theta$. In fitting a particular model, we seek the values of the parameters that minimize the deviance. Thus, optimization in the IRLS algorithm is achieved when the difference in deviance calculations between successive iterations is small (less than some chosen tolerance). The values of the parameters that minimize the deviance are the same as the values of the parameters that maximize the likelihood.

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

It is natural to ask how the Newton-Raphson (based on the observed Hessian) variance estimates compare with the usual (based on the expected Hessian) variance estimates obtained using the IRLS algorithm outlined in the preceding section. The matrix of second derivatives in the IRLS algorithm is equal to the first term in (3.31). As Newson (1999) points out, the calculation of the expected Hessian is simplified from that of the observed Hessian because we assume that $E(\mu-y)=0$ or, equivalently, the conditional mean of $y$ given $X$ is correct. As such, the IRLS algorithm assumes that the conditional mean is specified correctly. Both approaches result in parameter estimates that differ only because of numeric roundoff or because of differences in optimization criteria.

This distinction is especially important in the calculation of sandwich estimates of variance. The Hessian may be calculated as given above in (3.31) or may be calculated using the more restrictive (naïve) assumptions of the IRLS algorithm as
$$E\left(\frac{\partial^2 \mathcal{L}}{\partial \beta_j \partial \beta_k}\right)=-\sum_{i=1}^n \frac{1}{a(\phi)} \frac{1}{v\left(\mu_i\right)}\left(\frac{\partial \mu}{\partial \eta}\right)i^2 x{j i} x_{k i}$$
occurs because for the canonical link we can make the substitution that $\theta=\eta$ to zero because

\begin{aligned}
\left(\mu_i-y_i\right) & \left{\frac{1}{v\left(\mu_i\right)^2}\left(\frac{\partial \mu}{\partial \eta}\right)_i^2 \frac{\partial v\left(\mu_i\right)}{\partial \mu}-\frac{1}{v\left(\mu_i\right)}\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right}_i \
& =\left(\mu_i-y_i\right)\left{\frac{1}{(\partial \mu / \partial \eta)_i^2}\left(\frac{\partial \mu}{\partial \eta}\right)_i^2 \frac{\partial}{\partial \mu_i}\left(\frac{\partial \mu}{\partial \eta}\right)_i-\frac{1}{(\partial \mu / \partial \eta)_i}\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right}(3.52) \
& =\left(\mu_i-y_i\right)\left{\frac{\partial}{\partial \mu_i}\left(\frac{\partial \mu}{\partial \eta}\right)_i-\left(\frac{\partial \eta}{\partial \mu}\right)_i\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right} \
& =\left(\mu_i-y_i\right)\left{\left(\frac{\partial^2 \mu}{\partial \mu \partial \eta}\right)_i-\left(\frac{\partial^2 \mu}{\partial \mu \partial \eta}\right)_i\right} \
& =0
\end{aligned}

# 广义线性模型代考

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

$$D=\sum_{i=1}^n 2\left[y_i\left{\theta\left(y_i\right)-\theta\left(\mu_i\right)\right}-b\left{\theta\left(y_i\right)\right}+b\left{\theta\left(\mu_i\right)\right}\right]$$

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

$$E\left(\frac{\partial^2 \mathcal{L}}{\partial \beta_j \partial \beta_k}\right)=-\sum_{i=1}^n \frac{1}{a(\phi)} \frac{1}{v\left(\mu_i\right)}\left(\frac{\partial \mu}{\partial \eta}\right)i^2 x{j i} x_{k i}$$

\begin{aligned}
\left（\mu＿i-y＿i\right) ＆ \left{\frac{1}{v\left(\mu_i\right)^2}\left(\frac{\partial \mu}{\partial \eta}\right)_i^2 \frac{\partial v\left(\mu_i\right)}{\partial \mu}-\frac{1}{v\left(\mu_i\right)}\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right}＿i \＆ =\left（\mu＿i-y＿i\right）\left{\frac{1}{(\partial \mu / \partial \eta)_i^2}\left(\frac{\partial \mu}{\partial \eta}\right)_i^2 \frac{\partial}{\partial \mu_i}\left(\frac{\partial \mu}{\partial \eta}\right)_i-\frac{1}{(\partial \mu / \partial \eta)_i}\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right}(3.52) \＆ =\left（\mu＿i-y＿i\right）\left{\frac{\partial}{\partial \mu_i}\left(\frac{\partial \mu}{\partial \eta}\right)_i-\left(\frac{\partial \eta}{\partial \mu}\right)_i\left(\frac{\partial^2 \mu}{\partial \eta^2}\right)_i\right} \＆ =\left（\mu＿i-y＿i\right）\left{\left(\frac{\partial^2 \mu}{\partial \mu \partial \eta}\right)_i-\left(\frac{\partial^2 \mu}{\partial \mu \partial \eta}\right)_i\right} \＆ =0
\end{aligned}

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

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

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

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

GLMS are traditionally formulated within the framework of the exponential family of distributions. In the associated representation, we can derive a general model that may be fit using the scoring process (IRLS) detailed in section 3.3 . Many people confuse the estimation method with the class of GLMs. This is a mistake because there are many estimation methods. Some software implementations allow specification of more diverse models than others. We will point this out throughout the text.
The exponential family is usually (there are other algebraically equivalent forms in the literature) written as
$$f_y(y ; \theta, \phi)=\exp \left{\frac{y \theta-b(\theta)}{a(\phi)}+c(y, \phi)\right}$$
where $\theta$ is the canonical (natural) parameter of location and $\phi$ is the parameter of scale. The location parameter (also known as the canonical link function) relates to the means, and the scalar parameter relates to the variances for members of the exponential family of distributions including Gaussian, gamma, inverse Gaussian, and others. Using the notation of the exponential family provides a means to specify models for continuous, discrete, proportional, count, and binary outcomes.

In the exponential family presentation, we construe each of the $y_i$ observations as being defined in terms of the parameters $\theta$. Because the observations are independent, the joint density of the sample of observations $y_i$, given parameters $\theta$ and $\phi$, is defined by the product of the density over the individual observations (review section 2.2). Interested readers can review Barndorff-Nielsen (1976) for the theoretical justification that allows this factorization:
$$f_{y_1, y_2, \ldots, y_n}\left(y_1, y_2, \ldots, y_n ; \theta, \phi\right)=\prod_{i=1}^n \exp \left{\frac{y_i \theta_i-b\left(\theta_i\right)}{a(\phi)}+c\left(y_i, \phi\right)\right}$$

## 统计代写|广义线性模型代写generalized linear model代考|Example: Using an offset in a GLM

In subsequent chapters (especially chapter $3$ ), we illustrate the two main components of the specification of a GLM. The first component of a GLM specification is a function of the linear predictor, which substitutes for the location (mean) parameter of the exponential family. This function is called the link function because it links the expected value of the outcome to the linear predictor comprising the regression coefficients; we specify this function with the link ( ) option. The second component of a GLM specification is the variance as a scaled function of the mean. In Stata, this function is specified using the name of a particular member distribution of the exponential family; we specify this function with the family ( ) option. The example below highlights a log-link Poisson GLM.
For this example, it is important to note the treatment of the offset in the linear predictor. The particular choices for the link and variance functions are not relevant to the utility of the offset.

Below, we illustrate the use of an offset with Stata’s glm command. From an analysis presented in chapter 12 , consider the output of the following model:

We would like to test whether the coefficient on white is equal to -0.20 . We could use Stata’s test command to obtain a Wald test

test white=-.20
(1) [los] white $=-.2$
\begin{aligned} \operatorname{chi}(1) & = & 2.83 \ \text { Prob }>\operatorname{chi2} & = & 0.0924 \end{aligned}
which indicates that -0.15 (coefficient on white) is not significantly different at a $5 \%$ level from -0.20 . However, we want to use a likelihood-ratio test, which is usually a more reliable test of parameter estimate significance. Stata provides a command that stores the likelihood from the unrestricted model (above) and then compares it with a restricted model. Having fit the unrestricted model, our attention now turns to fitting a model satisfying our specific set of constraints. Our constraint is that the coefficient on white be restricted to the constant value -0.20 .

# 广义线性模型代考

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

$$f_y(y ; \theta, \phi)=\exp \left{\frac{y \theta-b(\theta)}{a(\phi)}+c(y, \phi)\right}$$

$$f_{y_1, y_2, \ldots, y_n}\left(y_1, y_2, \ldots, y_n ; \theta, \phi\right)=\prod_{i=1}^n \exp \left{\frac{y_i \theta_i-b\left(\theta_i\right)}{a(\phi)}+c\left(y_i, \phi\right)\right}$$

## 统计代写|广义线性模型代写generalized linear model代考|Example: Using an offset in a GLM

(1) [los] white $=-.2$
\begin{aligned} \operatorname{chi}(1) & = & 2.83 \ \text { Prob }>\operatorname{chi2} & = & 0.0924 \end{aligned}

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

## 统计代写|时间序列分析代写Time-Series Analysis代考|Constant Conditional Correlation (CCC) models

statistics-lab™ 为您的留学生涯保驾护航 在代写时间序列分析Time-Series Analysis方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写时间序列分析Time-Series Analysis代写方面经验极为丰富，各种代写时间序列分析Time-Series Analysis相关的作业也就用不着说。

## 统计代写|时间序列分析代写Time-Series Analysis代考|Factor analysis

One other way to reduce the number of parameters in the VEC model was suggested by Bollerslev (1990) who proposed a representation where the conditional correlation matrix is assumed to be constant. Under such an assumption, the conditional covariances are proportional to the product of the corresponding conditional standard deviations. The model becomes
$$\boldsymbol{\Sigma}t=\mathbf{D}_t \mathbf{R D}_t$$ where $$\begin{gathered} D_t=\operatorname{diag}\left(\sigma{1,1, t}^{1 / 2}, \ldots, \sigma_{m, m, t}^{1 / 2}\right), \ R=\left[\begin{array}{ccccc} 1 & \rho_{1,2} & \cdots & \cdots & \rho_{1, m} \ \rho_{1,2} & 1 & \cdots & \cdots & \rho_{2, m} \ \vdots & \vdots & \ddots & \vdots & \vdots \ \vdots & \vdots & \vdots & \ddots & \vdots \ \rho_{1, m} & \rho_{2, m} & \cdots & \cdots & 1 \end{array}\right], \end{gathered}$$
and $\rho_{i, j}$ is the constant conditional correlation between $\varepsilon_{i, t}$ and $\varepsilon_{j, t}$. The representation is known as the constant conditional correlation (CCC) model. Thus,
$$\sigma_{i, j, t}=\rho_{i, j} \sqrt{\sigma_{i, i, t} \sigma_{j, j, t}}$$
and $\sigma_{i, i, t}$ can be modeled independently as univariate GARCH models like the simple GARCH $(1,1)$ model,
$$\sigma_{i, i, t}=c_i+\alpha_i \sigma_{i, i, t-1}+\beta_i \varepsilon_{i, t-1}^2, i=1, \ldots, m$$

## 统计代写|时间序列分析代写Time-Series Analysis代考|BEKK models

Other than the large number of parameters in the model, the other problem with the VEC model is that the conditional covariance matrix as formulated in Eq. (6.6) may not be positive definite. To overcome the difficulty, Engle and Kroner (1995) used a quadratic form to propose the following model, which, without including exogenous variables, is given by
$$\boldsymbol{\Sigma}t=\mathbf{C}^{\prime} \mathbf{C}+\sum{j=1}^p \boldsymbol{\Phi}j^{\prime} \boldsymbol{\Sigma}{t-1} \boldsymbol{\Phi}j+\sum{j=1}^q \boldsymbol{\Theta}j^{\prime} \varepsilon{t-1} \boldsymbol{\varepsilon}{t-1}^{\prime} \boldsymbol{\Theta}_j,$$ where $\mathbf{C}$ is a $m \times m$ triangular matrix, which is to ensure $\boldsymbol{\Sigma}_t$ to be definitely positive. Engle and Kroner call it BEKK model because it is related to their earlier joint work of Baba et al. (1990). For convenience, we will call the model in Eq. (6.15) as $\operatorname{BEKK}(p, q)$ model. The BEKK(1,1) model is $$\boldsymbol{\Sigma}_t=\mathbf{C}^{\prime} \mathbf{C}+\boldsymbol{\Phi}_1^{\prime} \boldsymbol{\Sigma}{t-1} \boldsymbol{\Phi}1+\boldsymbol{\Theta}_1^{\prime} \boldsymbol{\varepsilon}{t-1} \boldsymbol{\varepsilon}_{t-1}^{\prime} \boldsymbol{\Theta}_1$$

The model will be stationary if and only if the eigenvalues of $\boldsymbol{\Phi}1^{\prime} \otimes \boldsymbol{\Phi}_1+\boldsymbol{\Theta}_1^{\prime} \otimes \boldsymbol{\Theta}_1$ are in the unit circle, where $\otimes$ is the Kronecker product of two matrices. For a two-dimensional BEKK $(1,1)$ model, its explicit form is given by \begin{aligned} \boldsymbol{\Sigma}_t= & {\left[\begin{array}{ll} \sigma{1,1, t} & \sigma_{1,2, t} \ \sigma_{1,2, t} & \sigma_{2,2, t} \end{array}\right]=\left[\begin{array}{ll} c_{1,1} & c_{1,2} \ c_{2,1} & c_{2,2} \end{array}\right]+\left[\begin{array}{ll} \phi_{1,1} & \phi_{1,2} \ \phi_{2,1} & \phi_{2,2} \end{array}\right]^{\prime}\left[\begin{array}{ll} \sigma_{1,1, t-1} & \sigma_{1,2, t-1} \ \sigma_{1,2, t-1} & \sigma_{2,2, t-1} \end{array}\right]\left[\begin{array}{ll} \phi_{1,1} & \phi_{1,2} \ \phi_{2,1} & \phi_{2,2} \end{array}\right] } \ & +\left[\begin{array}{ll} \theta_{1,1} & \theta_{1,2} \ \theta_{2,1} & \theta_{2,2} \end{array}\right]^{\prime}\left[\begin{array}{cc} \varepsilon_{1, t-1}^2 & \varepsilon_{1, t-1} \varepsilon_{2, t-1} \ \varepsilon_{2, t-1} \varepsilon_{1, t-1} & \varepsilon_{2, t-1}^2 \end{array}\right]\left[\begin{array}{ll} \theta_{1,1} & \theta_{1,2} \ \theta_{2,1} & \theta_{2,2} \end{array}\right], \end{aligned}
and hence,
\begin{aligned} \sigma_{1,1, t}= & c_{1,1}+\phi_{1,1}^2 \sigma_{1,1, t-1}+2 \phi_{1,1} \phi_{2,1} \sigma_{1,2, t-1}+\phi_{2,1}^2 \sigma_{2,2, t-1} \ & +\theta_{1,1}^2 \varepsilon_{1, t-1}^2+2 \theta_{1,1} \theta_{2,1} \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1}^2 \varepsilon_{2, t-1}^2 \ \sigma_{1,2, t}= & c_{1,2}+\phi_{1,1} \phi_{1,2} \sigma_{1,1, t-1}+\left(\phi_{1,1} \phi_{2,2}+\phi_{1,2} \phi_{2,1}\right) \sigma_{1,2, t-1}+\phi_{2,1} \phi_{2,2} \sigma_{2,2, t-1} \ & +\theta_{1,1} \theta_{1,2} \varepsilon_{1, t-1}^2+\left(\theta_{1,1} \theta_{2,2}+\theta_{1,2} \theta_{2,1}\right) \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1} \theta_{2,2} \varepsilon_{2, t-1}^2, \ \sigma_{2,2, t}= & c_{2,2}+\phi_{1,2}^2 \sigma_{1,1, t-1}+2 \phi_{1,1} \phi_{2,2} \sigma_{1,2, t-1}+\phi_{2,2}^2 \sigma_{2,2, t-1} \ & +\theta_{1,2}^2 \varepsilon_{1, t-1}^2+2 \theta_{1,2} \theta_{2,2} \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1}^2 \varepsilon_{2, t-1}^2, \end{aligned}

# 时间序列分析代考

## 统计代写|时间序列分析代写Time-Series Analysis代考|Factor analysis

Bollerslev(1990)提出了另一种减少VEC模型中参数数量的方法，他提出了一种假设条件相关矩阵为常数的表示。在这种假设下，条件协方差与相应条件标准差的乘积成正比。模型变成了
$$\boldsymbol{\Sigma}t=\mathbf{D}t \mathbf{R D}_t$$ where $$\begin{gathered} D_t=\operatorname{diag}\left(\sigma{1,1, t}^{1 / 2}, \ldots, \sigma{m, m, t}^{1 / 2}\right), \ R=\left[\begin{array}{ccccc} 1 & \rho_{1,2} & \cdots & \cdots & \rho_{1, m} \ \rho_{1,2} & 1 & \cdots & \cdots & \rho_{2, m} \ \vdots & \vdots & \ddots & \vdots & \vdots \ \vdots & \vdots & \vdots & \ddots & \vdots \ \rho_{1, m} & \rho_{2, m} & \cdots & \cdots & 1 \end{array}\right], \end{gathered}$$
$\rho_{i, j}$是$\varepsilon_{i, t}$和$\varepsilon_{j, t}$之间的常数条件相关。这种表示称为恒定条件相关(CCC)模型。因此，
$$\sigma_{i, j, t}=\rho_{i, j} \sqrt{\sigma_{i, i, t} \sigma_{j, j, t}}$$

$$\sigma_{i, i, t}=c_i+\alpha_i \sigma_{i, i, t-1}+\beta_i \varepsilon_{i, t-1}^2, i=1, \ldots, m$$

## 统计代写|时间序列分析代写Time-Series Analysis代考|BEKK models

$$\boldsymbol{\Sigma}t=\mathbf{C}^{\prime} \mathbf{C}+\sum{j=1}^p \boldsymbol{\Phi}j^{\prime} \boldsymbol{\Sigma}{t-1} \boldsymbol{\Phi}j+\sum{j=1}^q \boldsymbol{\Theta}j^{\prime} \varepsilon{t-1} \boldsymbol{\varepsilon}{t-1}^{\prime} \boldsymbol{\Theta}j,$$其中$\mathbf{C}$是一个$m \times m$三角矩阵，这是为了保证$\boldsymbol{\Sigma}_t$是肯定的正数。Engle和Kroner称其为BEKK模型，因为它与他们早期Baba等人(1990)的联合研究有关。为方便起见，我们将式(6.15)中的模型称为$\operatorname{BEKK}(p, q)$模型。BEKK(1,1)模型为 $$\boldsymbol{\Sigma}_t=\mathbf{C}^{\prime} \mathbf{C}+\boldsymbol{\Phi}_1^{\prime} \boldsymbol{\Sigma}{t-1} \boldsymbol{\Phi}1+\boldsymbol{\Theta}_1^{\prime} \boldsymbol{\varepsilon}{t-1} \boldsymbol{\varepsilon}{t-1}^{\prime} \boldsymbol{\Theta}_1$$

\begin{aligned} \sigma_{1,1, t}= & c_{1,1}+\phi_{1,1}^2 \sigma_{1,1, t-1}+2 \phi_{1,1} \phi_{2,1} \sigma_{1,2, t-1}+\phi_{2,1}^2 \sigma_{2,2, t-1} \ & +\theta_{1,1}^2 \varepsilon_{1, t-1}^2+2 \theta_{1,1} \theta_{2,1} \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1}^2 \varepsilon_{2, t-1}^2 \ \sigma_{1,2, t}= & c_{1,2}+\phi_{1,1} \phi_{1,2} \sigma_{1,1, t-1}+\left(\phi_{1,1} \phi_{2,2}+\phi_{1,2} \phi_{2,1}\right) \sigma_{1,2, t-1}+\phi_{2,1} \phi_{2,2} \sigma_{2,2, t-1} \ & +\theta_{1,1} \theta_{1,2} \varepsilon_{1, t-1}^2+\left(\theta_{1,1} \theta_{2,2}+\theta_{1,2} \theta_{2,1}\right) \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1} \theta_{2,2} \varepsilon_{2, t-1}^2, \ \sigma_{2,2, t}= & c_{2,2}+\phi_{1,2}^2 \sigma_{1,1, t-1}+2 \phi_{1,1} \phi_{2,2} \sigma_{1,2, t-1}+\phi_{2,2}^2 \sigma_{2,2, t-1} \ & +\theta_{1,2}^2 \varepsilon_{1, t-1}^2+2 \theta_{1,2} \theta_{2,2} \varepsilon_{1, t-1} \varepsilon_{2, t-1}+\theta_{2,1}^2 \varepsilon_{2, t-1}^2, \end{aligned}

## 有限元方法代写

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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。