ccost {dave} | R Documentation |

Given 2 alternative classifications (g groups) of rows in a data frame of vegetation data, confusion matrix, C, is derived first. Using the first classification a matrix of row centroids is derived (using function `centroid`

) of wich a g by g distance matrix, W, is computed (correlation transformed to distance). Cost factor, cf, is the sum of element by element multiplication of C and W respectively, cf=sum(CW).

```
ccost(veg, oldgr, newgr, y,...)
ccost2(veg,oldgr, newgr, y)
## Default S3 method:
ccost(veg, oldgr, newgr, y,...)
## S3 method for class 'ccost'
print(x,...)
```

`veg` |
A data frame of vegetation releves (rows) by species (columns) |

`oldgr` |
Initial classification, e.g., derived by hclust() |

`newgr` |
Final classification, e.g., result of a model |

`y` |
Transformation of species scores: x'= x exp(y) |

`x` |
An object of class "ccost" |

`...` |
Further variables used for printing |

Cost factor cf has range 0 (both classifications identical) to n (number of rows), where n is the worst case of misclassification.

An output list of class "ccost" with at least the following intems:

`dimension` |
Dimension of confusion matrix (n by n) |

`ccost` |
Cost factor, cf |

`old.groups` |
Initial classification |

`new.groups` |
Final classification |

`conf.matrix` |
Confusion matrix |

`weight.matrix` |
Weigth matrix |

`transf` |
Transformation applied to scores, y-value |

Otto Wildi

Ripley, B. D. 1996. Pattern recognition and neural networks. Cambridge: Cambridge University Press.

Venables, W. N. & Ripley, B. D. 2010. Modern applied statistics with S. Fourth Edition. Springer, NY.

Wildi, O. 2017. Data Analysis in Vegetation Ecology. 3rd ed. CABI, Oxfordshire, Boston.

```
# First, groups of releves are formed by cluster analysis
require(vegan)
dr<- vegdist(nveg^0.5,method="bray") # dr is distance matrix of rows
o.clr<- hclust(dr,method="ward") # this is clustering
oldgr<- cutree(o.clr,k=3) # 3 row groups formed
oldgr # this displays initial classification:
# 2 4 6 9 10 18 25 27 39 49 50
# 1 2 1 3 2 3 1 2 3 1 3
# For simplicity we assume that row "2" and "50" change memebership:
newgr<- c(2,2,1,3,2,3,1,2,3,1,1)
o.ccost<- ccost(nveg,oldgr,newgr,y=0.5) # does square root transformation
# Default method releasing cf
o.ccost # displays C and W (see above)
```

[Package *dave* version 2.0 Index]