Centered logratio transform
clr_transform(df)
Perform a centered logratio transformation on the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe of compositional data. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
A new dataframe containing the CLR transformed data. |
Raises:
Type | Description |
---|---|
InvalidCompositionException
|
Data is not normalized to the expected value. |
NumericValueSignException
|
Data contains zeros or negative values. |
Source code in eis_toolkit/transformations/coda/clr.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
inverse_clr(df, colnames=None, scale=1.0)
Perform the inverse transformation for a set of CLR transformed data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe of CLR transformed compositional data. |
required |
colnames |
Optional[Sequence[str]]
|
List of column names to rename the columns to. |
None
|
scale |
Number
|
The value to which each composition should be normalized. Eg., if the composition is expressed as percentages, scale=100. |
1.0
|
Returns:
Type | Description |
---|---|
DataFrame
|
A dataframe containing the inverse transformed data. |
Raises:
Type | Description |
---|---|
NumericValueSignException
|
The input scale value is zero or less. |
Source code in eis_toolkit/transformations/coda/clr.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|