Question: Bug in gpls package?

0

Carlos J. Gil Bellosta •

**40**wrote:Hello,
I am submitting this mail to this address as it is the one provided in
the gpls package for maintenance.
I think I came accross a bug in the glpls1a.cv.error function in such
package. This function calls the unexported function
glpls1a.predict
which is defined as follows:
function (X, beta, family = "binomial", link = "logit")
{
if (all(X[, 1] == rep(1, nrow(X)))) {
eta <- X %*% beta
}
else {
eta <- cbind(rep(1, nrow(X)), X) %*% beta
}
return(h(eta, family, link))
}
I.e., the function checks whether the first row in the new data is all
ones (looking for an intercept maybe?) and if so, decides that X and
beta are conformable. As I was applying a cv analysis, nrow( X ) was 1
and the first element in X was 1 just by chance for one observation
(not an intercept) so the the wrong option was taken resulting in
"non-conformable arguments" for matrix multiplication.
Is there a safer way to check for intercepts other than comparing the
first row to a vector of ones?
Best regards,
Carlos J. Gil Bellosta
http://www.datanalytics.com