### 统计代写|linear regression代写线性回归代考|Comparing Means from Two Groups

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

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

## 统计代写|linear regression代写线性回归代考|Comparing Means from Two Groups

We referred to a mean-comparison test, the $t$-test, earlier in the chapter when comparing the weights of two litters of puppies. Let’s review this test in more detail. First, recall that we may compare many statistics from distributions, including standard deviations and standard errors. A common exercise, however, is to assess, in an inferential sense, whether the mean from one population is likely different from the mean of another population. If we draw samples from two populations, we should consider sampling error. Our samples probably have different means than the true population means,

so we should take this likely variation into account. A $t$-test is designed to evaluate whether two means are likely different across populations by, first, taking the difference between the sample means and, second, evaluating the presumed sampling error.

The name $t$-test is used because the $t$-value that is the basis of the test follows a Student’s $t$-distribution. ${ }^{32}$ This distribution is almost indistinguishable from the normal distribution when the sample size is greater than 50 . At smaller sample sizes, the $t$-distribution has fatter tails and is a bit flatter in the middle than the normal distribution.

Equations $2.13$ and $2.14$ demonstrate how to compute a conventional $t$-test that assumes the means are drawn from two independent populations.
$$\begin{gathered} t=\frac{\bar{x}-\bar{y}}{s_{p} \sqrt{\frac{1}{n_{1}}+\frac{1}{n_{2}}}} \ \text { where } s_{p}=\sqrt{\frac{\left(n_{1}-1\right) s_{1}^{2}+\left(n_{2}-1\right) s_{2}^{2}}{\left(n_{1}+n_{2}\right)-2}} \end{gathered}$$
The $s_{p}$ in the equations is the pooled standard deviation, which estimates the sampling error. The $n$ s denote the sample sizes and the $s^{2} s$ are the variances for the two groups. A key assumption of this test is that the variances from the two groups are equal. Some researchers are uncomfortable making this assumption-or it may not be tenable-so they use the estimator shown in Equation 2.15, which is called Welch’s $t$-test. ${ }^{33}$
$$t^{\prime}=\frac{\bar{x}-\bar{y}}{\sqrt{\frac{\operatorname{var}(x)}{n_{1}}+\frac{\operatorname{var}(y)}{n_{2}}}}$$
Since the $t^{\prime}$ does not follow the $t$-distribution, we must rely on special tables to determine the probability of a difference between the two means when using Welch’s test. Fortunately, $R$ and other statistical software provide both versions of the $t$-test.

Here’s an example of a $t$-test that uses litters 3 and 4 from the earlier puppy samples. As a reminder, the weights in ounces are

Litter 3: $[39,55,56,58,61,66,69]$
Litter 4: $[42,44,48,55,57,60,66]$
The means are $57.7$ and $53.1$, with a difference of 4.6. A t-test returns a $t$-value of $0.92$ with a $p$-value of $0.37$ and a CI of ${-6.2,15.4}$. The interpretations of the two inferential measures are:
$p$-value: if we take many, many samples from the two populations of puppies and the difference in the population means is zero, we expect to find a difference in sample means of $4.6$ ounces or more approximately 37 times, on average, out of every 100 pairs of samples we examine.
$95 \%$ CI: given a difference of $4.6$ ounces, we are $95 \%$ confident that the difference in the population means falls in the interval $-6.2$ and $15.4$.

## 统计代写|linear regression代写线性回归代考|Examples Using $R$

The file Nations2018.csv ${ }^{37}$ is a small dataset that contains data from eight nations. The variables are public expenditures (expend), a measure of government expenditures on individual and collective goods and services as a percentage of the nation’s gross domestic product, openness to trade with other nations (econopen), and the percentage of the labor force that is unionized (perlabor). Let’s use $R$ to compute some of the statistics discussed in this chapter. To begin, after importing the dataset and installing the $R$ package psych, ${ }^{38}$ use the following code to obtain descriptive statistics for the public expenditures variable:

R code
library (psych) # to activate the package
describe (Nations2018\$expend) R output (abbreviated)$\begin{array}{llllllll} & 8 & 19.79 & 2.87 & 19.8 & 19.8 & 1.85 & 14.1\end{array}$range skew kurtosis se$9.3-0.6-0.62 \quad 1.01$The describe function provides various statistics, including the mean, standard deviation (sd), median, trimmed mean, median absolute deviation (mad), range, skewness, kurtosis, and standard error of the mean (se). The$95 \%$CI for the mean is simple to calculate using the t.test function (e.g., t.test (Nations 2018 sexpend)). R also has several user-written packages that include CI functions (e.g., Hmisc). For public expenditures, the$95 \%$CI from the t.test function is$17.39$and 22.19. How should we interpret it? Compute the correlation and covariance between public expenditures and economic openness (hint: see the earlier$\mathrm{R}$function, but you might also wish to review the documentation for the psych package for similar functions). You should find a correlation of$0.64$and a covariance of$36.36$. Let’s examine another dataset. Open the data file GSS2018.csv.${ }^{39}$The dataset contains a variable called female, which includes two categories: male and female.${ }^{40}$We’ll use it to compare personal income (labeled pincome) for these two groups using a$t$-test.$R$code t.test (GSS2018\$pincome GSS2018\$female) What does the output show? What is the$t$-value? What is the$p$-value? The$95 \%$CI? How should we interpret the$95 \%$CI? Suppose we wish to test a conceptual model that proposes that males have higher incomes than females in the U.S. Are the results consistent with this model? Let’s practice building some graphs using the variables pincome and sei in the GSS2018 dataset. What do kernel density plots show about them?$?^{4}$Box-and-whisker plots? 12 What measures of central tendency are most appropriate for these variables? If one of them is skewed, can you find a transformation that normalizes its distribution? ## 统计代写|linear regression代写线性回归代考|Chapter Exercises The dataset called American.csv consists of data from a 2004 national survey of adults in the U.S. Our objective is to examine some variables from this dataset. In addition to an identification variable (id), they include: • educate: years of formal education. • american: a continuous measure of what the respondent thinks it means to be “an American” that ranges from believing that being an American means being a Christian, speaking English only, and being born in the U.S. (high end of the scale) to not seeing these as indicators of being an American (low end of the scale). • group: a binary variable that indicates whether or not the respondent is an immigrant to the U.S. After importing the dataset into$R$, complete the following exercises: 1. Compute the means, medians, standard deviations, variances, skewnesses, and standard errors of the means for the variables educate and american. 2. Furnish the number of respondents in each category of the group variable, followed by the percentage of respondents in each category of this variable. What percentage of the sample is in the “Not immigrant” category? What percentage of the sample is in the “Immigrant” category? 1. Conduct a$t$-test (Welch’s version) that compares the means of the variable american for those in the “Not immigrant” group and those in the “Immigrant” group. Report the means for the two groups, the$p$-value from the$t$-test, and the$95 \%$CI from the$t$-test. Interpret the$p$-value and the$95 \%$CI. 2. What is the Pearson’s correlation of educate and american? What is the$95 \%$CI of the correlation? Provide a brief interpretation of the Pearson’s correlation. 3. Create a kernel density plot and a box plot of the variable american. Describe its distribution. 4. Challenge: use R’s plot function to create a scatter plot with educate on the$x$-axis and american on the$y$-axis. Describe the pattern shown by the scatter plot. Why is a scatter plot limited in this situation? Search within$R$or online for the R function jitter. Use this function to modify the scatter plot. Why is the scatter plot still of limited use for understanding the association between the two variables? ## linear regression代写 ## 统计代写|linear regression代写线性回归代考|Comparing Means from Two Groups 我们提到了均值比较检验，吨-测试，在本章前面比较两窝小狗的重量时。让我们更详细地回顾一下这个测试。首先，回想一下，我们可以比较分布中的许多统计数据，包括标准偏差和标准误差。然而，一个常见的练习是从推断的意义上评估一个群体的平均值是否可能不同于另一个群体的平均值。如果我们从两个总体中抽取样本，我们应该考虑抽样误差。我们的样本可能具有与真实总体均值不同的均值， 所以我们应该考虑到这种可能的变化。一种吨-test 旨在通过首先获取样本均值之间的差异，然后评估假定的抽样误差来评估两种均值在总体中是否可能不同。 名字吨使用 -test 是因为吨-作为测试基础的值遵循学生的吨-分配。32当样本量大于 50 时，这种分布与正态分布几乎无法区分。在较小的样本量下，吨-分布的尾部较粗，中间比正态分布更平。 方程2.13和2.14演示如何计算常规吨-假设平均值来自两个独立总体的测试。 吨=X¯−是¯sp1n1+1n2 在哪里 sp=(n1−1)s12+(n2−1)s22(n1+n2)−2 这sp方程中是汇总标准偏差，它估计了抽样误差。这ns 表示样本大小和s2s是两组的方差。该检验的一个关键假设是两组的方差相等。一些研究人员对做出这个假设感到不舒服——或者它可能站不住脚——所以他们使用方程 2.15 中显示的估计量，称为 Welch’s吨-测试。33 吨′=X¯−是¯曾是⁡(X)n1+曾是⁡(是)n2 由于吨′不遵循吨-分布，我们在使用韦尔奇检验时必须依靠特殊的表格来确定两个均值之间存在差异的概率。幸运的是，R和其他统计软件提供两个版本的吨-测试。 这是一个示例吨- 使用早期小狗样本中的第 3 和第 4 窝的测试。提醒一下，以盎司为单位的重量是 垃圾3：[39,55,56,58,61,66,69] 垃圾4：[42,44,48,55,57,60,66] 手段是57.7和53.1，相差 4.6。t 检验返回一个吨-的价值0.92与p-的价值0.37和一个 CI−6.2,15.4. 两种推论测度的解释是： p-value：如果我们从两个小狗群体中抽取很多很多样本，并且群体均值的差异为零，我们希望找到样本均值的差异4.6在我们检查的每 100 对样品中，平均大约 37 次。 95%CI：给定一个差异4.6盎司，我们是95%确信总体均值的差异落在区间内−6.2和15.4. ## 统计代写|linear regression代写线性回归代考|Examples Using R 文件 Nations2018.csv37是一个包含来自八个国家的数据的小型数据集。变量是公共支出（支出），衡量政府在个人和集体商品和服务上的支出占国家国内生产总值的百分比，与其他国家的贸易开放度（econopen），以及劳动力的百分比工会（perlabor）。让我们使用R计算本章讨论的一些统计数据。首先，在导入数据集并安装R包装心理，38使用以下代码获取公共支出变量的描述性统计数据： R代码 库（psych）#激活包 describe（Nations2018$ expend）
R输出（略）
819.792.8719.819.81.8514.1

9.3−0.6−0.621.01

Rcode
t.test (GSS2018 $pincome GSS2018$ female)

## 统计代写|linear regression代写线性回归代考|Chapter Exercises

• 教育：多年的正规教育。
• 美国人：对受访者认为成为“美国人”意味着什么的连续衡量，范围从相信成为美国人意味着成为基督徒、只会说英语、出生在美国（量表的高端）到不相信将这些视为作为美国人的指标（规模的低端）。
• group：一个二元变量，表示受访者是否是美国移民 将
数据集导入到R，完成以下练习：
1. 计算变量education 和american 的均值、中位数、标准差、方差、偏度和标准误。
2. 提供组变量的每个类别中的受访者数量，然后是该变量的每个类别中的受访者百分比。样本的百分比在“不”中

1. 进行一次吨-test（Welch 的版本）比较“非移民”组和“移民”组的变量 American 的均值。报告两组的均值，p-值来自吨-测试，并且95%来自 CI吨-测试。解释p-价值和95%那里。
2. 皮尔逊教育与美国的相关性是什么？是什么95%CI 的相关性？提供 Pearson 相关性的简要解释。
3. 创建变量美国的核密度图和箱线图。描述其分布。
4. 挑战：使用 R 的 plot 函数创建散点图，并在X-轴和美国是-轴。描述散点图显示的模式。为什么散点图在这种情况下受到限制？内搜索R或在线获取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 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。