The alpha-k-NN regression with compositional predictor variables | R Documentation |
\alpha
-k-NN regression with compositional predictor variables
The \alpha
-k-NN regression with compositional predictor variables.
alfa.knn.reg(xnew, y, x, a = 1, k = 2:10, apostasi = "euclidean", method = "average")
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 |
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". |
The \alpha
-k-NN regression with compositional predictor variables is applied.
A matrix with the estimated response data for each value of k.
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Tsagris M., Alenazi A. and Stewart C. (2023). Flexible non-parametric regression models for compositional response data with zeros. Statistics and Computing, 33(106).
https://link.springer.com/article/10.1007/s11222-023-10277-5
aknn.reg, alfa.knn, alfa.pcr, alfa.ridge
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.