# goodness.metaMDS: Goodness of Fit and Shepard Plot for Nonmetric... In vegan: Community Ecology Package

## Description

Function `goodness.metaMDS` find goodness of fit measure for points in nonmetric multidimensional scaling, and function `stressplot` makes a `Shepard` diagram.

## Usage

 ```1 2 3 4 5``` ```## S3 method for class 'metaMDS' goodness(object, dis, ...) ## Default S3 method: stressplot(object, dis, pch, p.col = "blue", l.col = "red", lwd = 2, ...) ```

## Arguments

 `object` A result object from `metaMDS`, `monoMDS` or `isoMDS`. `dis` Dissimilarities. This should not be used with `metaMDS` or `monoMDS`, but must be used with `isoMDS`. `pch` Plotting character for points. Default is dependent on the number of points. `p.col, l.col` Point and line colours. `lwd` Line width. For `monoMDS` the default is `lwd = 1` if more than two lines are drawn, and `lwd = 2` otherwise. `...` Other parameters to functions, e.g. graphical parameters.

## Details

Function `goodness.metaMDS` finds a goodness of fit statistic for observations (points). This is defined so that sum of squared values is equal to squared stress. Large values indicate poor fit. The absolute values of the goodness statistic depend on the definition of the stress: `isoMDS` expresses stress in percents, and therefore its goodness values are 100 times higher than those of `monoMDS` which expresses the stress as a proportion.

Function `stressplot` draws a Shepard diagram which is a plot of ordination distances and monotone or linear fit line against original dissimilarities. In addition, it displays two correlation-like statistics on the goodness of fit in the graph. The nonmetric fit is based on stress S and defined as R2 = 1-S*S. The “linear fit” is the squared correlation between fitted values and ordination distances. For `monoMDS`, the “linear fit” and R2 from “stress type 2” are equal.

Both functions can be used with `metaMDS`, `monoMDS` and `isoMDS`. The original dissimilarities should not be given for `monoMDS` or `metaMDS` results (the latter tries to reconstruct the dissimilarities using `metaMDSredist` if `isoMDS` was used as its engine). With `isoMDS` the dissimilarities must be given. In either case, the functions inspect that dissimilarities are consistent with current ordination, and refuse to analyse inconsistent dissimilarities. Function `goodness.metaMDS` is generic in vegan, but you must spell its name completely with `isoMDS` which has no class.

## Value

Function `goodness` returns a vector of values. Function `stressplot` returns invisibly an object with items for original dissimilarities, ordination distances and fitted values.

## Author(s)

Jari Oksanen.

`metaMDS`, `monoMDS`, `isoMDS`, `Shepard`. Similar diagrams for eigenvector ordinations can be drawn with `stressplot.wcmdscale`, `stressplot.cca`, `stressplot.rda` and `stressplot.capscale`.

## Examples

 ```1 2 3 4 5 6 7``` ```data(varespec) mod <- metaMDS(varespec) stressplot(mod) gof <- goodness(mod) gof plot(mod, display = "sites", type = "n") points(mod, display = "sites", cex = 2*gof/mean(gof)) ```

### Example output

```Loading required package: permute
This is vegan 2.4-4
Square root transformation
Wisconsin double standardization
Run 0 stress 0.1843196
Run 1 stress 0.3811651
Run 2 stress 0.2126571
Run 3 stress 0.1962453
Run 4 stress 0.2439795
Run 5 stress 0.1976152
Run 6 stress 0.2173476
Run 7 stress 0.1852399
Run 8 stress 0.2005511
Run 9 stress 0.1948417
Run 10 stress 0.2124996
Run 11 stress 0.2028828
Run 12 stress 0.2530506
Run 13 stress 0.1974419
Run 14 stress 0.2204287
Run 15 stress 0.2104573
Run 16 stress 0.1982376
Run 17 stress 0.1948415
Run 18 stress 0.2045022
Run 19 stress 0.2134694
Run 20 stress 0.1962451
*** No convergence -- monoMDS stopping criteria:
20: stress ratio > sratmax
[1] 0.02956349 0.03430663 0.04593897 0.04039584 0.04187239 0.03235999
[7] 0.03348133 0.03063787 0.03138894 0.02968296 0.03368395 0.02593423
[13] 0.03839280 0.03420943 0.02954730 0.02675647 0.04274826 0.03775407
[19] 0.06790026 0.03251787 0.02989796 0.03040904 0.05486768 0.04079135
```

vegan documentation built on May 31, 2017, 4:08 a.m.