### 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|The Principal Components

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

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

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|The Principal Components

Let $\mathbf{x}=\left(x_{1}, x_{2}, \cdots, x_{p}\right)^{\mathrm{T}}$ be a set of $p$ continuous variables. The basic idea of a PCA method is to transform the set of variables $\left(x_{1}, x_{2}, \cdots, x_{p}\right)$ into a smaller set of uncorrelated new variables and try to explain most variability in the original variables $\mathbf{x}$ through these new variables. Specifically, let
$$\mu=E(\mathbf{x})=\left(\mu_{1}, \mu_{2}, \cdots, \mu_{p}\right)^{\mathrm{T}}, \quad \Sigma=\operatorname{Cov}(\mathbf{x})=\left(\sigma_{i j}\right)_{p \times p}$$
be the mean vector and the covariance matrix of $x$ respectively. Note that the mean vector $\boldsymbol{\mu}$ represents the center of $\mathbf{x}$, and the covariance matrix $\Sigma$ represents the vari-

ations (the diagonal elements of $\Sigma$ ) and correlations (the off-diagonal elements of $\Sigma$ ) of the random vector $\mathbf{x}$.

For ease interpretation, we usually replace $\mathbf{x}$ by its centered version $\mathbf{x}-\boldsymbol{\mu}$. We consider the following linear combinations of the components of vector $\mathrm{x}-\mu$
$$\begin{array}{r} y_{1}=\mathbf{a}{1}^{\mathrm{T}}(\mathbf{x}-\mu)=a{11}\left(x_{1}-\mu_{1}\right)+a_{12}\left(x_{2}-\mu_{2}\right)+\cdots+a_{1 p}\left(x_{p}-\mu_{p}\right), \ y_{2}=\mathbf{a}{2}^{\mathrm{T}}(\mathbf{x}-\mu)=a{21}\left(x_{1}-\mu_{1}\right)+a_{22}\left(x_{2}-\mu_{2}\right)+\cdots+a_{2 p}\left(x_{p}-\mu_{p}\right) \ \cdots \cdots \ y_{p}=\mathbf{a}{p}^{\mathrm{T}}(\mathbf{x}-\boldsymbol{\mu})=a{p 1}\left(x_{1}-\mu_{1}\right)+a_{p 2}\left(x_{2}-\mu_{2}\right)+\cdots+a_{p p}\left(x_{p}-\mu_{p}\right), \end{array}$$
where $\mathbf{a}{k}=\left(a{k 1}, a_{k 2}, \cdots, a_{k p}\right)^{\mathrm{T}}$ is a vector of constants. That is, each $y_{k}$ is a linear combination of the original random vector $x$. Then, we can show that
$$\operatorname{Var}\left(y_{i}\right)=\mathbf{a}{i}^{\mathrm{T}} \Sigma \mathbf{a}{i}, \quad \operatorname{Cov}\left(y_{i}, y_{j}\right)=\mathbf{a}{i}^{\mathrm{T}} \Sigma \mathbf{a}{j}, \quad i, j=1,2, \cdots, p .$$
Note that the variance of $y_{i}$ increases as the length of $\mathbf{a}{i}$, denoted by $\left|\mathbf{a}{i}\right|$, increases. To ensure uniqueness of $\mathbf{a}{i}$, we can assume that $\mathbf{a}{i}$ is a unit vector, i.e., $\left|\mathbf{a}{i}\right|=1$, for $i=1,2, \cdots, p$. This can be easily done since a vector can always be rescaled to have length of one. The first principal component (PC) is defined as $$y{1}=\mathbf{a}{1}^{\top} \mathbf{x}$$ where $\mathbf{a}{1}$ is chosen to maximize the variance $\operatorname{Var}\left(\mathbf{a}{1}^{\mathrm{T}} \mathbf{x}\right)$ over all constant vectors $\mathbf{a}{1}$ subject to the restriction $\left|\mathbf{a}{1}\right|=1$. The second principal component (PC) is defined as $$y{2}=\mathbf{a}{2}^{\mathbf{T}} \mathbf{x}$$ where $\mathbf{a}{2}$ is chosen to maximize the variance $\operatorname{Var}\left(\mathbf{a}{2}^{\mathrm{T}} \mathbf{x}\right)$ over all constant vectors $\mathbf{a}{2}$ subject to the restrictions
$$\left|\mathbf{a}{2}\right|=1, \quad \operatorname{Cov}\left(\mathbf{a}{2}^{\mathrm{T}} \mathbf{x}, \mathbf{a}_{1}^{\mathrm{T}} \mathbf{x}\right)=0$$

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|Choose Number of Principal Components

The purpose of $\mathrm{PCA}$ is to reduce dimension, i.e., reduce the number of variables. In practice, we need to decide how many dimensions we can reduce without much loss of information. In other words, we should decide how many principal components should be retained. This question can be answered by the amount of variation that can be explained through the first few principal components.
Note that the total variation (variance) in the data is
$$\operatorname{tr}(\Sigma)=\sigma_{11}+\cdots+\sigma_{p p}=\lambda_{1}+\cdots+\lambda_{p}$$
Thus, the importance of the $\mathrm{j}$-th $\mathrm{PC}$ can be measured by the ratio
$$\frac{\lambda_{j}}{t r(\Sigma)}, \quad j=1,2, \cdots, p$$

i.e,, the proportion of the total variability explained by the $j$-th $\mathrm{PC}$. For example, the importance of the first two PCs can be measured by the ratio
$$\frac{\lambda_{1}+\lambda_{2}}{\operatorname{tr}(\Sigma)}$$
If the first few PCs can explain most (e.g., $70 \% \sim 80 \%$ ) of the total variability, then these first few PCs can replace all the original $p$ variables without much loss of information, where the information is measured by the variability. For example, if the first two $\mathrm{PCs}\left(y_{1}\right.$ and $\left.y_{2}\right)$ can explain $70 \%$ variation in the original $p=10$ variables $\left(x_{1}, \cdots, x_{10}\right)$, i.e., if $\left(\lambda_{1}+\lambda_{2}\right) / \operatorname{tr}(\Sigma)=0.7$, we can just use the two new variables (i.e., the first two PCs $y_{1}$ and $\left.y_{2}\right)$ instead of the original 10 variables $\left(x_{1}, \cdots, x_{10}\right)$ in data analysis, so the dimension of the data space is reduced from 10 to 2 (a big reduction in dimension!). Then, we can use graphical tools to display the “new data” on the two new variables. Although we loss some information by using the two new variables instead of the original ten variables, we gain a lot in data analysis, such as better parameter estimates and better use of graphical tools.

There have been some suggestions in the literature on choosing the number of principal components. For example, some authors suggest that, if we do PCA on the correlation matrix (not the covariance matrix), then the eigenvalues greater than 1 should be retained, which means that the PCs with variance larger than 1 are retained. A scree plot (see Figure 2.4) is also a useful visual aid for deciding the number of principal components. We will illustrate these methods in the $R$ examples later. These methods are rules of thumb and should be treated as a guideline only. In real applications, however, we do not need to follow these guidelines strictly. The decision for choosing the number of principal components should be based on subjectmatter interpretation, i.e., whether the chosen principal components make good sense in the particular problem under consideration and whether the chosen number of principal components can help us in data analysis. For example, if we choose two principal components, we will be able to use graphical tools, but if we choose three or more principal components, we are unable to use graphical tools. On the other hand, we usually hope that the chosen number of principal components can explain most of the variation in the data, such as at least $70 \%$ of the total variation. In summary, choosing the number of principal components should be guided by data analysis rather than certain strict rules.

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|Considerations in Data Analysis

In practice, the true population mean vector $\mu$ and covariance matrix $\Sigma$ are unknown. Thus, in data analysis, we should use the sample estimates of the mean vector and the covariance matrix to replace the unknown population mean vector and covariance

matrix. Specifically, given a sample of data $\left{\mathbf{x}{1}, \cdots, \mathbf{x}{n}\right}$, where $\mathbf{x}{i}=\left(x{i 1}, \cdots, x_{i p}\right)^{\mathrm{T}}$, we can use the following sample mean vector $\overline{\mathbf{x}}=\hat{\mu}$ and sample covariance matrix $S=\hat{\Sigma}$ for PCA:
$$\overline{\mathbf{x}}=\frac{1}{n} \sum_{i=1}^{n} \mathbf{x}{i}, \quad S=\left(\hat{\sigma}{i j}\right){p \times p}=\frac{1}{n-1} \sum{i=1}^{n}\left(\mathbf{x}{i}-\overline{\mathbf{x}}\right)\left(\mathbf{x}{i}-\overline{\mathbf{x}}\right)^{\mathrm{T}} .$$
The accuracies of these estimates depend on the sample size $n$. The larger the sample size, the closer the sample estimates to the population parameters.

Note that PCA results may depend on the scales or units of the variables. For example, a distance $x_{1}$ can be measured in centermeter or in meter, and their values can differ by 100 times. The PCA results may depend on the scale (or unit) of $x_{1}$. Usually, it is desirable that all the variables in the original data have similar scales, i.e., the magnitudes of the values are comparable (e.g., not some values are around $0.0001$ while other values are around 10000 ). To address this issue, it is generally desirable to perform PCA on the correlation matrix $R$ rather than the original covariance matrix $\Sigma$, or perform PCA on the standardized data:
$$z_{i j}=\frac{x_{i j}-\bar{x}{j}}{\sqrt{\sigma{j j}}}, \quad i=1,2, \cdots, n ; \quad k=1,2, \cdots, p,$$
where $\bar{x}{j}=\sum{i=1}^{n} x_{i j} / n$, which are transformations of the original data, with mean 0 and variance $1 .$

Once we find the PCs, i.e., the new variables $y_{j}$ ‘s, we can convert the original data $x_{i j}$ into “new data” of the PCs $y_{j}$ ‘s. For example, for individual $i$, let
$$\hat{y}{i k}=\hat{\mathbf{a}}{k}^{\mathrm{T}}\left(\mathbf{x}{i}-\overline{\mathbf{x}}\right), \quad i=1,2, \cdots, n ; \quad k=1,2, \cdots, p,$$ where $\hat{\mathbf{a}}{k}$ ‘s are the eigenvectors of the sample covariance matrix $\boldsymbol{S}=\hat{\Sigma}$ or the sample correlation matrix $\boldsymbol{R}$. These “new data”
$$\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2, \cdots, p\right}$$ are called $P C$ scores, and they can be used for further analysis. For example, we may proceed with “new data” on the first two $\mathrm{PCs}\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2\right}$. in data analysis. In other words, data analysis is performed on the new data with two variables rather than the original data with $p$ variables.

Principal components are linear combinations of the original variables. Original variables have practical meanings, but the principal components do not always have practical meanings. However, sometimes we may be able to interpret interesting practical meanings for some principal components, as illustrated in Examples 2 and 3 in next section.

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|The Principal Components

μ=和(X)=(μ1,μ2,⋯,μp)吨,Σ=这⁡(X)=(σ一世j)p×p

ations（的对角线元素Σ）和相关性（的非对角元素Σ) 的随机向量X.

|一个2|=1,这⁡(一个2吨X,一个1吨X)=0

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|Choose Number of Principal Components

tr⁡(Σ)=σ11+⋯+σpp=λ1+⋯+λp

λj吨r(Σ),j=1,2,⋯,p

λ1+λ2tr⁡(Σ)

## 统计代写|多元统计分析代写Multivariate Statistical Analysis代考|Considerations in Data Analysis

X¯=1n∑一世=1nX一世,小号=(σ^一世j)p×p=1n−1∑一世=1n(X一世−X¯)(X一世−X¯)吨.

\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2, \cdots, p\right}\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2, \cdots, p\right}被称为磷C分数，它们可用于进一步分析。例如，我们可以对前两个进行“新数据”\mathrm{PCs}\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2\右}\mathrm{PCs}\left{\hat{y}{i k}: i=1,2, \cdots, n ; k=1,2\右}. 在数据分析中。换句话说，数据分析是对具有两个变量的新数据而不是具有p变量。

## 有限元方法代写

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