你如何(以及为什么)使用对比?

发布于 2024-08-23 06:00:59 字数 131 浏览 3 评论 0原文

在什么情况下您会在分析中创建对比?它是如何完成的以及它的用途是什么?

我检查了 ?contrasts?C - 两者都导致“S 中统计模型的第 2 章”,这对我来说不容易获得。

Under what cases do you create contrasts in your analysis? How is it done and what is it used for?

I checked ?contrasts and ?C - both lead to "Chapter 2 of Statistical Models in S", which is not readily available to me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌面超妹 2024-08-30 06:00:59

当您使用因素(即分类变量)作为解释变量来拟合线性模型时,需要进行对比。对比指定了如何将因素的水平编码到一系列数字虚拟变量中以拟合模型。

以下是关于所使用的不同对比种类的一些很好的注释:
http://www.unc.edu/courses /2006spring/ecol/145/001/docs/lectures/lecture26.htm

当使用的对比发生变化时,模型在允许的基础联合概率分布方面保持不变。仅其参数化发生变化。拟合值也保持不变。此外,一旦您获得了一种对比选择的参数值,就可以轻松推导出另一种对比选择的参数值。

因此,对比的选择没有统计结果。这纯粹是为了使系数和假设检验更容易解释。

Contrasts are needed when you fit linear models with factors (i.e. categorical variables) as explanatory variables. The contrast specifies how the levels of the factors will be coded into a family of numeric dummy variables for fitting the model.

Here are some good notes for the different varieties of contrasts used:
http://www.unc.edu/courses/2006spring/ecol/145/001/docs/lectures/lecture26.htm

When the contrasts used are changed, the model remains the same in terms of the underlying joint probability distributions allowed. Only its parametrization changes. The fitted values remain the same as well. Also, once you have the value of the parameters for one choice of contrasts, it is easy to derive what the value of the parameters for another choice of contrasts would have been.

Therefore the choice of contrasts has no statistical consequence. It is purely a matter of making coefficients and hypothesis tests easier to interpret.

风为裳 2024-08-30 06:00:59

看看 此处(第365-370页,可免费查看)。第 364 页开始对植物竞争实验进行单向方差分析。第 364 页中缺少的代码是:

comp<-read.table("c:\\temp\\competition.txt",header=T)
attach(comp)
names(comp)
[1] "biomass" "clipping"
The categorical explanatory variable is clipping and it has five levels as follows:
levels(clipping)
...

对比的定义稍后在第 368 页上给出(在同音异义段落中)。如果您想遵循示例,可以下载数据集。请参阅我的帖子

强烈推荐这本书是毫无疑问的。

Take a look here (pages 365-370, which are free to view). On page 364 starts a one-way analysis of variance of a plant competition experiment. The code from page 364 that is missing is:

comp<-read.table("c:\\temp\\competition.txt",header=T)
attach(comp)
names(comp)
[1] "biomass" "clipping"
The categorical explanatory variable is clipping and it has five levels as follows:
levels(clipping)
...

The definition of contrasts is given later, on page 368 (in the homonym paragraph). If you want to follow the examples, you can download the datasets. See my post here.

It is out of the question that the book is highly recommended.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文