0

为什么 glmulti R 包中的函数在 lmer 拟合(线性混合模型)和 gls 拟合模型(lme 包)上不能很好地工作:

A. 提取模型平均系数?它的 coef 函数不起作用。

我在 lmer 拟合模型(即混合模型)上使用了 glmulti R 包并运行了模型选择。但是我没有进行模型平均,因为即使我应用了这里提到的包装器 getfit() 函数glmulti 和 liner 混合模型,coef 函数也不起作用

B. 它的 level=2 选择,即专用于在 glmulti 对象上包含成对交互的部分?它有时会起作用,在另一种情况下会失败。例如,当它失败时我收到此错误消息。我选择了不同的方法=“h”,“g”,“d”来查看故障是否与计算能力有关,但没有一个选择有效。“.jnew("glmulti/ModelGenerator", y, .jarray(xc), .jarray(xq), : java.lang.ArrayIndexOutOfBoundsException: 10 中的错误:”另一个问题是,一旦我在新的glmulti,那些工作良好的以前的作品将不再工作。

C. 如果我使用 MuMIn 包中的模型平均函数并将我的推断基于其输出,会产生多大的差异?我的担忧来自 glmulti 包的作者对 MuMIn 包的批评。他们说“*MuMIn 可以处理包含交互的公式,但它将交互视为标准变量,这引发了几个问题”,请参阅第 4 页的倒数第二段http://www.jstatsoft.org/v34/i12/paper

非常感谢您的帮助 :)

感谢 Ben 的快速回复和建议。这是我的数据。Block 和 Composition 用作随机效应因子,六个变量(TShann、Alt、Slope、CPT、MAT 和 MARF)用作固定效应因子(协变量)。我想研究这六个变量对收益率的主要和成对交互影响。

Blocks  TShann  Alt Slope   CPT MAT MARF    PlotID  Layer   Composition Yeild
Block1  1.82    87  1   98.65   2.6 625 B1P1    0-10cm  Pa,Ps   37.42
Block1  1.77    138 1   25.71   2.4 638 B1P2    0-10cm  Bp,Pa   42.47
Block1  1.57    139 1   16.5    2.4 638 B1P3    0-10cm  Bp,Pa   54.87
Block1  1.93    138 1   63.3    2.5 637 B1P4    0-10cm  Bp,Pa   51.93
Block1  1.89    114 2   75.11   2.6 631 B1P5    0-10cm  Bp,Ps   27.27
Block1  1.04    112 1   99.39   2.5 631 B1P6    0-10cm  Pa  47.66
Block1  1.02    120 1   0.31    2.3 625 B1P7    0-10cm  Bp  47.62
Block1  1.06    120 1   0.98    2.3 624 B1P8    0-10cm  Bp  41.31
Block1  1.09    119 1   99.08   2.2 623 B1P9    0-10cm  Ps  39.69
Block1  1.07    134 1   98.77   2.1 624 B1P10   0-10cm  Pa  46.55
Block1  1.12    124 2   2.48    2.2 623 B1P11   0-10cm  Bp  40.55
Block1  2.45    233 1   74.2    1.4 639 B1P12   0-10cm  Bp,Pa,Ps    40.28
Block1  2   219 2   79.15   1.4 639 B1P13   0-10cm  Bp,Ps   25.31
Block1  1   101 1   100 1.8 622 B1P14   0-10cm  Ps  22.72
Block1  1.8 97  1   76.35   1.9 622 B1P15   0-10cm  Bp,Ps   28.54
Block1  1.16    143 1   97.95   1.8 634 B1P16   0-10cm  Ps  22.4
Block1  1.73    139 2   100 1.8 633 B1P17   0-10cm  Pa,Ps   24.26
Block1  1.05    110 1   99.19   2   633 B1P18   0-10cm  Pa  33.76
Block1  2.03    130 2   99.75   2.1 634 B1P19   0-10cm  Pa,Ps   36.86
Block1  1.57    119 1   83.18   2.2 628 B1P20   0-10cm  Bp,Pa   42.5
Block1  1.05    135 2   100 2   637 B1P21   0-10cm  Ps  22.44
Block1  1.99    126 1   100 2.1 635 B1P22   0-10cm  Pa,Ps   39.58
Block1  1.18    122 1   100 2.1 634 B1P23   0-10cm  Pa  37.67
Block1  1.9 151 2   74  1.9 637 B1P24   0-10cm  Bp,Pa   49.77
Block1  2.55    136 1   86.87   2.1 635 B1P25   0-10cm  Bp,Pa,Ps    38.21
Block1  2.97    108 1   70.06   2.1 636 B1P26   0-10cm  Bp,Pa,Ps    31.7
Block1  2.31    119 1   91.18   2.5 636 B1P27   0-10cm  Pa,Ps   36.8
Block1  2.13    111 2   51.16   2.5 636 B1P28   0-10cm  Bp,Pa   45.83
Block1  1   422.8   2   0   7.3 711 B2P1    0-10cm  Fs  37.59
Block2  1   389.93  1   0   7.4 697 B2P2    0-10cm  Fs  35.08
Block2  1.68    323.1   1   2.96    7.8 636 B2P3    0-10cm  Ap,Fe   40.07
Block2  1.43    272.7   1   0   7.9 631 B2P4    0-10cm  Fe  38.47
Block2  1.19    337.04  1   0   7.8 637 B2P5    0-10cm  Qp  34.49
Block2  2   284 1   0   7.8 638 B2P6    0-10cm  Fs,Qp   30.55
Block2  1.3 479.9   1   92.69   6.9 755 B2P7    0-10cm  Pa  60.06
Block2  1.27    328.52  1   94.19   7.8 643 B2P8    0-10cm  Pa  35.41
Block2  2.86    371.96  1   0   7.4 697 B2P9    0-10cm  Ap,Fe,Fs    33.21
Block2  2.94    381.31  2   0   7.4 697 B2P10   0-10cm  Ap,Fe,Fs    41.88
Block2  2.36    457.82  1   0   7.1 736 B2P11   0-10cm  Fe,Fs   39.86
Block2  2.29    382.73  1   0   7.3 694 B2P12   0-10cm  Fs,Qp   32.56
Block2  2.8 301.09  1   0   8   611 B2P13   0-10cm  Ap,Fe,Qp    33.91
Block2  2.49    323.66  1   63.24   7.8 643 B2P14   0-10cm  Fs,Pa   39.31
Block2  1.84    378.12  2   69.99   7.4 699 B2P15   0-10cm  Fe,Pa   59.51
Block2  2.72    331.15  2   47.28   7.6 661 B2P16   0-10cm  Fs,Pa,Qp    35.54
Block2  1.68    364.72  1   0   7.5 678 B2P17   0-10cm  Ap,Fs   31.34
Block2  2.3 494.38  1   1.86    6.9 765 B2P18   0-10cm  Ap,Fe   42.31
Block2  2.17    407.45  1   0   7.3 694 B2P19   0-10cm  Ap,Fs,Qp    34.71
Block2  2.79    324.78  1   0   7.7 637 B2P20   0-10cm  Fe,Fs,Qp    38.69
Block2  2.91    391.97  1   0   7.3 694 B2P21   0-10cm  Ap,Fe,Fs,Qp 37.87
Block2  2.52    382.84  1   4.5 7.4 691 B2P22   0-10cm  Fe,Fs   31.91
Block2  2.78    378.29  1   26.12   7.5 658 B2P23   0-10cm  Fs,Pa,Qp    36.13
Block2  2.84    418.17  2   0   7.2 737 B2P24   0-10cm  Ap,Fe,Fs    37.06
Block2  2.86    368.38  1   0   7.5 671 B2P25   0-10cm  Ap,Fs,Qp    30.2
Block2  3.03    391.77  2   4.01    7   755 B2P26   0-10cm  Ap,Fe,Fs    81.08
Block2  3.38    469.13  1   0   7   746 B2P27   0-10cm  Ap,Fe,Fs,Qp 43.39
Block2  2   282.63  1   0   8   611 B2P28   0-10cm  Ap,Fe   55.47
Block2  3.15    401.12  2   3.27    7.3 699 B2P29   0-10cm  Fe,Fs,Qp    43.54
Block2  2.31    415.49  3   0   7.2 737 B2P30   0-10cm  Fs,Qp   36.96
Block2  2.87    458.57  1   0   6.9 758 B2P31   0-10cm  Fe,Fs   43.75
Block2  3.54    387.87  1   0   7.1 745 B2P32   0-10cm  Ap,Fe,Fs    38.18
Block2  3.81    390.85  1   15.3    7.5 681 B2P33   0-10cm  Ap,Fe,Fs,Pa 56.03
Block2  2.38    353.31  3   13.01   7.4 699 B2P34   0-10cm  Fe,Fs,Pa    57.4
Block2  3.07    331.04  1   7.79    7.8 637 B2P35   0-10cm  Fs,Qp   30.48
Block2  2.21    305.31  1   24.12   7.7 641 B2P36   0-10cm  Fe,Pa   63.12
Block2  4.4 430.02  2   4.04    7.2 713 B2P37   0-10cm  Ap,Fe,Fs,Qp 52.17
Block2  3.07    495.57  1   0.82    6.9 765 B2P38   0-10cm  Ap,Fe,Fs    38.47
Block3  2.06    443 2   0   7   581 B3P1    0-10cm  Qc,Qp   23.8
Block3  3.95    470 2   0   13.6    794 B3P2    0-10cm  Oc,Qc,Qi,Qp 39.86
Block3  1.5 416 2   0   13.4    819 B3P3    0-10cm  Oc,Qi   46.73
Block3  1.46    397 2   0   13.6    794 B3P4    0-10cm  Qp  25.5
Block3  3.3 422 2   0   13.6    794 B3P5    0-10cm  Oc,Qi,Qp    38.88
Block3  1   393 1   0   13.7    792 B3P6    0-10cm  Qi  35.99
Block3  1   402 3   0   13.2    728 B3P7    0-10cm  Cs  23.22
Block3  1.8 383 3   0   13.2    747 B3P8    0-10cm  Oc,Qi   49.01
Block3  3   429 2   0   13.4    700 B3P9    0-10cm  Oc,Qc,Qi    30.94
Block3  2.77    438 2   0   13  697 B3P10   0-10cm  Cs,Qi,Qp    47.88
Block3  3.35    379 2   0   14  709 B3P11   0-10cm  Cs,Oc,Qi,Qp 27.39
Block3  1.03    445 2   0   13  695 B3P12   0-10cm  Cs  43.31
Block3  2.15    479 2   0   13  695 B3P13   0-10cm  Cs,Qc   50.85
Block3  2.9 444 2   0   13.5    699 B3P14   0-10cm  Cs,Qc,Qi    47.67
Block3  1   388 1   0   13.5    699 B3P15   0-10cm  Qc  44.33
Block3  1.11    417 2   0   13.4    698 B3P16   0-10cm  Qi  37.9
Block3  2.37    395 2   0   13.6    794 B3P17   0-10cm  Qi,Qp   30.19
Block3  3.85    425 2   0   13.6    794 B3P18   0-10cm  OC,Qc,Qi,Qp 40.14
Block3  2.02    478 2   0   13.3    793 B3P19   0-10cm  Oc,Qc   41.85
Block3  2.55    508 2   0   13.3    792 B3P20   0-10cm  Qc,Qi,Qp    30.98
Block3  1.94    464 2   0   13.4    700 B3P21   0-10cm  Cs,Qi   77.66
Block3  3.66    410 3   0   13.7    707 B3P22   0-10cm  Cs,Oc,Qc,Qi 41.56
Block3  3.43    523 2   0   12.8    691 B3P23   0-10cm  Cs,Qc,Qi,Qp 39.08
Block3  1.86    416 2   0   13.2    694 B3P24   0-10cm  Qc,Qi   43.99
Block3  2.45    355 2   0   13.4    700 B3P25   0-10cm  Cs,OC,Qi    38.63
Block3  2.94    406 1   0   13.2    728 B3P26   0-10cm  Cs,Qc,Qp    40.76
Block3  1.28    421 2   0   13.2    728 B3P27   0-10cm  Qp  40.24
Block3  1.95    418 3   0   13.2    728 B3P28   0-10cm  Cs,Qp   26.31
Block3  2.52    471 2   0   13.6    794 B3P29   0-10cm  Oc,Qc,Qp    40.11
Block3  2.34    389 2   0   13.3    720 B3P30   0-10cm  Cs,Oc   28.59
Block3  1.33    269 2   0   13.9    721 B3P31   0-10cm  Oc  39.22
Block3  3.57    429 2   0   12.4    687 B3P32   0-10cm  Cs,Oc,Qc,Qi,    34.04
Block3  3.74    519 2   0   12.4    687 B3P33   0-10cm  Cs,Qc,Qi,Qp 42.68
Block3  4.74    480 3   0   12.4    687 B3P34   0-10cm  Cs,Oc,Qc,Qp,Qi  40.75
Block3  1   254 2   0   14.1    731 B3P35   0-10cm  Qc  36.14
Block3  2.47    436 2   0   13.2    728 B3P36   0-10cm  Cs,Qc,Qp    28.27
Block4  1.12    182 1   97.71   7   581 B4P1    0-10cm  Pa  41.27
Block4  1.5 157 1   4.37    6.9 585 B4P2    0-10cm  Cb  24.79
Block4  1.13    163 1   97.37   6.9 580 B4P3    0-10cm  Pa  29.14
Block4  3.66    171 1   26.56   6.8 582 B4P4    0-10cm  Bp,Pa,Qr    27.01
Block4  2   176 1   0   6.9 576 B4P5    0-10cm  Cb,Qr   23.39
Block4  3.1 190 1   42.44   6.8 585 B4P6    0-10cm  Bp,Cb,Pa    29.98
Block4  3.8 190 1   35.89   6.8 585 B4P7    0-10cm  Bp,Cb,Pa,Qr 32.7
Block4  2   180 1   0   6.8 585 B4P8    0-10cm  Bp,Cb   23.3
Block4  2.18    195 1   64.67   6.8 584 B4P9    0-10cm  Cb,Pa   27.27
Block4  1.74    145 1   2.92    6.8 582 B4P10   0-10cm  Cb,Qr   28.13
Block4  1.75    185 1   0   6.8 581 B4P11   0-10cm  Bp,Cb   24.78
Block4  1.23    160 1   5.27    6.8 583 B4P12   0-10cm  Cb  23.16
Block4  2.94    160 1   0   6.9 578 B4P13   0-10cm  Bp,Cb,Qr    26.84
Block4  3.65    150 1   70.67   6.9 578 B4P14   0-10cm  Cb,Pa,Ps,Qr 40.99
Block4  2.95    184 1   33.63   6.8 583 B4P15   0-10cm  Cb,Pa,Qr    40.3
Block4  2.35    186 1   45.55   6.8 583 B4P16   0-10cm  Pa,Qr   52.01
Block4  3.95    155 1   57.64   6.9 586 B4P17   0-10cm  Bp,Cb,Ps,Pa 59.3
Block4  3.23    160 1   46.08   6.9 581 B4P18   0-10cm  Cb,Ps,Qr    21.05
Block4  2.16    175 1   97.97   6.9 582 B4P19   0-10cm  Pa,Ps   26.99
Block4  1.73    173 1   1.72    7   576 B4P20   0-10cm  Cb,Qr   36.26
Block4  1.41    170 1   91.64   6.9 577 B4P21   0-10cm  Ps  36.91
Block4  3.34    160 1   71.93   6.9 581 B4P22   0-10cm  Pa,Ps,Qr    30.89
Block4  2.89    170 1   78.58   6.9 582 B4P23   0-10cm  Cb,Pa,Ps,   23.62
Block4  3.54    170 1   31.2    6.9 581 B4P24   0-10cm  Cb,Ps,Qr    29.85
Block4  2.13    171 1   63.18   6.9 585 B4P25   0-10cm  Cb,Ps   33.64
Block4  2.04    165 1   2.58    6.9 582 B4P26   0-10cm  Bp,Cb   36.12
Block4  3.74    175 1   51.14   6.8 581 B4P27   0-10cm  Cb,Pa,Ps,Qr 27.97
Block4  2.29    170 1   62.65   6.8 585 B4P28   0-10cm  Bp,Pa   28.34
Block4  3.55    155 1   53.48   6.8 582 B4P29   0-10cm  Bp,Ps,Qr    26.97
Block4  3.8 140 1   62.64   6.9 576 B4P30   0-10cm  Bp,Cb,Ps,Pa 33.39
Block4  3.68    150 1   27.62   6.9 578 B4P31   0-10cm  Bp,Cb,Pa,Qr 31.3
Block4  4.58    177 1   46.72   6.8 584 B4P32   0-10cm  Bp,Pa,Ps,Qr 42.21
Block4  3.4 184 1   52.43   6.9 582 B4P33   0-10cm  Bp,Cb,Ps    38.73
Block4  3.89    189 1   17.97   7   581 B4P34   0-10cm  Bp,Cb,Ps,Qr 24.84
Block4  4.8 188 1   46.77   6.8 582 B4P35   0-10cm  Bp,Cb,Pa,Ps,Qr  30.23
Block4  3.41    160 1   9.58    6.9 578 B4P36   0-10cm  Bp,Cb,Qr    22.46
Block4  4.62    145 1   57.41   6.9 578 B4P37   0-10cm  Bp,Cb,Pa,Ps,Qr  41.43
Block4  2.53    165 1   66.22   7   573 B4P38   0-10cm  Bp,Cb,Ps    26.37
Block4  4.2 170 1   22.62   7   572 B4P39   0-10cm  Bp,Cb,Ps,Qr 35.88
Block4  1.47    175 1   89.39   6.9 580 B4P40   0-10cm  Ps  28.98
Block4  3.7 200 1   34.21   6.7 585 B4P41   0-10cm  Bp,Pa,Ps,Qr 24.59
Block4  3.97    177 1   53.75   6.8 582 B4P42   0-10cm  Bp,Cb,Pa,Ps,    29.49
Block4  3.28    186 1   74.3    7   570 B4P43   0-10cm  Pa,Ps,Qr    23.52
Block5  1.17    838 2   98.88   5.8 675 B5P1    0-10cm  Pa  44.37
Block5  1   865 2   100 5.8 675 B5P2    0-10cm  Pa  44.63
Block5  3.14    869 2   25.95   5.8 675 B5P3    0-10cm  Ap,Fs,Pa    58.27
Block5  2.08    1019    2   98.23   5.6 687 B5P5    0-10cm  Aa,Pa   36.69
Block5  2.64    1045    2   8.05    5.6 687 B5P6    0-10cm  Ap,Fs   36.08
Block5  1.12    1062    2   97.53   5.2 709 B5P7    0-10cm  Aa  39.41
Block5  3.67    1028    2   40.83   5.4 701 B5P8    0-10cm  Aa,Ap,Fs,Pa 35.27
Block5  2.37    984 2   45.68   5.4 701 B5P9    0-10cm  Fs,Pa   45.6
Block5  3.13    968 2   78.33   5.4 701 B5P10   0-10cm  Aa,Ap,Pa    42.73
Block5  3.08    805 2   69.69   5.8 678 B5P11   0-10cm  Aa,Fs,Pa,   44.43
Block5  2   799 2   48.01   5.7 681 B5P12   0-10cm  Fs,Pa   36.94
Block5  1   812 2   0   5.7 681 B5P13   0-10cm  Fs  27.82
Block5  1.93    909 2   0   5.2 709 B5P14   0-10cm  Ap,Fs   38.01
Block5  1.34    930 3   6.81    5.2 709 B5P15   0-10cm  Ap  73.38
Block5  1.4 972 2   3.26    5.2 709 B5P16   0-10cm  Ap  35.49
Block5  1.96    1047    2   97.16   4.6 742 B5P17   0-10cm  Aa,Pa   43.19
Block5  2.97    1012    2   72.72   4.6 742 B5P18   0-10cm  Aa,Fs,Pa,   39.22
Block5  2.18    951 2   30.92   5.7 681 B5P19   0-10cm  Aa,Fs   31.47
Block5  2.94    869 2   26.36   5.7 681 B5P20   0-10cm  Aa,Ap,Fs    31.62
Block5  2.94    718 2   18.25   5.7 681 B5P21   0-10cm  Ap,Fs,Pa    38.54
Block5  2.89    843 2   75.15   6.2 655 B5P22   0-10cm  Aa,Fs,Pa    34.27
Block5  1.06    894 2   98.99   5.6 688 B5P23   0-10cm  Aa  33.8
Block5  1.96    919 2   59.5    5.6 688 B5P24   0-10cm  Aa,Fs   32.04
Block5  3.12    1030    2   18.55   4.6 742 B5P25   0-10cm  Aa,Ap,Fs    39.01
Block5  1.14    782 2   2.49    5.9 671 B5P26   0-10cm  Fs  37.58
Block5  2.77    738 2   42.01   6.3 652 B5P27   0-10cm  Ap,Pa   55.18
Block5  2.21    655 1   78.03   6.5 643 B5P28   0-10cm  Aa,Fs   44
Block5  3.9 893 2   43.94   5.2 708 B5P29   0-10cm  Aa,Ap,Fs,Pa 50.26
Block6  2.34    1224    2   61.84   9.7 545 B6P1    0-10cm  Ps,Qf   74.58
Block6  3.09    1238    1   28.63   9.7 545 B6P2    0-10cm  Pn,Ps,Qf    73.84
Block6  1.86    1228    2   31.43   9.7 549 B6P3    0-10cm  Pn,Qf   86.92
Block6  1.85    1286    1   30.8    9.7 549 B6P4    0-10cm  Ps,Qf   40.69
Block6  1.83    1283    1   70.89   9.7 549 B6P5    0-10cm  Ps,Qf   67.12
Block6  1.93    1306    2   36.77   9.7 549 B6P6    0-10cm  Pn,Qf   70.71
Block6  2.37    1291    2   10.51   9.7 548 B6P7    0-10cm  Pn,Ps   64.21
Block6  2   1207    2   49.13   9.6 553 B6P8    0-10cm  Pn,Qf   68.93
Block6  1   1211    2   100 9.6 553 B6P9    0-10cm  Qf  38.62
Block6  1   1270    2   100 9.6 553 B6P10   0-10cm  Qf  56.26
Block6  1   1187    2   100 9.9 537 B6P11   0-10cm  Qf  47.39
Block6  1   1073    2   0   10  526 B6P12   0-10cm  Pn  82.37
Block6  2.84    1010    2   73.39   10.8    491 B6P13   0-10cm  Pn,Qf,Qi    98.04
Block6  2.17    999 2   33.5    10.8    491 B6P14   0-10cm  Pn,Qi   84.62
Block6  1.1 980 2   1.87    10.8    491 B6P15   0-10cm  Pn  33.39
Block6  2.12    1032    2   32.46   10.8    491 B6P16   0-10cm  Pn,Qi   68.97
Block6  1.02    960 1   0.34    10.8    491 B6P17   0-10cm  Pn  83.84
Block6  1   1403    1   0   9.1 573 B6P18   0-10cm  Ps  46.3
Block6  1   1310    1   0   9.2 566 B6P19   0-10cm  Ps  93.55
Block6  1   1311    1   0   9.1 569 B6P20   0-10cm  Ps  95.7
Block6  1.98    1404    1   0   9   572 B6P21   0-10cm  Pn,Ps   60.85
Block6  1.99    1325    1   0   9   570 B6P22   0-10cm  Pn,Ps   75.42
Block6  2.32    1388    2   5.1 9.1 569 B6P23   0-10cm  Pn,Ps   61.78
Block6  3.87    1377    1   45.55   9.1 557 B6P24   0-10cm  Pn,Ps,Qf,Qi 82.94
Block6  3.58    1314    2   28.88   9.1 557 B6P25   0-10cm  Pn,Ps,Qf    94.59
Block6  3.87    1387    2   47.63   9.1 557 B6P26   0-10cm  Pn,Ps,Qf,Qi 92.18
Block6  2.98    1322    1   61.02   9.3 551 B6P27   0-10cm  Pn,Qf,Qi    73.52
Block6  1.75    1360    1   100 9.4 541 B6P28   0-10cm  Qf,Qi   47.47
Block6  3.44    1354    2   25.76   9.4 541 B6P29   0-10cm  Pn,Ps,Qf,Qi 30.52
Block6  1.97    1350    1   100 9.4 541 B6P30   0-10cm  Qf,Qi   37.82
Block6  1.85    1342    1   100 9.3 545 B6P31   0-10cm  Qf,Qi   30.81
Block6  1   1236    2   100 10.3    504 B6P32   0-10cm  Qi  64.2
Block6  1   1251    2   100 10.3    504 B6P33   0-10cm  Qi  60.76
Block6  1.59    1250    2   100 10.7    484 B6P34   0-10cm  Qf,Qi   30.09
Block6  2.57    1267    2   49.04   9.9 525 B6P35   0-10cm  Pn,Qi   38.79
Block6  1.99    1211    2   44.14   10.2    511 B6P36   0-10cm  Pn,Qi   60.9
4

1 回答 1

4

这对我有用sessionInfo(),如下所示:

R Under development (unstable) (2014-09-17 r66626)
Platform: i686-pc-linux-gnu (32-bit)

other attached packages:
[1] glmulti_1.0.7 rJava_0.9-6   lme4_1.1-8    Rcpp_0.11.2   Matrix_1.1-4 

loaded via a namespace (and not attached):
[1] compiler_3.2.0  grid_3.2.0      lattice_0.20-29 MASS_7.3-34    
[5] minqa_1.2.3     nlme_3.1-117    nloptr_1.0.4    splines_3.2.0  
[9] tools_3.2.0  

使用以下代码:

library("lme4")
library("glmulti")
dd <- read.table("SO_glmulti.dat",header=TRUE)
m1 <- lmer(Yeild~ (TShann+Alt+Slope+CPT+MAT+MARF)^2+
               (1|Blocks)+(1|Composition),
           data=dd)

请注意,我在这里收到有关预测器缩放的警告——可能是无害的

以前的SO问题

setMethod('getfit', 'merMod', function(object, ...) {
    summ <- coef(summary(object))
    summ1 <- summ[,1:2,drop=FALSE]
    ## if (length(dimnames(summ)[[1]])==1) {
    ##     summ1 <- matrix(summ1, nr=1,
    ##                     dimnames=list(c("(Intercept)"),
    ##                     c("Estimate","Std. Error")))
    ## }
    cbind(summ1, df=rep(10000,length(fixef(object))))
})

这是旧版本的glmulti--又快又脏,但取决于对公式的解析。

lmer.glmulti<-function(formula,data,random="",...) {
    lmer(paste(deparse(formula),random),data=data,
         REML=FALSE,...)
}

更难理解但更健壮:

lmer.glmulti<-function(formula,data,random="",...) {
    newf <- formula
    newf[[3]] <- substitute(f+r,
                            list(f=newf[[3]],
                                 r=reformulate(random)[[2]]))
    lmer(newf,data=data,
         REML=FALSE,...)
}

这就是我最终的结果:

glmulti_lmm <- glmulti(formula(m1,fixed.only=TRUE),
                     random="+(1|Blocks)+(1|Composition)",
                       data=dd,method="g",
                       deltaM=0.5, 
                       fitfunc=lmer.glmulti,
                       intercept=TRUE,marginality=FALSE,level=2)

我一开始尝试默认的method="h",2650后放弃了。在 50 代之后,我的第一次运行method="g"得到了一个相当稳定的 IC,但平均 IC 一直在缓慢下降,所以我不耐烦并提高deltaM到 0.5。

第一次运行我得到了 IC=1651.69761603866 和模型Yeild~1+CPT+CPT:TShann+CPT:Alt+MAT:Alt+MARF:CPT

在第二次运行时(增加了 deltaM),我变得更幸运了(IC=1649.61044009369, Yeild~1+TShann+CPT+CPT:Alt+MAT:CPT+MARF:CPT)。(我不知道是否有办法设置种子/确保可重复性glmulti)。该模型声称在 120 代后收敛。

coef(glmulti_lmm)对我来说很好。输出的底部(权重最高的变量)是:

                  Estimate Uncond. variance Nb models   Importance
[... skip ...]
CPT:MARF      1.334119e-03     5.491836e-07        11 0.7875438701
CPT:MAT       4.051261e-02     5.215084e-04        18 0.7995790960
TShann        1.260082e+00     1.650145e+00        35 0.8111493166
CPT          -9.923303e-01     2.764638e-01        74 0.9600979205
Alt:CPT      -2.465917e-04     7.937155e-09        72 0.9765910742
(Intercept)   3.754893e+01     5.988814e+01       100 1.0000000000

顺便说一句,您可能会对“生态学家高估预测变量在模型平均中的重要性:呼吁谨慎解释”感兴趣,Galipaud 等人。http://dx.doi.org/10.1111/2041-210X.12251

于 2014-09-22T21:46:13.903 回答