The alpha-k-NN regression with compositional predictor variables {Compositional}R Documentation

The α-k-NN regression with compositional predictor variables

Description

The α-k-NN regression with compositional predictor variables.

Usage

alfa.knn.reg(xnew, y, x, a = 1, k = 2:10, apostasi = "euclidean", method = "average")

Arguments

xnew

A matrix with the new compositional predictor variables whose response is to be predicted. Zeros are allowed.

y

The response variable, a numerical vector.

x

A matrix with the available compositional predictor variables. Zeros are allowed.

a

A single value of α. As zero values in the compositional data are allowed, you must be careful to choose strictly positive vcalues of α. If negative values are passed, the positive ones are used only. If the data are already alpha-transformed, you can make this NULL.

k

The number of nearest neighbours to consider. It can be a single number or a vector.

apostasi

The type of distance to use, either "euclidean" or "manhattan".

method

If you want to take the average of the reponses of the k closest observations, type "average". For the median, type "median" and for the harmonic mean, type "harmonic".

Details

The α-k-NN regression with compositional predictor variables is applied.

Value

A matrix with the estimated response data for each value of k.

Author(s)

Michail Tsagris.

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

References

Michail Tsagris, Abdulaziz Alenazi and Connie Stewart (2020). Non-parametric regression models for compositional data. https://arxiv.org/pdf/2002.05137.pdf

See Also

aknn.reg, alfa.knn, alfa.pcr, alfa.ridge

Examples

library(MASS)
x <- as.matrix(fgl[, 2:9])
x <- x / rowSums(x)
y <- fgl[, 1]
mod <- alfa.knn.reg(x, y, x, a = 0.5, k = 2:4)

[Package Compositional version 5.2 Index]