cv.tflr: Cross validation for the TFLR model

View source: R/cv.tflr.R

Cross validation for the TFLR modelR Documentation

Cross validation for the TFLR model

Description

Cross validation for the TFLR model.

Usage

cv.tflr(y, x, nfolds = 10, folds = NULL, seed = NULL)

Arguments

y

A matrix with compositional response data. Zero values are allowed.

x

A matrix with compositional predictors. Zero values are allowed.

nfolds

The number of folds to be used. This is taken into consideration only if the folds argument is not supplied.

folds

If you have the list with the folds supply it here. You can also leave it NULL and it will create folds.

seed

If seed is TRUE the results will always be the same.

Details

A k-fold cross validation for the transformation-free linear regression for compositional responses and predictors is performed.

Value

A list including:

runtime

The runtime of the cross-validation procedure.

kl

The Kullback-Leibler divergences for all runs.

js

The Jensen-Shannon divergences for all runs.

perf

The average Kullback-Leibler divergence and average Jensen-Shannon divergence.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Fiksel J., Zeger S. and Datta A. (2022). A transformation-free linear regression for compositional outcomes and predictors. Biometrics, 78(3): 974–987.

Tsagris. M. (2024). Constrained least squares simplicial-simplicial regression. https://arxiv.org/pdf/2403.19835.pdf

See Also

tflr, cv.scls, klalfapcr.tune

Examples


library(MASS)
y <- rdiri(100, runif(3, 1, 3))
x <- as.matrix(fgl[1:100, 2:9])
x <- x / rowSums(x)
mod <- cv.tflr(y, x)
mod


Compositional documentation built on Oct. 9, 2024, 5:10 p.m.