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

fosr error - large matrix and vector lambda supplied. #96

Open
edwardgunning opened this issue Mar 8, 2021 · 0 comments
Open

fosr error - large matrix and vector lambda supplied. #96

edwardgunning opened this issue Mar 8, 2021 · 0 comments

Comments

@edwardgunning
Copy link

Hi,

I came across #86 when diagnosing model warnings ( "In optimize(cvfcn, c(0, maxlam), tol = 0.01) : NA/Inf replaced by maximum positive value") using fosr (my data set has # observations ~ 400).

I noticed that when lambda is specified a vector, the pathological example that @julia-wrobel provided still throws an error, rather than a warning. That is:

`library(refund)
library(tidyverse)
set.seed(1988)
dat = pffrSim(n = 300, nygrid = 200, scenario = "int")

covars_df = data.frame(
intercept = rep(1, 300),
age = runif(300, 20, 80),
height = rnorm(300, 68),
weight = rnorm(300, 150)
)

covars_mat = as.matrix(covars_df)
Y_mat = as.matrix(dat$Y)

model_fosr = fosr(Y = Y_mat, X = covars_mat, lambda = 10*seq(0, 5))`

Throws error:

Calculating CV for candidate smoothing parameter values...
lambda LOFO-CV
[1,] 0 NA
[2,] 10 NA
[3,] 20 NA
[4,] 30 NA
[5,] 40 NA
[6,] 50 NA
Error in amc(as.vector(t(respmat)), X.sc %x% Bmat, gam.method = gam.method, :
is.null(lambda) | length(lambda) == n.p is not TRUE

For smaller data (e.g., change n=300 to n=100), no error is produced.

Just letting you know of this error in case the patch can be adapted to handle this.

Best wishes,
Ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant