regeqdist: Testing equality of two distance-regressions

View source: R/reg2cluster2dist.R

regeqdistR Documentation

Testing equality of two distance-regressions

Description

Jackknife-based test for equality of two regressions between distance matrices.

Usage

regeqdist(dmx,dmy,grouping,groups=levels(as.factor(grouping))[1:2])

## S3 method for class 'regeqdist'
print(x,...)

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, indicating 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.

x

object of class "regeqdist".

...

optional arguments for print method.

Details

The null hypothesis that the regressions within the two groups are equal is tested using jackknife pseudovalues independently in both groups allowing for potentially different variances of the pseudovalues, and aggregating as in Welch's t-test. Tests are run separately for intercept and slope and aggregated by Bonferroni's rule.

The test cannot be run and many components will be NA in case that within-group regressions or jackknifed within-group regressions are ill-conditioned.

This was implemented having in mind an application in which the explanatory distances represent geographical distances, the response distances are genetic distances, and groups represent species or species-candidates. In this application, for testing whether the regression patterns are compatble with the two groups behaving like a single species, one would first use regeqdist to test whether a joint regression for the within-group distances of both groups makes sense. If this is not rejected, regdistbetween is run to see whether the between-group distances are compatible with the within-group distances. On the other hand, if a joint regression on within-group distances is rejected, regdistbetweenone can be used to test whether the between-group distances are at least compatible with the within-group distances of one of the groups, which can still be the case within a single species, see Hausdorf and Hennig (2019).

Value

list of class "regeqdist" with components

pval

p-values for intercept and slope.

coeffdiff

vector of differences between groups (first minus second) for intercept and slope.

condition

condition numbers of regressions, see kappa.

lmfit

list. Output objects of lm within the two groups.

jr

list of two lists of two; output object of jackknife within the two groups for intercept and slope.

xcenter

mean of dmx within the two groups used for centering.

tstat

t-statistic.

tdf

vector of degrees of freedom of t-statistic according to Welch-Sattertwaithe approximation for intercept and slope.

jackest

jackknife-estimator of difference between regressions; vector with intercept and slope difference.

jackse

vector with jackknife-standard errors for jackest, intercept and slope.

jackpseudo

list of two lists of vectors; jacknife pseudovalues within both groups for intercept and slope estimators.

groups

see above.

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

regdistbetween, regdistbetweenone

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")
  loggeo <- log(ver.geo+quantile(as.vector(as.dist(ver.geo)),0.25))

  species <-c(rep(1,13),rep(2,22))
  rtest <- regeqdist(dmx=loggeo,dmy=vei$distmat,grouping=species,groups=c(1,2))
  print(rtest)

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