Linear interpolation of kernel values

cmf_kernels_interpolate(kernels_a, alpha, alphas)

Arguments

kernels_a

alpha

alphas

Details

Value

References

Note

See also

Examples

##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as cmf_kernels_interpolate <- function(kernels_a, alpha, alphas) { nalphas <- length(alphas) if (alpha >= alphas[1] && alpha <= alphas[nalphas]) { iamin <- 1 iamax <- 2 for (ia in 1:(nalphas-1)) { amin <- alphas[ia] amax <- alphas[ia+1] if ((alpha>=amin) && (alpha<=amax)) { iamin <- ia iamax <- ia + 1 break } } c1 <- (amax - alpha) / (amax - amin) c2 <- (alpha - amin) / (amax - amin) res <- c1 * kernels_a[[iamin]] + c2 * kernels_a[[iamax]] } else if (alpha < alphas[1]) { res <- kernels_a[[1]] } else if (alpha > alphas[nalphas]) { res <- kernels_a[[nalphas]] } return(res) }