Using kernlab::kqr(reduced = TRUE), how is the y argument missing in the call to csi()? I'm trying to perform a kernelized quantile regression on some data using the function kqr() from the kernlab package in R. The regression runs on some portions of my data, but on other portions, I run into invertibility issues, so at the advice of my team, I'm trying to make use of the Cholesky decomposition functionality in the package. Here is some sample code below that reproduces the error:
library(kernlab)
x = as.matrix(sort(sample(seq(from = 5, to = 29),100, replace = TRUE)))
y = as.matrix(sample(seq(from = 0, to = 36)/36, 100, replace = TRUE))
kqr(x = x, y = y,
   ​tau = .85,
   ​kernel = "rbfdot",
   ​kpar = list(sigma = 10),
   ​reduced = TRUE)

Setting reduced = TRUE produces this error:
Error in csi(x, kernel = kernel, rank = rank) : 
  argument "y" is missing, with no default

First I checked the documentation for csi(), the relevant bit of which reads:
csi(x, y, kernel="rbfdot", kpar=list(sigma=0.1), rank,
centering = TRUE, kappa = 0.99 ,delta = 40 ,tol = 1e-5)

csi() is indeed looking for a y argument, so then I checked what csi() is actually doing by viewing the actual implementation in R, since y is clearly specified in the call to kqr(). I called getMethod("kqr","matrix") and I found where csi() is called in the function. This is what I found:
if (!reduced) 
            H = kernelMatrix(kernel, x)
        else H = csi(x, kernel = kernel, rank = rank)

It looks to me like y really isn't being passed through from kqr() to csi() when reduced = TRUE.
I recognize the arrogance in so quickly assuming a bug in the code, but I don't know how else to make sense of the error. Am I naively using the function incorrectly? If this is indeed a bug, how should I go about remedying the function to make it usable with reduced = TRUE? If this is not a bug, then can anyone see how I need to specify my function call to kqr() so that csi() inherits the y argument properly?
 A: I think that you are using this function correctly. This could be a bug in the code (y is not passed to csi). You could try to contact the maintainer of the kernlab package for clarification. See also instructions here.
Temporary solution
To get the function run, you could temporarely change kqr using trace.
Once you use trace an editor will open.
Edit the csi call (line 79) to: else H = csi(x, as.matrix(y), kernel = kernel, rank = rank)
Then the kqr should work properly.
At the end you can stop the tracing with:
untrace(kqr,signature="matrix")

Example code
#load library
library(kernlab)

# example data
x = as.matrix(sort(sample(seq(from = 5, to = 29),100, replace = TRUE)))
y = as.matrix(sample(seq(from = 0, to = 36)/36, 100, replace = TRUE))

# trace function and enable edit
# edit kqr according to the explanations above
trace("kqr",signature="matrix",edit=TRUE)
#> [1] "kqr"

#run (check edits again)
kqr(x = x, y = y,
    tau = .85,
    kernel = "rbfdot",
    kpar = list(sigma = 10),
    reduced = TRUE)
#> Tracing function ".local" in package "kernlab"
#> Kernel Quantile Regression object of class "kqr" 
#> 
#> Gaussian Radial Basis kernel function. 
#>  Hyperparameter : sigma =  10 
#> 
#> Regularization Cost Parameter C:  0.1
#> Number of training instances learned : 100 
#> Train error :  pinball loss :  0.215005418  rambloss : 0.85

#stop tracing
untrace(kqr,signature="matrix")
#> Untracing specified method for function "kqr" in environment
#> <namespace:kernlab>

Created on 2021-10-19 by the reprex package (v2.0.1)
