k-NN regression with compositional data: k-NN regression with compositional data
Description
k-NN regression with compositional data.
Usage
compknn.reg(y, x, xnew, k = 2:10, type = "alr", yb = NULL)
Arguments
y
A matrix with compositional data. Zero values are not allowed.
x
The predictor variable(s), they have to be continuous.
xnew
This is by default set to NULL. If you have new data whose compositional data values you want to predict, put them here.
k
The number of nearest neighbours to consider. It can be a single number or a vector.
type
This is either "alr" or "ilr", corresponding to the additive and the isometric log-ratio transformation respectively.
yb
If you have already transformed the data using the additive log-ratio transformation, plut it here. Othewrise leave it NULL.
This is intended to be used in the function alfareg.tune in order to speed up the process.
Value
A list including:
est
The fitted values of xnew. If you provide more than one k nearest neighbours this will contain a matrix of the estimated
values for each value of k.
Details
The k-NN regression is applied with responses being compositional data and the predictors being euclidean data.
References
Aitchison J. (1986). The statistical analysis of compositional data. Chapman \& Hall.