加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

R语言中多维数据的方差分解及forward selection

(2010-07-25 22:54:07)
标签:

杂谈

所谓方差分解的内涵是这样的。一组数据(Y),说,我很复杂;另外一组数据说,我也很复杂(E);第三组数据说,不好,我也复杂(S)。这个复杂,用方差来表征。而方差之间是可以相互解释的。1、2、3组数据的复杂,两两间有共通部分。2用尽全力,可以解释1中的一部分(a),3用尽全力,也可以解释1中的一部分(b)。1、2合力,也可以解释一部分(c)。而1、2合力也解释不了的部分为d。下面是这样:
library(vegan)
rda(Y, E) 

Call:

rda(X = Y, Y = E)

 

Partitioning of variance:

              Inertia Proportion

Total          6.0000     1.0000

Constrained    5.2692     0.8782  the percentage E can explained

Unconstrained  0.7308     0.1218

 

Eigenvalues, and their contribution to the variance

 

Importance of components: 

                      RDA1   RDA2   RDA3   RDA4    RDA5    RDA6   PC1    PC2

Eigenvalue            4.92 0.1194 0.1059 0.0825 0.02988 0.00723 0.384 0.2034

Proportion Explained  0.82 0.0199 0.0176 0.0138 0.00498 0.00120 0.064 0.0339

Cumulative Proportion 0.82 0.8406 0.8583 0.8720 0.87699 0.87819 0.942 0.9760

                         PC3     PC4    PC5      PC6

Eigenvalue            0.0860 0.04641 0.0108 0.000616

Proportion Explained  0.0143 0.00773 0.0018 0.000100

Cumulative Proportion 0.9904 0.99810 0.9999 1.000000

 

Importance of components:

                       RDA1   RDA2   RDA3   RDA4    RDA5    RDA6

Eigenvalue            4.924 0.1194 0.1059 0.0825 0.02988 0.00723

Proportion Explained  0.935 0.0227 0.0201 0.0157 0.00567 0.00137

Cumulative Proportion 0.935 0.9572 0.9773 0.9930 0.99863 1.00000


Scaling 2 for species and site scores

* Species are scaled proportional to eigenvalues

* Sites are unscaled: weighted dispersion equal on all dimensions

* General scaling constant of scores:  3.0274


同样可以得到S可以解释的部分,比如说是0.7345

然后求E+S可以解释的部分,实际是求E+S不可以解释的部分

 

Call: 

rda(X = Y, Y = E, Z = S)

 

Partitioning of variance:

              Inertia Proportion

Total          6.0000     1.0000

Conditioned    4.9624     0.8271

Constrained    0.7868     0.1311

Unconstrained  0.2508     0.0418这是不可解释的部分

 

Eigenvalues, and their contribution to the variance

after removing the contribution of conditiniong variables

 

Importance of components:

                       RDA1  RDA2  RDA3   RDA4   RDA5     RDA6   PC1    PC2     PC3

Eigenvalue            0.393 0.206 0.109 0.0669 0.0127 0.000254 0.165 0.0822 0.00331

Proportion Explained  0.378 0.198 0.105 0.0645 0.0122 0.000240 0.159 0.0792 0.00319

Cumulative Proportion 0.378 0.577 0.681 0.7458 0.7581 0.758310 0.918 0.9968 1.00000

 

Accumulated constrained eigenvalues

Importance of components:

                       RDA1  RDA2  RDA3   RDA4   RDA5     RDA6

Eigenvalue            0.393 0.206 0.109 0.0669 0.0127 0.000254

Proportion Explained  0.499 0.261 0.138 0.0850 0.0162 0.000320

Cumulative Proportion 0.499 0.760 0.898 0.9835 0.9997 1.000000

 

Scaling 2 for species and site scores

* Species are scaled proportional to eigenvalues

* Sites are unscaled: weighted dispersion equal on all dimensions

* General scaling constant of scores:  3.0274

 

 

Species scores

 

           RDA1     RDA2     RDA3     RDA4     RDA5      RDA6

氨基酸  0.05032 -0.23450 -0.03096 -0.16156  0.09800 -0.005019

糖类    0.33094 -0.06727  0.28093 -0.14253 -0.03792  0.004606

羧酸   -0.16719  0.47500  0.06466 -0.12253  0.03184 -0.002039

杂类    0.67220  0.16830 -0.08843  0.07567  0.02936 -0.001875

聚合物  0.04102 -0.01976  0.01194 -0.03390 -0.05905 -0.017668

酰胺类  0.07963  0.01456 -0.27193 -0.18408 -0.05490  0.004679

 

 

Site scores (weighted sums of species scores)

 

       RDA1     RDA2     RDA3    RDA4    RDA5    RDA6

1  -0.17227 -0.01607  0.32489  0.4627  0.4424  1.1243

2   0.03381 -0.06797  0.40757  0.2167  0.7958 -4.5834

3   0.12764  0.19025 -0.71172 -0.9496 -1.3782  3.7444

4  -0.31396 -0.85269  0.30681  1.9064 -0.4643 -0.3825

5   1.15855  1.55876 -0.66518 -1.1845 -0.8376 -0.5405

6  -0.26971 -0.53186  0.79232 -0.3373  1.5398  0.4933

7  -1.54211  1.21819 -0.23281  1.1187  2.9660 -2.4333

8  -0.49221 -1.51228 -1.40678 -0.3923 -0.8610 -0.3740

9  -0.13254  0.64827 -1.36074  0.8335  0.3608 -0.1458

10 -0.66728 -1.74427  1.32106 -2.4978 -1.1574  2.8262

11  0.51853  0.09139  0.33940 -1.2221 -2.3344  2.7709

12  1.49327  0.69983  1.09911  1.4157  0.1561 -1.2784

13 -0.74239  0.89492  0.65436 -1.2385 -2.3846  3.8700

14 -0.39911  0.21786 -0.08959  0.7703 -0.2570 -2.9781

15  1.39979 -0.79434 -0.77872  1.0982  3.4135 -2.1131

 

 

Site constraints (linear combinations of constraining variables)

 

      RDA1     RDA2     RDA3     RDA4     RDA5    RDA6

1  -0.1168 -0.08062  0.48359 -0.08457 -1.04381  0.6948

2  -0.1709 -0.10535  0.51584 -0.70106  0.14110 -0.1560

3   0.2682  0.25749 -0.98455  0.59406  0.93431 -0.4662

4  -0.5545 -1.42253  0.48514  1.60379 -0.23390  0.2061

5   0.8365  0.74262 -0.43210 -1.45682 -0.31975 -0.3052

6   0.2400  0.72676  0.46573 -0.05336  0.39269  0.1382

7  -1.7179  0.79651  0.06406  0.07296  1.48611 -0.7389

8  -0.2515 -0.78766 -1.70120  0.18889 -0.37670 -0.4047

9  -0.2480  0.45277 -1.17910  0.05373 -0.71183  1.6386

10 -0.4708 -1.40809  1.05975 -1.41720  0.18073  0.1998

11  0.5567 -0.07437  0.18673 -0.04788 -0.39332 -0.7487

12  1.4485  0.72737  1.10766  1.22088  0.06150 -0.0895

13 -0.6971  0.93150  0.39169  0.10566  0.06296  1.2762

14 -0.4006  0.27261  0.01626  0.12896 -1.46903 -1.5917

15  1.2780 -1.02901 -0.47950 -0.20803  1.28893  0.3471

 

 

Biplot scores for constraining variables

 

               RDA1     RDA2      RDA3      RDA4      RDA5     RDA6

pH.H2O.   -0.302863  0.10367  0.157284 -0.042456 -0.435636 -0.30536

H2O       -0.007642 -0.27559 -0.089946 -0.071777 -0.008832 -0.05420

EC        -0.031034  0.04747 -0.125103  0.007019  0.121992  0.02514

SOM        0.029698 -0.16131 -0.217162 -0.029197 -0.008583  0.18298

Nt         0.081163  0.02886  0.072383  0.004714 -0.138659  0.26608

Pt         0.277357 -0.17170 -0.006217 -0.094796 -0.116895  0.12061

Corg.Nt   -0.068781 -0.27484 -0.290561  0.091834  0.184620 -0.14944

Cmic.Corg  0.162569  0.20239  0.298060 -0.033212 -0.103654 -0.26600


然后通过简单的加减方程,计算a,b,c,d。

forward selection是为了得到和因变量密切相关的自变量,这个选择有较强的整体性

library(packfor)

forward.sel(Y, E, alpha=0.05)


 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有