remove_zeros {intervalpsych}R Documentation

Remove Zeros from Simplex

Description

Remove zero-components from interval data in the simplex format.

Usage

remove_zeros(simplex, method = "rescaling", padding = 0.01)

Arguments

simplex

A numeric simplex vector of length 3 where the elements sum to 1, or a numeric matrix or data frame where each row is a simplex vector.

method

A character string specifying the method to remove zeros. Currently, only "rescaling" is supported. Default is "rescaling".

padding

A numeric value to add to each element of the simplex when using the "rescaling" method. Default is 0.01.

Details

Rescaling

The rescaling methods adds a small value (padding) to each element of the simplex and then divides by the row sum to close the composition.

Value

A numeric matrix with the same dimensions as the input simplex, with zeros removed according to the specified method.

Examples

# Example usage:
simplex <- matrix(c(0.2, 0.3, 0.5, 0, 0.5, 0.5), nrow = 2, byrow = TRUE)
remove_zeros(simplex)


[Package intervalpsych version 0.1.0 Index]