David Zelený

en:monte_carlo

# Differences

This shows you the differences between two versions of the page.

 en:monte_carlo [2015/04/03 04:28]David Zelený created en:monte_carlo [2019/01/31 08:59] (current)David Zelený [Theory] 2019/01/31 08:59 David Zelený [Theory] 2019/01/26 20:00 David Zelený 2017/10/11 20:36 external edit2017/02/17 14:50 David Zelený 2016/06/28 16:29 external edit2015/04/17 03:42 David Zelený [Exercise 1] 2015/04/16 23:37 David Zelený [Exercise 1] 2015/04/16 23:36 David Zelený [Exercise 1] 2015/04/16 23:32 David Zelený [Exercise 1] 2015/04/16 23:23 David Zelený 2015/04/16 23:07 David Zelený 2015/04/03 05:05 David Zelený [Monte Carlo permutation test] 2015/04/03 04:47 David Zelený [Monte Carlo permutation test] 2015/04/03 04:46 David Zelený 2015/04/03 04:28 David Zelený created Next revision Previous revision 2019/01/31 08:59 David Zelený [Theory] 2019/01/26 20:00 David Zelený 2017/10/11 20:36 external edit2017/02/17 14:50 David Zelený 2016/06/28 16:29 external edit2015/04/17 03:42 David Zelený [Exercise 1] 2015/04/16 23:37 David Zelený [Exercise 1] 2015/04/16 23:36 David Zelený [Exercise 1] 2015/04/16 23:32 David Zelený [Exercise 1] 2015/04/16 23:23 David Zelený 2015/04/16 23:07 David Zelený 2015/04/03 05:05 David Zelený [Monte Carlo permutation test] 2015/04/03 04:47 David Zelený [Monte Carlo permutation test] 2015/04/03 04:46 David Zelený 2015/04/03 04:28 David Zelený created Line 1: Line 1: + ====== Ordination analysis ====== + ===== Monte Carlo permutation test (constrained ordination) ===== - The next question is whether the global model is significant: + [[{|width: 7em; background-color:​ light; color: firebrick}monte_carlo|**Theory**]] - + [[{|width: 7em; background-color:​ white; color: navy}monte_carlo_R|R functions]] - anova (rda.vasc) + [[{|width: 7em; background-color:​ white; color: navy}monte_carlo_examples|Examples]] - ​ + [[{|width: 7em; background-color:​ white; color: navy}monte_carlo_exercise|Exercise {{::​lock-icon.png?​nolink|}}]] - <​code>​ + ==== Theory ==== - Permutation test for rda under reduced model + FIXME - Permutation: free + - Number of permutations: 999 + - Model: rda(formula = vasc.hell ~ Ca + Mg + Fe + K + Na + Si + SO4 + PO4 + NO3 + NH3 + Cl + Corg + pH + conduct + slope, data = chem) + The function of permutation test is to evaluate whether the variation explained by the model (variables) is higher than would be variation explained by the same number of randomly generated variables. - Df Variance ​     F Pr(>​F) ​ + - Model    15  0.21277 2.1599 ​ 0.001 *** + - Residual 54  0.35464 ​ + - --- + - Signif. codes: ​ 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 + - ​ + - Alternatively,​ we may be interested in significance of only the first constrained axis. This is achieved by adding argument ''​first = TRUE'':​ - - anova (rda.vasc, first = TRUE) - ​ - <​code>​ - Permutation test for rda under reduced model - Permutation:​ free - Number of permutations:​ 999 - - Model: rda(formula = vasc.hell ~ Ca + Mg + Fe + K + Na + Si + SO4 + PO4 + NO3 + NH3 + Cl + Corg + pH + conduct + slope, data = chem) - Df Variance ​     F Pr(>​F) ​   ​ - RDA1      1  0.09793 14.912 ​ 0.001 *** - Residual 54  0.35464 ​                 ​ - --- - Signif. codes: ​ 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - ​ - - Or, we may calculate significance of each constrained axis independently. This can be done by adding argument ''​by = "​axis"''​. Note that since there is 14 variables and hence 14 axes, the calculation takes rather long; you may speed it up using parallel calculation,​ if your computer has more than one core (use argument ''​parallel''​ with number of available cores, 4 in case of my computer): ​ - - anova (rda.vasc, by = '​axis',​ parallel = 4) - ​ - <​code>​ - Permutation test for rda under reduced model - Marginal tests for axes - Permutation:​ free - Number of permutations:​ 999 - - Model: rda(formula = vasc.hell ~ Ca + Mg + Fe + K + Na + Si + SO4 + PO4 + NO3 + NH3 + Cl + Corg + pH + conduct + slope, data = chem) - Df Variance ​      F Pr(>​F) ​   ​ - RDA1      1  0.09793 14.9120 ​ 0.001 *** - RDA2      1  0.02237 ​ 3.4070 ​ 0.001 *** - RDA3      1  0.01546 ​ 2.3547 ​ 0.001 *** - RDA4      1  0.01110 ​ 1.6905 ​ 0.009 ** - RDA5      1  0.01061 ​ 1.6152 ​ 0.012 *  ​ - RDA6      1  0.00930 ​ 1.4155 ​ 0.050 *  ​ - RDA7      1  0.00840 ​ 1.2798 ​ 0.110    ​ - RDA8      1  0.00637 ​ 0.9703 ​ 0.498    ​ - RDA9      1  0.00593 ​ 0.9023 ​ 0.644    ​ - RDA10     ​1 ​ 0.00582 ​ 0.8861 ​ 0.677    ​ - RDA11     ​1 ​ 0.00496 ​ 0.7549 ​ 0.877    ​ - RDA12     ​1 ​ 0.00423 ​ 0.6448 ​ 0.970    ​ - RDA13     ​1 ​ 0.00394 ​ 0.5994 ​ 0.992    ​ - RDA14     ​1 ​ 0.00331 ​ 0.5034 ​ 1.000    ​ - RDA15     ​1 ​ 0.00304 ​ 0.4626 ​ 1.000    ​ - Residual 54  0.35464 ​ - --- - Signif. codes: ​ 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - ​ - - Other testing option is to test each term (constraining variable) separately - this is done adding the argument ''​by = "​terms"''​. It sequentially adds each variable one by one in order in which they enter the model formula, and for each calculates partial explained variation and its significance with previous variables as covariables (i.e. for the first variable it is marginal variation explained by this variable and its significance,​ for the second variable it is partial variation explained by the second variable after removing the variation of the first variable as covariable, etc.). In the context of our data this option is not too useful, since variables in dataset are ordered without explicit meaning. - - - anova (rda.vasc, by = '​terms',​ parallel = 4) - ​ - <​code>​ - Permutation test for rda under reduced model - Terms added sequentially (first to last) - Permutation:​ free - Number of permutations:​ 999 - - Model: rda(formula = vasc.hell ~ Ca + Mg + Fe + K + Na + Si + SO4 + PO4 + NO3 + NH3 + Cl + Corg + pH + conduct + slope, data = chem) - Df Variance ​      F Pr(>​F) ​   ​ - Ca        1  0.07886 12.0079 ​ 0.001 *** - Mg        1  0.01395 ​ 2.1242 ​ 0.009 ** - Fe        1  0.00962 ​ 1.4643 ​ 0.082 .  ​ - K         ​1 ​ 0.00822 ​ 1.2511 ​ 0.155    ​ - Na        1  0.01154 ​ 1.7577 ​ 0.031 *  ​ - Si        1  0.01387 ​ 2.1119 ​ 0.015 *  ​ - SO4       ​1 ​ 0.00688 ​ 1.0476 ​ 0.348    ​ - PO4       ​1 ​ 0.00598 ​ 0.9111 ​ 0.569    ​ - NO3       ​1 ​ 0.00860 ​ 1.3102 ​ 0.124    ​ - NH3       ​1 ​ 0.01239 ​ 1.8872 ​ 0.014 *  ​ - Cl        1  0.00601 ​ 0.9154 ​ 0.567    ​ - Corg      1  0.00905 ​ 1.3778 ​ 0.100 .  ​ - pH        1  0.01151 ​ 1.7525 ​ 0.034 *  ​ - conduct ​  ​1 ​ 0.00959 ​ 1.4609 ​ 0.100 .  ​ - slope     ​1 ​ 0.00669 ​ 1.0186 ​ 0.387    ​ - Residual 54  0.35464 ​ - --- - Signif. codes: ​ 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - ​ - - The last testing option is with argument ''​by = "​margin"'',​ testing variation explained by each explanatory variable with all the others used as covariables:​ - - anova (rda.vasc, by = '​margin',​ parallel = 4) - ​ - <​code>​ - Permutation test for rda under reduced model - Marginal effects of terms - Permutation:​ free - Number of permutations:​ 999 - - Model: rda(formula = vasc.hell ~ Ca + Mg + Fe + K + Na + Si + SO4 + PO4 + NO3 + NH3 + Cl + Corg + pH + conduct + slope, data = chem) - Df Variance ​     F Pr(>​F) ​ - Ca        1  0.01441 2.1947 ​ 0.008 ** - Mg        1  0.00976 1.4857 ​ 0.075 . - Fe        1  0.00723 1.1006 ​ 0.263 - K         ​1 ​ 0.00690 1.0508 ​ 0.342 - Na        1  0.00561 0.8539 ​ 0.631 - Si        1  0.01221 1.8599 ​ 0.030 * - SO4       ​1 ​ 0.00742 1.1306 ​ 0.260 - PO4       ​1 ​ 0.00470 0.7159 ​ 0.874 - NO3       ​1 ​ 0.00893 1.3600 ​ 0.114 - NH3       ​1 ​ 0.01077 1.6404 ​ 0.054 . - Cl        1  0.00581 0.8849 ​ 0.628 - Corg      1  0.00788 1.1997 ​ 0.185 - pH        1  0.00858 1.3066 ​ 0.154 - conduct ​  ​1 ​ 0.00922 1.4042 ​ 0.105 - slope     ​1 ​ 0.00669 1.0186 ​ 0.373 - Residual 54  0.35464 ​ - --- - Signif. codes: ​ 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - 