Learn R Programming

adehabitatHS (version 0.3.18)

biv.test: Bivariate Test

Description

biv.plot displays a bivariate plot. biv.test displays the results of a bivariate randomisation test.

Usage

biv.plot(dfxy, br = 10, points = TRUE, density = TRUE, 
         kernel = TRUE, o.include = FALSE, pch, cex, col, h, sub, 
         side = c("top", "bottom", "none"), ...)
biv.test(dfxy, point, br = 10, points = TRUE, density = TRUE, 
         kernel = TRUE, o.include = FALSE, pch, cex, col, Pcol, h, sub, 
         side = c("top", "bottom", "none"), ...)

Arguments

dfxy

a data frame with N lines (couples of values) and two columns

br

a parameter used to define the numbers of breaks of the histograms. A larger value leads to a larger number of breaks

points

logical. Whether the points should be displayed

density

logical. Whether the kernel density estimation should be displayed for the marginal histograms

kernel

logical. Whether the kernel density estimation should be displayed for the bivariate plot

o.include

logical. If TRUE, the origin is included in the plot

pch

plotting "character", i.e., symbol to use for the points. (see ?points)

cex

character expansion for the points

col

color code or name for the points, see ?par

h

vector of bandwidths for x and y directions, used in the function kde2d of the package MASS. Defaults to normal reference bandwidth (see ?kde2d)

sub

a character string to be inserted in the plot as a title

side

if "top", the x and y scales of the grid are upside, if "bottom" they are downside, if "none" no legend

point

a vector of length 2, representing the observation to be compared with the simulated values of the randomisation test

Pcol

color code or name for the observed point

...

further arguments passed to or from other methods

Author

Mathieu Basille basille@ase-research.org

Warning

biv.plot and biv.test use the function kde2d of the package MASS.

Details

biv.test is used to display the results of a bivariate randomisation test. An example of use of the function is provided in the function niche.test.

The x-axis of the main window corresponds to the first column of dfxy; the y-axis corresponds to the second column. Kernel density is estimated to indicate the contours of the distribution of randomised values. The two marginal histograms correspond to the univariate tests on each axis, for which the p-values are computed with as.randtest (package ade4, one-sided tests).

See Also

as.randtest (package ade4)

Examples

Run this code

x = rnorm(1000,2)
y = 2*x+rnorm(1000,2)
dfxy = data.frame(x, y)

biv.plot(dfxy)
biv.plot(dfxy, points=FALSE, col="lightblue", br=20)

p = c(3, 4)
biv.test(dfxy, p)
biv.test(dfxy, p, points=FALSE, Pcol="darkred", col="lightblue", br=20)

Run the code above in your browser using DataLab