Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning of rankMatrix() in df2lambda() #24

Closed
sbrockhaus opened this issue Dec 15, 2015 · 1 comment
Closed

warning of rankMatrix() in df2lambda() #24

sbrockhaus opened this issue Dec 15, 2015 · 1 comment

Comments

@sbrockhaus
Copy link
Member

@sbrockhaus sbrockhaus commented Dec 15, 2015

For the computation of df2lambda the rank of the design matrix is computed, see
https://github.com/hofnerb/mboost/blob/master/pkg/mboostPatch/R/bl.R#L9
and
https://github.com/hofnerb/mboost/blob/master/pkg/mboostPatch/R/bkronecker.R#L57

In the case that 'p>n', one gets a warning that the rank is computed for t(x) instead of x:

Warning in structure(if (useGrad) which.min(diff1) else if (Meth == "qr") { :
  rankMatrix(x, method='qr'): computing t(x) as nrow(x) < ncol(x)

I think it would be better to suppress the warning, by setting

rank_X <- rankMatrix(X, method = 'qr', warn.t = FALSE)

or by checking whether nrow(X) < ncol(X) and then supplying, t(X) instead of X, see the help of ?rankMatrix argument warn.t.
(As the warning occurs for each base-learner with 'p<n' it can get kind of annoying for models with many base-learners, especially when using cvrisk() on the model.)

In the following a small example for the warning:

library(mboost)
### setting with 'p>n' gives warning in rankMatrix() 
set.seed(290875)
n <- 10
x1 <- rnorm(n)
y <- 2*x1 
mod2 <- mboost(y ~ bbs(x1, df = 4))
dim(extract(mod2, "design")[[1]])
# options(warn = 1)

### for comparison: setting with 'p<n' does not give this warning
set.seed(290875)
n <- 30
x1 <- rnorm(n)
y <- 2*x1 
mod2 <- mboost(y ~ bbs(x1, df = 4))
dim(extract(mod2, "design")[[1]])
@hofnerb hofnerb closed this in 74d80f4 Dec 17, 2015
@sbrockhaus
Copy link
Member Author

@sbrockhaus sbrockhaus commented Jan 15, 2016

Thanks! There is another code-line giving the same warning as rankMatrix() is used:
https://github.com/hofnerb/mboost/blob/master/pkg/mboostPatch/R/bkronecker.R#L57
Can you set the argument warn.t = FALSE here as well?
Best

@sbrockhaus sbrockhaus reopened this Jan 15, 2016
@hofnerb hofnerb closed this in 1feb002 Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.