Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

specgroups

Average within-group distances for given groups


Description

Generates average within-group distances (overall and group-wise) from a dissimilarity matrix and a given grouping.

Usage

specgroups(distmat,groupvector, groupinfo)

Arguments

distmat

dissimilarity matrix or dist-object.

groupvector

integer vector. For every row of distmat, a number indicating the group membership.

groupinfo

list with components lg (levels of groupvector), ng (number of groups), nsg (vector of group sizes).

Value

A list with parameters

overall

overall average within-groups dissimilarity.

gr

vector of group-wise average within-group dissimilarities (this will be NaN if the group size is only 1).

Author(s)

Examples

options(digits=4)
  data(siskiyou)
  x <- prabinit(prabmatrix=siskiyou, neighborhood=siskiyou.nb,
              distance="logkulczynski")  
  groupvector <- as.factor(siskiyou.groups)
  ng <- length(levels(groupvector))
  lg <- levels(groupvector)
  nsg <- numeric(0)
    for (i in 1:ng) nsg[i] <- sum(groupvector==lg[i])
  groupinfo <- list(lg=lg,ng=ng,nsg=nsg)
  specgroups(x$distmat,groupvector,groupinfo)

prabclus

Functions for Clustering and Testing of Presence-Absence, Abundance and Multilocus Genetic Data

v2.3-2
GPL
Authors
Christian Hennig <christian.hennig@unibo.it>, Bernhard Hausdorf <Hausdorf@zoologie.uni-hamburg.de>
Initial release
2020-01-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.