你如何(以及为什么)使用对比?
在什么情况下您会在分析中创建对比?它是如何完成的以及它的用途是什么?
我检查了 ?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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用因素(即分类变量)作为解释变量来拟合线性模型时,需要进行对比。对比指定了如何将因素的水平编码到一系列数字虚拟变量中以拟合模型。
以下是关于所使用的不同对比种类的一些很好的注释:
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.
看看 此处(第365-370页,可免费查看)。第 364 页开始对植物竞争实验进行单向方差分析。第 364 页中缺少的代码是:
对比的定义稍后在第 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:
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.