【问题标题】:Model selection in R, all models giving the same AIC and BICR中的模型选择,所有模型都给出相同的AIC和BIC
【发布时间】:2017-06-22 20:57:23
【问题描述】:

所以这是我的数据头,

  thickness grains resistivity
1      25.1   14.9      0.0270
2     368.4   58.1      0.0267
3     540.4   77.3      0.0160
4     712.1   95.6      0.0105
5     883.7  113.0      0.0090
6    1055.7  130.0      0.0247

我想为涉及厚度和晶粒的三种不同模型找到 AIC 和 BIC。

AIC(lm(formula = resistivity ~ (1/thickness), data=z)) #142.194
BIC(lm(formula = resistivity ~ (1/thickness), data=z)) #142.9898

AIC(lm(formula = resistivity ~ (1/grains), data=z)) #142.194
BIC(lm(formula = resistivity ~ (1/grains), data=z)) #142.9898

AIC(lm(formula = resistivity ~ (1/thickness) + (1/grains), data=z)) #142.194
BIC(lm(formula = resistivity ~ (1/thickness) + (1/grains), data=z)) #142.9898

我已经评论了每个旁边的输出,为什么它们都一样?

【问题讨论】:

    标签: r model-comparison


    【解决方案1】:

    您获得相同的 AIC 和 BIC,因为模型都是相同的。你只是得到一个常数,电阻率的平均值。

    lm(formula = resistivity ~ (1/thickness), data = z)
      Coefficients:
      (Intercept)  
          0.01898 
    

    问题在于,如果您想要在公式中计算 1/厚度,则必须在公式中通过将计算括在 I() 中来指明这一点。这在help(formula) 中有描述。你想要的是

    lm(formula = resistivity ~ I(1/thickness), data=z)
    lm(formula = resistivity ~ I(1/grains), data=z)
    lm(formula = resistivity ~ I(1/thickness) + I(1/grains), data=z)
    

    【讨论】:

      猜你喜欢
      • 2015-11-24
      • 2018-02-21
      • 1970-01-01
      • 1970-01-01
      • 2021-08-28
      • 2016-11-15
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      相关资源
      最近更新 更多