gpt4 book ai didi

r - 非图形线性估计

转载 作者:行者123 更新时间:2023-12-01 09:09:21 25 4
gpt4 key购买 nike

在我的previous post ,我正在寻找 R 中的相关比(η 或 η2)例程。令我惊讶的是,在 GLM 程序中没有人使用 η 进行线性检查。

如何检查双变量相关性的线性?仅使用散点图?

有几种方法可以做到这一点,一种方法是比较线性和非线性模型R2,然后应用F检验来寻找它们之间的显着差异。

如何以“非图形”方式检查线性度?

最佳答案

答案就是您所说的(比较线性模型和非线性模型)。例如

model1<-lm(yv~xv)
model2<-lm(yv~xv+I(xv^2)) #Even if we restrict ourselves to the inclusion of a quadratic term, there are many curves we can describe, depending upon the signs of the linear and quadratic terms

anova(model1,model2)

Analysis of Variance Table

Model 1: yv ~ xv
Model 2: yv ~ xv + I(xv^2)
Res.Df RSS Df Sum of Sq F Pr(>F)
1 16 91.057
2 15 68.143 1 22.915 5.0441 0.0402 *

更复杂的曲线模型是对线性模型的显着改进 (p=0.04),因此,在这种情况下,我们接受数据中存在弯曲的证据。

关于r - 非图形线性估计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3013772/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com