achc: Analysis of Convex Hull Coverage

Description Usage Arguments Details Value Author(s) Examples

View source: R/achc.R

Description

Function obtains relative frequencies of convex hull coverage in the represented data space, and uses a permutation procedure to generate confidence limits for random assignmnet of observations to groups.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
achc(
  dat,
  std = FALSE,
  group,
  grid.points = 500,
  grid.space = 0.05,
  iter = 99,
  seed = NULL,
  print.progress = TRUE
)

Arguments

dat

Either a data frame or matrix of data to be analyzed. Because of computational limitations, the number of variables is currently limited to 5.

std

A logical value that if TRUE finds standard deviates of the data (data are both centered and scaled by variable standard deviations).

group

A factor or vector coerible to factor for defining groups.

grid.points

The desired number of points, sampled from a uniform distribution of points in the data space, within a convex hull for all observed points. This number might be less than the maximum possible number of points (which could be huge).

grid.space

The approximate spacing of uniform points along each axis. For example, 0.05 means points will be placed at increments that are 5 percent of the expanse of data, per axis.

iter

The number of iterations (permutations) to run for the test. Because the observed case counts as one iteration, this should be the number desired, minus one.

seed

Change the random seed, if desired. If NULL, the seed will equal the number of permutations.

print.progress

A logical value to indicate if permutation progress should be printed to the screen. This is useful for analyses that will run a long time.

Details

A description is needed here

Value

An object of class achc is a list containing the following

grid

The grid points obtained.

analysis

A matrix of 0s and 1s for convex hull presenece at grid points (rows) by groups (columns) for each permutation.

group

The factor of group levels used; useful for downstream functions.

perms

The number of permutations.

perm.schedule

The sampling frames in each permutation.

std

Whether data were standardized.

Author(s)

Michael Collyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 3 dimensions of data
library(RRPP)
data("Pupfish")
group <- interaction(Pupfish$Sex, Pupfish$Pop)
P <- prcomp(Pupfish$coords)$x[,1:3] # first 3 PCs

grid.preview(P, pts = 100, pt.scale = 0.1)
pupCHC <- achc(P, std = FALSE, group, iter = 99, grid.points = 100, grid.space = 0.1)
pupCHC
summary(pupCHC, confidence = 0.95)
plot(pupCHC, lwd = 2)
plot(pupCHC, lwd = 2, confidence = 0.99)

# The grid used
library(rgl)
plot3d(pupCHC$grid)
aspect3d("iso")

# Example of 8-dimensional data analysis
data(PupfishHeads)
group <- factor(paste(PupfishHeads$locality, PupfishHeads$year, sep = "."))
P <- prcomp(PupfishHeads$coords)$x[, 1:8] # first 8 PCs

grid.preview(P, pts = 100, pt.scale = 0.1)
pupCHC <- achc(P, std = FALSE, group, iter = 99, grid.points = 100, grid.space = 0.05)
pupCHC
summary(pupCHC, confidence = 0.95)
plot(pupCHC, lwd = 2)

mlcollyer/ACHC documentation built on May 30, 2020, 10:26 p.m.