plotdistreg: Plots for within-groups and between-groups distance...

View source: R/reg2cluster2dist.R

plotdistregR Documentation

Plots for within-groups and between-groups distance regression

Description

Visualisation of various regressions on distance (or dissimilarity) data where objects are from two groups.

Usage

plotdistreg(dmx,dmy,grouping,groups=levels(as.factor(grouping))[1:2],
                        cols=c(1,2,3,4),
                        pchs=rep(1,3),
                        ltys=c(1,2,1,2),
                        individual=TRUE,jointwithin=TRUE,jointall=TRUE,
                        oneplusjoint=TRUE,jittering=TRUE,bcenterline=TRUE,
                        xlim=NULL,ylim=NULL,xlab="geographical distance",
                        ylab="genetic distance",...)

Arguments

dmx

dissimilarity matrix or object of class dist. Explanatory dissimilarities (often these will be proper distances, but more general dissimilarities that do not necessarily fulfill the triangle inequality can be used, same for dmy).

dmy

dissimilarity matrix or object of class dist. Response dissimilarities.

grouping

something that can be coerced into a factor, defining the grouping of objects represented by the dissimilarities dmx and dmy (i.e., if grouping has length n, dmx and dmy must be dissimilarities between n objects).

groups

Vector of two levels. The two groups defining the regressions to be compared in the test. These can be factor levels, integer numbers, or strings, depending on the entries of grouping.

cols

vector of four colors (or color numbers) to be used for plotting distances and regression lines within the first group, within the second group, distances between groups, and a line marking the center of the between-groups explanatory distances, see col-argument of par.

pchs

vector of three plot symbols (or numbers) to be used for plotting distances within the first group, within the second group, and distances between groups, see pch-argument of par.

ltys

vector of line type numbers to be used for single group within-group regression, both groups combined within-group regression, regression with all distances, and regression combining within-groups distances of one group with between-groups distances, see lty-argument of par.

individual

if TRUE, within-groups distances regression lines are shown for both groups.

jointwithin

if TRUE, the within-groups distances regression line for both groups combined is shown.

jointall

if TRUE, the regression line based on all distances is shown.

oneplusjoint

if TRUE, the regression lines combining within-groups distances of one group with between-groups distances are shown (the colors of these are the colors of the individual groups, the first two components of the cols-argument).

jittering

if TRUE, points are jittered to avoid overplotting.

bcenterline

if TRUE, a line is plotted to mark the center of the between-groups distances on the explanatory variable.

xlim

to be passed on to plot; the default is determined from the involved distances.

ylim

to be passed on to plot; the default is determined from the involved distances.

xlab

to be passed on to plot.

ylab

to be passed on to plot.

...

optional arguments to be passed on to plot.

Author(s)

Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en

References

Hausdorf, B. and Hennig, C. (2019) Species delimitation and geography. Submitted.

See Also

regeqdist, regdistbetween, regdistbetweenone, regdistdiffone

Examples

  options(digits=4)
  data(veronica)
  ver.geo <- coord2dist(coordmatrix=veronica.coord[173:207,],file.format="decimal2")
  vei <- prabinit(prabmatrix=veronica[173:207,],distance="jaccard")

  species <-c(rep(1,13),rep(2,22))
  loggeo <- log(ver.geo+quantile(as.vector(as.dist(ver.geo)),0.25))
  plotdistreg(dmx=loggeo,dmy=vei$distmat,grouping=species,
  jointwithin=FALSE,jointall=FALSE,groups=c(1,2))
  legend(5,0.75,c("within species 1",
  "within species 2","species 1 and between","species 2 and between"),lty=c(1,1,2,2),col=c(1,2,1,2))
  plotdistreg(dmx=loggeo,dmy=vei$distmat,grouping=species,
  jointwithin=TRUE,jointall=TRUE,oneplusjoint=FALSE,groups=c(1,2))
  legend(5,0.75,c("within species 1",
  "within species 2","all distances","all within species"),lty=c(1,1,1,2),col=c(1,2,3,3))
  


prabclus documentation built on Sept. 24, 2024, 5:07 p.m.