繁体   English   中英

R中的模型选择,所有模型都给出相同的AIC和BIC

[英]Model selection in R, all models giving the same AIC and BIC

所以这是我的数据的头,

  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

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

您获得相同的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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM