Learn R Programming

adehabitat (version 1.1-1)

kselect: K-Select Analysis: a Method to Analyse the Habitat Selection by Animals

Description

Performs a multivariate analysis of ecological data (K-select analysis).

Usage

kselect(dudi, factor, weight, scannf = TRUE, nf = 2, ewa = FALSE)
print.kselect(x, ...)
kplot.kselect(object, xax = 1, yax = 2, csub = 2, possub = c("topleft",
              "bottomleft", "bottomright", "topright"),
              addval = TRUE, cpoint = 1, csize = 1, clegend = 2, ...)
hist.kselect(x, xax = 1, mar = c(0, 0, 0, 0), ampl = 1, 
             col.out = gray(0.75), col.in = gray(0.75), ncell = TRUE,
             denout = NULL, denin = NULL, lwdout = 1, lwdin = 1,
             maxy = 1, csub = 2, possub =
             c("bottomleft", "topleft", "bottomright", "topright"),
             ncla = 15, ...) 
plot.kselect(x, xax = 1, yax = 2, ...)

Arguments

dudi
an object of class dudi
factor
a factor with the same length as nrow(dudi$tab)
weight
a numeric vector of integer values giving the weight associated to the rows of dudi$tab.
scannf
logical. Whether the eigenvalues bar plot should be displayed
nf
if scannf = FALSE, an integer indicating the number of kept axes
ewa
logical. If TRUE, uniform weights are given to all animals in the analysis. If FALSE, animal weights are given by the proportion of relocations of each animal (i.e. an animal with 10 relocations has a weight 10 tim
x
an object of class kselect
object
an object of class kselect
xax
the column number for the x-axis
yax
the column number for the y-axis
addval
logical. If TRUE, the frequency of the relocations per animal is displayed (see examples)
cpoint
the size of the points (if 0, the points where no relocations are found are not displayed)
mar
the margin parameter (see help(par)).
ampl
the amplification factor (i.e. ylim = c(-1 , 1) / ampl)
col.out
character string. The color of the upper histogram
col.in
character string. The color of the lower histogram
ncell
logical. If TRUE, the histogram shows the distribution of the cells of the raster map where at least one relocation is found. If FALSE, the histogram shows the distribution of the relocations
denout
the density of shading lines for the upper histogram, in lines per inch (see help(hist) for further informations)
denin
the density of shading lines for the lower histogram, in lines per inch
lwdout
the line width for the upper histogram
lwdin
the line width for the lower histogram
maxy
the maximum Y coordinate (since the histogram draws frequencies, default value of maxy is 1)
csub
the character size for the legend, used with par("cex")*csub
csize
the size coefficient for the points
clegend
the character size for the legend used by par("cex")*clegend
possub
a character string indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")
ncla
the number of classes of the histograms
...
additional arguments to be passed to the generic function hist, print or, in the case of plot.kselect, s.distri

Value

  • kselect returns a list of the class kselect and dudi (see dudi).

References

Calenge, C., Dufour, A.B. and Maillard, D. (submitted). K-select analysis, a new method to analyse habitat selection in radio-tracking studies.

See Also

sahrlocs2kselect for conversion of objects class sahrlocs to objects suitable for a K-select analysis, s.distri, and dudi for class dudi.

Examples

Run this code
## Loads the data
data(puechabon)
sahr <- puechabon$sahr

## prepares the data for the kselect analysis
x <- sahrlocs2kselect(sahr)
tab <- x$tab

## Example of analysis with two variables: the slope and the elevation.
## Have a look at the use and availability of the two variables
## for the 4 animals
tab <- tab[,((names(tab) == "Slope")|(names(tab) == "Elevation"))]
tab <- scale(tab)
tmp <- split.data.frame(tab, x$factor)
wg <- split(x$weight, x$factor)
opar <- par(mfrow = n2mfrow(nlevels(x$factor)))
for (i in names(tmp))
  s.distri(scale(tmp[[i]]), wg[[i]])
par(opar)

## We call a new graphic window
x11()
## A K-select analysis
acp <- dudi.pca(tab, scannf = FALSE, nf = 2)
kn <- kselect(acp, x$factor, x$weight,
 scannf = FALSE, nf = 2)

# use of the generic function scatter
scatter(kn)

# Displays the first factorial plane
kplot(kn)
kplot(kn, cellipse = 0, cpoint = 0)
kplot(kn, addval = FALSE, cstar = 0)

# this factorial plane can be compared with
# the other graph to see the rotation proposed by
# the analysis
graphics.off()

# Displays the first factorial axis
hist(kn)

# Displays the second factorial axis
hist(kn, xax = 2)

# Summary of the analysis
plot(kn)

Run the code above in your browser using DataLab