polyTrait: Construct second degree polynomial of traits

Description Usage Arguments Details Value Note

View source: R/polyTrait.R

Description

Construct second degree orthogonal polynomial of numerical traits while keeping the factors and binary traits as is.

Usage

1

Arguments

data

An object of class alienData.

Details

This function calculates the second degree polynomials of each variable independently. The second degree polynomial of each variable are orthogonal to one another.

In the process of calculating the second degree polynomials of each variable, the resulting two variables were rescaled by multiplying each value by the square root of the number of species (observations). The calculation will result in the non-squared variable to present slightly different values from the values of the original variable (even after rescaling). This is expected and the non-squared variable still presents the same information.

The function will automatically transform all binary (0-1) variable to a factor.

In addition, all factors are designed to have a sum to zero contrast (contr.sum).

Value

An object of class alienData with all numerical traits squared. The squared variables all end with "_Sq".

Note

Many aspect of this function were inspired from an internal function of the mvabund R package.


TheoreticalEcosystemEcology/alien documentation built on Dec. 25, 2021, 5:57 p.m.