-
Notifications
You must be signed in to change notification settings - Fork 26
Description
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