拟合R中的Redlich-Kister方程

时间:2013-12-15 08:51:30

标签: r statistics

我的一位朋友请求帮助,以便在R中使用Redlich-Kister方程式。我从this article获取表3的前三列(也在下图中显示)并使用以下R代码。我得到的结果不同于文章输出。任何帮助解决这个问题将受到高度赞赏。感谢

Data <-
structure(list(X2 = c(0, 0.0048, 0.0086, 0.0131, 0.0188, 0.0261,
0.0411, 0.0561, 0.0768, 0.0935, 0.1425, 0.1993, 0.2799, 0.3524,
0.4103, 0.4553, 0.5505, 0.6562, 0.7295, 0.8186, 0.8825, 0.9584,
1), d5 = c(0.99996, 0.9998, 0.99972, 0.99972, 0.9998, 1.00021,
1.00129, 1.00278, 1.00486, 1.00652, 1.00968, 1.00943, 1.00453,
0.99806, 0.99251, 0.98837, 0.97969, 0.97136, 0.96601, 0.96058,
0.95709, 0.95345, 0.95155), V5 = c(NA, -0.015, -0.028, -0.046,
-0.069, -0.105, -0.184, -0.274, -0.403, -0.51, -0.796, -1.037,
-1.224, -1.274, -1.257, -1.224, -1.081, -0.874, -0.691, -0.473,
-0.308, -0.114, NA)), .Names = c("X2", "d5", "V5"), class = "data.frame", row.names = c(NA,
-23L))

fm1 <-
  lm(
  formula=
     V5 ~ -1 +
          I(X2*(1-X2)) +
          I(X2*(1-X2)*(1-2*X2)) +
          I(X2*(1-X2)*(1-2*X2)^2) +
          I(X2*(1-X2)*(1-2*X2)^3) +
          I(X2*(1-X2)*(1-2*X2)^4) +
          I(X2*(1-X2)*(1-2*X2)^5)
   , data = Data)

summary(fm1)$coef

输出

                                   Estimate Std. Error     t value     Pr(>|t|)
I(X2 * (1 - X2))                  -4.636138 0.01554354 -298.267899 1.017962e-29
I(X2 * (1 - X2) * (1 - 2 * X2))   -2.729863 0.07286814  -37.463052 3.095331e-16
I(X2 * (1 - X2) * (1 - 2 * X2)^2) -1.695933 0.15189170  -11.165411 1.150270e-08
I(X2 * (1 - X2) * (1 - 2 * X2)^3) -1.658202 0.39261960   -4.223432 7.371920e-04
I(X2 * (1 - X2) * (1 - 2 * X2)^4)  3.010149 0.23867895   12.611709 2.184653e-09
I(X2 * (1 - X2) * (1 - 2 * X2)^5)  4.492079 0.45676290    9.834596 6.220233e-08

enter image description here enter image description here enter image description here enter image description here

1 个答案:

答案 0 :(得分:1)

我在表格中找不到您的数据,所以我自己输入:

Data <- data.frame(X2=c(0, 0.0059,0.0111,0.0209,0.0334,0.0462,0.06,0.0771,0.1145,0.1621,
                        0.2259,0.316,.378,.4361,.5214,.6594,.7835,.9103,.9545,1),
                   V5=c(NA,-.041,-.081,-.165,-.284,-.415,-.562,-.734,-1.055,-1.365,-1.618,-1.764,
                        -1.777,-1.726,-1.582,-1.232,-.882,-.414,-.217,NA))

然后我仔细研究了结果表并发现它们符合七度多项式(对于DMEA):

Data$V5x <- Data$V5/(Data$X2)/(1-Data$X2)
Data$X2a <- 1-2*Data$X2
fm1 <- lm(V5x ~ poly(X2a, 7, raw=TRUE), data = Data)

summary(fm1)$coef

#                            Estimate Std. Error     t value     Pr(>|t|)
#(Intercept)                -6.512876 0.03473349 -187.510013 4.573934e-19
#poly(X2a, 7, raw = TRUE)1  -4.066934 0.16822455  -24.175629 3.338491e-10
#poly(X2a, 7, raw = TRUE)2  -1.033662 0.43270844   -2.388819 3.803527e-02
#poly(X2a, 7, raw = TRUE)3   3.495208 1.15371167    3.029533 1.268724e-02
#poly(X2a, 7, raw = TRUE)4  -7.186365 1.24383354   -5.777594 1.783191e-04
#poly(X2a, 7, raw = TRUE)5 -10.215220 2.37360372   -4.303676 1.552439e-03
#poly(X2a, 7, raw = TRUE)6   8.982591 0.96372896    9.320661 3.017317e-06
#poly(X2a, 7, raw = TRUE)7  10.151813 1.50463933    6.747007 5.060875e-05

这与他们的结果类似(对于DMEA,5)。差异可能是由于我使用的数据中的拼写错误,舍入错误或使用数字优化器。