ortho: Project a dataset in a euclidean space.

Description Usage Arguments Value Author(s) Examples

View source: R/multivariate.R

Description

Project a set of points defined by a distance matrix or a set of variables in an eucleadean space. If the distance matrix is a metric, this is done using the pcoa function, for other distance the nmds is used. When points are described by a set of variable the nmds is used.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ortho(data, ...)

## S3 method for class 'dist'
ortho(data, tol = 1e-07, ...)

## S3 method for class 'matrix'
ortho(data, scale = FALSE, ...)

## S3 method for class 'data.frame'
ortho(data, scale = FALSE, ...)

## S3 method for class 'procmod_frame'
ortho(data, ...)

Arguments

data

a numeric matrix describing the points

...

other parameters specific to some implementation

tol

a tolerance threshold : an eigenvalue is considered positive if it is larger than -tol*lambda1 where lambda1 is the largest eigenvalue.

scale

a logical value indicating if the dimensions must be scaled to force for every column that sd=1. FALSE by default.

Value

a numeric matrix with at most n-1 dimensions, with n the number pf observations. This matrix defines the coordinates of each point in the orthogonal space.

Author(s)

Eric Coissac

Christelle Gonindard-Melodelima

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
library(vegan)
data(bacteria)
data(eukaryotes)
data(soil)

dataset <- procmod_frame(euk = vegdist(decostand(eukaryotes,
                                                 method = "hellinger"),
                                       method = "euclidean"),
                         bac = vegdist(decostand(bacteria,
                                                 method = "hellinger"),
                                       method = "euclidean"),
                         soil = scale(soil,
                                      center = TRUE,
                                      scale  = TRUE))

dp <- ortho(dataset)

bacteria_rel_freq <- sweep(bacteria,
                           1,
                           rowSums(bacteria),
                           "/")
bacteria_hellinger <- sqrt(bacteria_rel_freq)
bacteria_dist <- dist(bacteria_hellinger)

project <- ortho(bacteria_dist)

ProcMod documentation built on May 12, 2021, 9:08 a.m.

Related to ortho in ProcMod...