【问题标题】:Model extraction with polynomial involved涉及多项式的模型提取
【发布时间】:2020-08-16 22:55:47
【问题描述】:

我想提取定义我的模型的函数。 我正在使用 lme4Rstudio 中的 lmer 函数来获取模型。我正在使用的函数如下所示:

model<-lmer(y~poly(x, 6)+ z +(1|d))
  

显示估算值和其他内容:

summary(model)

我假设该函数如下所示: y~intercept+x*0.3418+x^2*-0.1.....+x^6*0.05871+z*-0.002566

如果我为 x 和 z 插入值,则预测的 y 值与它们应该达到的值相差甚远。 当我绘制图表时,它显示了现实的价值。

plot(x, predict(Model))

summary(Modeltest)
Linear mixed model fit by REML. t-tests use Satterthwaite's method 
Formula: sum.ARM.g.cm³.ges ~ poly(Baumalter.bei.Jahrringsbildung, 6) +  
    Bonität.h100.gemessen.interpoliert + (1 | Baumnummer)

REML criterion at convergence: -8023.5

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.3263 -0.5221 -0.0344  0.6118  3.1398 

Random effects:
 Groups     Name        Variance  Std.Dev.
 Baumnummer (Intercept) 0.0010255 0.03202 
 Residual               0.0001138 0.01067 
Number of obs: 1307, groups:  Baumnummer, 12

Fixed effects:
                                           Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)                               5.841e-01  4.858e-02  1.000e+01  12.024 2.87e-07 ***
poly(Baumalter.bei.Jahrringsbildung, 6)1  3.418e-01  1.114e-02  1.289e+03  30.675  < 2e-16 ***
poly(Baumalter.bei.Jahrringsbildung, 6)2 -1.066e-01  1.122e-02  1.289e+03  -9.506  < 2e-16 ***
poly(Baumalter.bei.Jahrringsbildung, 6)3 -1.467e-01  1.092e-02  1.289e+03 -13.441  < 2e-16 ***
poly(Baumalter.bei.Jahrringsbildung, 6)4  1.547e-01  1.081e-02  1.289e+03  14.305  < 2e-16 ***
poly(Baumalter.bei.Jahrringsbildung, 6)5 -6.797e-02  1.073e-02  1.289e+03  -6.334 3.30e-10 ***
poly(Baumalter.bei.Jahrringsbildung, 6)6  5.871e-02  1.072e-02  1.289e+03   5.474 5.27e-08 ***
Bonität.h100.gemessen.interpoliert       -2.566e-03  1.415e-03  1.000e+01  -1.814   0.0998 .  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) p(B..J,6)1 p(B..J,6)2 p(B..J,6)3 p(B..J,6)4 p(B..J,6)5 p(B..J,6)6
pl(B..J,6)1 -0.005                                                                  
pl(B..J,6)2 -0.003  0.079                                                           
pl(B..J,6)3 -0.001  0.040      0.057                                                
pl(B..J,6)4  0.003 -0.017      0.004      0.014                                     
pl(B..J,6)5  0.001 -0.020     -0.025     -0.011      0.002                          
pl(B..J,6)6  0.001 -0.012     -0.021     -0.020     -0.008      0.004               
Bntth100gms -0.982  0.005      0.004      0.002     -0.003     -0.001     -0.001   

希望大家帮我找个合适的功能。

【问题讨论】:

  • 您能简单地复制并粘贴摘要中的输出吗?
  • 完成,格式化很抱歉
  • 你需要把随机效果加回去吗?你能说得更清楚一点吗?

标签: r modeling polynomials


【解决方案1】:

这不是 lme4 特有的问题,它与 poly() 函数有关。默认情况下poly() 创建一个正交多项式;这不一定是一个容易重构的函数。你可以试试poly(x, 6, raw=TRUE),它会给你一个b0+b1*x+b2*x^2+...形式的“原始”多项式

this question 详细说明了如何推导正交多项式的系数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-02
    • 1970-01-01
    • 2012-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-19
    相关资源
    最近更新 更多