CRAN Package Check Results for Package kir

Last updated on 2026-12-05 15:51:08 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.3.0 4.22 125.23 129.45 OK
r-devel-linux-x86_64-debian-gcc 0.3.0 3.09 80.79 83.88 OK
r-devel-linux-x86_64-fedora-clang 0.4.0 84.43 OK
r-devel-linux-x86_64-fedora-gcc 0.4.0 86.55 OK
r-devel-windows-x86_64 0.3.0 7.00 123.00 130.00 OK
r-patched-linux-x86_64 0.3.0 4.37 118.52 122.89 OK
r-release-linux-x86_64 0.3.0 3.20 116.78 119.98 OK
r-release-macos-arm64 0.4.0 2.00 79.00 81.00 OK
r-release-macos-x86_64 0.4.0 5.00 770.00 775.00 OK
r-release-windows-x86_64 0.3.0 6.00 119.00 125.00 OK
r-oldrel-macos-arm64 0.4.0 2.00 95.00 97.00 ERROR
r-oldrel-macos-x86_64 0.4.0 5.00 598.00 603.00 OK
r-oldrel-windows-x86_64 0.3.0 11.00 150.00 161.00 OK

Check Details

Version: 0.4.0
Check: tests
Result: ERROR Running ‘testthat.R’ [60s/56s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > library(testthat) > library(kir) > > test_check("kir") Knowledge Integration Quantile Regression fit Penalty: SCAD Selection: fixed Prior: beta_prior (1 nonzero prior slope) tau: 0.5 lambda: 0.01 zeta: 0.25 Solver: PGD, converged PGD iterations: 15 Nonzero predictors: 2 of 2 *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(newModels[[pos]]$coefficients, x, y, newModels[[pos]]$tau, obj$lambda, local.penalty.factor = penalty.factor * tau.penalty.factor[j], penalty, a[k], weights = weights) 2: rq.lla(init.model, x, y, penalty, a, penalty.factor, tau.penalty.factor, scalex, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 3: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 4: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-1.74688423482202, 0.701583114677164, -0.776990945918909, -1.22981312678372, -1.62986102116045, 1.48015533417847, 0.908616171649339, 0.302475366496952, -1.33489665708055, 0.828471093029582, -0.67935123962284, -0.271053890629315, -0.481721841510625, 0.319582142010314, 0.737736044817482, -1.51151743225488, -0.374537738311257, 0.706471685102107, -0.141896819424521, 1.60718378485484, 0.306670241892734, 0.765015165006591, -0.832448455103301, 0.0452761764970431, 0.245158902555043, -0.81990287451666, -0.258894015195106, -0.282060940190303, 1.83890983509371, 0.93993300250428, -0.735237967915471, -0.213158632590587, -0.130649631765989, -1.70923696338331, 0.847210955512885, 1.3729870226531, 0.66855088983272, 0.379694548313621, 1.71967735151526, -0.856529505237801, -0.749131970490723, 0.452481529927907, 1.00098083116572, 1.29200540782173, 0.33031631607699, -2.10068358225551, -0.260897476039287, -1.47596328584215, 1.21385856724715, -0.255592855694785, -0.288679144066084, -0.749877958708027, -0.451035403436058, -1.53684302287603, 0.601177215938271, -0.173402636811132, -0.594234149961602, 1.28275174480327, -0.234837384042623, 0.375936793250943, 1.09375884387588, 0.809382692872996, 2.01167429719049, 0.40664303541315, 0.227312149664971, -1.4475939466925, -2.16061508299873, 0.806258570000693, -1.15084409253327, 1.20972132757765, 0.729276369893945, -0.235718518851247, -2.0293469555958, 0.426796046703024, 1.26525192708875, -0.761142765166774, -0.21667322585552, -2.605703871626, -1.41616741930113, -0.701092176782223, 0.0821399461053013, 0.11178938618083, 1.37219382085892, -1.12092445155929, -0.235768349891611, -1.0800569854825, 0.669257925808061, -0.197244472775838, 0.441949411253645, 0.787301509676411, -1.3486722791357, 0.36956121401072, 0.992215861969906, -0.44429005795676, 1.61086370528626, 0.487660767614398), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.44013774120954, 1.17646270553815, 0.0226668425663064, 0.849243594831841, 1.16427399130315, 0.525212504228419, 2.13882658033868, 1.34802014161986, 1.98941921212376, 0.729026139039017, 2.28032020309293), tau = 0.5, penalty = "SCAD", a = 3.7) 5: do.call(rqPen::rq.pen, args) 6: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 7: quantreg_call("start", do.call(rqPen::rq.pen, args)) 8: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 13: FUN(X[[i]]) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 18: FUN(X[[i]], ...) 19: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 20: kir_run_chunk(ii, X, FUN) 21: FUN(X[[i]], ...) 22: eval(expr, env) 23: doTryCatch(return(expr), name, parentenv, handler) 24: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 25: tryCatchList(expr, classes, parentenv, handlers) 26: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 27: try(eval(expr, env), silent = TRUE) 28: serialize(what, NULL, xdr = FALSE) 29: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 30: mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]]) 31: FUN(X[[i]], ...) 32: lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])) 33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 34: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 35: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 36: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO")) lambda_scale <- match.arg(lambda_scale) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) if (!automatic_lambda) validate_grid(lambda, "lambda", lower = 0) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(max_iter, "max_iter") validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_seed(seed) rng <- kir_seed_begin(seed) on.exit(kir_seed_restore(rng), add = TRUE) foldid <- draw_folds(n, nfolds) inner <- if (input$spec$type == "prior_vars") { draw_prior_folds(n, control, outer = foldid) } else NULL kir_seed_reset(seed) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", foldid = inner$full, rule = control$rule) tuning <- list(lambda_source = "supplied") if (automatic_lambda) { path <- kiqr_automatic_lambda(x = input$x, y = input$y, y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda tuning <- path$tuning } tuning$lambda <- lambda tuning$zeta <- zeta tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule) } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } else "supply a `lambda` grid with a larger upper bound" warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE) } coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, prior = prior$record, convergence = list(min = result$convergence.min, `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), prior_vars = NULL, y_prior = NULL, seed = 31, standardize = TRUE, prior_control = list(nfolds = 3), nfolds = 3, cores = 2, max_iter = 1000, huber_gamma = 0.1) 37: do.call(fitter, args) 38: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, method = c("cv", "hbic", "fit"), ..., prior_vars = NULL, y_prior = NULL, seed = NULL, standardize = TRUE, penalty = c("SCAD", "LASSO"), penalty_factor = NULL, nfolds = 5, cores = 1, max_iter = 1e+05, huber_gamma = 0.01, scad_a = 3.7, tol = 1e-04) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr") if (no_prior_supplied(beta_prior, prior_vars, y_prior)) { zeta <- no_prior_zeta(zeta) } if (missing(method)) { method <- if (length(lambda) == 1L && length(zeta) == 1L) "fit" else "cv" } method <- match.arg(method) supplied <- c(penalty = !missing(penalty), penalty_factor = !missing(penalty_factor), nfolds = !missing(nfolds), cores = !missing(cores), max_iter = !missing(max_iter), huber_gamma = !missing(huber_gamma), scad_a = !missing(scad_a), tol = !missing(tol)) extra <- check_extra_args(c(list(...), mget(names(supplied)[supplied]))) extra <- kir_translate_extra(extra, method, half_life = TRUE) fitters <- list(cv = kiqr_cv, hbic = kiqr_hbic_run, fit = kiqr_fit) fitter <- fitters[[method]] stop_unsupported_args(names(extra), method, fitters, "kiqr") if (method == "fit" && (length(lambda) != 1L || length(zeta) != 1L)) { stop("`method = \"fit\"` requires one value each for `lambda` and `zeta`.", call. = FALSE) } args <- c(list(x = x, y = y, beta_prior = beta_prior, tau = tau, lambda = lambda, zeta = zeta, prior_vars = prior_vars, y_prior = y_prior, seed = seed, standardize = standardize), extra) out <- do.call(fitter, args) out$call <- match.call() out})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), method = "cv", lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), max_iter = 1000, seed = 31, beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, huber_gamma = 0.1, nfolds = 3, prior_control = list(nfolds = 3), cores = 2) 39: do.call(get(model), c(args, list(cores = 2))) 40: withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) 41: suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) 42: with_backend(backend, { multi <- suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) multi$call <- NULL expect_identical(multi, serial, info = paste(model, method, type, backend))}) 43: eval(code, test_env) 44: eval(code, test_env) 45: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 46: doTryCatch(return(expr), name, parentenv, handler) 47: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 48: tryCatchList(expr, classes, parentenv, handlers) 49: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 50: doWithOneRestart(return(expr), restart) 51: withOneRestart(expr, restarts[[1L]]) 52: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 53: test_code(code, parent.frame()) 54: test_that("CV and HBIC restore all prior grids under dynamic scheduling", { skip_without_backends() set.seed(2604) x <- matrix(rnorm(36 * 4), 36, dimnames = list(NULL, paste0("v", 1:4))) beta <- c(1, 0.8, -0.3, 0, 0) yp <- drop(cbind(1, x) %*% beta) y <- yp + rnorm(36, sd = 0.3) for (model in c("kiqr", "kir")) for (method in c("cv", "hbic")) { for (type in c("beta_prior", "prior_vars", "y_prior")) { args <- c(list(x = x, y = y, method = method, lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), max_iter = 1000, seed = 31), switch(type, beta_prior = list(beta_prior = beta), prior_vars = list(prior_vars = 1), y_prior = list(y_prior = yp))) if (model == "kiqr") args <- c(args, list(tau = 0.5, huber_gamma = 0.1)) if (method == "cv") args <- c(args, list(nfolds = 3, prior_control = list(nfolds = 3))) serial <- suppressWarnings(do.call(get(model), c(args, list(cores = 1)))) serial$call <- NULL for (backend in kir_test_backends()) with_backend(backend, { multi <- suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) multi$call <- NULL expect_identical(multi, serial, info = paste(model, method, type, backend)) }) } } }) 55: eval(code, test_env) 56: eval(code, test_env) 57: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 58: doTryCatch(return(expr), name, parentenv, handler) 59: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 60: tryCatchList(expr, classes, parentenv, handlers) 61: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 62: doWithOneRestart(return(expr), restart) 63: withOneRestart(expr, restarts[[1L]]) 64: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 65: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 66: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 67: FUN(X[[i]], ...) 68: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 69: doTryCatch(return(expr), name, parentenv, handler) 70: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 71: tryCatchList(expr, classes, parentenv, handlers) 72: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 73: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 74: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 75: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 76: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 77: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(newModels[[pos]]$coefficients, x, y, newModels[[pos]]$tau, obj$lambda, local.penalty.factor = penalty.factor * tau.penalty.factor[j], penalty, a[k], weights = weights) 2: rq.lla(init.model, x, y, penalty, a, penalty.factor, tau.penalty.factor, scalex, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 3: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 4: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-1.74688423482202, 0.701583114677164, -0.934235552715437, 1.48015533417847, 0.908616171649339, 0.302475366496952, 0.828471093029582, -0.67935123962284, -0.271053890629315, 1.0400490657633, -0.540850053120684, 0.737736044817482, 1.34920152700499, 2.07052345102704, -1.35726825044567, -0.374537738311257, -0.234284193539822, 0.500379572697357, 0.804669398134318, -1.02824993710535, 0.306670241892734, -0.123466145457348, 0.0452761764970431, 0.755268200167084, 0.245158902555043, -0.81990287451666, 0.661455213860662, 0.93993300250428, -0.735237967915471, -0.213158632590587, -1.70923696338331, 0.847210955512885, 1.3729870226531, -0.216721323498699, -0.51997119032546, 1.71967735151526, -0.0225359851620699, 0.361729737312684, 0.945674007097247, -0.749131970490723, -0.596732751549598, 0.420341580440434, -1.94892006701553, 1.11945718426648, 0.33031631607699, -0.384812155382804, -1.47596328584215, -1.31452399759341, 1.21385856724715, -0.255592855694785, 0.400353249071171, -1.53684302287603, 0.601177215938271, -0.173402636811132, 1.28275174480327, -0.234837384042623, 0.375936793250943, 0.587291903844629, 0.80126774046948, 2.01167429719049, 0.893536947940452, 0.116560142743486, -1.07545118493623, 0.227312149664971, -1.96195082218178, 0.442638179119431, -0.303318666173017, 0.746470169716108, -1.15084409253327, -1.64592608468585, -0.235718518851247, -0.48994898598519, -2.0293469555958, 0.426796046703024, 0.367850293480281, -2.605703871626, -1.41616741930113, -0.701092176782223, 0.11178938618083, 1.37219382085892, -1.12092445155929, 0.661296576185364, -0.15738133569092, 0.669257925808061, 0.504005491764951, -1.0823333949774, 0.943543520811809, 0.441949411253645, 1.44176604637256, 0.864211517199748, -0.987799066373311, -0.150068238091532, 0.992215861969906, 0.291981566320514, 0.487660767614398, 0.843028511570857), y = c(-0.347444760047483, 2.25021217765047, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 1.5020484263109, 0.746402815609336, 1.17646270553815, 2.34226166902041, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 0.903087252456754, 2.25613071832197, 0.183849783697106, 1.34802014161986, 0.986270800177914, 2.28032020309293, 1.81735477065944), tau = 0.5, penalty = "SCAD", a = 3.7) 5: do.call(rqPen::rq.pen, args) 6: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 7: quantreg_call("start", do.call(rqPen::rq.pen, args)) 8: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 13: FUN(X[[i]]) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 18: FUN(X[[i]], ...) 19: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 20: kir_run_chunk(ii, X, FUN) 21: FUN(X[[nexti]], ...) 22: eval(expr, env) 23: doTryCatch(return(expr), name, parentenv, handler) 24: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 25: tryCatchList(expr, classes, parentenv, handlers) 26: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 27: try(eval(expr, env), silent = TRUE) 28: serialize(what, NULL, xdr = FALSE) 29: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 30: mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]]) 31: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 32: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 33: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 34: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO")) lambda_scale <- match.arg(lambda_scale) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) if (!automatic_lambda) validate_grid(lambda, "lambda", lower = 0) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(max_iter, "max_iter") validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_seed(seed) rng <- kir_seed_begin(seed) on.exit(kir_seed_restore(rng), add = TRUE) foldid <- draw_folds(n, nfolds) inner <- if (input$spec$type == "prior_vars") { draw_prior_folds(n, control, outer = foldid) } else NULL kir_seed_reset(seed) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", foldid = inner$full, rule = control$rule) tuning <- list(lambda_source = "supplied") if (automatic_lambda) { path <- kiqr_automatic_lambda(x = input$x, y = input$y, y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda tuning <- path$tuning } tuning$lambda <- lambda tuning$zeta <- zeta tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule) } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } else "supply a `lambda` grid with a larger upper bound" warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE) } coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, prior = prior$record, convergence = list(min = result$convergence.min, `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), prior_vars = NULL, y_prior = NULL, seed = 31, standardize = TRUE, prior_control = list(nfolds = 3), nfolds = 3, cores = 2, max_iter = 1000, huber_gamma = 0.1) 35: do.call(fitter, args) 36: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, method = c("cv", "hbic", "fit"), ..., prior_vars = NULL, y_prior = NULL, seed = NULL, standardize = TRUE, penalty = c("SCAD", "LASSO"), penalty_factor = NULL, nfolds = 5, cores = 1, max_iter = 1e+05, huber_gamma = 0.01, scad_a = 3.7, tol = 1e-04) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr") if (no_prior_supplied(beta_prior, prior_vars, y_prior)) { zeta <- no_prior_zeta(zeta) } if (missing(method)) { method <- if (length(lambda) == 1L && length(zeta) == 1L) "fit" else "cv" } method <- match.arg(method) supplied <- c(penalty = !missing(penalty), penalty_factor = !missing(penalty_factor), nfolds = !missing(nfolds), cores = !missing(cores), max_iter = !missing(max_iter), huber_gamma = !missing(huber_gamma), scad_a = !missing(scad_a), tol = !missing(tol)) extra <- check_extra_args(c(list(...), mget(names(supplied)[supplied]))) extra <- kir_translate_extra(extra, method, half_life = TRUE) fitters <- list(cv = kiqr_cv, hbic = kiqr_hbic_run, fit = kiqr_fit) fitter <- fitters[[method]] stop_unsupported_args(names(extra), method, fitters, "kiqr") if (method == "fit" && (length(lambda) != 1L || length(zeta) != 1L)) { stop("`method = \"fit\"` requires one value each for `lambda` and `zeta`.", call. = FALSE) } args <- c(list(x = x, y = y, beta_prior = beta_prior, tau = tau, lambda = lambda, zeta = zeta, prior_vars = prior_vars, y_prior = y_prior, seed = seed, standardize = standardize), extra) out <- do.call(fitter, args) out$call <- match.call() out})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), method = "cv", lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), max_iter = 1000, seed = 31, beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, huber_gamma = 0.1, nfolds = 3, prior_control = list(nfolds = 3), cores = 2) 37: do.call(get(model), c(args, list(cores = 2))) 38: withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) 39: suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) 40: with_backend(backend, { multi <- suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) multi$call <- NULL expect_identical(multi, serial, info = paste(model, method, type, backend))}) 41: eval(code, test_env) 42: eval(code, test_env) 43: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 44: doTryCatch(return(expr), name, parentenv, handler) 45: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 46: tryCatchList(expr, classes, parentenv, handlers) 47: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 48: doWithOneRestart(return(expr), restart) 49: withOneRestart(expr, restarts[[1L]]) 50: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 51: test_code(code, parent.frame()) 52: test_that("CV and HBIC restore all prior grids under dynamic scheduling", { skip_without_backends() set.seed(2604) x <- matrix(rnorm(36 * 4), 36, dimnames = list(NULL, paste0("v", 1:4))) beta <- c(1, 0.8, -0.3, 0, 0) yp <- drop(cbind(1, x) %*% beta) y <- yp + rnorm(36, sd = 0.3) for (model in c("kiqr", "kir")) for (method in c("cv", "hbic")) { for (type in c("beta_prior", "prior_vars", "y_prior")) { args <- c(list(x = x, y = y, method = method, lambda = c(0.05, 0.15), zeta = c(0.8, 0, 0.3, 1), max_iter = 1000, seed = 31), switch(type, beta_prior = list(beta_prior = beta), prior_vars = list(prior_vars = 1), y_prior = list(y_prior = yp))) if (model == "kiqr") args <- c(args, list(tau = 0.5, huber_gamma = 0.1)) if (method == "cv") args <- c(args, list(nfolds = 3, prior_control = list(nfolds = 3))) serial <- suppressWarnings(do.call(get(model), c(args, list(cores = 1)))) serial$call <- NULL for (backend in kir_test_backends()) with_backend(backend, { multi <- suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) multi$call <- NULL expect_identical(multi, serial, info = paste(model, method, type, backend)) }) } } }) 53: eval(code, test_env) 54: eval(code, test_env) 55: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 56: doTryCatch(return(expr), name, parentenv, handler) 57: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 58: tryCatchList(expr, classes, parentenv, handlers) 59: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 60: doWithOneRestart(return(expr), restart) 61: withOneRestart(expr, restarts[[1L]]) 62: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 63: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 64: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 65: FUN(X[[i]], ...) 66: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 67: doTryCatch(return(expr), name, parentenv, handler) 68: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 69: tryCatchList(expr, classes, parentenv, handlers) 70: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 71: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 72: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 73: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 74: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 75: test_check("kir") An irrecoverable exception occurred. R is aborting now ... Saving _problems/test-loadbalance-46.R *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: Traceback: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, 1: "LASSO", a)rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) 2: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, 2: ...)rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) 3: 3: rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, max.iter, converge.eps, lambda.discard = lambda.discard, ...) ...) 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, 4: penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) lambda.discard = lambda.discard, weights = weights, ...) 5: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, 5: max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, weights = weights, ...) penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, 6: max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", weights = weights, ...) "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, 6: tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, { ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, penalty <- match.arg(penalty) tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, stop("All entries of tau should be unique") weights = NULL, ...) }{ if (is.unsorted(tau)) { penalty <- match.arg(penalty) stop("Quantile values should be entered in ascending order") alg <- match.arg(alg) } if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") if (length(y) != nrow(x)) { } stop("length of x and number of rows in x are not the same") if (is.unsorted(tau)) { } stop("Quantile values should be entered in ascending order") if (min(apply(x, 2, sd)) == 0) { } stop("At least one of the x predictors has a standard deviation of zero") if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } } if (penalty == "aLASSO") { if (is.null(weights) == FALSE) { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") if (penalty == "ENet" | penalty == "Ridge") { } stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") if (length(weights) != length(y)) { } stop("number of weights does not match number of responses") if (penalty == "aLASSO") { } warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") if (sum(weights <= 0) > 0) { } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") stop("all weights most be positive") } if (sum(weights <= 0) > 0) { } stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { } y <- as.numeric(y) if (is.matrix(y) == TRUE) { } y <- as.numeric(y) if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == stop("Penalty factors must be non-negative.") 0) { } stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { } stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") if (scalex) { } if (scalex) { x <- scale(x) x <- scale(x) } } if (penalty == "LASSO") { if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) weights = weights, ...) } } else if (penalty == "Ridge") { else if (penalty == "Ridge") { if (alg != "huber") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") stop("huber alg is only option for Ridge penalty") } } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, converge.eps, lambda.discard = lambda.discard, ...) scalex = FALSE, tau.penalty.factor, a = 0, max.iter, } converge.eps, lambda.discard = lambda.discard, ...) else if (penalty == "ENet") { } if (alg != "huber") { else if (penalty == "ENet") { stop("huber alg is only option for ENet penalty") if (alg != "huber") { } stop("huber alg is only option for ENet penalty") if (is.null(a)) { } if (is.null(a)) { stop("Specify a value for a for ENet penalty") stop("Specify a value for a for ENet penalty") } } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, converge.eps, gamma, lambda.discard = lambda.discard, ...) ...) } } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, lambda.discard = lambda.discard, weights = weights, ...) ...) } } if (scalex) { if (scalex) { for (i in 1:length(fit$models)) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) attributes(x)$`scaled:scale`) } } else { else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } } } } if (lambda.discard) { if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } } } fit$weights <- weights fit$weights <- weights fit$call <- match.call() fit$call <- match.call() fit fit})(x = c(2.02976680254099, -0.924454735019604, -0.645038975588689, -1.19830324701652, -1.17512419136511, 0.504760941771944, -0.352407260154575, })(x = c(2.02976680254099, -1.4223299789818, -0.924454735019604, -0.0852647155754194, 1.93338896896123, 0.117191742921125, 2.45533612036215, -1.19830324701652, -1.17512419136511, -0.352407260154575, -0.0852647155754194, 1.6421708663652, 0.226871795844437, -1.12213496859494, -0.541036054757722, 0.742586541621464, 0.462355561365264, 1.05747528897091, -1.61180243286025, 1.93338896896123, 2.45533612036215, 2.02402466560042, 0.0845280984010655, 1.02473023092809, -0.054018509028608, 0.508863559691845, 0.349799604907625, 1.6421708663652, 0.226871795844437, -1.12213496859494, -0.541036054757722, -1.21056907767332, -1.09939554299237, 0.475601793627063, -0.126884598722137, -0.241301864960321, 0.742586541621464, 0.595532581993574, 0.462355561365264, -0.314271449855737, -0.65316137473815, 0.7518501746584, -0.377507756944675, -1.61180243286025, 1.02473023092809, -0.054018509028608, 0.508863559691845, 0.0755851598583044, 0.970862028609763, -0.929433266038919, -0.519341123070035, 0.349799604907625, -0.510058167549672, -1.09939554299237, -0.314271449855737, -0.623953437070941, -0.634371283313816, 0.349249664912587, -0.136919229115098, -0.65316137473815, -0.793499067768389, 0.7518501746584, -1.33152801509216, 0.686017490231808, -0.333195371917585, 0.363091818115056, 1.84434020115321, -0.377507756944675, 0.970862028609763, -0.929433266038919, -1.53605929713035, 0.757263860271903, 0.488978289218536, -1.77588332818172, 0.309034680923315, -0.634371283313816, 1.10161993683408, 0.349249664912587, -0.136919229115098, 0.140727558176705, -1.03751874807229, 0.041661512805674, 0.133170843807366, 0.686017490231808, -0.333195371917585, -0.0512359526882051, 0.363091818115056, 0.309829308732826, 1.18340661988915, 0.807464483174762, 1.23229176395568, 0.757263860271903, 0.488978289218536, 0.309034680923315, 0.140727558176705, 0.73171056651179, -1.06260482478871, -0.723227246075157, -1.00076642804367, -1.03751874807229, 0.133170843807366, 0.558218570721797, 0.73633539566727, -1.85508405751867, -1.50834413899009, -1.02550203809269, -0.659134000404826, 0.309829308732826, 1.18340661988915, 0.807464483174762, 1.23229176395568, -0.11173921704798, 0.335934697014777, -0.038063613031295, -0.0104599657638214, 1.35080165485728, 0.73171056651179, 0.435467038137777, -1.06260482478871, -0.47765041771437, -0.919016330858739, -0.425304315526716, -2.01688873126219, -1.00076642804367, -1.85508405751867, -1.50834413899009, -1.02550203809269, 0.606414609054415, 1.76544979364713, -0.756211612773313, 0.641475173690406, -0.659134000404826, 2.63528852273052, 0.335934697014777, -0.47765041771437, 0.89296363603433, -0.676868406231887, -1.74507898400803, -0.527062378798573, -0.919016330858739, -0.387315288903273, -0.425304315526716, -0.379473265315923, -0.209313728032921, 0.383974163231164, -0.304300389749029, -1.56381020598583, -2.01688873126219, 1.76544979364713, -0.756211612773313, 0.218550188893291, 0.142043747040958, -2.05784466478052, 0.927138294479829, 0.963865375872252, -0.676868406231887, 1.1930716028577, -1.74507898400803, -0.527062378798573, 0.753291055709181, -0.0749355103260018, -0.703332812511664, 0.314809721012768, -0.209313728032921, 0.383974163231164, 0.462741941890384, -0.304300389749029, -1.23582874081278, 1.56274631935155, -1.64133719830489, 1.05614298604371, 0.142043747040958, -2.05784466478052, 0.963865375872252, 0.753291055709181, -0.0749355103260018, 0.314809721012768, 0.528888377749661, 0.490336400919154, 0.136988648133905, 1.59264991659855, 0.578809408918058, -0.417332008957307, -1.23582874081278, 1.56274631935155, -1.64133719830489, 1.05614298604371, 0.917341665004607, 0.136988648133905, -2.00130006830185, 1.59264991659855, 0.625682190197015, 1.55050647704236, 0.369619663650055, -0.174717118323951, -0.417332008957307, 0.625682190197015, 1.55050647704236, 0.369619663650055, -1.90103931892406, -0.895514470766944, 0.721389407897209, 0.783222216209243, -0.174717118323951, 0.959192393095508, -0.895514470766944, 0.210580249161236, 0.210580249161236, 1.09222703056739, 0.299045345643664, 0.0972277645880531, 1.09222703056739, -1.083872457281, 0.299045345643664, 0.840462443548589, 0.945830120625551, -1.89400297928635, -1.21923620594258, -0.0230032430724594, 0.0972277645880531, -1.89400297928635, -1.21923620594258, 0.0252802863279144, 0.341765587946093, -0.29547290490614, 0.3458852639534, 0.178591188904302, -0.29547290490614, -1.23550338323457, 0.3458852639534, 0.178591188904302, -1.47589196984538, -0.419446465991891, -0.955238888959497, -0.275299358060636, -1.47589196984538, -0.419446465991891, 0.99345213094729, -0.955238888959497, 0.58656022652938, -0.849339937111335, -1.62118709782745, 1.07420809372023, 0.58656022652938, -0.849339937111335, 1.07420809372023, 1.11526414088976, 1.11526414088976, -0.084175763839948, 0.262419945178727, 0.0180223294843316, -0.084175763839948, 0.0180223294843316, -0.0669617219173729, 0.939859156510575, -0.384092462871435, 0.240172237176087, 0.592580911951259, 0.648562135636633, 0.939859156510575, -0.384092462871435, 0.240172237176087, -1.9356617938841, 0.395971743642491, 1.0724401875031, -1.33066970567449, 0.592580911951259, 0.237837861885234, -1.9356617938841, -2.34895785521095, 0.395971743642491, -1.33066970567449, 0.525212838208188, 0.175408824720068, 0.525212838208188, 0.175408824720068, 0.63418622976483, 1.21400366799326, 0.63418622976483, 1.21400366799326, -0.655589965239558, 2.05845813756291, 0.069529941412175, 2.05845813756291, 2.18932711210877, 1.02998457589241, -0.259184606176068, 0.388173323261591, -0.603989852986333, 0.952949673088353, -0.259184606176068, 0.388173323261591, 0.952949673088353, -1.84330125799151, 0.343615097271085, -1.84330125799151, -1.95208592177504, 1.10272277172609, -0.746448220356653, -1.95208592177504, 1.10272277172609, -0.344868498918864, -1.13911206028756, 0.273603074663941, -0.931522524823459, -0.128652187182702, -0.172933780654815, 0.273603074663941, -0.128652187182702, -0.638553010897555, -0.638553010897555, 0.55274656991046, 2.1406514829445, 0.948711324475765, 0.0375439471660837, 1.31217967132952, -1.14491953997933, 0.460754334139996, -1.37348978431467, 1.328619578441, -1.60124919287051, -0.620165843949603, 0.55274656991046, 2.1406514829445, 0.0375439471660837, 0.679841005597609, -0.527114696434009, -0.86292590857131, 1.59466622025251, -0.0778352390996005, 1.31217967132952, -1.14491953997933, -0.562538148116926, 0.460754334139996, 0.174302111298891, -0.999818517635082, -0.393534007020188, -0.138179097345487, -1.37348978431467, 1.328619578441, 0.0790433410939509, -1.60124919287051, -1.24023862801766, 0.548322395763614, -0.510622123149699, 1.33844865284022, -0.86292590857131, 1.59466622025251, -0.0778352390996005, 0.174302111298891, 0.0474534352138238, -0.749872626812795, -1.8843760446447, 1.06112579513477, -0.393534007020188, -1.24023862801766, 1.04217783807476, 0.548322395763614, -0.20480311289164, 1.62624899494295, -1.44970731816349, 0.0461190843370063, -0.510622123149699, 1.33844865284022, 0.0474534352138238, -0.749872626812795, 0.088318363731879, 0.061829884142029, -0.353299740832593, 0.222511136868468, -0.349253901548057, 1.06112579513477, -0.464598472612664, 0.0780721830488908, 1.65275692243905, 2.07717712603769, -0.563211245613888, -0.0163818298621174, -0.20480311289164, 1.62624899494295, 0.0461190843370063, 0.061829884142029, -1.81471714998571, 0.890628122307323), y = c(2.67982244558618, -0.382433261367634, -0.353299740832593, 0.222511136868468, -0.935302502923367, -1.67956548635685, -0.547750084688965, -0.524540176527502, -0.489269134564159, -0.316915017859565, 2.07717712603769, -0.0163818298621174, -1.81471714998571, 1.60275538701347, 1.06014446834989, 3.7175742283744, 2.86231069039424, 0.890628122307323), y = c(2.67982244558618, -0.547750084688965, 4.38469733949897, 1.49532848801924, 3.19557873241325, 1.14811037084504, -0.398795236883855, -0.524540176527502, -0.489269134564159, 2.20631144379421, -0.587063864331435, 0.13698799943166, -0.0861136242523111, 2.30764400112505, 1.60275538701347, 1.06014446834989, 3.7175742283744, 0.938377272967946, 2.02536395425182, 2.32588201659058, -0.498299717773021, 3.16537527240507, 2.86231069039424, 3.19557873241325, 1.14811037084504, -0.587063864331435, 3.07851251854135, 2.65860810566436, 2.24148456160325, 0.138421241440572, 0.13698799943166, 2.30764400112505, 2.32588201659058, 2.5185301708005, 1.01230914783832, 0.823381704730666, 1.04571344529047, 0.337862939714959, 2.24601641622231, 0.268193432979243, 1.66945935164809, 1.06502057639093, -0.498299717773021, 3.16537527240507, 3.07851251854135, 2.65860810566436, 1.44259323881427, -0.435455534138912, 0.894421688079667, 1.66801070614777, 2.24148456160325, 0.756159454596157, 1.01230914783832, 2.07174273642158, 0.358451952436733, 0.823381704730666, 1.04571344529047, 2.24601641622231, 1.90147803693366, 0.233005189045355, 1.68171995374156), tau = 0.5, 1.66945935164809, 1.50727683947692, 1.06502057639093, 1.44259323881427, penalty = "SCAD", a = 3.7)-0.129065176588918, -0.746903550648001, 0.894421688079667, 1.90147803693366, 0.233005189045355, 1.68171995374156), tau = 0.5, penalty = "SCAD", 7: a = 3.7)do.call(rqPen::rq.pen, args) 7: 8: do.call(rqPen::rq.pen, args)withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { 8: flagged <<- TRUEwithCallingHandlers(expr, warning = function(w) { .quantreg_notes$nonunique <- .quantreg_notes$nonunique + if (quantreg_is_nonunique(w)) { 1L if (!flagged) { .quantreg_notes$stages <- union(.quantreg_notes$stages, flagged <<- TRUE stage) .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, } invokeRestart("muffleWarning") stage) } } invokeRestart("muffleWarning")}) } 9: })quantreg_call("start", do.call(rqPen::rq.pen, args)) 9: quantreg_call("start", do.call(rqPen::rq.pen, args))10: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, 10: a = a)initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)11: doTryCatch(return(expr), name, parentenv, handler)11: 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])doTryCatch(return(expr), name, parentenv, handler) 13: 12: tryCatchList(expr, classes, parentenv, handlers)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14: 13: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, tryCatchList(expr, classes, parentenv, handlers) Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))14: })tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {15: list(ok = FALSE, message = conditionMessage(e))FUN(X[[i]])}) 16: doTryCatch(return(expr), name, parentenv, handler)15: FUN(X[[i]])17: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 18: 16: tryCatchList(expr, classes, parentenv, handlers)doTryCatch(return(expr), name, parentenv, handler) 19: 17: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), tryCatchOne(expr, names, parentenv, handlers[[1L]]) error = function(e) list(ok = FALSE, message = conditionMessage(e))) 20: 18: FUN(X[[i]], ...)tryCatchList(expr, classes, parentenv, handlers) 21: 19: lapply(ii, function(i) {tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), before <- quantreg_notes_counts() error = function(e) list(ok = FALSE, message = conditionMessage(e))) tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))20: })FUN(X[[i]], ...) 22: kir_run_chunk(ii, X, FUN)21: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), 23: error = function(e) list(ok = FALSE, message = conditionMessage(e)))FUN(X[[i]], ...)}) 24: 22: eval(expr, env)kir_run_chunk(ii, X, FUN) 25: 23: doTryCatch(return(expr), name, parentenv, handler)FUN(X[[i]], ...) 26: tryCatchOne(expr, names, parentenv, handlers[[1L]])24: eval(expr, env)27: tryCatchList(expr, classes, parentenv, handlers)25: doTryCatch(return(expr), name, parentenv, handler)28: tryCatch(expr, error = function(e) {26: call <- conditionCall(e)tryCatchOne(expr, names, parentenv, handlers[[1L]]) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L)27: dcall <- deparse(call, nlines = 1L)tryCatchList(expr, classes, parentenv, handlers) prefix <- paste("Error in", dcall, ": ") LONG <- 75L28: sm <- strsplit(conditionMessage(e), "\n")[[1L]]tryCatch(expr, error = function(e) { w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") call <- conditionCall(e) if (is.na(w)) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], call <- sys.call(-4L) type = "b") dcall <- deparse(call, nlines = 1L) if (w > LONG) prefix <- paste("Error in", dcall, ": ") prefix <- paste0(prefix, "\n ") LONG <- 75L } sm <- strsplit(conditionMessage(e), "\n")[[1L]] else prefix <- "Error : " w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (is.na(w)) if (!silent && isTRUE(getOption("show.error.messages"))) { w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") cat(msg, file = outFile) if (w > LONG) .Internal(printDeferredWarnings()) } prefix <- paste0(prefix, "\n ") invisible(structure(msg, class = "try-error", condition = e)) } else prefix <- "Error : "}) msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L]))29: if (!silent && isTRUE(getOption("show.error.messages"))) {try(eval(expr, env), silent = TRUE) 30: cat(msg, file = outFile)serialize(what, NULL, xdr = FALSE) .Internal(printDeferredWarnings())31: } invisible(structure(msg, class = "try-error", condition = e))})sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 29: 32: try(eval(expr, env), silent = TRUE)mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])30: 33: serialize(what, NULL, xdr = FALSE)FUN(X[[i]], ...) 31: 34: sendMaster(try(eval(expr, env), silent = TRUE), FALSE)lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]]))32: mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, 35: silent = mc.silent, mc.affinity = affinity.list[[i]]) parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, 33: FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) FUN(X[[i]], ...) 36: 34: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) {lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), return(fold_priors[[i]]) mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE]35: Y_train <- Y[train_idx]parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))36: })kir_lapply(seq_len(nfolds), function(i) { if (!init_attempt$ok) { if (!isTRUE(fold_priors[[i]]$valid)) { return(cv_fold_failure("init_error", init_attempt$message)) return(fold_priors[[i]]) } } beta_y <- init_attempt$value train_idx <- which(fold_indices != i) if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, } Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(valid = TRUE, beta_y = beta_y) list(ok = FALSE, message = conditionMessage(e))}, cores = cores) }) if (!init_attempt$ok) {37: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, return(cv_fold_failure("init_error", init_attempt$message)) lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, } cores = cores, gamma = huber_gamma, max_iter = max_iter, beta_y <- init_attempt$value fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + penalty = penalty, Y_p = prior$y, warm_start = warm_start, 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { a = scad_a, tol = tol) return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) }38: list(valid = TRUE, beta_y = beta_y)}, cores = cores)kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2)37: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, 39: withCallingHandlers(expr, warning = function(w) if (inherits(w, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, classes)) tryInvokeRestart("muffleWarning")) cores = cores, gamma = huber_gamma, max_iter = max_iter, 40: fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, penalty = penalty, Y_p = prior$y, warm_start = warm_start, cores = 2)) a = scad_a, tol = tol) 38: 41: kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, eval(code, test_env) 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2) 42: 39: eval(code, test_env)withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning"))43: withCallingHandlers({40: eval(code, test_env) new_expectations <- the$test_expectations > starting_expectationssuppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, if (snapshot_skipped) { nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, skip("On CRAN") cores = 2)) } else if (!new_expectations && skip_on_empty) {41: eval(code, test_env) skip_empty() }42: }, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) {eval(code, test_env) skip(paste0("{", e$package, "} is not installed.")) }43: }, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUEwithCallingHandlers({ eval(code, test_env) invokeRestart("muffle_cran_snapshot") new_expectations <- the$test_expectations > starting_expectations}, skip = handle_skip, warning = handle_warning, message = handle_message, if (snapshot_skipped) { error = handle_error, interrupt = handle_interrupt) skip("On CRAN") }44: else if (!new_expectations && skip_on_empty) {doTryCatch(return(expr), name, parentenv, handler) skip_empty() }45: }, expectation = handle_expectation, packageNotFoundError = function(e) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) if (on_cran()) { skip(paste0("{", e$package, "} is not installed."))46: }tryCatchList(expr, classes, parentenv, handlers)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE47: invokeRestart("muffle_cran_snapshot")tryCatch(withCallingHandlers({}, skip = handle_skip, warning = handle_warning, message = handle_message, eval(code, test_env) error = handle_error, interrupt = handle_interrupt) new_expectations <- the$test_expectations > starting_expectations 44: if (snapshot_skipped) {doTryCatch(return(expr), name, parentenv, handler) skip("On CRAN") }45: tryCatchOne(expr, names, parentenv, handlers[[1L]]) else if (!new_expectations && skip_on_empty) { skip_empty()46: tryCatchList(expr, classes, parentenv, handlers) } }, expectation = handle_expectation, packageNotFoundError = function(e) {47: if (on_cran()) {tryCatch(withCallingHandlers({ skip(paste0("{", e$package, "} is not installed.")) eval(code, test_env) } new_expectations <- the$test_expectations > starting_expectations}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE if (snapshot_skipped) { invokeRestart("muffle_cran_snapshot") skip("On CRAN")}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt), error = handle_fatal) else if (!new_expectations && skip_on_empty) { skip_empty()48: doWithOneRestart(return(expr), restart) } }, expectation = handle_expectation, packageNotFoundError = function(e) {49: if (on_cran()) {withOneRestart(expr, restarts[[1L]]) skip(paste0("{", e$package, "} is not installed.")) }50: withRestarts(tryCatch(withCallingHandlers({}, snapshot_on_cran = function(cnd) { eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations snapshot_skipped <<- TRUE if (snapshot_skipped) { invokeRestart("muffle_cran_snapshot") skip("On CRAN")}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt), error = handle_fatal) else if (!new_expectations && skip_on_empty) { skip_empty() }48: }, expectation = handle_expectation, packageNotFoundError = function(e) {doWithOneRestart(return(expr), restart) if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }49: }, snapshot_on_cran = function(cnd) {withOneRestart(expr, restarts[[1L]]) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot") }, skip = handle_skip, warning = handle_warning, message = handle_message, 50: error = handle_error, interrupt = handle_interrupt), error = handle_fatal), withRestarts(tryCatch(withCallingHandlers({ end_test = function() { eval(code, test_env) }) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {51: skip("On CRAN") }test_code(code, parent.frame()) else if (!new_expectations && skip_on_empty) { skip_empty()52: }test_that("kiqr folds with seed equal hand-built folds and are core-independent", }, expectation = handle_expectation, packageNotFoundError = function(e) { { d <- prior_data() if (on_cran()) { fit <- suppressWarnings(kiqr_cv(d$x, d$y, d$b, tau = 0.5, skip(paste0("{", e$package, "} is not installed.")) nlambda = 3, zeta = c(0, 0.5), seed = 2026, huber_gamma = 0.1)) } set.seed(2026)}, snapshot_on_cran = function(cnd) { expect_identical(fit$foldid, sample(rep(1:5, length.out = 50))) snapshot_skipped <<- TRUE skip_on_os("windows") serial <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, invokeRestart("muffle_cran_snapshot") tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, }, skip = handle_skip, warning = handle_warning, message = handle_message, huber_gamma = 0.1, cores = 1)) error = handle_error, interrupt = handle_interrupt), error = handle_fatal), parallel <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, end_test = function() { tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, }) huber_gamma = 0.1, cores = 2)) serial$call <- parallel$call <- NULL51: expect_identical(serial, parallel)test_code(code, parent.frame()) }) 53: 52: test_that("kiqr folds with seed equal hand-built folds and are core-independent", eval(code, test_env) { d <- prior_data()54: fit <- suppressWarnings(kiqr_cv(d$x, d$y, d$b, tau = 0.5, eval(code, test_env) nlambda = 3, zeta = c(0, 0.5), seed = 2026, huber_gamma = 0.1)) set.seed(2026)55: expect_identical(fit$foldid, sample(rep(1:5, length.out = 50)))withCallingHandlers({ skip_on_os("windows") eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations serial <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, if (snapshot_skipped) { tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, skip("On CRAN") huber_gamma = 0.1, cores = 1)) } parallel <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, else if (!new_expectations && skip_on_empty) { skip_empty() tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, } huber_gamma = 0.1, cores = 2))}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { serial$call <- parallel$call <- NULL skip(paste0("{", e$package, "} is not installed.")) expect_identical(serial, parallel) }) } }, snapshot_on_cran = function(cnd) {53: snapshot_skipped <<- TRUEeval(code, test_env) invokeRestart("muffle_cran_snapshot")54: }, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)eval(code, test_env) 56: doTryCatch(return(expr), name, parentenv, handler)55: withCallingHandlers({ 57: eval(code, test_env)tryCatchOne(expr, names, parentenv, handlers[[1L]]) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN")58: }tryCatchList(expr, classes, parentenv, handlers) else if (!new_expectations && skip_on_empty) { skip_empty()59: }tryCatch(withCallingHandlers({ eval(code, test_env)}, expectation = handle_expectation, packageNotFoundError = function(e) { new_expectations <- the$test_expectations > starting_expectations if (on_cran()) { if (snapshot_skipped) { skip(paste0("{", e$package, "} is not installed.")) skip("On CRAN") } }}, snapshot_on_cran = function(cnd) { else if (!new_expectations && skip_on_empty) { snapshot_skipped <<- TRUE skip_empty() invokeRestart("muffle_cran_snapshot") }}, skip = handle_skip, warning = handle_warning, message = handle_message, }, expectation = handle_expectation, packageNotFoundError = function(e) { error = handle_error, interrupt = handle_interrupt) if (on_cran()) { skip(paste0("{", e$package, "} is not installed."))56: }doTryCatch(return(expr), name, parentenv, handler)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE57: invokeRestart("muffle_cran_snapshot")tryCatchOne(expr, names, parentenv, handlers[[1L]])}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)58: tryCatchList(expr, classes, parentenv, handlers)60: doWithOneRestart(return(expr), restart) 59: 61: tryCatch(withCallingHandlers({withOneRestart(expr, restarts[[1L]]) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {62: skip("On CRAN")withRestarts(tryCatch(withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { } skip("On CRAN")}, expectation = handle_expectation, packageNotFoundError = function(e) { } if (on_cran()) { else if (!new_expectations && skip_on_empty) { skip(paste0("{", e$package, "} is not installed.")) skip_empty() } }}, snapshot_on_cran = function(cnd) {}, expectation = handle_expectation, packageNotFoundError = function(e) { snapshot_skipped <<- TRUE if (on_cran()) { invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt), error = handle_fatal)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE60: invokeRestart("muffle_cran_snapshot")doWithOneRestart(return(expr), restart)}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), 61: end_test = function() {withOneRestart(expr, restarts[[1L]]) }) 62: 63: withRestarts(tryCatch(withCallingHandlers({test_code(code = exprs, env = env, reporter = get_reporter() %||% eval(code, test_env) StopReporter$new()) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {64: skip("On CRAN")source_file(path, env = env(env), desc = desc, shuffle = shuffle, } error_call = error_call) else if (!new_expectations && skip_on_empty) { skip_empty()65: }FUN(X[[i]], ...)}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) {66: skip(paste0("{", e$package, "} is not installed."))lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, } error_call = error_call) }, snapshot_on_cran = function(cnd) {67: snapshot_skipped <<- TRUEdoTryCatch(return(expr), name, parentenv, handler) invokeRestart("muffle_cran_snapshot") }, skip = handle_skip, warning = handle_warning, message = handle_message, 68: error = handle_error, interrupt = handle_interrupt), error = handle_fatal), tryCatchOne(expr, names, parentenv, handlers[[1L]]) end_test = function() { })69: tryCatchList(expr, classes, parentenv, handlers)63: test_code(code = exprs, env = env, reporter = get_reporter() %||% 70: StopReporter$new())tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n")64: NULLsource_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call)}) 65: 71: FUN(X[[i]], ...)with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 66: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, 72: error_call = error_call)test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, 67: env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, doTryCatch(return(expr), name, parentenv, handler) desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call)68: tryCatchOne(expr, names, parentenv, handlers[[1L]])73: test_files(test_dir = path, test_paths = test_paths, test_package = package, 69: reporter = reporter, load_helpers = load_helpers, env = env, tryCatchList(expr, classes, parentenv, handlers) stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle)70: tryCatch(code, testthat_abort_reporter = function(cnd) {74: cat(conditionMessage(cnd), "\n")test_dir("testthat", package = package, reporter = reporter, NULL}) ..., load_package = "installed") 71: 75: with_reporter(reporters$multi, lapply(test_paths, test_one_file, test_check("kir") env = env, desc = desc, shuffle = shuffle, error_call = error_call)) An irrecoverable exception occurred. R is aborting now ... 72: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 73: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 74: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 75: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) 2: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) 3: rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, ...) 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 5: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 6: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) Traceback: } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { 1: stop("Penalty factors must be non-negative.")rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, } "LASSO", a) if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { 2: stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model")rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, } scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, if (scalex) { ...) x <- scale(x) 3: }rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, if (penalty == "LASSO") { max.iter, converge.eps, lambda.discard = lambda.discard, fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, ...) alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, weights = weights, ...) } penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, else if (penalty == "Ridge") { if (alg != "huber") { coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) stop("huber alg is only option for Ridge penalty") 5: }rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, } else if (penalty == "ENet") { max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, if (alg != "huber") { stop("huber alg is only option for ENet penalty") weights = weights, ...) } if (is.null(a)) { 6: stop("Specify a value for a for ENet penalty")(function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", } "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, scalex = FALSE, tau.penalty.factor, a, max.iter, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, converge.eps, gamma, lambda.discard = lambda.discard, weights = NULL, ...) ...){ } penalty <- match.arg(penalty) else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == alg <- match.arg(alg) "MCP") { if (length(tau) > length(unique(tau))) { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, stop("All entries of tau should be unique") eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, } coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, if (is.unsorted(tau)) { ...) stop("Quantile values should be entered in ascending order") } } if (scalex) { if (length(y) != nrow(x)) { for (i in 1:length(fit$models)) { stop("length of x and number of rows in x are not the same") if (!is.null(dim(fit$models[[i]]$coefficients))) { } if (min(apply(x, 2, sd)) == 0) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, stop("At least one of the x predictors has a standard deviation of zero") 2, transform_coefs, attributes(x)$`scaled:center`, } attributes(x)$`scaled:scale`) if (is.null(weights) == FALSE) { } if (penalty == "ENet" | penalty == "Ridge") { else { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, } attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) if (penalty == "aLASSO") { } warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } } } if (lambda.discard) { if (length(weights) != length(y)) { lmin <- min(sapply(fit$models, lambdanum)) stop("number of weights does not match number of responses") fit$lambda <- fit$lambda[1:lmin] } for (j in 1:length(fit$models)) { if (sum(weights <= 0) > 0) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, stop("all weights most be positive") 1:lmin] } fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] } fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] if (is.matrix(y) == TRUE) { } y <- as.numeric(y) } } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") fit$weights <- weights } fit$call <- match.call() if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == fit 0) {})(x = c(2.02976680254099, -1.4223299789818, -0.924454735019604, stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model")-0.645038975588689, -1.19830324701652, 0.504760941771944, -0.0852647155754194, } if (scalex) {1.93338896896123, 0.117191742921125, 2.45533612036215, 2.02402466560042, x <- scale(x)0.0845280984010655, 1.6421708663652, 0.226871795844437, -1.12213496859494, }-0.541036054757722, -0.241301864960321, 0.742586541621464, 0.595532581993574, 1.05747528897091, -1.61180243286025, 1.02473023092809, 0.508863559691845, if (penalty == "LASSO") {0.349799604907625, -1.21056907767332, -0.510058167549672, -1.09939554299237, fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, 0.475601793627063, -0.126884598722137, -0.65316137473815, -0.793499067768389, 0.7518501746584, -1.33152801509216, -0.377507756944675, 0.0755851598583044, -0.929433266038919, -0.519341123070035, -1.53605929713035, -0.623953437070941, max.iter, converge.eps, lambda.discard = lambda.discard, 1.10161993683408, -0.333195371917585, -0.0512359526882051, 0.363091818115056, weights = weights, ...)1.84434020115321, 0.757263860271903, -1.77588332818172, 0.140727558176705, }-1.03751874807229, 0.041661512805674, 0.133170843807366, 0.558218570721797, else if (penalty == "Ridge") {0.73633539566727, 0.309829308732826, 1.18340661988915, 0.807464483174762, if (alg != "huber") {1.23229176395568, 1.35080165485728, 0.73171056651179, 0.435467038137777, stop("huber alg is only option for Ridge penalty")-0.723227246075157, -1.00076642804367, -1.85508405751867, -1.02550203809269, }-0.659134000404826, -0.11173921704798, 2.63528852273052, 0.335934697014777, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, -0.038063613031295, -0.0104599657638214, -0.919016330858739, converge.eps, lambda.discard = lambda.discard, ...)-0.387315288903273, -0.425304315526716, -0.379473265315923, -2.01688873126219, }0.606414609054415, -0.756211612773313, 0.641475173690406, 0.218550188893291, else if (penalty == "ENet") { if (alg != "huber") {0.89296363603433, 1.1930716028577, 0.383974163231164, 0.462741941890384, stop("huber alg is only option for ENet penalty")-0.304300389749029, -1.56381020598583, 0.142043747040958, 0.927138294479829, }0.753291055709181, -0.0749355103260018, -0.703332812511664, 0.314809721012768, if (is.null(a)) {0.528888377749661, 0.490336400919154, -1.23582874081278, 1.56274631935155, stop("Specify a value for a for ENet penalty") }-1.64133719830489, 1.05614298604371, 0.917341665004607, 0.136988648133905, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, -2.00130006830185, 0.578809408918058, -0.417332008957307, 0.625682190197015, scalex = FALSE, tau.penalty.factor, a, max.iter, 0.369619663650055, -0.174717118323951, -1.90103931892406, 0.959192393095508, converge.eps, gamma, lambda.discard = lambda.discard, -0.895514470766944, 0.721389407897209, 0.783222216209243, 1.09222703056739, ...)-1.083872457281, 0.299045345643664, 0.840462443548589, 0.0972277645880531, }0.945830120625551, -1.21923620594258, -0.0230032430724594, 0.0252802863279144, 0.341765587946093, -1.23550338323457, -0.419446465991891, 0.99345213094729, else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") {-0.955238888959497, -0.275299358060636, 0.58656022652938, -1.62118709782745, fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, 1.11526414088976, -0.084175763839948, 0.262419945178727, 0.0180223294843316, eps = eps, penalty.factor = penalty.factor, alg = alg, -0.0669617219173729, 0.648562135636633, 0.939859156510575, -0.384092462871435, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, 0.240172237176087, 0.592580911951259, 0.237837861885234, -1.9356617938841, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, -2.34895785521095, 1.0724401875031, -1.33066970567449, 0.525212838208188, lambda.discard = lambda.discard, weights = weights, 0.63418622976483, 1.21400366799326, 0.069529941412175, -0.655589965239558, ...)2.05845813756291, 2.18932711210877, 1.02998457589241, 0.388173323261591, }-0.603989852986333, 0.952949673088353, 0.343615097271085, -1.84330125799151, if (scalex) {-0.746448220356653, 1.10272277172609, -0.344868498918864, -1.13911206028756, for (i in 1:length(fit$models)) {-0.172933780654815, -0.931522524823459, 2.1406514829445, 0.948711324475765, if (!is.null(dim(fit$models[[i]]$coefficients))) {0.0375439471660837, 0.679841005597609, 1.31217967132952, -0.562538148116926, fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`)-1.37348978431467, 1.328619578441, 0.0790433410939509, -1.60124919287051, }-0.620165843949603, -0.527114696434009, -0.86292590857131, 1.59466622025251, -0.0778352390996005, 0.174302111298891, -0.999818517635082, -0.393534007020188, else {-0.138179097345487, 1.04217783807476, 0.548322395763614, -0.510622123149699, fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, 0.0474534352138238, -0.749872626812795, -0.349253901548057, -1.8843760446447, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) }1.06112579513477, -0.464598472612664, 0.0780721830488908, 1.62624899494295, }-1.44970731816349, 0.0461190843370063, 0.088318363731879, 0.061829884142029, }-0.382433261367634, 0.222511136868468, -0.935302502923367, 1.65275692243905, if (lambda.discard) {-0.316915017859565, -0.563211245613888), y = c(2.67982244558618, lmin <- min(sapply(fit$models, lambdanum))-1.67956548635685, -0.547750084688965, -0.398795236883855, -0.524540176527502, fit$lambda <- fit$lambda[1:lmin]2.20631144379421, 1.06014446834989, 3.7175742283744, 0.938377272967946, for (j in 1:length(fit$models)) {2.86231069039424, 4.38469733949897, 1.49532848801924, 3.19557873241325, fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1.14811037084504, -0.587063864331435, 0.13698799943166, -0.0861136242523111, 1:lmin]2.30764400112505, 2.02536395425182, 2.5185301708005, -0.498299717773021, fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin]3.16537527240507, 2.65860810566436, 2.24148456160325, 0.756159454596157, 0.138421241440572, 1.01230914783832, 2.07174273642158, 0.358451952436733, fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin]1.04571344529047, 0.337862939714959, 2.24601641622231, 0.268193432979243, fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin]1.66945935164809, 1.50727683947692, 1.44259323881427, -0.129065176588918, -0.435455534138912, -0.746903550648001, 1.66801070614777), tau = 0.5, } penalty = "SCAD", a = 3.7) } fit$weights <- weights 7: do.call(rqPen::rq.pen, args) fit$call <- match.call() fit 8: })(x = c(2.02976680254099, -1.4223299789818, -0.645038975588689, withCallingHandlers(expr, warning = function(w) {-1.19830324701652, -1.17512419136511, 0.504760941771944, -0.352407260154575, if (quantreg_is_nonunique(w)) {-0.0852647155754194, 1.93338896896123, 0.117191742921125, 2.45533612036215, if (!flagged) {2.02402466560042, 0.0845280984010655, 0.226871795844437, -0.241301864960321, flagged <<- TRUE0.595532581993574, 0.462355561365264, 1.05747528897091, -1.61180243286025, .quantreg_notes$nonunique <- .quantreg_notes$nonunique + -0.054018509028608, 0.508863559691845, -1.21056907767332, -0.510058167549672, -1.09939554299237, 0.475601793627063, -0.126884598722137, -0.314271449855737, 1L-0.793499067768389, 0.7518501746584, -1.33152801509216, 0.0755851598583044, .quantreg_notes$stages <- union(.quantreg_notes$stages, 0.970862028609763, -0.519341123070035, -1.53605929713035, -0.623953437070941, stage)-0.634371283313816, 1.10161993683408, 0.349249664912587, -0.136919229115098, }0.686017490231808, -0.333195371917585, -0.0512359526882051, 1.84434020115321, invokeRestart("muffleWarning")0.757263860271903, 0.488978289218536, -1.77588332818172, 0.309034680923315, 0.140727558176705, -1.03751874807229, 0.041661512805674, 0.133170843807366, }0.558218570721797, 0.73633539566727, 1.18340661988915, 1.35080165485728, })0.435467038137777, -1.06260482478871, -0.723227246075157, -1.00076642804367, -1.50834413899009, -1.02550203809269, -0.11173921704798, 2.63528852273052, 9: 0.335934697014777, -0.038063613031295, -0.0104599657638214, -0.47765041771437, -0.387315288903273, -0.425304315526716, -0.379473265315923, 0.606414609054415, 1.76544979364713, 0.641475173690406, 0.218550188893291, 0.89296363603433, -0.676868406231887, 1.1930716028577, -1.74507898400803, -0.527062378798573, quantreg_call("start", do.call(rqPen::rq.pen, args))-0.209313728032921, 0.383974163231164, 0.462741941890384, -1.56381020598583, 0.142043747040958, -2.05784466478052, 0.927138294479829, 0.963865375872252, 10: 0.753291055709181, -0.0749355103260018, -0.703332812511664, 0.314809721012768, initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)0.528888377749661, 0.490336400919154, 1.56274631935155, 0.917341665004607, -2.00130006830185, 1.59264991659855, 0.578809408918058, -0.417332008957307, 11: doTryCatch(return(expr), name, parentenv, handler)1.55050647704236, 0.369619663650055, -1.90103931892406, 0.959192393095508, -0.895514470766944, 0.721389407897209, 0.783222216209243, 0.210580249161236, 12: -1.083872457281, 0.299045345643664, 0.840462443548589, 0.945830120625551, tryCatchOne(expr, names, parentenv, handlers[[1L]])-1.89400297928635, -0.0230032430724594, 0.0252802863279144, 0.341765587946093, -0.29547290490614, -1.23550338323457, 0.3458852639534, 0.178591188904302, 13: -1.47589196984538, -0.419446465991891, 0.99345213094729, -0.275299358060636, tryCatchList(expr, classes, parentenv, handlers)0.58656022652938, -0.849339937111335, -1.62118709782745, 1.07420809372023, 1.11526414088976, -0.084175763839948, 0.262419945178727, 0.0180223294843316, 14: -0.0669617219173729, 0.648562135636633, -0.384092462871435, 0.237837861885234, tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, -2.34895785521095, 0.395971743642491, 1.0724401875031, -1.33066970567449, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {0.175408824720068, 0.63418622976483, 0.069529941412175, -0.655589965239558, list(ok = FALSE, message = conditionMessage(e))2.05845813756291, 2.18932711210877, 1.02998457589241, -0.259184606176068, })-0.603989852986333, 0.952949673088353, 0.343615097271085, -0.746448220356653, 15: -1.95208592177504, -0.344868498918864, -1.13911206028756, -0.172933780654815, FUN(X[[i]])0.273603074663941, -0.931522524823459, -0.128652187182702, -0.638553010897555, 0.55274656991046, 2.1406514829445, 0.948711324475765, 0.679841005597609, 16: 1.31217967132952, -1.14491953997933, -0.562538148116926, 0.460754334139996, doTryCatch(return(expr), name, parentenv, handler)-1.37348978431467, 1.328619578441, 0.0790433410939509, -1.60124919287051, 17: tryCatchOne(expr, names, parentenv, handlers[[1L]])-0.620165843949603, -0.527114696434009, 1.59466622025251, -0.999818517635082, -0.138179097345487, -1.24023862801766, 1.04217783807476, 0.548322395763614, 18: 1.33844865284022, 0.0474534352138238, -0.349253901548057, -1.8843760446447, tryCatchList(expr, classes, parentenv, handlers) 1.06112579513477, -0.464598472612664, 0.0780721830488908, -0.20480311289164, 19: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), -1.44970731816349, 0.0461190843370063, 0.088318363731879, -0.382433261367634, error = function(e) list(ok = FALSE, message = conditionMessage(e)))-0.353299740832593, -0.935302502923367, 1.65275692243905, -0.316915017859565, 20: 2.07717712603769, -0.563211245613888, -0.0163818298621174, -1.81471714998571, FUN(X[[i]], ...) 21: lapply(ii, function(i) {0.890628122307323), y = c(2.67982244558618, -1.67956548635685, before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), -0.398795236883855, -0.524540176527502, -0.489269134564159, 2.20631144379421, error = function(e) list(ok = FALSE, message = conditionMessage(e)))1.60275538701347, 1.06014446834989, 3.7175742283744, 0.938377272967946, })2.86231069039424, 4.38469733949897, 1.49532848801924, 1.14811037084504, 22: -0.0861136242523111, 2.02536395425182, 2.32588201659058, 2.5185301708005, kir_run_chunk(ii, X, FUN)-0.498299717773021, 3.07851251854135, 2.65860810566436, 0.756159454596157, 0.138421241440572, 1.01230914783832, 2.07174273642158, 0.358451952436733, 23: 0.823381704730666, 0.337862939714959, 2.24601641622231, 0.268193432979243, FUN(X[[nexti]], ...) 1.50727683947692, 1.06502057639093, -0.129065176588918, -0.435455534138912, 24: -0.746903550648001, 0.894421688079667, 1.66801070614777, 1.90147803693366, eval(expr, env)0.233005189045355, 1.68171995374156), tau = 0.5, penalty = "SCAD", a = 3.7)25: doTryCatch(return(expr), name, parentenv, handler) 7: 26: tryCatchOne(expr, names, parentenv, handlers[[1L]]) do.call(rqPen::rq.pen, args)27: tryCatchList(expr, classes, parentenv, handlers) 8: 28: withCallingHandlers(expr, warning = function(w) {tryCatch(expr, error = function(e) { if (quantreg_is_nonunique(w)) { call <- conditionCall(e) if (!flagged) { if (!is.null(call)) { flagged <<- TRUE if (identical(call[[1L]], quote(doTryCatch))) .quantreg_notes$nonunique <- .quantreg_notes$nonunique + call <- sys.call(-4L) 1L dcall <- deparse(call, nlines = 1L) .quantreg_notes$stages <- union(.quantreg_notes$stages, prefix <- paste("Error in", dcall, ": ") stage) LONG <- 75L } sm <- strsplit(conditionMessage(e), "\n")[[1L]] invokeRestart("muffleWarning") w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") } if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], }) type = "b") if (w > LONG) 9: prefix <- paste0(prefix, "\n ")quantreg_call("start", do.call(rqPen::rq.pen, args)) } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n")10: .Internal(seterrmessage(msg[1L]))initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, if (!silent && isTRUE(getOption("show.error.messages"))) { a = a) cat(msg, file = outFile) .Internal(printDeferredWarnings()) }11: invisible(structure(msg, class = "try-error", condition = e))doTryCatch(return(expr), name, parentenv, handler)}) 12: 29: tryCatchOne(expr, names, parentenv, handlers[[1L]])try(eval(expr, env), silent = TRUE) 13: tryCatchList(expr, classes, parentenv, handlers) 14: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, 30: Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {serialize(what, NULL, xdr = FALSE) list(ok = FALSE, message = conditionMessage(e)) }) 31: 15: FUN(X[[i]])sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 16: 32: doTryCatch(return(expr), name, parentenv, handler)mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]])17: tryCatchOne(expr, names, parentenv, handlers[[1L]])33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, 18: tryCatchList(expr, classes, parentenv, handlers) FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE)19: 34: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), kir_lapply(seq_len(nfolds), function(i) { error = function(e) list(ok = FALSE, message = conditionMessage(e))) if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]])20: }FUN(X[[i]], ...) train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE]21: Y_train <- Y[train_idx]lapply(ii, function(i) { init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, before <- quantreg_notes_counts() Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) if (!init_attempt$ok) {}) return(cv_fold_failure("init_error", init_attempt$message)) 22: }kir_run_chunk(ii, X, FUN) beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 23: 1L || anyNA(beta_y) || any(!is.finite(beta_y))) {FUN(X[[nexti]], ...) return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) }24: list(valid = TRUE, beta_y = beta_y)eval(expr, env)}, cores = cores) 25: 35: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, doTryCatch(return(expr), name, parentenv, handler) lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, 26: fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, tryCatchOne(expr, names, parentenv, handlers[[1L]]) penalty = penalty, Y_p = prior$y, warm_start = warm_start, 27: a = scad_a, tol = tol)tryCatchList(expr, classes, parentenv, handlers) 28: 36: tryCatch(expr, error = function(e) {kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, call <- conditionCall(e) if (!is.null(call)) { 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2) if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L)37: dcall <- deparse(call, nlines = 1L)withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) prefix <- paste("Error in", dcall, ": ") LONG <- 75L38: sm <- strsplit(conditionMessage(e), "\n")[[1L]]suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, if (is.na(w)) cores = 2)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b")39: if (w > LONG) eval(code, test_env) prefix <- paste0(prefix, "\n ") }40: else prefix <- "Error : "eval(code, test_env) msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L]))41: if (!silent && isTRUE(getOption("show.error.messages"))) {withCallingHandlers({ eval(code, test_env) cat(msg, file = outFile) .Internal(printDeferredWarnings()) new_expectations <- the$test_expectations > starting_expectations } if (snapshot_skipped) { invisible(structure(msg, class = "try-error", condition = e)) skip("On CRAN")}) } else if (!new_expectations && skip_on_empty) {29: skip_empty()try(eval(expr, env), silent = TRUE) } }, expectation = handle_expectation, packageNotFoundError = function(e) {30: if (on_cran()) {serialize(what, NULL, xdr = FALSE) skip(paste0("{", e$package, "} is not installed.")) }31: }, snapshot_on_cran = function(cnd) {sendMaster(try(eval(expr, env), silent = TRUE), FALSE) snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")32: }, skip = handle_skip, warning = handle_warning, message = handle_message, mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, error = handle_error, interrupt = handle_interrupt) silent = mc.silent, mc.affinity = affinity.list[[nexti]]) 42: 33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, doTryCatch(return(expr), name, parentenv, handler) FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 43: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 34: 44: kir_lapply(seq_len(nfolds), function(i) {tryCatchList(expr, classes, parentenv, handlers) if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]])45: } train_idx <- which(fold_indices != i)tryCatch(withCallingHandlers({ X_train <- X[train_idx, , drop = FALSE] eval(code, test_env) Y_train <- Y[train_idx] new_expectations <- the$test_expectations > starting_expectations init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, if (snapshot_skipped) { Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) skip("On CRAN") }) } else if (!new_expectations && skip_on_empty) { if (!init_attempt$ok) { skip_empty() return(cv_fold_failure("init_error", init_attempt$message)) } }}, expectation = handle_expectation, packageNotFoundError = function(e) { beta_y <- init_attempt$value if (on_cran()) { if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + skip(paste0("{", e$package, "} is not installed.")) 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { } return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept."))}, snapshot_on_cran = function(cnd) { } snapshot_skipped <<- TRUE list(valid = TRUE, beta_y = beta_y) invokeRestart("muffle_cran_snapshot")}, cores = cores)}, skip = handle_skip, warning = handle_warning, message = handle_message, 35: error = handle_error, interrupt = handle_interrupt), error = handle_fatal)kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, 46: foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, doWithOneRestart(return(expr), restart) cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, 47: penalty = penalty, Y_p = prior$y, warm_start = warm_start, withOneRestart(expr, restarts[[1L]]) a = scad_a, tol = tol) 48: 36: withRestarts(tryCatch(withCallingHandlers({kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, eval(code, test_env) 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {37: skip("On CRAN")withCallingHandlers(expr, warning = function(w) if (inherits(w, } classes)) tryInvokeRestart("muffleWarning")) else if (!new_expectations && skip_on_empty) { skip_empty()38: }suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, }, expectation = handle_expectation, packageNotFoundError = function(e) { nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) cores = 2)) } }, snapshot_on_cran = function(cnd) {39: snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")eval(code, test_env)}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), 40: end_test = function() {eval(code, test_env) }) 41: 49: withCallingHandlers({test_code(code, parent.frame()) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations50: if (snapshot_skipped) { skip("On CRAN")test_that("kiqr folds with seed equal hand-built folds and are core-independent", } else if (!new_expectations && skip_on_empty) { { skip_empty() d <- prior_data() fit <- suppressWarnings(kiqr_cv(d$x, d$y, d$b, tau = 0.5, } nlambda = 3, zeta = c(0, 0.5), seed = 2026, huber_gamma = 0.1))}, expectation = handle_expectation, packageNotFoundError = function(e) { set.seed(2026) expect_identical(fit$foldid, sample(rep(1:5, length.out = 50))) if (on_cran()) { skip_on_os("windows") skip(paste0("{", e$package, "} is not installed.")) serial <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, } tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, }, snapshot_on_cran = function(cnd) { huber_gamma = 0.1, cores = 1)) snapshot_skipped <<- TRUE parallel <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, invokeRestart("muffle_cran_snapshot") huber_gamma = 0.1, cores = 2))}, skip = handle_skip, warning = handle_warning, message = handle_message, serial$call <- parallel$call <- NULL error = handle_error, interrupt = handle_interrupt) expect_identical(serial, parallel) })42: 51: doTryCatch(return(expr), name, parentenv, handler)eval(code, test_env) 52: 43: tryCatchOne(expr, names, parentenv, handlers[[1L]])eval(code, test_env) 44: 53: tryCatchList(expr, classes, parentenv, handlers)withCallingHandlers({ eval(code, test_env)45: new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {tryCatch(withCallingHandlers({ skip("On CRAN") eval(code, test_env) } new_expectations <- the$test_expectations > starting_expectations else if (!new_expectations && skip_on_empty) { if (snapshot_skipped) { skip_empty() skip("On CRAN") } }}, expectation = handle_expectation, packageNotFoundError = function(e) { else if (!new_expectations && skip_on_empty) { skip_empty() if (on_cran()) { } skip(paste0("{", e$package, "} is not installed.")) }}, expectation = handle_expectation, packageNotFoundError = function(e) {}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE if (on_cran()) { invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")54: }, skip = handle_skip, warning = handle_warning, message = handle_message, doTryCatch(return(expr), name, parentenv, handler) error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 55: 46: tryCatchOne(expr, names, parentenv, handlers[[1L]])doWithOneRestart(return(expr), restart) 56: 47: withOneRestart(expr, restarts[[1L]])tryCatchList(expr, classes, parentenv, handlers) 57: 48: tryCatch(withCallingHandlers({withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { if (snapshot_skipped) { skip("On CRAN") skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() } } else if (!new_expectations && skip_on_empty) {}, expectation = handle_expectation, packageNotFoundError = function(e) { skip_empty() } if (on_cran()) {}, expectation = handle_expectation, packageNotFoundError = function(e) { skip(paste0("{", e$package, "} is not installed.")) if (on_cran()) { }}, snapshot_on_cran = function(cnd) { skip(paste0("{", e$package, "} is not installed.")) } snapshot_skipped <<- TRUE}, snapshot_on_cran = function(cnd) { invokeRestart("muffle_cran_snapshot") snapshot_skipped <<- TRUE}, skip = handle_skip, warning = handle_warning, message = handle_message, invokeRestart("muffle_cran_snapshot") error = handle_error, interrupt = handle_interrupt), error = handle_fatal), }, skip = handle_skip, warning = handle_warning, message = handle_message, end_test = function() { error = handle_error, interrupt = handle_interrupt), error = handle_fatal) }) 49: 58: test_code(code, parent.frame())doWithOneRestart(return(expr), restart) 50: 59: withOneRestart(expr, restarts[[1L]])test_that("kiqr folds with seed equal hand-built folds and are core-independent", {60: d <- prior_data()withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) fit <- suppressWarnings(kiqr_cv(d$x, d$y, d$b, tau = 0.5, new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { nlambda = 3, zeta = c(0, 0.5), seed = 2026, huber_gamma = 0.1)) skip("On CRAN") set.seed(2026) } expect_identical(fit$foldid, sample(rep(1:5, length.out = 50))) else if (!new_expectations && skip_on_empty) { skip_on_os("windows") skip_empty() serial <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, } tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, }, expectation = handle_expectation, packageNotFoundError = function(e) { huber_gamma = 0.1, cores = 1)) if (on_cran()) { parallel <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, skip(paste0("{", e$package, "} is not installed.")) } tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, }, snapshot_on_cran = function(cnd) { huber_gamma = 0.1, cores = 2)) serial$call <- parallel$call <- NULL snapshot_skipped <<- TRUE expect_identical(serial, parallel) invokeRestart("muffle_cran_snapshot") })}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), 51: end_test = function() {eval(code, test_env) }) 52: eval(code, test_env)61: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new())53: withCallingHandlers({62: eval(code, test_env)source_file(path, env = env(env), desc = desc, shuffle = shuffle, new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { error_call = error_call) skip("On CRAN") 63: } else if (!new_expectations && skip_on_empty) {FUN(X[[i]], ...) skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) {64: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, if (on_cran()) { error_call = error_call) skip(paste0("{", e$package, "} is not installed.")) 65: }doTryCatch(return(expr), name, parentenv, handler)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE66: invokeRestart("muffle_cran_snapshot")tryCatchOne(expr, names, parentenv, handlers[[1L]])}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 67: 54: tryCatchList(expr, classes, parentenv, handlers)doTryCatch(return(expr), name, parentenv, handler) 68: tryCatch(code, testthat_abort_reporter = function(cnd) {55: cat(conditionMessage(cnd), "\n")tryCatchOne(expr, names, parentenv, handlers[[1L]]) NULL })56: tryCatchList(expr, classes, parentenv, handlers)69: with_reporter(reporters$multi, lapply(test_paths, test_one_file, 57: env = env, desc = desc, shuffle = shuffle, error_call = error_call))tryCatch(withCallingHandlers({ eval(code, test_env)70: new_expectations <- the$test_expectations > starting_expectationstest_files_serial(test_dir = test_dir, test_package = test_package, if (snapshot_skipped) { test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, skip("On CRAN") env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, } desc = desc, load_package = load_package, shuffle = shuffle, else if (!new_expectations && skip_on_empty) { error_call = error_call) skip_empty() } }, expectation = handle_expectation, packageNotFoundError = function(e) {71: if (on_cran()) {test_files(test_dir = path, test_paths = test_paths, test_package = package, skip(paste0("{", e$package, "} is not installed.")) reporter = reporter, load_helpers = load_helpers, env = env, } stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, }, snapshot_on_cran = function(cnd) { load_package = load_package, parallel = parallel, shuffle = shuffle) snapshot_skipped <<- TRUE 72: invokeRestart("muffle_cran_snapshot")test_dir("testthat", package = package, reporter = reporter, }, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) ..., load_package = "installed") 58: 73: doWithOneRestart(return(expr), restart)test_check("kir") 59: An irrecoverable exception occurred. R is aborting now ... withOneRestart(expr, restarts[[1L]]) 60: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 61: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 62: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 63: FUN(X[[i]], ...) 64: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 65: doTryCatch(return(expr), name, parentenv, handler) 66: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 67: tryCatchList(expr, classes, parentenv, handlers) 68: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 69: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 70: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 71: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 72: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 73: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) 2: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) 3: rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, ...) 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 5: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 6: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-1.4223299789818, -0.924454735019604, -0.645038975588689, -1.17512419136511, 0.504760941771944, -0.352407260154575, 0.117191742921125, 2.02402466560042, 0.0845280984010655, 1.6421708663652, -1.12213496859494, -0.541036054757722, -0.241301864960321, 0.742586541621464, 0.595532581993574, 0.462355561365264, 1.05747528897091, 1.02473023092809, -0.054018509028608, 0.349799604907625, -1.21056907767332, -0.510058167549672, 0.475601793627063, -0.126884598722137, -0.314271449855737, -0.65316137473815, -0.793499067768389, -1.33152801509216, -0.377507756944675, 0.0755851598583044, 0.970862028609763, -0.929433266038919, -0.519341123070035, -1.53605929713035, -0.623953437070941, -0.634371283313816, 1.10161993683408, 0.349249664912587, -0.136919229115098, 0.686017490231808, -0.0512359526882051, 0.363091818115056, 1.84434020115321, 0.488978289218536, -1.77588332818172, 0.309034680923315, 0.041661512805674, 0.558218570721797, 0.73633539566727, 0.309829308732826, 0.807464483174762, 1.23229176395568, 1.35080165485728, 0.73171056651179, 0.435467038137777, -1.06260482478871, -0.723227246075157, -1.85508405751867, -1.50834413899009, -0.659134000404826, -0.11173921704798, 2.63528852273052, -0.038063613031295, -0.0104599657638214, -0.47765041771437, -0.919016330858739, -0.387315288903273, -0.379473265315923, -2.01688873126219, 0.606414609054415, 1.76544979364713, -0.756211612773313, 0.641475173690406, 0.218550188893291, 0.89296363603433, -0.676868406231887, 1.1930716028577, -1.74507898400803, -0.527062378798573, -0.209313728032921, 0.462741941890384, -0.304300389749029, -1.56381020598583, -2.05784466478052, 0.927138294479829, 0.963865375872252, -0.703332812511664, 0.528888377749661, 0.490336400919154, -1.23582874081278, -1.64133719830489, 1.05614298604371, 0.917341665004607, 0.136988648133905, -2.00130006830185, 1.59264991659855, 0.578809408918058, 0.625682190197015, 1.55050647704236, -0.174717118323951, -1.90103931892406, 0.959192393095508, 0.721389407897209, 0.783222216209243, 0.210580249161236, 1.09222703056739, -1.083872457281, 0.840462443548589, 0.0972277645880531, 0.945830120625551, -1.89400297928635, -1.21923620594258, -0.0230032430724594, 0.0252802863279144, 0.341765587946093, -0.29547290490614, -1.23550338323457, 0.3458852639534, 0.178591188904302, -1.47589196984538, 0.99345213094729, -0.955238888959497, -0.275299358060636, -0.849339937111335, -1.62118709782745, 1.07420809372023, 0.262419945178727, -0.0669617219173729, 0.648562135636633, 0.939859156510575, 0.240172237176087, 0.592580911951259, 0.237837861885234, -1.9356617938841, -2.34895785521095, 0.395971743642491, 1.0724401875031, 0.525212838208188, 0.175408824720068, 1.21400366799326, 0.069529941412175, -0.655589965239558, 2.18932711210877, 1.02998457589241, -0.259184606176068, 0.388173323261591, -0.603989852986333, 0.343615097271085, -1.84330125799151, -0.746448220356653, -1.95208592177504, 1.10272277172609, -0.344868498918864, -1.13911206028756, -0.172933780654815, 0.273603074663941, -0.931522524823459, -0.128652187182702, -0.638553010897555, 0.55274656991046, 0.948711324475765, 0.0375439471660837, 0.679841005597609, -1.14491953997933, -0.562538148116926, 0.460754334139996, 0.0790433410939509, -0.620165843949603, -0.527114696434009, -0.86292590857131, -0.0778352390996005, 0.174302111298891, -0.999818517635082, -0.393534007020188, -0.138179097345487, -1.24023862801766, 1.04217783807476, -0.510622123149699, 1.33844865284022, -0.749872626812795, -0.349253901548057, -1.8843760446447, -0.464598472612664, 0.0780721830488908, -0.20480311289164, 1.62624899494295, -1.44970731816349, 0.088318363731879, 0.061829884142029, -0.382433261367634, -0.353299740832593, 0.222511136868468, -0.935302502923367, 1.65275692243905, -0.316915017859565, 2.07717712603769, -0.563211245613888, -0.0163818298621174, -1.81471714998571, 0.890628122307323), y = c(-1.67956548635685, -0.547750084688965, -0.398795236883855, -0.489269134564159, 2.20631144379421, 1.60275538701347, 0.938377272967946, 4.38469733949897, 1.49532848801924, 3.19557873241325, -0.587063864331435, 0.13698799943166, -0.0861136242523111, 2.30764400112505, 2.02536395425182, 2.32588201659058, 2.5185301708005, 3.16537527240507, 3.07851251854135, 2.24148456160325, 0.756159454596157, 0.138421241440572, 2.07174273642158, 0.358451952436733, 0.823381704730666, 1.04571344529047, 0.337862939714959, 0.268193432979243, 1.66945935164809, 1.50727683947692, 1.06502057639093, 1.44259323881427, -0.129065176588918, -0.435455534138912, -0.746903550648001, 0.894421688079667, 1.66801070614777, 1.90147803693366, 0.233005189045355, 1.68171995374156), tau = 0.5, penalty = "SCAD", a = 3.7) 7: do.call(rqPen::rq.pen, args) 8: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 9: quantreg_call("start", do.call(rqPen::rq.pen, args)) 10: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 11: doTryCatch(return(expr), name, parentenv, handler) 12: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13: tryCatchList(expr, classes, parentenv, handlers) 14: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 15: FUN(X[[i]]) 16: doTryCatch(return(expr), name, parentenv, handler) 17: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 18: tryCatchList(expr, classes, parentenv, handlers) 19: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 20: FUN(X[[i]], ...) 21: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 22: kir_run_chunk(ii, X, FUN) 23: FUN(X[[nexti]], ...) 24: eval(expr, env) 25: doTryCatch(return(expr), name, parentenv, handler) 26: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 27: tryCatchList(expr, classes, parentenv, handlers) 28: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 29: try(eval(expr, env), silent = TRUE) 30: serialize(what, NULL, xdr = FALSE) 31: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 32: mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]]) 33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 34: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 35: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 36: kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2) 37: withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) 38: suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2)) 39: eval(code, test_env) 40: eval(code, test_env) 41: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 42: doTryCatch(return(expr), name, parentenv, handler) 43: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 44: tryCatchList(expr, classes, parentenv, handlers) 45: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 46: doWithOneRestart(return(expr), restart) 47: withOneRestart(expr, restarts[[1L]]) 48: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 49: test_code(code, parent.frame()) 50: test_that("kiqr folds with seed equal hand-built folds and are core-independent", { d <- prior_data() fit <- suppressWarnings(kiqr_cv(d$x, d$y, d$b, tau = 0.5, nlambda = 3, zeta = c(0, 0.5), seed = 2026, huber_gamma = 0.1)) set.seed(2026) expect_identical(fit$foldid, sample(rep(1:5, length.out = 50))) skip_on_os("windows") serial <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 1)) parallel <- suppressWarnings(kiqr_cv(d$x, d$y, prior_vars = 1:2, tau = 0.5, nlambda = 3, zeta = c(0, 0.5, 1), seed = 3, huber_gamma = 0.1, cores = 2)) serial$call <- parallel$call <- NULL expect_identical(serial, parallel) }) 51: eval(code, test_env) 52: eval(code, test_env) 53: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 54: doTryCatch(return(expr), name, parentenv, handler) 55: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 56: tryCatchList(expr, classes, parentenv, handlers) 57: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 58: doWithOneRestart(return(expr), restart) 59: withOneRestart(expr, restarts[[1L]]) 60: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 61: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 62: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 63: FUN(X[[i]], ...) 64: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 65: doTryCatch(return(expr), name, parentenv, handler) 66: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 67: tryCatchList(expr, classes, parentenv, handlers) 68: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 69: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 70: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 71: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 72: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 73: test_check("kir") An irrecoverable exception occurred. R is aborting now ... Saving _problems/test-prior-inputs-115.R *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(newModels[[pos]]$coefficients, x, y, newModels[[pos]]$tau, obj$lambda, local.penalty.factor = penalty.factor * tau.penalty.factor[j], penalty, a[k], weights = weights) 2: rq.lla(init.model, x, y, penalty, a, penalty.factor, tau.penalty.factor, scalex, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 3: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 4: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-1.74688423482202, 0.701583114677164, -0.776990945918909, -1.22981312678372, -1.62986102116045, 1.48015533417847, 0.908616171649339, 0.302475366496952, -1.33489665708055, 0.828471093029582, -0.67935123962284, -0.271053890629315, -0.481721841510625, 0.319582142010314, 0.737736044817482, -1.51151743225488, -0.374537738311257, 0.706471685102107, -0.141896819424521, 1.60718378485484, 0.306670241892734, 0.765015165006591, -0.832448455103301, 0.0452761764970431, 0.245158902555043, -0.81990287451666, -0.258894015195106, -0.282060940190303, 1.83890983509371, 0.93993300250428, -0.735237967915471, -0.213158632590587, -0.130649631765989, -1.70923696338331, 0.847210955512885, 1.3729870226531, 0.66855088983272, 0.379694548313621, 1.71967735151526, -0.856529505237801, -0.749131970490723, 0.452481529927907, 1.00098083116572, 1.29200540782173, 0.33031631607699, -2.10068358225551, -0.260897476039287, -1.47596328584215, 1.21385856724715, -0.255592855694785, -0.288679144066084, -0.749877958708027, -0.451035403436058, -1.53684302287603, 0.601177215938271, -0.173402636811132, -0.594234149961602, 1.28275174480327, -0.234837384042623, 0.375936793250943, 1.09375884387588, 0.809382692872996, 2.01167429719049, 0.40664303541315, 0.227312149664971, -1.4475939466925, -2.16061508299873, 0.806258570000693, -1.15084409253327, 1.20972132757765, 0.729276369893945, -0.235718518851247, -2.0293469555958, 0.426796046703024, 1.26525192708875, -0.761142765166774, -0.21667322585552, -2.605703871626, -1.41616741930113, -0.701092176782223, 0.0821399461053013, 0.11178938618083, 1.37219382085892, -1.12092445155929, -0.235768349891611, -1.0800569854825, 0.669257925808061, -0.197244472775838, 0.441949411253645, 0.787301509676411, -1.3486722791357, 0.36956121401072, 0.992215861969906, -0.44429005795676, 1.61086370528626, 0.487660767614398), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.44013774120954, 1.17646270553815, 0.0226668425663064, 0.849243594831841, 1.16427399130315, 0.525212504228419, 2.13882658033868, 1.34802014161986, 1.98941921212376, 0.729026139039017, 2.28032020309293), tau = 0.5, penalty = "SCAD", a = 3.7) 5: do.call(rqPen::rq.pen, args) 6: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 7: quantreg_call("start", do.call(rqPen::rq.pen, args)) 8: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 13: FUN(X[[i]]) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 18: FUN(X[[i]], ...) 19: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 20: kir_run_chunk(ii, X, FUN) 21: FUN(X[[i]], ...) 22: eval(expr, env) 23: doTryCatch(return(expr), name, parentenv, handler) 24: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 25: tryCatchList(expr, classes, parentenv, handlers) 26: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 27: try(eval(expr, env), silent = TRUE) 28: serialize(what, NULL, xdr = FALSE) 29: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 30: mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]]) 31: FUN(X[[i]], ...) 32: lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])) 33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 34: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 35: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 36: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO")) lambda_scale <- match.arg(lambda_scale) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) if (!automatic_lambda) validate_grid(lambda, "lambda", lower = 0) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(max_iter, "max_iter") validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_seed(seed) rng <- kir_seed_begin(seed) on.exit(kir_seed_restore(rng), add = TRUE) foldid <- draw_folds(n, nfolds) inner <- if (input$spec$type == "prior_vars") { draw_prior_folds(n, control, outer = foldid) } else NULL kir_seed_reset(seed) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", foldid = inner$full, rule = control$rule) tuning <- list(lambda_source = "supplied") if (automatic_lambda) { path <- kiqr_automatic_lambda(x = input$x, y = input$y, y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda tuning <- path$tuning } tuning$lambda <- lambda tuning$zeta <- zeta tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule) } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } else "supply a `lambda` grid with a larger upper bound" warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE) } coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, prior = prior$record, convergence = list(min = result$convergence.min, `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 31, standardize = TRUE, nlambda = 3, prior_control = list(nfolds = 3), nfolds = 3, cores = 2, max_iter = 1000, huber_gamma = 0.1) 37: do.call(fitter, args) 38: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, method = c("cv", "hbic", "fit"), ..., prior_vars = NULL, y_prior = NULL, seed = NULL, standardize = TRUE, penalty = c("SCAD", "LASSO"), penalty_factor = NULL, nfolds = 5, cores = 1, max_iter = 1e+05, huber_gamma = 0.01, scad_a = 3.7, tol = 1e-04) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr") if (no_prior_supplied(beta_prior, prior_vars, y_prior)) { zeta <- no_prior_zeta(zeta) } if (missing(method)) { method <- if (length(lambda) == 1L && length(zeta) == 1L) "fit" else "cv" } method <- match.arg(method) supplied <- c(penalty = !missing(penalty), penalty_factor = !missing(penalty_factor), nfolds = !missing(nfolds), cores = !missing(cores), max_iter = !missing(max_iter), huber_gamma = !missing(huber_gamma), scad_a = !missing(scad_a), tol = !missing(tol)) extra <- check_extra_args(c(list(...), mget(names(supplied)[supplied]))) extra <- kir_translate_extra(extra, method, half_life = TRUE) fitters <- list(cv = kiqr_cv, hbic = kiqr_hbic_run, fit = kiqr_fit) fitter <- fitters[[method]] stop_unsupported_args(names(extra), method, fitters, "kiqr") if (method == "fit" && (length(lambda) != 1L || length(zeta) != 1L)) { stop("`method = \"fit\"` requires one value each for `lambda` and `zeta`.", call. = FALSE) } args <- c(list(x = x, y = y, beta_prior = beta_prior, tau = tau, lambda = lambda, zeta = zeta, prior_vars = prior_vars, y_prior = y_prior, seed = seed, standardize = standardize), extra) out <- do.call(fitter, args) out$call <- match.call() out})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), tau = 0.5, method = "cv", lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), nlambda = 3, huber_gamma = 0.1, max_iter = 1000, seed = 31, beta_prior = c(1, 0.8, -0.3, 0, 0), nfolds = 3, prior_control = list(nfolds = 3), cores = 2) 39: do.call(kiqr, c(args, list(cores = 2))) 40: withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) 41: suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) 42: with_backend(backend, { b <- suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) b$call <- NULL expect_identical(a, b, info = paste(method, type, backend))}) 43: eval(code, test_env) 44: eval(code, test_env) 45: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 46: doTryCatch(return(expr), name, parentenv, handler) 47: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 48: tryCatchList(expr, classes, parentenv, handlers) 49: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 50: doWithOneRestart(return(expr), restart) 51: withOneRestart(expr, restarts[[1L]]) 52: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 53: test_code(code, parent.frame()) 54: test_that("all prior types retain serial/parallel quantile CV and HBIC results", { skip_without_backends() d <- speed_data() for (method in c("cv", "hbic")) for (type in c("beta_prior", "prior_vars", "y_prior")) { args <- c(list(x = d$x, y = d$y, tau = 0.5, method = method, lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), nlambda = 3, huber_gamma = 0.1, max_iter = 1000, seed = 31), prior_args(d, type)) if (method == "cv") args <- c(args, list(nfolds = 3, prior_control = list(nfolds = 3))) a <- suppressWarnings(do.call(kiqr, c(args, list(cores = 1)))) a$call <- NULL for (backend in kir_test_backends()) with_backend(backend, { b <- suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) b$call <- NULL expect_identical(a, b, info = paste(method, type, backend)) }) } }) 55: eval(code, test_env) 56: eval(code, test_env) 57: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 58: doTryCatch(return(expr), name, parentenv, handler) 59: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 60: tryCatchList(expr, classes, parentenv, handlers) 61: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 62: doWithOneRestart(return(expr), restart) 63: withOneRestart(expr, restarts[[1L]]) 64: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 65: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 66: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 67: FUN(X[[i]], ...) 68: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 69: doTryCatch(return(expr), name, parentenv, handler) 70: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 71: tryCatchList(expr, classes, parentenv, handlers) 72: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 73: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 74: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 75: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 76: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 77: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(newModels[[pos]]$coefficients, x, y, newModels[[pos]]$tau, obj$lambda, local.penalty.factor = penalty.factor * tau.penalty.factor[j], penalty, a[k], weights = weights) 2: rq.lla(init.model, x, y, penalty, a, penalty.factor, tau.penalty.factor, scalex, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 3: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 4: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-1.74688423482202, 0.701583114677164, -0.934235552715437, 1.48015533417847, 0.908616171649339, 0.302475366496952, 0.828471093029582, -0.67935123962284, -0.271053890629315, 1.0400490657633, -0.540850053120684, 0.737736044817482, 1.34920152700499, 2.07052345102704, -1.35726825044567, -0.374537738311257, -0.234284193539822, 0.500379572697357, 0.804669398134318, -1.02824993710535, 0.306670241892734, -0.123466145457348, 0.0452761764970431, 0.755268200167084, 0.245158902555043, -0.81990287451666, 0.661455213860662, 0.93993300250428, -0.735237967915471, -0.213158632590587, -1.70923696338331, 0.847210955512885, 1.3729870226531, -0.216721323498699, -0.51997119032546, 1.71967735151526, -0.0225359851620699, 0.361729737312684, 0.945674007097247, -0.749131970490723, -0.596732751549598, 0.420341580440434, -1.94892006701553, 1.11945718426648, 0.33031631607699, -0.384812155382804, -1.47596328584215, -1.31452399759341, 1.21385856724715, -0.255592855694785, 0.400353249071171, -1.53684302287603, 0.601177215938271, -0.173402636811132, 1.28275174480327, -0.234837384042623, 0.375936793250943, 0.587291903844629, 0.80126774046948, 2.01167429719049, 0.893536947940452, 0.116560142743486, -1.07545118493623, 0.227312149664971, -1.96195082218178, 0.442638179119431, -0.303318666173017, 0.746470169716108, -1.15084409253327, -1.64592608468585, -0.235718518851247, -0.48994898598519, -2.0293469555958, 0.426796046703024, 0.367850293480281, -2.605703871626, -1.41616741930113, -0.701092176782223, 0.11178938618083, 1.37219382085892, -1.12092445155929, 0.661296576185364, -0.15738133569092, 0.669257925808061, 0.504005491764951, -1.0823333949774, 0.943543520811809, 0.441949411253645, 1.44176604637256, 0.864211517199748, -0.987799066373311, -0.150068238091532, 0.992215861969906, 0.291981566320514, 0.487660767614398, 0.843028511570857), y = c(-0.347444760047483, 2.25021217765047, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 1.5020484263109, 0.746402815609336, 1.17646270553815, 2.34226166902041, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 0.903087252456754, 2.25613071832197, 0.183849783697106, 1.34802014161986, 0.986270800177914, 2.28032020309293, 1.81735477065944), tau = 0.5, penalty = "SCAD", a = 3.7) 5: do.call(rqPen::rq.pen, args) 6: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 7: quantreg_call("start", do.call(rqPen::rq.pen, args)) 8: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 13: FUN(X[[i]]) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 18: FUN(X[[i]], ...) 19: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 20: kir_run_chunk(ii, X, FUN) 21: FUN(X[[nexti]], ...) 22: eval(expr, env) 23: doTryCatch(return(expr), name, parentenv, handler) 24: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 25: tryCatchList(expr, classes, parentenv, handlers) 26: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 27: try(eval(expr, env), silent = TRUE) 28: serialize(what, NULL, xdr = FALSE) 29: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 30: mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]]) 31: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 32: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 33: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 34: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO")) lambda_scale <- match.arg(lambda_scale) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) if (!automatic_lambda) validate_grid(lambda, "lambda", lower = 0) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(max_iter, "max_iter") validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_seed(seed) rng <- kir_seed_begin(seed) on.exit(kir_seed_restore(rng), add = TRUE) foldid <- draw_folds(n, nfolds) inner <- if (input$spec$type == "prior_vars") { draw_prior_folds(n, control, outer = foldid) } else NULL kir_seed_reset(seed) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", foldid = inner$full, rule = control$rule) tuning <- list(lambda_source = "supplied") if (automatic_lambda) { path <- kiqr_automatic_lambda(x = input$x, y = input$y, y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda tuning <- path$tuning } tuning$lambda <- lambda tuning$zeta <- zeta tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule) } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } else "supply a `lambda` grid with a larger upper bound" warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE) } coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, prior = prior$record, convergence = list(min = result$convergence.min, `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), beta_prior = c(1, 0.8, -0.3, 0, 0), tau = 0.5, lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 31, standardize = TRUE, nlambda = 3, prior_control = list(nfolds = 3), nfolds = 3, cores = 2, max_iter = 1000, huber_gamma = 0.1) 35: do.call(fitter, args) 36: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, method = c("cv", "hbic", "fit"), ..., prior_vars = NULL, y_prior = NULL, seed = NULL, standardize = TRUE, penalty = c("SCAD", "LASSO"), penalty_factor = NULL, nfolds = 5, cores = 1, max_iter = 1e+05, huber_gamma = 0.01, scad_a = 3.7, tol = 1e-04) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr") if (no_prior_supplied(beta_prior, prior_vars, y_prior)) { zeta <- no_prior_zeta(zeta) } if (missing(method)) { method <- if (length(lambda) == 1L && length(zeta) == 1L) "fit" else "cv" } method <- match.arg(method) supplied <- c(penalty = !missing(penalty), penalty_factor = !missing(penalty_factor), nfolds = !missing(nfolds), cores = !missing(cores), max_iter = !missing(max_iter), huber_gamma = !missing(huber_gamma), scad_a = !missing(scad_a), tol = !missing(tol)) extra <- check_extra_args(c(list(...), mget(names(supplied)[supplied]))) extra <- kir_translate_extra(extra, method, half_life = TRUE) fitters <- list(cv = kiqr_cv, hbic = kiqr_hbic_run, fit = kiqr_fit) fitter <- fitters[[method]] stop_unsupported_args(names(extra), method, fitters, "kiqr") if (method == "fit" && (length(lambda) != 1L || length(zeta) != 1L)) { stop("`method = \"fit\"` requires one value each for `lambda` and `zeta`.", call. = FALSE) } args <- c(list(x = x, y = y, beta_prior = beta_prior, tau = tau, lambda = lambda, zeta = zeta, prior_vars = prior_vars, y_prior = y_prior, seed = seed, standardize = standardize), extra) out <- do.call(fitter, args) out$call <- match.call() out})(x = c(-1.44983309485655, 0.577084542831131, -0.646925180093162, -1.02178550458098, -1.35295762872545, -0.777097169935027, 1.22161090918992, 0.748472964591027, 0.246690701030565, -1.10877692843341, 0.68212636884758, -0.566095985915577, -0.228094705945323, -0.402492206252685, 0.857277213627229, 0.26085222334741, -0.451440383985939, 0.607013065982764, 1.11320326326539, -1.25498911478588, 1.71033604943473, -1.12729683117347, -0.313761862636311, -0.197655603876688, 0.581131453899569, 0.410521975399909, 0.662422583457124, -0.121174454094455, 1.32676902257736, -0.854925209567759, 0.25016334971806, -0.105916967346194, 0.629595572489626, -0.692834635872126, 0.0337731897080502, 0.621526730995309, 0.0184511968608169, -1.08851597011447, -0.505433935794679, -0.529512375075423, 1.67490905934006, 0.451126895368413, 0.74056153230367, -1.00051988029118, -0.457899071618583, -0.372143712766176, -2.01284135483905, 0.644191289859692, 1.19065428011535, 0.458501754271115, -0.461601938387686, 0.158280215091125, -0.776783323349032, 1.55098531388264, -0.259776280501775, -1.12658369399496, 0.139608569589368, 0.746528419602303, -1.01496054936764, -0.856565106706716, 0.233931037010372, 0.200526525087416, -2.26195491041992, 0.804011318408232, 1.10648640302428, 0.927149183055009, 0.106959171536718, -0.636306388374478, -2.41968963729868, -0.507516223810804, -1.77038940743407, -1.60259820940371, 1.51185410436011, -0.0347669364260037, -0.0695907822215443, -0.555009884598383, -0.240473332624064, 0.655626792426647, -1.38330315622559, 0.866997218016458, 0.0517395787861677, -0.391192295451155, 1.58436527166469, -0.0129214717393219, 0.629928083559235, 1.38544723152404, 0.852382705752477, 1.08613680058902, 1.07759568385913, 2.35156787463916, 1.17471049518481, 0.662246892789732, 0.356930025304056, -0.897680893751611, 0.473498277605396, -1.83073588979104, -1.28936708121072, 0.700132355182765, -0.0849991125440985, -2.03983319034458, 1.08284861147785, 1.01992036735125, -0.977033130508217, -1.4981148171995, 1.5074995936742, 1.00182361902677, -0.0138488801677398, -0.281430498409348, -2.17867773858963, 0.429235189752184, 1.3195009146125, -0.832108707022009, -0.253995319760293, 0.36664706204278, -2.79064888654297, -1.52760862795527, -0.768347474204527, 0.0632821081362448, 0.0947636456601986, 1.43305095916754, -1.21412201424618, -0.274270369216048, 0.67822596999894, -1.17072926674308, -0.191039666623908, 0.686679267135406, 0.511215558883232, -0.233366025663557, -1.1731463400757, 0.97791351066223, 0.445324910620412, 1.50692218987386, 0.81201699714133, 0.893679425897005, -1.07277054863849, -1.45594282980227, 0.368463703731199, -0.18327467828332, 1.0295934118895, 0.286090256420465, -0.495677045372136, 1.68646872703421, 0.493860861952917, 0.871187480522075), y = c(-0.347444760047483, 2.25021217765047, 0.868938007783749, 0.849020721564972, -0.825951803110181, 0.667329998628564, 1.65553432592787, 1.85117263639381, 0.917354239442501, -0.0825102999799137, 2.09625490877118, 0.0554233551211066, 0.276497796038814, 0.517346246941844, 1.5020484263109, 1.44013774120954, 0.746402815609336, 1.17646270553815, 2.34226166902041, 0.0226668425663064, 2.617134129449, -0.266096393040668, 0.849243594831841, 0.837364799142825, 1.16427399130315, 0.903087252456754, 2.25613071832197, 0.525212504228419, 2.13882658033868, 0.183849783697106, 1.34802014161986, 0.986270800177914, 1.98941921212376, 0.729026139039017, 2.28032020309293, 1.81735477065944), tau = 0.5, method = "cv", lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), nlambda = 3, huber_gamma = 0.1, max_iter = 1000, seed = 31, beta_prior = c(1, 0.8, -0.3, 0, 0), nfolds = 3, prior_control = list(nfolds = 3), cores = 2) 37: do.call(kiqr, c(args, list(cores = 2))) 38: withCallingHandlers(expr, warning = function(w) if (inherits(w, classes)) tryInvokeRestart("muffleWarning")) 39: suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) 40: with_backend(backend, { b <- suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) b$call <- NULL expect_identical(a, b, info = paste(method, type, backend))}) 41: eval(code, test_env) 42: eval(code, test_env) 43: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 44: doTryCatch(return(expr), name, parentenv, handler) 45: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 46: tryCatchList(expr, classes, parentenv, handlers) 47: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 48: doWithOneRestart(return(expr), restart) 49: withOneRestart(expr, restarts[[1L]]) 50: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 51: test_code(code, parent.frame()) 52: test_that("all prior types retain serial/parallel quantile CV and HBIC results", { skip_without_backends() d <- speed_data() for (method in c("cv", "hbic")) for (type in c("beta_prior", "prior_vars", "y_prior")) { args <- c(list(x = d$x, y = d$y, tau = 0.5, method = method, lambda = c(0.15, 0.05), zeta = c(0, 0.5, 1), nlambda = 3, huber_gamma = 0.1, max_iter = 1000, seed = 31), prior_args(d, type)) if (method == "cv") args <- c(args, list(nfolds = 3, prior_control = list(nfolds = 3))) a <- suppressWarnings(do.call(kiqr, c(args, list(cores = 1)))) a$call <- NULL for (backend in kir_test_backends()) with_backend(backend, { b <- suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) b$call <- NULL expect_identical(a, b, info = paste(method, type, backend)) }) } }) 53: eval(code, test_env) 54: eval(code, test_env) 55: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 56: doTryCatch(return(expr), name, parentenv, handler) 57: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 58: tryCatchList(expr, classes, parentenv, handlers) 59: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 60: doWithOneRestart(return(expr), restart) 61: withOneRestart(expr, restarts[[1L]]) 62: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 63: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 64: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 65: FUN(X[[i]], ...) 66: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 67: doTryCatch(return(expr), name, parentenv, handler) 68: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 69: tryCatchList(expr, classes, parentenv, handlers) 70: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 71: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 72: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 73: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 74: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 75: test_check("kir") An irrecoverable exception occurred. R is aborting now ... Saving _problems/test-pure-r-speedup-25.R *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) Traceback: 2: 1: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, "LASSO", a) 2: ...)rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, 3: ...)rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, 3: ...)rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, 4: ...)rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, 4: coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, lambda.discard = lambda.discard, weights = weights, ...) penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, 5: lambda.discard = lambda.discard, weights = weights, ...)rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, 5: tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, weights = weights, ...) tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, 6: weights = weights, ...)(function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, 6: eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, weights = NULL, ...) tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, { max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, penalty <- match.arg(penalty) weights = NULL, ...) alg <- match.arg(alg){ if (length(tau) > length(unique(tau))) { penalty <- match.arg(penalty) stop("All entries of tau should be unique") alg <- match.arg(alg) } if (length(tau) > length(unique(tau))) { if (is.unsorted(tau)) { stop("All entries of tau should be unique") stop("Quantile values should be entered in ascending order") } } if (is.unsorted(tau)) { if (length(y) != nrow(x)) { stop("Quantile values should be entered in ascending order") stop("length of x and number of rows in x are not the same") } } if (length(y) != nrow(x)) { if (min(apply(x, 2, sd)) == 0) { stop("length of x and number of rows in x are not the same") stop("At least one of the x predictors has a standard deviation of zero") } } if (min(apply(x, 2, sd)) == 0) { if (is.null(weights) == FALSE) { stop("At least one of the x predictors has a standard deviation of zero") if (penalty == "ENet" | penalty == "Ridge") { } stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") if (is.null(weights) == FALSE) { } if (penalty == "ENet" | penalty == "Ridge") { if (penalty == "aLASSO") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } } if (penalty == "aLASSO") { if (length(weights) != length(y)) { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") stop("number of weights does not match number of responses") } } if (length(weights) != length(y)) { if (sum(weights <= 0) > 0) { stop("number of weights does not match number of responses") stop("all weights most be positive") } } if (sum(weights <= 0) > 0) { } stop("all weights most be positive") if (is.matrix(y) == TRUE) { } y <- as.numeric(y) } } if (is.matrix(y) == TRUE) { if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { y <- as.numeric(y) stop("Penalty factors must be non-negative.") } } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == stop("Penalty factors must be non-negative.") 0) { } stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == } 0) { if (scalex) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") x <- scale(x) } } if (scalex) { if (penalty == "LASSO") { x <- scale(x) fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, } alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, if (penalty == "LASSO") { max.iter, converge.eps, lambda.discard = lambda.discard, fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, weights = weights, ...) alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, } max.iter, converge.eps, lambda.discard = lambda.discard, else if (penalty == "Ridge") { weights = weights, ...) if (alg != "huber") { } stop("huber alg is only option for Ridge penalty") else if (penalty == "Ridge") { } if (alg != "huber") { stop("huber alg is only option for Ridge penalty") fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, } scalex = FALSE, tau.penalty.factor, a = 0, max.iter, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, converge.eps, lambda.discard = lambda.discard, ...) scalex = FALSE, tau.penalty.factor, a = 0, max.iter, } converge.eps, lambda.discard = lambda.discard, ...) else if (penalty == "ENet") { } if (alg != "huber") { else if (penalty == "ENet") { stop("huber alg is only option for ENet penalty") if (alg != "huber") { } stop("huber alg is only option for ENet penalty") if (is.null(a)) { } stop("Specify a value for a for ENet penalty") if (is.null(a)) { } stop("Specify a value for a for ENet penalty") fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, } scalex = FALSE, tau.penalty.factor, a, max.iter, fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, converge.eps, gamma, lambda.discard = lambda.discard, scalex = FALSE, tau.penalty.factor, a, max.iter, ...) converge.eps, gamma, lambda.discard = lambda.discard, } ...) else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == } "MCP") { else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, "MCP") { eps = eps, penalty.factor = penalty.factor, alg = alg, fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, eps = eps, penalty.factor = penalty.factor, alg = alg, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, lambda.discard = lambda.discard, weights = weights, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, ...) lambda.discard = lambda.discard, weights = weights, } ...) if (scalex) { } for (i in 1:length(fit$models)) { if (scalex) { if (!is.null(dim(fit$models[[i]]$coefficients))) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) attributes(x)$`scaled:scale`) } } else { else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } } } } if (lambda.discard) { if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } } } fit$weights <- weights fit$weights <- weights fit$call <- match.call() fit$call <- match.call() fit fit})(x = c(-0.480929964184092, 0.260519766567896, -1.59200466103378, })(x = c(0.260519766567896, -1.59200466103378, -1.40725041787884, 1.64335146467444, -0.892840424931319, 1.81756154427673, 0.978797687004774, 1.64335146467444, -0.892840424931319, 1.81756154427673, 0.978797687004774, 0.173703947905053, -0.765927517696757, -1.61810355158559, -0.0782084430118756, 0.173703947905053, -0.976837423770878, -0.765927517696757, -0.189597162487224, 0.243391974133732, -0.0390778086750066, 1.29434963746335, -0.482279521462859, -1.61810355158559, -1.15189740652332, 0.243391974133732, 1.29434963746335, -0.558585716414447, -0.590758101893177, 0.209556129343577, -0.302746488912255, -0.482279521462859, -0.558585716414447, 0.209556129343577, -0.302746488912255, 0.651833412794388, 0.237187670023245, 0.00338263970996021, -0.690618021978373, 0.651833412794388, 0.316433783039526, 0.237187670023245, -0.690618021978373, -0.0367816181903371, -0.952189092663698, -0.897641035317988, 1.04327144637081, -1.66516790325749, 0.810440863822785, 0.00524028359330871, -0.0367816181903371, -0.952189092663698, -1.09708210062877, -0.897641035317988, 2.0840079165118, -0.505358581849998, -0.188882588762531, -1.73601861884627, 0.253061242456012, 1.29911679965598, -0.819128719560444, 1.29708575976511, 1.04327144637081, -1.66516790325749, -0.81575388783004, 0.00524028359330871, -2.39660323105394, 1.2850897415188, 1.09757213031115, -0.0475104423233482, -0.188882588762531, -1.73601861884627, 1.29911679965598, -0.819128719560444, 0.419701569133166, 0.880008192673729, 0.0405437013938304, 0.755358169051026, 1.29708575976511, -0.184222138886314, -2.39660323105394, 1.09757213031115, 2.01475904959565, 0.300820902060301, -0.837491161464251, 2.32561807403787, 0.492523350335849, 1.17682092754277, -0.0475104423233482, -0.754005802604193, -0.115523592122234, 0.539093521141975, 1.68462689833557, -0.779912455660777, 0.828516691486403, 0.880008192673729, 0.0405437013938304, 2.01475904959565, -1.06192273586877, -0.598289100215227, 0.454542303445962, -0.752264789434704, 0.300820902060301, 2.32561807403787, -0.115523592122234, -1.92984604921306, 0.23114412423776, 0.16002275215957, -0.678536727582994, 0.454020071118106, 0.539093521141975, 1.68462689833557, -0.779912455660777, -1.06192273586877, -1.05427070799935, 0.403048093999773, -0.0595473052841988, 0.317670135650049, -0.598289100215227, 0.753052282356617, 0.454542303445962, -0.117736413642914, -0.596113140927472, -0.895592811687222, -0.593678000243985, -1.28273734306206, -0.752264789434704, 1.11518209112638, 0.16002275215957, 0.454020071118106, 0.507092196508004, -0.841777866803666, -1.48923599683666, -1.01490797696978, -1.05427070799935, 0.403048093999773, 0.317670135650049, -0.596113140927472, 0.935444614114769, -0.534088166645793, -0.34505410278588, 1.32059123786425, -0.895592811687222, 2.24816079672845, -0.593678000243985, 0.507092196508004, -1.12629308183889, 1.40647291272127, -0.592638487900015, -0.433416785678295, -0.841777866803666, -1.48923599683666, 1.19738387616164, -1.01490797696978, 0.246389440165875, 0.596697039965637, -0.114370683525385, -2.04842260257209, 0.935444614114769, -0.534088166645793, 0.513682786066848, 1.32059123786425, 0.490169357980235, -0.993809618751362, 1.26416783468821, 1.61230696508862, -0.0738217576160378, -0.514159194962561, -0.409521271613194, -0.592638487900015, -0.433416785678295, 0.596697039965637, -0.114370683525385, 0.307136887765479, -0.0264157781098175, 0.108987211068105, 2.42595424675667, -2.04842260257209, 0.585631022797479, 0.490169357980235, 1.26416783468821, -0.744375892135879, 1.14747223558578, -0.297444203907775, 1.35169184466744, 1.11960014388449, 0.84042732370201, 1.61230696508862, 0.448778723709004, 1.22658270048902, 0.507873642253097, 1.21654131763847, -0.232029786942293, -2.27574501157137, -0.514159194962561, -0.409521271613194, -0.0264157781098175, 0.24621353067705, -1.19649231661486, -0.170258311951397, -0.447294767764776, 0.108987211068105, -0.744375892135879, 1.14747223558578, 0.636311636002868, -0.297444203907775, 1.35169184466744, 1.22658270048902, 0.507873642253097, -2.39806671231901, -0.383193509602829, 0.196337427651516, -1.6805425275174, 1.21654131763847, -0.983396249976296, -0.232029786942293, -1.31172301278579, 0.465677938877392, -1.66253601887376, -0.389250213357483, 0.173814881278103, 0.24621353067705, -0.619025938900027, -0.170258311951397, -2.39806671231901, 0.307135768005431, 1.96920305815874, -0.421141474496417, 0.296542144665709, -0.383193509602829, 0.196337427651516, 0.465677938877392, -1.66253601887376, 0.595345764317693, 0.344632284654097, 0.614273519390885, 0.769737955442115, -0.389250213357483, -0.204023905854089, 0.173814881278103, 1.96920305815874, 1.64434616238955, 1.53068077115633, -0.873544206000083, -0.37848477306934, -0.421141474496417, 0.296542144665709, -1.72119849326892, 0.595345764317693, -0.0842551306297439, -0.668737523423983, 0.507708645141382, 0.0184897854190604, 0.344632284654097, 0.614273519390885, -1.10277299780746, 1.64434616238955, -1.42734605465849, -1.54009574924658, -0.348838525991777, -0.0585698760740088, -0.37848477306934, -0.0842551306297439, 0.507708645141382, 0.0184897854190604, 0.249252884273094, -1.20361619470353, 0.995348222527196, -1.10271693572617, -1.42734605465849, -0.190194041240307, -1.54009574924658, -0.0585698760740088, 1.08429237686244, 0.810799800847407, 1.09700292973764, -0.134738532916573, -0.126190884172312, 0.436693831010392, 0.249252884273094, 0.873336280127636, -0.130259600993283, 0.666997132075878, 2.34600727653217, -0.310638737201563, 0.228062643008582, 0.995348222527196, -1.10271693572617, 0.810799800847407, -0.436551333999957, -0.190421194112009, -0.57026926707334, -0.064412824236531, 1.09700292973764, -0.130259600993283, 0.666997132075878, -0.790268314901752, 0.877991110246356, 0.0448036904574768, 2.86361689779448, 1.75876553094505, 2.34600727653217, -0.310638737201563, -0.436551333999957, -0.190421194112009, -1.32267695022682, 0.149332073807028, 0.994756514610935, 0.655164539365328, -0.57026926707334, 0.325915311596853, -0.064412824236531, -0.553108474568718, 1.69372240429395, -1.34535765088102, 0.887975619642803, -0.0236845752526422, 0.877991110246356, 0.40101251535969, 2.86361689779448, -1.32267695022682, -0.410599675813112, -0.586318395249533, -1.1227359636359, -1.36378197448477, 0.149332073807028, 0.994756514610935, 1.69372240429395, -1.34535765088102, 0.67500256527487, -0.915966420229162, -0.553579409254506, -0.53500986197262, 0.887975619642803, 0.74323666956593, -0.0236845752526422, -0.586318395249533, -1.1227359636359, -1.36378197448477, 0.732249076628045, 0.67500256527487, -0.838891844626356, 0.94846924157143, -1.093321463503, -0.197024214923906, -0.915966420229162, -0.553579409254506, 1.45442064053784, -0.838891844626356, 0.109785116627086, 0.349664062525036, 0.350092730132617, -0.47259496296446, -0.197024214923906, 0.109785116627086, 0.350092730132617, -0.47259496296446, -0.972985140134891, -0.00688691136878618, 0.553497874350005, -0.972985140134891, -0.0592832243177925, -0.00688691136878618, -1.74566994142626, 0.0120152987051703, -2.00060867262392, -0.190332371253106, -1.74566994142626, -0.687010588604653, 0.980247669797378, 0.0120152987051703, -0.172076938743874, 1.40463941705858, -1.0964165752767, 0.813079120107948, -2.16501305661807, 0.266034963779649, -0.190332371253106, -0.172076938743874, 0.972051319507345, 0.656368681552279, 1.79898310148832, 1.45055215955865, -1.0964165752767, 0.813079120107948, 0.656368681552279, 1.79898310148832, -1.26912307125113, -7.23693975609212e-05, 0.51010559890879, -1.64541647727544, 1.18483740721526, 1.45055215955865, -1.26912307125113, -7.23693975609212e-05, -0.211885473264558, 0.915858297903235, 1.43981802803642, -0.519100653045014, 0.51010559890879, -1.64541647727544, -0.797101937637874, -0.211885473264558, 0.834669785259211, -0.41668001229606, -0.332546112384471, -0.133548828630418, -0.00109839012607603, 0.915858297903235, 0.0833138553766202, 0.378672085115843, -2.17767837786795, -0.089803727960599, -1.18768168265036, -0.519100653045014, -0.41668001229606, -0.332546112384471, -0.133548828630418, 0.649640688100547, -1.65569474117988, 0.249536315754572, -0.282744634419443, -2.17767837786795, -0.089803727960599, -1.18768168265036, -1.1590786535223, 1.23706988384999, -0.298463060075283, 2.64941583089529, 0.855084725146911, 0.649640688100547, 0.249536315754572, -0.282744634419443, 1.23706988384999, -0.130745934805482, -1.00177114849685, -1.37708887580633, 0.923718989980203, -0.627348705073184, -0.298463060075283, 2.64941583089529, 0.855084725146911, -0.568950737699092, -0.365142585378765, -0.987179767154307, -0.138465561604632, -0.770703284421041, -1.00177114849685, -0.568950737699092, -0.365142585378765, 0.055219202839128, 0.0252872324466324, -1.61280839813112, 1.64106012294032, -0.138465561604632, 0.055219202839128, 0.0252872324466324, 1.35483019428629, -1.61280839813112, 0.501564943943222, -1.59981727301431, -1.00667224920994, 0.501564943943222, 0.104002368048707, 0.150635323328018, 1.57963066795073, 0.104002368048707, 0.177842012675469, 0.65932024179183, 1.57963066795073, 0.214539282389954, -0.425410819704295, -0.78646461711948, 0.32265981431347, 0.214539282389954, -0.78646461711948, 0.32265981431347, -0.617743014082345, -1.45505073934713, -0.617743014082345, -0.691383967506924, 2.19859759229711, -0.691383967506924, 2.21508451762438, 2.19859759229711, 0.916480093230269, 0.916480093230269, 0.302002825739899, -0.571232792728185, 1.60428326504309, 0.302002825739899, -0.571232792728185, 1.60428326504309, 0.569816082442537, -1.48914423154807, -0.622220133322318, -0.406211381494906, -0.205105555008739, -1.48914423154807, 0.241058418681867, -0.622220133322318, 1.2707494765249, 0.212577218565332, 0.755398353857206, -0.173176911394089, 0.399506520245378, -0.205105555008739, 0.755398353857206, -0.173176911394089, 0.399506520245378, 0.482601497875709, -0.817518515864716, -0.895630489676748, -0.16324222534558, -0.817518515864716, -0.895630489676748, -0.16324222534558, 0.274473210914837, -1.00481772631638, -0.0127800822943463, 1.43065817623729, 0.276241896865518, -1.00481772631638, 1.43065817623729, 0.276241896865518, 0.25949092938393, 0.25949092938393, -0.528697409570685, -2.30211735471764, 0.328595805593842, -0.821393865640373, -0.528697409570685, -2.30211735471764, 0.328595805593842, 0.797637682037914, -1.77677564313819, -1.42771940379687, 2.36967276662897, 0.20771443594019, -1.77677564313819, -2.13363715605127, -1.44357315055489, -2.13363715605127, -1.44357315055489, 0.760992224640061, 0.535742738863866, 0.535742738863866, -0.47435779943055, 1.0752096413995, -0.424137577268592, -0.47435779943055, 1.0752096413995, -1.35086649263108, -0.571528563467765, -1.35086649263108, 0.0385700999892817, -0.0404380024106825, 0.298108923796898, 0.0385700999892817, -0.106282119737649, -0.32616805418065, 0.597224474041138, -0.106282119737649, 1.03353127740633, 0.0683425625448555, 0.597224474041138, 0.84402731079208, 0.322732254149139, -0.301019146817286, 0.4668472319913160.84402731079208, -0.301019146817286, 0.466847231991316), y = c(0.0448627666042494, ), y = c(-1.0452895993915, 0.0448627666042494, 0.0363078802313261, 0.0363078802313261, 0.367679857721344, -0.491397921673926, -2.06488706198297, -0.491397921673926, -2.06488706198297, 1.72969641494695, 1.70470730010384, 1.72969641494695, 1.70470730010384, -0.208081528452669, -3.13798440514384, -0.208081528452669, -0.51130098112415, -2.08708500499336, -2.5469205657653, -0.51130098112415, 1.07596881345409, -2.08708500499336, -0.42615219461289, -0.42196794034535, 1.09568905836738, -0.840334478862128, -0.429370220618968, -0.42196794034535, -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.07785207524724, -1.56077625698081, -0.373025118995136, 1.08246073319612, -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, 1.37170614929101, 1.16467390795061, 1.95746740934544, 0.133931068403801, 1.16467390795061, 0.133931068403801, 0.157225011614585, 0.837211052912362, 0.157225011614585, 0.837211052912362, 0.236582446962088, -0.131939153301765, -0.16193066288313, 0.236582446962088, -0.131939153301765, 0.705725879821486, 0.705725879821486, 1.16251120027416, -0.663263819670189, 0.473939300920076, -0.685275799280433, -0.663263819670189, -0.374344426655121, -0.0726485429797235, -1.41861211613841, -0.374344426655121, -0.0726485429797235, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, -0.418792999565742, 1.77623836983434, -3.61483612448731, 2.96552569684401, -1.8020408761339, -1.8020408761339, -1.56633881582512, 1.72645142029684, -0.859355646799327, 0.425069805391752, -1.56633881582512, -0.276657946582118, 0.272882674851505, -0.276657946582118, 0.542511301313889, 2.84463116713737, 0.095384303368777, 0.095384303368777, -0.445805065205247, -0.664674301588493, 1.81521439870693, -0.445805065205247, 1.81521439870693, 0.61493427504324), tau = 0.5, 0.61493427504324), tau = 0.5, penalty = "SCAD", a = 3.7) penalty = "SCAD", a = 3.7) 7: 7: do.call(rqPen::rq.pen, args)do.call(rqPen::rq.pen, args) 8: withCallingHandlers(expr, warning = function(w) { 8: if (quantreg_is_nonunique(w)) {withCallingHandlers(expr, warning = function(w) { if (!flagged) { if (quantreg_is_nonunique(w)) { flagged <<- TRUE if (!flagged) { .quantreg_notes$nonunique <- .quantreg_notes$nonunique + flagged <<- TRUE 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, .quantreg_notes$nonunique <- .quantreg_notes$nonunique + stage) 1L } .quantreg_notes$stages <- union(.quantreg_notes$stages, invokeRestart("muffleWarning") stage) } }}) invokeRestart("muffleWarning") } 9: })quantreg_call("start", do.call(rqPen::rq.pen, args)) 9: 10: quantreg_call("start", do.call(rqPen::rq.pen, args))initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)10: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, 11: a = a)doTryCatch(return(expr), name, parentenv, handler) 11: 12: doTryCatch(return(expr), name, parentenv, handler)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 12: 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])tryCatchList(expr, classes, parentenv, handlers) 13: 14: tryCatchList(expr, classes, parentenv, handlers)tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {14: list(ok = FALSE, message = conditionMessage(e))tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, }) Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))15: })FUN(X[[i]]) 15: 16: FUN(X[[i]])doTryCatch(return(expr), name, parentenv, handler) 16: 17: doTryCatch(return(expr), name, parentenv, handler)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17: 18: tryCatchList(expr, classes, parentenv, handlers)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 19: 18: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), tryCatchList(expr, classes, parentenv, handlers) error = function(e) list(ok = FALSE, message = conditionMessage(e))) 19: 20: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), FUN(X[[i]], ...) error = function(e) list(ok = FALSE, message = conditionMessage(e))) 21: 20: lapply(ii, function(i) {FUN(X[[i]], ...) before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), 21: error = function(e) list(ok = FALSE, message = conditionMessage(e)))lapply(ii, function(i) {}) before <- quantreg_notes_counts()22: kir_run_chunk(ii, X, FUN) tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))23: })FUN(X[[i]], ...) 22: 24: kir_run_chunk(ii, X, FUN)eval(expr, env) 23: 25: FUN(X[[i]], ...)doTryCatch(return(expr), name, parentenv, handler) 24: 26: eval(expr, env)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 25: 27: doTryCatch(return(expr), name, parentenv, handler)tryCatchList(expr, classes, parentenv, handlers) 26: 28: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 27: tryCatch(expr, error = function(e) {tryCatchList(expr, classes, parentenv, handlers) call <- conditionCall(e)28: if (!is.null(call)) {tryCatch(expr, error = function(e) { if (identical(call[[1L]], quote(doTryCatch))) call <- conditionCall(e) if (!is.null(call)) { call <- sys.call(-4L) if (identical(call[[1L]], quote(doTryCatch))) dcall <- deparse(call, nlines = 1L) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") prefix <- paste("Error in", dcall, ": ") LONG <- 75L LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") type = "b") if (w > LONG) if (w > LONG) prefix <- paste0(prefix, "\n ") prefix <- paste0(prefix, "\n ") } } else prefix <- "Error : " else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) cat(msg, file = outFile) .Internal(printDeferredWarnings()) .Internal(printDeferredWarnings()) } } invisible(structure(msg, class = "try-error", condition = e)) invisible(structure(msg, class = "try-error", condition = e))})}) 29: 29: try(eval(expr, env), silent = TRUE)try(eval(expr, env), silent = TRUE) 30: 30: serialize(what, NULL, xdr = FALSE)serialize(what, NULL, xdr = FALSE) 31: 31: sendMaster(try(eval(expr, env), silent = TRUE), FALSE)sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 32: 32: mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]]) silent = mc.silent, mc.affinity = affinity.list[[i]]) 33: 33: FUN(X[[i]], ...)FUN(X[[i]], ...) 34: 34: lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), lapply(jobid, function(i) mcparallel(list(FUN(X[[i]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])) mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[i]])) 35: 35: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 36: 36: kir_lapply(seq_len(nfolds), function(i) {kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) return(fold_priors[[i]]) } } train_idx <- which(fold_indices != i) train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) list(ok = FALSE, message = conditionMessage(e)) }) }) if (!init_attempt$ok) { if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) return(cv_fold_failure("init_error", init_attempt$message)) } } beta_y <- init_attempt$value beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } } list(valid = TRUE, beta_y = beta_y) list(valid = TRUE, beta_y = beta_y)}, cores = cores)}, cores = cores) 37: 37: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol)38: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, 38: nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", standardize = TRUE, warm_start = TRUE, ...) "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), { standardize = TRUE, warm_start = TRUE, ...) quantreg_scope_enter(){ on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) quantreg_scope_enter() kir_parallel_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) on.exit(kir_parallel_exit(), add = TRUE) kir_parallel_enter() if (missing(tau)) on.exit(kir_parallel_exit(), add = TRUE) stop_missing_tau(beta_prior, "kiqr_cv") if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) "LASSO")) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", lambda_scale <- match.arg(lambda_scale) "LASSO")) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, lambda_scale <- match.arg(lambda_scale) prior_vars = prior_vars, y_prior = y_prior, tau = tau, input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) input <- std$input automatic_lambda <- is.null(lambda) n <- nrow(input$x) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) if (!automatic_lambda) zeta <- default_zeta_grid(input$spec$type) validate_grid(lambda, "lambda", lower = 0) if (!automatic_lambda) validate_zeta(zeta, arg = "zeta") validate_grid(lambda, "lambda", lower = 0) check_y_prior_zeta_one(zeta, input$x, input$spec) validate_zeta(zeta, arg = "zeta") nfolds <- validate_folds(nfolds, n) check_y_prior_zeta_one(zeta, input$x, input$spec) validate_count(cores, "cores") nfolds <- validate_folds(nfolds, n) validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(cores, "cores") validate_count(max_iter, "max_iter") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_rqpen_control(rqpen_control) validate_scad_tol(scad_a, tol, penalty) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_count(max_iter, "max_iter") validate_seed(seed) validate_rqpen_control(rqpen_control) rng <- kir_seed_begin(seed) validate_flag(warm_start, "warm_start") on.exit(kir_seed_restore(rng), add = TRUE) control <- validate_prior_control(prior_control) foldid <- draw_folds(n, nfolds) validate_seed(seed) inner <- if (input$spec$type == "prior_vars") { rng <- kir_seed_begin(seed) draw_prior_folds(n, control, outer = foldid) on.exit(kir_seed_restore(rng), add = TRUE) } foldid <- draw_folds(n, nfolds) else NULL inner <- if (input$spec$type == "prior_vars") { kir_seed_reset(seed) draw_prior_folds(n, control, outer = foldid) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, } nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, else NULL tol = tol) kir_seed_reset(seed) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, foldid = inner$full, rule = control$rule) nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tuning <- list(lambda_source = "supplied") tol = tol) if (automatic_lambda) { prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", path <- kiqr_automatic_lambda(x = input$x, y = input$y, foldid = inner$full, rule = control$rule) y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, tuning <- list(lambda_source = "supplied") huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, if (automatic_lambda) { rqpen_control = rqpen_control, lambda_scale = lambda_scale) path <- kiqr_automatic_lambda(x = input$x, y = input$y, lambda <- path$lambda y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, tuning <- path$tuning huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, } rqpen_control = rqpen_control, lambda_scale = lambda_scale) tuning$lambda <- lambda lambda <- path$lambda tuning$zeta <- zeta tuning <- path$tuning tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) } tuning$warm_start <- warm_start tuning$lambda <- lambda tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == tuning$zeta <- zeta "y_prior" tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) prior$record$zeta_one_excluded <- tuning$zeta_one_excluded tuning$warm_start <- warm_start fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == inner_foldid = inner$by_fold[[i]], rule = control$rule) "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded } fold_prior_fun <- function(i) { result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, kiqr_fold_prior(input, prior, foldid != i, tau, opts, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, inner_foldid = inner$by_fold[[i]], rule = control$rule) foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, } fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, penalty = penalty, Y_p = prior$y, warm_start = warm_start, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, a = scad_a, tol = tol) foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, if (!is.null(result$fold_prior_coefficients) && (input$spec$type == cores = cores, gamma = huber_gamma, max_iter = max_iter, "prior_vars" || identical(input$spec$form, "slopes"))) { fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, prior$record$fold_coefficients <- result$fold_prior_coefficients penalty = penalty, Y_p = prior$y, warm_start = warm_start, } a = scad_a, tol = tol) tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, if (!is.null(result$fold_prior_coefficients) && (input$spec$type == result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, "prior_vars" || identical(input$spec$form, "slopes"))) { result$lambda.1se, result$zeta.1se)) prior$record$fold_coefficients <- result$fold_prior_coefficients if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", } "upper")) { tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, advice <- if (tuning$boundary[["min"]] == "lower") { result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, "decrease `lambda_min_ratio` or supply a wider `lambda` grid" result$lambda.1se, result$zeta.1se)) } if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", else "supply a `lambda` grid with a larger upper bound" "upper")) { warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", advice <- if (tuning$boundary[["min"]] == "lower") { tuning$boundary[["min"]], advice), call. = FALSE) "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } } coefficient_names <- c("(Intercept)", input$predictor_names) else "supply a `lambda` grid with a larger upper bound" coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), tuning$boundary[["min"]], advice), call. = FALSE) coefficient_names)) } fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, coefficient_names <- c("(Intercept)", input$predictor_names) `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), penalty = penalty, predictor_names = input$predictor_names, coefficient_names)) nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, foldid = result$foldid, folds = result$nfolds, seed = seed, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", prior = prior$record, convergence = list(min = result$convergence.min, penalty = penalty, predictor_names = input$predictor_names, `1se` = result$convergence.1se)), class = c("kiqr_cv", nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, "kiqr")) fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) foldid = result$foldid, folds = result$nfolds, seed = seed, fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-0.591031102584369, 0.026594369016167, -1.51655309708187, prior = prior$record, convergence = list(min = result$convergence.min, -1.36265334929581, 1.17848915603162, -0.934151319673365, 1.32360564621202, `1se` = result$convergence.1se)), class = c("kiqr_cv", 0.624917789944714, -0.0457229557060947, -1.00412057567228, -0.828433236663958, "kiqr"))-0.348351725172981, -1.53829339708705, -0.255565245464953, -1.14994503270755, fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names)0.0123269676794679, -0.222969540747622, 0.887771647911303, -0.592155279876746, fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling)-0.655718118580886, -0.682517622215019, -0.0158581927282744, quantreg_scope_record(fit)-0.442604785355045, 0.352557499448816, 0.0731705822914032, 0.0071588003806459, })(x = c(-0.591031102584369, 0.026594369016167, -1.51655309708187, -0.187600110602252, -0.76570064552539, -0.221056820744958, -0.983588587470196, -1.36265334929581, 1.17848915603162, -0.934151319673365, 1.32360564621202, -1.10428404215097, -0.938150214178364, 0.678624244182574, -1.57749786529483, 0.624917789944714, -0.0457229557060947, -1.00412057567228, -0.828433236663958, -0.869938458225642, 0.484677045357101, -0.186052698644391, 1.54555470018366, -0.348351725172981, -1.53829339708705, -0.255565245464953, -1.14994503270755, -0.6113800701282, -0.347756487336345, -1.63651630553942, 0.0203814401000371, 0.0123269676794679, -0.222969540747622, 0.887771647911303, -0.592155279876746, 0.891742680167841, -0.872749683252251, 0.890050829839478, -0.343874346129348, -0.655718118580886, -0.682517622215019, -0.0158581927282744, -2.186781368328, 0.880058181492043, 0.723856556146425, 0.219852680260502, -0.442604785355045, 0.352557499448816, 0.0731705822914032, 0.0071588003806459, 0.78987057400076, -0.229993900077565, -0.818502482627721, 0.499734157285632, -0.187600110602252, -0.76570064552539, -0.221056820744958, -0.983588587470196, 0.159192348086018, 0.542626428177669, -0.156645054182717, 0.438793320642639, -1.10428404215097, -0.938150214178364, 0.678624244182574, -1.57749786529483, 1.48787059522956, 0.0601650977954321, -0.849012867932317, 2.3396930572073, -0.869938458225642, 0.484677045357101, -0.186052698644391, 1.54555470018366, -0.121202952207389, -1.95020737105763, 0.538711490308542, 1.69351481682805, -0.6113800701282, -0.347756487336345, -1.63651630553942, 0.0203814401000371, -0.790968220502282, -1.0752606000877, -0.607875122371882, 0.754401660588849, 0.891742680167841, -0.872749683252251, 0.890050829839478, -0.343874346129348, 0.453476062515215, -0.12343368044626, -0.76309682228376, 0.22827008805461, -2.186781368328, 0.880058181492043, 0.723856556146425, 0.219852680260502, 1.11946191647044, 0.156573183627664, -0.688772134082379, 0.45294960414968, 0.78987057400076, -0.229993900077565, -0.818502482627721, 0.499734157285632, -1.06754665004997, 0.40156514874452, -0.064773690927254, 0.31549629010048, 0.159192348086018, 0.542626428177669, -0.156645054182717, 0.438793320642639, -0.60568155466456, -0.907584691581957, 2.26160897578211, -0.603226708199307, 1.48787059522956, 0.0601650977954321, -0.849012867932317, 2.3396930572073, -1.29786209560729, 0.506451202763822, -0.853334262388665, -1.50603178934849, -0.121202952207389, -1.95020737105763, 0.538711490308542, 1.69351481682805, 1.20232889939251, -1.0278653857247, 0.938269957785018, -0.543154658413624, -0.790968220502282, -1.0752606000877, -0.607875122371882, 0.754401660588849, 0.513095125060458, -0.352590882519352, 1.32653328660507, -1.14015184737515, 0.453476062515215, -0.12343368044626, -0.76309682228376, 0.22827008805461, 1.41310993795933, -0.602178783855351, -0.441668618861122, 0.243638772981765, 1.11946191647044, 0.156573183627664, -0.688772134082379, 0.45294960414968, 0.596781151552077, -0.120040713979049, -2.06974347624009, 0.585625585340276, -1.06754665004997, 0.40156514874452, -0.064773690927254, 0.31549629010048, 0.489391420294719, -1.00659629419074, 1.26965329080706, 1.12391572124242, -0.60568155466456, -0.907584691581957, 2.26160897578211, -0.603226708199307, 0.842483763135379, 1.62060965216855, 0.447665842415645, -2.29890543636378, -1.29786209560729, 0.506451202763822, -0.853334262388665, -1.50603178934849, -0.0791636557813867, -0.523064416390043, -0.417579736179349, 1.20232889939251, -1.0278653857247, 0.938269957785018, -0.543154658413624, 0.30487780447769, -0.0313740549538529, 0.10512464987343, 2.46252211409212, 0.513095125060458, -0.352590882519352, 1.32653328660507, -1.14015184737515, -0.639988814672429, 1.21138919161606, 0.71116326022022, -0.202617819731427, 1.41310993795933, -0.602178783855351, -0.441668618861122, 0.243638772981765, 1.41124016652594, 1.28880733773623, 0.585472792092364, 1.27898075858866, 0.596781151552077, -0.120040713979049, -2.06974347624009, 0.585625585340276, -0.873896086126546, -0.138602737817888, -1.19519933379972, 0.32941007299964, 0.489391420294719, -1.00659629419074, 1.26965329080706, 1.12391572124242, -1.08243363479137, -0.517320328175245, -0.0781526686297915, -0.349262803591145, 0.842483763135379, 1.62060965216855, 0.447665842415645, -2.29890543636378, -2.25830413757063, -0.286532789591887, 0.280600911826615, -1.55612911873253, -0.0791636557813867, -0.523064416390043, -0.417579736179349, 0.544179732652263, -1.53850780252623, -0.292459929280143, -0.111195954189926, 0.30487780447769, -0.0313740549538529, 0.10512464987343, 2.46252211409212, 0.25856016426853, 0.389029071285452, 2.0155416760087, -0.323668977512006, 0.378662065091522, -1.59591537837665, 0.671073724102061, 0.425723468271415, -0.639988814672429, 1.21138919161606, 0.71116326022022, -0.202617819731427, 0.689596579577318, -0.990719145101699, 0.841735344548856, 1.6976340685188, 1.41124016652594, 1.28880733773623, 0.585472792092364, 1.27898075858866, 1.58640018968795, -0.766393980020216, -0.281924781619278, 0.00601074598927869, -0.873896086126546, -0.138602737817888, -1.19519933379972, 0.32941007299964, -0.565968490200937, 0.585311324573246, 0.106557758745421, -1.30834898551151, -1.08243363479137, -0.517320328175245, -0.0781526686297915, -0.349262803591145, -0.0976619358928339, -1.4186867561377, -0.252912722456529, 0.0311465455672697, -2.25830413757063, -0.286532789591887, 0.280600911826615, -1.55612911873253, -0.0350279244241573, 0.515815648320885, 0.332384409215427, 0.943117509956653, 0.544179732652263, -1.53850780252623, -0.292459929280143, -0.111195954189926, 0.311647466302197, -1.08940511998598, 1.06251939182712, -0.990664282291747, 0.25856016426853, 0.389029071285452, 2.0155416760087, -0.323668977512006, 1.14956086662167, 0.881918801332212, 1.16199951732311, -0.0975175762236416, 0.378662065091522, -1.59591537837665, 0.671073724102061, 0.425723468271415, -0.0932320248340282, 0.669602677456627, -0.724744472330573, 2.27612056631615, 0.689596579577318, -0.990719145101699, 0.841735344548856, 1.6976340685188, -0.265823185198619, -0.386299431192284, -0.150796105603069, -0.514244013452848, 1.58640018968795, -0.766393980020216, -0.281924781619278, 0.00601074598927869, 0.343247266220106, -0.0302282215915427, -0.49782414830986, 0.871486865882586, -0.565968490200937, 0.585311324573246, 0.106557758745421, -1.30834898551151, 0.074272805513109, 0.415102103813952, 2.7713820861761, 1.71423333026475, -0.0976619358928339, -1.4186867561377, -0.252912722456529, 0.0311465455672697, -1.23416605007213, 0.174288114115666, 0.983210854883472, 0.658280963931637, -0.0350279244241573, 0.515815648320885, 0.332384409215427, 0.943117509956653, 1.6519984790595, -1.25586749806704, 0.881040288183123, 0.742550527843682, 0.311647466302197, -1.08940511998598, 1.06251939182712, -0.990664282291747, 0.00874156116443356, -0.361468251189953, -0.529600211031989, 1.14956086662167, 0.881918801332212, 1.16199951732311, -0.0975175762236416, -1.0428576337799, -1.27349634060697, 0.732037330726618, 0.677262471344541, -0.0932320248340282, 0.669602677456627, -0.724744472330573, 2.27612056631615, -0.845015487649319, -0.498274750112178, 1.42302871042578, -0.480506954012273, -0.265823185198619, -0.386299431192284, -0.150796105603069, -0.514244013452848, -0.771268652413693, 0.938922062221907, -1.01471312207972, -0.157114037087788, 0.343247266220106, -0.0302282215915427, -0.49782414830986, 0.871486865882586, 0.136448620191636, 0.365970650786999, 0.366380810417199, -0.420786855167701, 0.074272805513109, 0.415102103813952, 2.7713820861761, 1.71423333026475, -0.899572390614362, -0.0253200951818512, 0.0248139759795345, -1.23416605007213, 0.174288114115666, 0.983210854883472, 0.658280963931637, 0.561003817282416, -1.63889606880835, -0.625944959411033, 0.969328438022189, 1.6519984790595, -1.25586749806704, 0.881040288183123, 0.742550527843682, 0.0429000719587969, -2.04013379709133, 0.285952287820425, -1.88282766956995, 0.00874156116443356, -0.361468251189953, -0.529600211031989, -1.0428576337799, -1.27349634060697, 0.732037330726618, 0.677262471344541, -0.15071111772361, -0.133243874305348, 1.37539682070027, -1.0176746005728, -0.845015487649319, -0.498274750112178, 1.42302871042578, -0.480506954012273, 0.809377489293562, 0.956915831868467, 0.638131349174454, 1.79197290706804, -0.771268652413693, 0.938922062221907, -1.01471312207972, -0.157114037087788, 1.17179272004281, 1.44011834104833, -1.3062799631651, -0.0247597816198378, 0.490431109972915, -1.68627076518603, -0.829620828933711, -0.238654125576964, 0.136448620191636, 0.365970650786999, 0.366380810417199, -0.420786855167701, -0.0257958838562224, 0.900170667043693, 1.42927873774721, 0.0594457822358079, -0.899572390614362, -0.0253200951818512, 0.0248139759795345, 0.561003817282416, -1.63889606880835, -0.625944959411033, 0.969328438022189, -0.548887950270233, 0.818184409669585, -0.445460941455792, -0.360500355932039, 0.0429000719587969, -2.04013379709133, 0.285952287820425, -1.88282766956995, -0.159547758190255, 0.357706152482205, -2.22376258208559, -0.115372825486446, -0.15071111772361, -0.133243874305348, 1.37539682070027, -1.0176746005728, -1.22403834511744, -1.1951542674148, 0.631337247585679, -1.69665002159048, 0.809377489293562, 0.956915831868467, 0.638131349174454, 1.79197290706804, 0.227301516675197, -0.310209536983869, 1.22453842424653, -0.658199629531311, 1.17179272004281, 1.44011834104833, -1.3062799631651, -0.0247597816198378, -0.326082409258126, 2.65076184606774, 0.838799943338105, -0.802962786970869, 0.490431109972915, -1.68627076518603, -0.829620828933711, -0.238654125576964, -0.156717323599945, -1.03630108518638, -1.4153066216368, 0.908108596964723, -0.0257958838562224, 0.900170667043693, 1.42927873774721, 0.0594457822358079, -0.59922785350864, -0.393417116411639, -1.02156633137411, -0.164512802159358, -0.548887950270233, 0.818184409669585, -0.445460941455792, -0.360500355932039, 0.0310750763469802, 0.000848999425567642, 1.34345582777401, -1.65334228451632, -0.159547758190255, 0.357706152482205, -2.22376258208559, -0.115372825486446, 1.6324982037773, 0.481806535961803, -1.64022351077949, -1.04125034329438, -1.22403834511744, -1.1951542674148, 0.631337247585679, -1.69665002159048, 0.0803375767690832, 0.154902757379373, 0.641111910950676, 0.1274287396582, 0.227301516675197, -0.310209536983869, 1.22453842424653, -0.658199629531311, 1.57046515324945, 0.191960608321051, -0.454277536315632, -0.818878987885141, -0.326082409258126, 2.65076184606774, 0.838799943338105, -0.802962786970869, 0.30114351448628, -1.55005090160424, -0.72519599476199, -0.797741726688203, -0.156717323599945, -1.03630108518638, -1.4153066216368, 0.908108596964723, 2.06550044725063, 2.04925872291846, 0.786209454002233, 0.180870969788242, -0.59922785350864, -0.393417116411639, -1.02156633137411, -0.164512802159358, -0.679377494412951, 1.46378330659275, 0.44470118685535, -1.58363734000052, 0.0310750763469802, 0.000848999425567642, 1.34345582777401, -1.65334228451632, 0.120832955460222, -0.729606528263807, -0.516810356092618, 1.13520998312328, 1.6324982037773, 0.481806535961803, -1.64022351077949, -1.04125034329438, -0.318695466230325, 0.092775340607271, 0.627523394963977, -0.287241679815022, 0.0803375767690832, 0.154902757379373, 0.641111910950676, 0.1274287396582, 0.276924545339165, 0.358783696955915, -0.922000345109948, -0.998950602390343, 1.57046515324945, 0.191960608321051, -0.454277536315632, -0.818878987885141, -0.277454746901607, 0.153750787820796, -1.10651395716324, -0.129230344755356, 0.30114351448628, -1.55005090160424, -0.72519599476199, -0.797741726688203, 1.29274044847617, 0.155493169075694, 0.138991329543313, -0.925818058934539, 2.06550044725063, 2.04925872291846, 0.786209454002233, 0.180870969788242, -0.637474716672803, -2.38451955993373, 0.207068446842626, 0.0879848794802258, -0.679377494412951, 1.46378330659275, 0.44470118685535, -1.58363734000052, 0.669134520790577, -1.86699096741038, -1.52312605001272, 2.21778959004011, 0.120832955460222, -0.729606528263807, -0.516810356092618, 1.13520998312328, -2.2185450748282, -1.53874401269311, 0.633034071175666, 0.411134597421937, -0.318695466230325, 0.092775340607271, 0.627523394963977, -0.287241679815022, -0.583943269741735, 0.942578304685943, -0.53446994539148, -1.4474161300306, 0.276924545339165, 0.358783696955915, -0.922000345109948, -0.998950602390343, -0.679668866316591, -0.0786438655603861, -0.156476923799872, -0.277454746901607, 0.153750787820796, -1.10651395716324, -0.129230344755356, 0.177034979712513, -0.221341777694144, 0.901519800134285, -0.0493141925062218, 1.29274044847617, 0.155493169075694, 0.138991329543313, -0.925818058934539, -0.437957469271032, 0.471701948482876, 0.714834222047201, 0.201292100781617, -0.637474716672803, -2.38451955993373, 0.207068446842626, 0.0879848794802258, -0.413182587809343, 0.343263735624697), y = c(-1.0452895993915, 0.669134520790577, -1.86699096741038, -1.52312605001272, 2.21778959004011, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, -2.2185450748282, -1.53874401269311, 0.633034071175666, 0.411134597421937, -2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, -0.583943269741735, 0.942578304685943, -0.53446994539148, -1.4474161300306, -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, -0.679668866316591, -0.0786438655603861, -0.156476923799872, -2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, 0.177034979712513, -0.221341777694144, 0.901519800134285, -0.0493141925062218, -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.56077625698081, -0.437957469271032, 0.471701948482876, 0.714834222047201, 0.201292100781617, -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, -0.413182587809343, 0.343263735624697), y = c(-1.0452895993915, 1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, 0.837211052912362, -0.16193066288313, 0.236582446962088, -0.131939153301765, -2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, 0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, 0.473939300920076, -1.41861211613841, -0.374344426655121, -0.0726485429797235, -2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.56077625698081, -0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, 0.837211052912362, -0.16193066288313, 0.236582446962088, -0.131939153301765, -0.664674301588493, 1.81521439870693, 0.61493427504324), beta_prior = c(0.8, 0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, -0.4, 0, 0, 0, 0), tau = 0.5, lambda = c(0.05, 0.2), zeta = c(0, 0.473939300920076, -1.41861211613841, -0.374344426655121, -0.0726485429797235, 0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 1, standardize = TRUE, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, cores = 2L)-0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 39: 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, do.call(fitter, args)-0.664674301588493, 1.81521439870693, 0.61493427504324), beta_prior = c(0.8, -0.4, 0, 0, 0, 0), tau = 0.5, lambda = c(0.05, 0.2), zeta = c(0, 40: 0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 1, standardize = TRUE, kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, cores = 2L) 0.2), zeta = c(0, 0.5, 1), cores = cores) 39: 41: do.call(fitter, args)withCallingHandlers(expr, warning = function(w) { messages <<- c(messages, conditionMessage(w))40: invokeRestart("muffleWarning")kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)}) 41: 42: withCallingHandlers(expr, warning = function(w) {collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, messages <<- c(messages, conditionMessage(w)) lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) invokeRestart("muffleWarning") })43: 42: eval(code, test_env)collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores))44: eval(code, test_env)43: eval(code, test_env)45: withCallingHandlers({44: eval(code, test_env)eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations 45: withCallingHandlers({ if (snapshot_skipped) { eval(code, test_env) skip("On CRAN") new_expectations <- the$test_expectations > starting_expectations } if (snapshot_skipped) { else if (!new_expectations && skip_on_empty) { skip_empty() skip("On CRAN") } }}, expectation = handle_expectation, packageNotFoundError = function(e) { else if (!new_expectations && skip_on_empty) { if (on_cran()) { skip_empty() skip(paste0("{", e$package, "} is not installed.")) } }}, expectation = handle_expectation, packageNotFoundError = function(e) {}, snapshot_on_cran = function(cnd) { if (on_cran()) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE46: invokeRestart("muffle_cran_snapshot")doTryCatch(return(expr), name, parentenv, handler)}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)47: tryCatchOne(expr, names, parentenv, handlers[[1L]])46: doTryCatch(return(expr), name, parentenv, handler)48: tryCatchList(expr, classes, parentenv, handlers)47: tryCatchOne(expr, names, parentenv, handlers[[1L]])49: tryCatch(withCallingHandlers({48: eval(code, test_env)tryCatchList(expr, classes, parentenv, handlers) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {49: skip("On CRAN")tryCatch(withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { } skip("On CRAN")}, expectation = handle_expectation, packageNotFoundError = function(e) { } if (on_cran()) { else if (!new_expectations && skip_on_empty) { skip(paste0("{", e$package, "} is not installed.")) skip_empty() } }}, snapshot_on_cran = function(cnd) {}, expectation = handle_expectation, packageNotFoundError = function(e) { snapshot_skipped <<- TRUE if (on_cran()) { invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt), error = handle_fatal)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE50: invokeRestart("muffle_cran_snapshot")doWithOneRestart(return(expr), restart)}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)51: withOneRestart(expr, restarts[[1L]])50: doWithOneRestart(return(expr), restart)52: withRestarts(tryCatch(withCallingHandlers({51: eval(code, test_env)withOneRestart(expr, restarts[[1L]]) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {52: skip("On CRAN")withRestarts(tryCatch(withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { skip("On CRAN") } }}, expectation = handle_expectation, packageNotFoundError = function(e) { else if (!new_expectations && skip_on_empty) { if (on_cran()) { skip_empty() skip(paste0("{", e$package, "} is not installed.")) } }}, expectation = handle_expectation, packageNotFoundError = function(e) {}, snapshot_on_cran = function(cnd) { if (on_cran()) { snapshot_skipped <<- TRUE skip(paste0("{", e$package, "} is not installed.")) invokeRestart("muffle_cran_snapshot") }}, skip = handle_skip, warning = handle_warning, message = handle_message, }, snapshot_on_cran = function(cnd) { error = handle_error, interrupt = handle_interrupt), error = handle_fatal), snapshot_skipped <<- TRUE end_test = function() { invokeRestart("muffle_cran_snapshot") }) }, skip = handle_skip, warning = handle_warning, message = handle_message, 53: error = handle_error, interrupt = handle_interrupt), error = handle_fatal), test_code(code, parent.frame()) end_test = function() { }) 54: 53: test_that("quantreg non-unique warnings are reported once with counts", test_code(code, parent.frame()) { d <- review_data()54: test_that("quantreg non-unique warnings are reported once with counts", runs <- c("serial", kir_test_backends()) { for (run in runs) { d <- review_data() cores <- if (run == "serial") runs <- c("serial", kir_test_backends()) 1L for (run in runs) { else 2L old <- options(kir.parallel = if (run == "serial") cores <- if (run == "serial") 1L "auto" else 2L else run) old <- options(kir.parallel = if (run == "serial") out <- collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, "auto" seed = 1, lambda = c(0.05, 0.2), zeta = c(0, else run) 0.5, 1), cores = cores)) out <- collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, options(old) seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) q <- out$value$quantreg_nonunique options(old) expect_true(q$fits > 0L) q <- out$value$quantreg_nonunique expect_false(any(grepl("Solution may be nonunique", expect_true(q$fits > 0L) out$warnings, fixed = TRUE))) if (q$nonunique > 0L) { expect_false(any(grepl("Solution may be nonunique", expect_length(out$warnings, 1L) out$warnings, fixed = TRUE))) expect_match(out$warnings, sprintf("in %d of %d quantile-regression fits", if (q$nonunique > 0L) { q$nonunique, q$fits), fixed = TRUE) expect_length(out$warnings, 1L) printed <- capture.output(print(summary(out$value), expect_match(out$warnings, sprintf("in %d of %d quantile-regression fits", details = TRUE)) q$nonunique, q$fits), fixed = TRUE) expect_true(any(grepl("possibly non-unique solutions", printed <- capture.output(print(summary(out$value), printed))) details = TRUE)) } expect_true(any(grepl("possibly non-unique solutions", if (cores == 1L) printed))) counts_serial <- q } else expect_identical(q, counts_serial) if (cores == 1L) } }) counts_serial <- q else expect_identical(q, counts_serial)55: }eval(code, test_env) }) 56: 55: eval(code, test_env)eval(code, test_env) 57: withCallingHandlers({56: eval(code, test_env)eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {57: skip("On CRAN")withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { } skip("On CRAN")}, expectation = handle_expectation, packageNotFoundError = function(e) { } if (on_cran()) { else if (!new_expectations && skip_on_empty) { skip(paste0("{", e$package, "} is not installed.")) skip_empty() } }}, snapshot_on_cran = function(cnd) {}, expectation = handle_expectation, packageNotFoundError = function(e) { snapshot_skipped <<- TRUE if (on_cran()) { invokeRestart("muffle_cran_snapshot") skip(paste0("{", e$package, "} is not installed."))}, skip = handle_skip, warning = handle_warning, message = handle_message, } error = handle_error, interrupt = handle_interrupt)}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE58: invokeRestart("muffle_cran_snapshot")doTryCatch(return(expr), name, parentenv, handler)}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt)59: tryCatchOne(expr, names, parentenv, handlers[[1L]])58: doTryCatch(return(expr), name, parentenv, handler)60: tryCatchList(expr, classes, parentenv, handlers)59: tryCatchOne(expr, names, parentenv, handlers[[1L]])61: tryCatch(withCallingHandlers({ eval(code, test_env)60: new_expectations <- the$test_expectations > starting_expectationstryCatchList(expr, classes, parentenv, handlers) if (snapshot_skipped) { skip("On CRAN")61: tryCatch(withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { } skip("On CRAN")}, expectation = handle_expectation, packageNotFoundError = function(e) { } if (on_cran()) { else if (!new_expectations && skip_on_empty) { skip(paste0("{", e$package, "} is not installed.")) } skip_empty()}, snapshot_on_cran = function(cnd) { } snapshot_skipped <<- TRUE}, expectation = handle_expectation, packageNotFoundError = function(e) { invokeRestart("muffle_cran_snapshot") if (on_cran()) {}, skip = handle_skip, warning = handle_warning, message = handle_message, skip(paste0("{", e$package, "} is not installed.")) error = handle_error, interrupt = handle_interrupt), error = handle_fatal) } }, snapshot_on_cran = function(cnd) {62: snapshot_skipped <<- TRUEdoWithOneRestart(return(expr), restart) invokeRestart("muffle_cran_snapshot") }, skip = handle_skip, warning = handle_warning, message = handle_message, 63: error = handle_error, interrupt = handle_interrupt), error = handle_fatal)withOneRestart(expr, restarts[[1L]]) 62: 64: doWithOneRestart(return(expr), restart)withRestarts(tryCatch(withCallingHandlers({ 63: withOneRestart(expr, restarts[[1L]]) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) {64: skip("On CRAN")withRestarts(tryCatch(withCallingHandlers({ } eval(code, test_env) else if (!new_expectations && skip_on_empty) { new_expectations <- the$test_expectations > starting_expectations skip_empty() if (snapshot_skipped) { } skip("On CRAN")}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { } skip(paste0("{", e$package, "} is not installed.")) else if (!new_expectations && skip_on_empty) { } skip_empty()}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE } invokeRestart("muffle_cran_snapshot")}, expectation = handle_expectation, packageNotFoundError = function(e) {}, skip = handle_skip, warning = handle_warning, message = handle_message, if (on_cran()) { error = handle_error, interrupt = handle_interrupt), error = handle_fatal), skip(paste0("{", e$package, "} is not installed.")) end_test = function() { }) }65: }, snapshot_on_cran = function(cnd) {test_code(code = exprs, env = env, reporter = get_reporter() %||% snapshot_skipped <<- TRUE StopReporter$new()) invokeRestart("muffle_cran_snapshot") }, skip = handle_skip, warning = handle_warning, message = handle_message, 66: error = handle_error, interrupt = handle_interrupt), error = handle_fatal), source_file(path, env = env(env), desc = desc, shuffle = shuffle, end_test = function() { error_call = error_call) }) 67: 65: FUN(X[[i]], ...)test_code(code = exprs, env = env, reporter = get_reporter() %||% 68: StopReporter$new())lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)66: source_file(path, env = env(env), desc = desc, shuffle = shuffle, 69: error_call = error_call)doTryCatch(return(expr), name, parentenv, handler) 67: 70: FUN(X[[i]], ...)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 68: 71: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, tryCatchList(expr, classes, parentenv, handlers) error_call = error_call) 72: 69: tryCatch(code, testthat_abort_reporter = function(cnd) {doTryCatch(return(expr), name, parentenv, handler) cat(conditionMessage(cnd), "\n") NULL70: })tryCatchOne(expr, names, parentenv, handlers[[1L]]) 73: 71: with_reporter(reporters$multi, lapply(test_paths, test_one_file, tryCatchList(expr, classes, parentenv, handlers) env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 72: 74: tryCatch(code, testthat_abort_reporter = function(cnd) {test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, cat(conditionMessage(cnd), "\n") NULL desc = desc, load_package = load_package, shuffle = shuffle, }) error_call = error_call) 73: 75: with_reporter(reporters$multi, lapply(test_paths, test_one_file, test_files(test_dir = path, test_paths = test_paths, test_package = package, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 74: load_package = load_package, parallel = parallel, shuffle = shuffle) test_files_serial(test_dir = test_dir, test_package = test_package, 76: test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 75: 77: test_files(test_dir = path, test_paths = test_paths, test_package = package, test_check("kir") reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle)An irrecoverable exception occurred. R is aborting now ... 76: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 77: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) 2: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) 3: rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, ...) 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 5: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 6: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-0.480929964184092, 0.260519766567896, -1.59200466103378, -1.40725041787884, 1.64335146467444, 0.978797687004774, -0.976837423770878, -0.189597162487224, -1.61810355158559, -0.0782084430118756, -1.15189740652332, 0.243391974133732, -0.0390778086750066, 1.29434963746335, -0.482279521462859, -0.590758101893177, 0.209556129343577, -0.302746488912255, 0.316433783039526, 0.00338263970996021, -0.690618021978373, -0.0367816181903371, -1.09708210062877, -0.897641035317988, 1.04327144637081, -1.66516790325749, -0.81575388783004, 0.810440863822785, 0.00524028359330871, 2.0840079165118, -0.505358581849998, -1.73601861884627, 0.253061242456012, 1.29911679965598, 1.29708575976511, -0.184222138886314, 1.2850897415188, 0.492523350335849, 1.17682092754277, -0.0475104423233482, -0.754005802604193, 0.828516691486403, 0.419701569133166, 0.880008192673729, 0.0405437013938304, 0.755358169051026, 2.01475904959565, 0.300820902060301, -0.837491161464251, 2.32561807403787, -0.115523592122234, -1.92984604921306, 0.539093521141975, -1.06192273586877, 0.753052282356617, -0.117736413642914, -0.752264789434704, 0.23114412423776, 1.11518209112638, 0.16002275215957, -0.678536727582994, 0.454020071118106, -1.05427070799935, -0.0595473052841988, 0.317670135650049, -0.596113140927472, 2.24816079672845, -1.28273734306206, 0.507092196508004, -0.841777866803666, 1.19738387616164, -1.01490797696978, 0.935444614114769, -0.534088166645793, 0.513682786066848, -0.34505410278588, 1.32059123786425, -1.12629308183889, 1.40647291272127, -0.433416785678295, 0.246389440165875, 0.596697039965637, -2.04842260257209, 0.585631022797479, -0.993809618751362, 1.11960014388449, 0.84042732370201, 1.61230696508862, 0.448778723709004, -2.27574501157137, -0.0738217576160378, -0.514159194962561, -0.409521271613194, 0.307136887765479, -0.0264157781098175, 0.108987211068105, 2.42595424675667, -0.744375892135879, 1.14747223558578, 0.636311636002868, -0.297444203907775, 0.507873642253097, -0.983396249976296, -1.31172301278579, 0.24621353067705, -1.19649231661486, -0.619025938900027, -0.170258311951397, -0.447294767764776, -2.39806671231901, -0.383193509602829, -1.6805425275174, 0.465677938877392, -1.66253601887376, -0.204023905854089, 0.307135768005431, 1.96920305815874, -0.421141474496417, -1.72119849326892, 0.595345764317693, 0.344632284654097, 0.614273519390885, -1.10277299780746, 0.769737955442115, 1.64434616238955, 1.53068077115633, -0.873544206000083, -0.0842551306297439, -0.668737523423983, 0.507708645141382, -1.42734605465849, -0.190194041240307, -0.348838525991777, -0.126190884172312, 0.436693831010392, 0.249252884273094, 0.873336280127636, 0.228062643008582, -1.20361619470353, 0.995348222527196, -1.10271693572617, 1.08429237686244, 0.810799800847407, 1.09700292973764, -0.134738532916573, -0.130259600993283, 0.666997132075878, -0.790268314901752, 2.34600727653217, -0.190421194112009, 0.325915311596853, -0.553108474568718, 0.877991110246356, 0.0448036904574768, 0.40101251535969, 2.86361689779448, 1.75876553094505, -1.32267695022682, 0.149332073807028, 0.655164539365328, 1.69372240429395, -1.34535765088102, 0.74323666956593, -0.410599675813112, -0.586318395249533, -1.1227359636359, 0.732249076628045, 0.67500256527487, -0.915966420229162, -0.553579409254506, 1.45442064053784, -0.53500986197262, -0.838891844626356, 0.94846924157143, -1.093321463503, 0.109785116627086, 0.349664062525036, 0.350092730132617, -0.972985140134891, -0.0592832243177925, 0.553497874350005, -0.687010588604653, 0.980247669797378, 0.0120152987051703, -2.16501305661807, 0.266034963779649, -2.00060867262392, -0.190332371253106, -0.172076938743874, 1.40463941705858, -1.0964165752767, 0.813079120107948, 0.972051319507345, 0.656368681552279, 1.79898310148832, 1.18483740721526, 1.45055215955865, 0.51010559890879, -0.797101937637874, -0.00109839012607603, 0.915858297903235, 1.43981802803642, 0.0833138553766202, -0.519100653045014, 0.834669785259211, -0.41668001229606, -0.332546112384471, 0.378672085115843, -2.17767837786795, -0.089803727960599, -1.1590786535223, -1.65569474117988, 0.249536315754572, -0.282744634419443, -0.627348705073184, -0.298463060075283, 2.64941583089529, 0.855084725146911, -0.770703284421041, -0.130745934805482, -1.00177114849685, -1.37708887580633, 0.923718989980203, -0.365142585378765, -0.987179767154307, -0.138465561604632, 0.0252872324466324, 1.35483019428629, 1.64106012294032, -1.59981727301431, -1.00667224920994, 0.104002368048707, 0.177842012675469, 0.65932024179183, 0.150635323328018, 1.57963066795073, 0.214539282389954, -0.425410819704295, -0.78646461711948, 0.32265981431347, -1.45505073934713, -0.617743014082345, -0.691383967506924, 2.21508451762438, 2.19859759229711, -0.571232792728185, 0.569816082442537, 0.241058418681867, -0.622220133322318, -0.406211381494906, 1.2707494765249, -0.205105555008739, 0.212577218565332, 0.755398353857206, -0.173176911394089, 0.482601497875709, -0.817518515864716, -0.895630489676748, 0.274473210914837, -0.0127800822943463, 1.43065817623729, 0.276241896865518, -0.821393865640373, -0.528697409570685, -2.30211735471764, 0.328595805593842, 0.20771443594019, 0.797637682037914, -1.77677564313819, -1.42771940379687, 2.36967276662897, -1.44357315055489, 0.760992224640061, 0.535742738863866, 1.0752096413995, -0.424137577268592, -0.571528563467765, -0.0404380024106825, 0.298108923796898, -0.106282119737649, 1.03353127740633, 0.0683425625448555, -0.32616805418065, 0.597224474041138, 0.84402731079208, 0.322732254149139, -0.301019146817286, 0.466847231991316), y = c(-1.0452895993915, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, 1.70470730010384, -3.13798440514384, 1.07596881345409, -2.08708500499336, -2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, -0.840334478862128, -0.429370220618968, -1.56077625698081, -0.373025118995136, 1.08246073319612, -0.881394598453857, 1.95746740934544, 0.133931068403801, 0.157225011614585, -0.16193066288313, 0.236582446962088, -0.131939153301765, 0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, 0.473939300920076, -1.41861211613841, -0.0726485429797235, -1.14129810719626, 1.77623836983434, 2.96552569684401, -0.418792999565742, 0.425069805391752, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, -0.664674301588493, 1.81521439870693, 0.61493427504324), tau = 0.5, penalty = "SCAD", a = 3.7) 7: do.call(rqPen::rq.pen, args) Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, 8: "LASSO", a)withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { 2: if (!flagged) {rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, flagged <<- TRUE scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L 3: .quantreg_notes$stages <- union(.quantreg_notes$stages, rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, stage) max.iter, converge.eps, lambda.discard = lambda.discard, ...) } 4: invokeRestart("muffleWarning")rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, } penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, }) coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 9: 5: quantreg_call("start", do.call(rqPen::rq.pen, args))rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, 10: tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, a = a) weights = weights, ...) 11: doTryCatch(return(expr), name, parentenv, handler) 6: 12: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, tryCatchOne(expr, names, parentenv, handlers[[1L]]) eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, 13: tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, tryCatchList(expr, classes, parentenv, handlers) max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) 14: {tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, penalty <- match.arg(penalty) Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { alg <- match.arg(alg) list(ok = FALSE, message = conditionMessage(e)) if (length(tau) > length(unique(tau))) {}) stop("All entries of tau should be unique") }15: if (is.unsorted(tau)) {FUN(X[[i]]) stop("Quantile values should be entered in ascending order") }16: if (length(y) != nrow(x)) {doTryCatch(return(expr), name, parentenv, handler) stop("length of x and number of rows in x are not the same") }17: if (min(apply(x, 2, sd)) == 0) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) {18: tryCatchList(expr, classes, parentenv, handlers) if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.")19: }tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), if (penalty == "aLASSO") { error = function(e) list(ok = FALSE, message = conditionMessage(e))) warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") }20: if (length(weights) != length(y)) {FUN(X[[i]], ...) stop("number of weights does not match number of responses") }21: if (sum(weights <= 0) > 0) { stop("all weights most be positive")lapply(ii, function(i) { } } before <- quantreg_notes_counts() if (is.matrix(y) == TRUE) { tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), y <- as.numeric(y) error = function(e) list(ok = FALSE, message = conditionMessage(e))) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) {}) stop("Penalty factors must be non-negative.") }22: if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == kir_run_chunk(ii, X, FUN) 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model")23: } if (scalex) {FUN(X[[nexti]], ...) x <- scale(x) }24: if (penalty == "LASSO") {eval(expr, env) fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, 25: max.iter, converge.eps, lambda.discard = lambda.discard, doTryCatch(return(expr), name, parentenv, handler) weights = weights, ...) }26: else if (penalty == "Ridge") {tryCatchOne(expr, names, parentenv, handlers[[1L]]) if (alg != "huber") { stop("huber alg is only option for Ridge penalty")27: }tryCatchList(expr, classes, parentenv, handlers) fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, 28: converge.eps, lambda.discard = lambda.discard, ...)tryCatch(expr, error = function(e) { } call <- conditionCall(e) else if (penalty == "ENet") { if (!is.null(call)) { if (alg != "huber") { if (identical(call[[1L]], quote(doTryCatch))) stop("huber alg is only option for ENet penalty") call <- sys.call(-4L) } dcall <- deparse(call, nlines = 1L) if (is.null(a)) { prefix <- paste("Error in", dcall, ": ") stop("Specify a value for a for ENet penalty") } LONG <- 75L fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, sm <- strsplit(conditionMessage(e), "\n")[[1L]] scalex = FALSE, tau.penalty.factor, a, max.iter, w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) converge.eps, gamma, lambda.discard = lambda.discard, ...) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], } type = "b") else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == if (w > LONG) "MCP") { prefix <- paste0(prefix, "\n ") fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, } else prefix <- "Error : " eps = eps, penalty.factor = penalty.factor, alg = alg, msg <- paste0(prefix, conditionMessage(e), "\n") scalex = FALSE, tau.penalty.factor = tau.penalty.factor, .Internal(seterrmessage(msg[1L])) coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, if (!silent && isTRUE(getOption("show.error.messages"))) { ...) cat(msg, file = outFile) } .Internal(printDeferredWarnings()) if (scalex) { } invisible(structure(msg, class = "try-error", condition = e)) for (i in 1:length(fit$models)) {}) if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 29: 2, transform_coefs, attributes(x)$`scaled:center`, try(eval(expr, env), silent = TRUE) attributes(x)$`scaled:scale`) }30: else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, serialize(what, NULL, xdr = FALSE) attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) }31: } }sendMaster(try(eval(expr, env), silent = TRUE), FALSE) if (lambda.discard) { 32: lmin <- min(sapply(fit$models, lambdanum))mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, fit$lambda <- fit$lambda[1:lmin] silent = mc.silent, mc.affinity = affinity.list[[nexti]]) for (j in 1:length(fit$models)) {33: fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, 1:lmin] FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin]34: }kir_lapply(seq_len(nfolds), function(i) { } fit$weights <- weights if (!isTRUE(fold_priors[[i]]$valid)) { fit$call <- match.call() return(fold_priors[[i]]) fit }})(x = c(-0.480929964184092, -1.40725041787884, -0.892840424931319, train_idx <- which(fold_indices != i)1.81756154427673, 0.173703947905053, -0.976837423770878, -0.765927517696757, -0.189597162487224, -0.0782084430118756, -1.15189740652332, 0.243391974133732, X_train <- X[train_idx, , drop = FALSE]-0.0390778086750066, -0.482279521462859, -0.558585716414447, Y_train <- Y[train_idx]-0.590758101893177, 0.209556129343577, -0.302746488912255, 0.651833412794388, init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, 0.316433783039526, 0.237187670023245, 0.00338263970996021, -0.690618021978373, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {-0.0367816181903371, -0.952189092663698, -1.09708210062877, -0.897641035317988, list(ok = FALSE, message = conditionMessage(e)) })-1.66516790325749, -0.81575388783004, 0.810440863822785, 0.00524028359330871, if (!init_attempt$ok) {2.0840079165118, -0.505358581849998, -0.188882588762531, -1.73601861884627, return(cv_fold_failure("init_error", init_attempt$message))0.253061242456012, -0.819128719560444, -0.184222138886314, -2.39660323105394, }1.2850897415188, 1.09757213031115, 0.492523350335849, 1.17682092754277, beta_y <- init_attempt$value-0.0475104423233482, -0.754005802604193, 0.828516691486403, 0.419701569133166, if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 0.755358169051026, 0.300820902060301, -0.837491161464251, -1.92984604921306, 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept."))1.68462689833557, -0.779912455660777, -0.598289100215227, 0.753052282356617, 0.454542303445962, -0.117736413642914, 0.23114412423776, 1.11518209112638, }0.16002275215957, -0.678536727582994, -1.05427070799935, 0.403048093999773, list(valid = TRUE, beta_y = beta_y)-0.0595473052841988, 0.317670135650049, -0.596113140927472, -0.895592811687222, }, cores = cores)2.24816079672845, -0.593678000243985, -1.28273734306206, 0.507092196508004, -0.841777866803666, -1.48923599683666, 1.19738387616164, -1.01490797696978, 35: -0.534088166645793, 0.513682786066848, -0.34505410278588, 1.32059123786425, kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, -1.12629308183889, 1.40647291272127, -0.592638487900015, -0.433416785678295, 0.246389440165875, -0.114370683525385, 0.585631022797479, 0.490169357980235, -0.993809618751362, 1.26416783468821, 1.11960014388449, 0.84042732370201, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, 1.61230696508862, 0.448778723709004, -2.27574501157137, -0.0738217576160378, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, 0.307136887765479, 0.108987211068105, 2.42595424675667, 0.636311636002868, cores = cores, gamma = huber_gamma, max_iter = max_iter, 1.35169184466744, 1.22658270048902, 1.21654131763847, -0.983396249976296, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, -0.232029786942293, -1.31172301278579, -1.19649231661486, -0.619025938900027, -0.170258311951397, -0.447294767764776, -0.383193509602829, 0.196337427651516, penalty = penalty, Y_p = prior$y, warm_start = warm_start, -1.6805425275174, 0.465677938877392, -1.66253601887376, -0.389250213357483, a = scad_a, tol = tol) -0.204023905854089, 0.173814881278103, 0.307135768005431, 1.96920305815874, 36: -0.421141474496417, 0.296542144665709, -1.72119849326892, 0.595345764317693, (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, 0.614273519390885, -1.10277299780746, 0.769737955442115, 1.64434616238955, 1.53068077115633, -0.873544206000083, -0.37848477306934, -0.0842551306297439, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, -0.668737523423983, 0.0184897854190604, -0.190194041240307, -1.54009574924658, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, -0.348838525991777, -0.0585698760740088, -0.126190884172312, 0.436693831010392, 0.249252884273094, 0.873336280127636, 0.228062643008582, -1.20361619470353, 1.08429237686244, 1.09700292973764, -0.134738532916573, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", -0.790268314901752, -0.310638737201563, -0.436551333999957, -0.57026926707334, "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) 0.325915311596853, -0.064412824236531, -0.553108474568718, 0.0448036904574768, 0.40101251535969, 2.86361689779448, 1.75876553094505, 0.149332073807028, {0.994756514610935, 0.655164539365328, 1.69372240429395, -1.34535765088102, quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE)0.887975619642803, 0.74323666956593, -0.0236845752526422, -0.410599675813112, kir_parallel_enter()-0.586318395249533, -1.1227359636359, -1.36378197448477, 0.732249076628045, on.exit(kir_parallel_exit(), add = TRUE)0.67500256527487, -0.553579409254506, 1.45442064053784, -0.53500986197262, -0.838891844626356, 0.94846924157143, -1.093321463503, -0.197024214923906, if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv")0.109785116627086, 0.349664062525036, -0.47259496296446, -0.0592832243177925, dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), -0.00688691136878618, 0.553497874350005, -1.74566994142626, -0.687010588604653, "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds))0.980247669797378, 0.0120152987051703, -2.16501305661807, 0.266034963779649, penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO"))-2.00060867262392, 1.40463941705858, 0.813079120107948, 0.972051319507345, lambda_scale <- match.arg(lambda_scale)1.18483740721526, -1.26912307125113, -7.23693975609212e-05, -1.64541647727544, input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, -0.797101937637874, -0.211885473264558, -0.00109839012607603, 1.43981802803642, 0.0833138553766202, -0.519100653045014, 0.834669785259211, beta_init = beta_init, penalty_factor = penalty_factor)-0.332546112384471, -0.133548828630418, 0.378672085115843, -2.17767837786795, std <- kiqr_standardize_input(input, standardize)-0.089803727960599, -1.18768168265036, -1.1590786535223, 0.649640688100547, input <- std$input-1.65569474117988, 0.249536315754572, -0.282744634419443, 1.23706988384999, n <- nrow(input$x)-0.627348705073184, -0.298463060075283, 0.855084725146911, -0.770703284421041, -0.130745934805482, -1.00177114849685, -1.37708887580633, 0.923718989980203, automatic_lambda <- is.null(lambda)-0.568950737699092, -0.365142585378765, -0.987179767154307, 0.055219202839128, zeta <- no_prior_zeta(zeta, input$spec$type)1.35483019428629, -1.61280839813112, 1.64106012294032, 0.501564943943222, automatic_zeta <- is.null(zeta)-1.59981727301431, -1.00667224920994, 0.104002368048707, 0.177842012675469, if (automatic_zeta) 0.65932024179183, 0.150635323328018, -0.425410819704295, 0.32265981431347, zeta <- default_zeta_grid(input$spec$type)-1.45505073934713, 2.21508451762438, 0.916480093230269, 0.302002825739899, if (!automatic_lambda) 1.60428326504309, 0.569816082442537, -1.48914423154807, 0.241058418681867, validate_grid(lambda, "lambda", lower = 0)-0.406211381494906, 1.2707494765249, -0.205105555008739, 0.212577218565332, validate_zeta(zeta, arg = "zeta")-0.173176911394089, 0.399506520245378, 0.482601497875709, -0.817518515864716, check_y_prior_zeta_one(zeta, input$x, input$spec)-0.895630489676748, -0.16324222534558, 0.274473210914837, -1.00481772631638, nfolds <- validate_folds(nfolds, n)-0.0127800822943463, 1.43065817623729, 0.276241896865518, 0.25949092938393, validate_count(cores, "cores")-0.821393865640373, -0.528697409570685, 0.328595805593842, 0.20771443594019, validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE)0.797637682037914, -1.77677564313819, -1.42771940379687, 2.36967276662897, validate_scad_tol(scad_a, tol, penalty)-2.13363715605127, -1.44357315055489, 0.760992224640061, -0.47435779943055, validate_count(max_iter, "max_iter")-0.424137577268592, -1.35086649263108, -0.571528563467765, 0.0385700999892817, -0.0404380024106825, 0.298108923796898, -0.106282119737649, 1.03353127740633, validate_rqpen_control(rqpen_control)0.0683425625448555, -0.32616805418065, 0.322732254149139, 0.466847231991316 validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control)), y = c(-1.0452895993915, 0.367679857721344, -2.06488706198297, 1.72969641494695, -0.208081528452669, -3.13798440514384, -0.51130098112415, validate_seed(seed)1.07596881345409, -2.5469205657653, -0.42615219461289, -0.42196794034535, rng <- kir_seed_begin(seed)1.09568905836738, -0.429370220618968, -1.07785207524724, -1.56077625698081, on.exit(kir_seed_restore(rng), add = TRUE)-0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, foldid <- draw_folds(n, nfolds)1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, inner <- if (input$spec$type == "prior_vars") {0.837211052912362, -0.16193066288313, 0.236582446962088, 0.705725879821486, draw_prior_folds(n, control, outer = foldid)-0.685275799280433, 1.16251120027416, -0.663263819670189, 0.473939300920076, }-1.41861211613841, -0.374344426655121, -0.0726485429797235, -1.14129810719626, else NULL-3.61483612448731, -0.418792999565742, -1.8020408761339, 0.425069805391752, kir_seed_reset(seed)-1.56633881582512, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 2.84463116713737, 0.272882674851505, -0.664674301588493, 0.61493427504324), tau = 0.5, penalty = "SCAD", a = 3.7) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, 7: do.call(rqPen::rq.pen, args) nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) 8: withCallingHandlers(expr, warning = function(w) { prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", if (quantreg_is_nonunique(w)) { foldid = inner$full, rule = control$rule) if (!flagged) { tuning <- list(lambda_source = "supplied") flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + if (automatic_lambda) { 1L path <- kiqr_automatic_lambda(x = input$x, y = input$y, .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, invokeRestart("muffleWarning") } huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, }) rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda 9: quantreg_call("start", do.call(rqPen::rq.pen, args)) tuning <- path$tuning10: }initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, tuning$lambda <- lambda a = a) tuning$zeta <- zeta11: tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type)doTryCatch(return(expr), name, parentenv, handler) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == 12: "y_prior"tryCatchOne(expr, names, parentenv, handlers[[1L]]) prior$record$zeta_one_excluded <- tuning$zeta_one_excluded13: fold_prior_fun <- function(i) {tryCatchList(expr, classes, parentenv, handlers) kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule)14: }tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, list(ok = FALSE, message = conditionMessage(e)) foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, }) fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, 15: a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == FUN(X[[i]]) "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients16: doTryCatch(return(expr), name, parentenv, handler) } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, 17: result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", tryCatchOne(expr, names, parentenv, handlers[[1L]]) "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" }18: else "supply a `lambda` grid with a larger upper bound"tryCatchList(expr, classes, parentenv, handlers) warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", 19: tuning$boundary[["min"]], advice), call. = FALSE)tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), } error = function(e) list(ok = FALSE, message = conditionMessage(e))) coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), 20: coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), FUN(X[[i]], ...) coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, 21: lapply(ii, function(i) { `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, before <- quantreg_notes_counts() nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, error = function(e) list(ok = FALSE, message = conditionMessage(e))) prior = prior$record, convergence = list(min = result$convergence.min, }) `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names)22: fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling)kir_run_chunk(ii, X, FUN) quantreg_scope_record(fit) })(x = c(-0.591031102584369, 0.026594369016167, -1.51655309708187, 23: -1.36265334929581, 1.17848915603162, -0.934151319673365, 1.32360564621202, FUN(X[[nexti]], ...)0.624917789944714, -0.0457229557060947, -1.00412057567228, -0.828433236663958, -0.348351725172981, -1.53829339708705, -0.255565245464953, -1.14994503270755, 24: 0.0123269676794679, -0.222969540747622, 0.887771647911303, -0.592155279876746, -0.655718118580886, -0.682517622215019, -0.0158581927282744, eval(expr, env)-0.442604785355045, 0.352557499448816, 0.0731705822914032, 0.0071588003806459, -0.187600110602252, -0.76570064552539, -0.221056820744958, -0.983588587470196, 25: -1.10428404215097, -0.938150214178364, 0.678624244182574, -1.57749786529483, doTryCatch(return(expr), name, parentenv, handler)-0.869938458225642, 0.484677045357101, -0.186052698644391, 1.54555470018366, -0.6113800701282, -0.347756487336345, -1.63651630553942, 0.0203814401000371, 26: 0.891742680167841, -0.872749683252251, 0.890050829839478, -0.343874346129348, tryCatchOne(expr, names, parentenv, handlers[[1L]])-2.186781368328, 0.880058181492043, 0.723856556146425, 0.219852680260502, 0.78987057400076, -0.229993900077565, -0.818502482627721, 0.499734157285632, 27: 0.159192348086018, 0.542626428177669, -0.156645054182717, 0.438793320642639, tryCatchList(expr, classes, parentenv, handlers)1.48787059522956, 0.0601650977954321, -0.849012867932317, 2.3396930572073, -0.121202952207389, -1.95020737105763, 0.538711490308542, 1.69351481682805, 28: -0.790968220502282, -1.0752606000877, -0.607875122371882, 0.754401660588849, tryCatch(expr, error = function(e) {0.453476062515215, -0.12343368044626, -0.76309682228376, 0.22827008805461, call <- conditionCall(e)1.11946191647044, 0.156573183627664, -0.688772134082379, 0.45294960414968, if (!is.null(call)) {-1.06754665004997, 0.40156514874452, -0.064773690927254, 0.31549629010048, if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L)-0.60568155466456, -0.907584691581957, 2.26160897578211, -0.603226708199307, dcall <- deparse(call, nlines = 1L)-1.29786209560729, 0.506451202763822, -0.853334262388665, -1.50603178934849, prefix <- paste("Error in", dcall, ": ")1.20232889939251, -1.0278653857247, 0.938269957785018, -0.543154658413624, LONG <- 75L0.513095125060458, -0.352590882519352, 1.32653328660507, -1.14015184737515, sm <- strsplit(conditionMessage(e), "\n")[[1L]]1.41310993795933, -0.602178783855351, -0.441668618861122, 0.243638772981765, w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")0.596781151552077, -0.120040713979049, -2.06974347624009, 0.585625585340276, if (is.na(w)) 0.489391420294719, -1.00659629419074, 1.26965329080706, 1.12391572124242, w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 0.842483763135379, 1.62060965216855, 0.447665842415645, -2.29890543636378, type = "b")-0.0791636557813867, -0.523064416390043, -0.417579736179349, if (w > LONG) 0.30487780447769, -0.0313740549538529, 0.10512464987343, 2.46252211409212, prefix <- paste0(prefix, "\n ")-0.639988814672429, 1.21138919161606, 0.71116326022022, -0.202617819731427, } else prefix <- "Error : "1.41124016652594, 1.28880733773623, 0.585472792092364, 1.27898075858866, msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L]))-0.873896086126546, -0.138602737817888, -1.19519933379972, 0.32941007299964, if (!silent && isTRUE(getOption("show.error.messages"))) {-1.08243363479137, -0.517320328175245, -0.0781526686297915, -0.349262803591145, cat(msg, file = outFile)-2.25830413757063, -0.286532789591887, 0.280600911826615, -1.55612911873253, .Internal(printDeferredWarnings())0.544179732652263, -1.53850780252623, -0.292459929280143, -0.111195954189926, }0.25856016426853, 0.389029071285452, 2.0155416760087, -0.323668977512006, invisible(structure(msg, class = "try-error", condition = e))})0.378662065091522, -1.59591537837665, 0.671073724102061, 0.425723468271415, 0.689596579577318, -0.990719145101699, 0.841735344548856, 1.6976340685188, 1.58640018968795, -0.766393980020216, -0.281924781619278, 0.00601074598927869, 29: -0.565968490200937, 0.585311324573246, 0.106557758745421, -1.30834898551151, try(eval(expr, env), silent = TRUE)-0.0976619358928339, -1.4186867561377, -0.252912722456529, 0.0311465455672697, -0.0350279244241573, 0.515815648320885, 0.332384409215427, 0.943117509956653, 30: 0.311647466302197, -1.08940511998598, 1.06251939182712, -0.990664282291747, serialize(what, NULL, xdr = FALSE)1.14956086662167, 0.881918801332212, 1.16199951732311, -0.0975175762236416, -0.0932320248340282, 0.669602677456627, -0.724744472330573, 2.27612056631615, 31: -0.265823185198619, -0.386299431192284, -0.150796105603069, -0.514244013452848, sendMaster(try(eval(expr, env), silent = TRUE), FALSE)0.343247266220106, -0.0302282215915427, -0.49782414830986, 0.871486865882586, 0.074272805513109, 0.415102103813952, 2.7713820861761, 1.71423333026475, 32: -1.23416605007213, 0.174288114115666, 0.983210854883472, 0.658280963931637, mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]])1.6519984790595, -1.25586749806704, 0.881040288183123, 0.742550527843682, 0.00874156116443356, -0.361468251189953, -0.529600211031989, 33: -1.0428576337799, -1.27349634060697, 0.732037330726618, 0.677262471344541, -0.845015487649319, -0.498274750112178, 1.42302871042578, -0.480506954012273, -0.771268652413693, 0.938922062221907, -1.01471312207972, -0.157114037087788, parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, 0.136448620191636, 0.365970650786999, 0.366380810417199, -0.420786855167701, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) -0.899572390614362, -0.0253200951818512, 0.0248139759795345, 34: 0.561003817282416, -1.63889606880835, -0.625944959411033, 0.969328438022189, kir_lapply(seq_len(nfolds), function(i) {0.0429000719587969, -2.04013379709133, 0.285952287820425, -1.88282766956995, if (!isTRUE(fold_priors[[i]]$valid)) {-0.15071111772361, -0.133243874305348, 1.37539682070027, -1.0176746005728, return(fold_priors[[i]])0.809377489293562, 0.956915831868467, 0.638131349174454, 1.79197290706804, }1.17179272004281, 1.44011834104833, -1.3062799631651, -0.0247597816198378, train_idx <- which(fold_indices != i)0.490431109972915, -1.68627076518603, -0.829620828933711, -0.238654125576964, X_train <- X[train_idx, , drop = FALSE]-0.0257958838562224, 0.900170667043693, 1.42927873774721, 0.0594457822358079, Y_train <- Y[train_idx]-0.548887950270233, 0.818184409669585, -0.445460941455792, -0.360500355932039, init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, -0.159547758190255, 0.357706152482205, -2.22376258208559, -0.115372825486446, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) {-1.22403834511744, -1.1951542674148, 0.631337247585679, -1.69665002159048, list(ok = FALSE, message = conditionMessage(e))0.227301516675197, -0.310209536983869, 1.22453842424653, -0.658199629531311, })-0.326082409258126, 2.65076184606774, 0.838799943338105, -0.802962786970869, if (!init_attempt$ok) {-0.156717323599945, -1.03630108518638, -1.4153066216368, 0.908108596964723, return(cv_fold_failure("init_error", init_attempt$message))-0.59922785350864, -0.393417116411639, -1.02156633137411, -0.164512802159358, }0.0310750763469802, 0.000848999425567642, 1.34345582777401, -1.65334228451632, 1.6324982037773, 0.481806535961803, -1.64022351077949, -1.04125034329438, beta_y <- init_attempt$value0.0803375767690832, 0.154902757379373, 0.641111910950676, 0.1274287396582, if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1.57046515324945, 0.191960608321051, -0.454277536315632, -0.818878987885141, 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept."))0.30114351448628, -1.55005090160424, -0.72519599476199, -0.797741726688203, }2.06550044725063, 2.04925872291846, 0.786209454002233, 0.180870969788242, list(valid = TRUE, beta_y = beta_y)-0.679377494412951, 1.46378330659275, 0.44470118685535, -1.58363734000052, }, cores = cores) 0.120832955460222, -0.729606528263807, -0.516810356092618, 1.13520998312328, 35: -0.318695466230325, 0.092775340607271, 0.627523394963977, -0.287241679815022, kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, 0.276924545339165, 0.358783696955915, -0.922000345109948, -0.998950602390343, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, -0.277454746901607, 0.153750787820796, -1.10651395716324, -0.129230344755356, 1.29274044847617, 0.155493169075694, 0.138991329543313, -0.925818058934539, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, -0.637474716672803, -2.38451955993373, 0.207068446842626, 0.0879848794802258, cores = cores, gamma = huber_gamma, max_iter = max_iter, 0.669134520790577, -1.86699096741038, -1.52312605001272, 2.21778959004011, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, -2.2185450748282, -1.53874401269311, 0.633034071175666, 0.411134597421937, -0.583943269741735, 0.942578304685943, -0.53446994539148, -1.4474161300306, penalty = penalty, Y_p = prior$y, warm_start = warm_start, -0.679668866316591, -0.0786438655603861, -0.156476923799872, a = scad_a, tol = tol)0.177034979712513, -0.221341777694144, 0.901519800134285, -0.0493141925062218, -0.437957469271032, 0.471701948482876, 0.714834222047201, 0.201292100781617, 36: -0.413182587809343, 0.343263735624697), y = c(-1.0452895993915, (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, -2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", -2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.56077625698081, standardize = TRUE, warm_start = TRUE, ...) -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, {1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, quantreg_scope_enter()0.837211052912362, -0.16193066288313, 0.236582446962088, -0.131939153301765, on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE)0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, kir_parallel_enter()0.473939300920076, -1.41861211613841, -0.374344426655121, -0.0726485429797235, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, on.exit(kir_parallel_exit(), add = TRUE)-0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, if (missing(tau)) 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, stop_missing_tau(beta_prior, "kiqr_cv")2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, -0.664674301588493, 1.81521439870693, 0.61493427504324), beta_prior = c(0.8, dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), -0.4, 0, 0, 0, 0), tau = 0.5, lambda = c(0.05, 0.2), zeta = c(0, "kiqr_cv")0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 1, standardize = TRUE, nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) cores = 2L) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO"))37: lambda_scale <- match.arg(lambda_scale)do.call(fitter, args) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, 38: beta_init = beta_init, penalty_factor = penalty_factor)kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores) std <- kiqr_standardize_input(input, standardize) input <- std$input39: n <- nrow(input$x)withCallingHandlers(expr, warning = function(w) { automatic_lambda <- is.null(lambda) messages <<- c(messages, conditionMessage(w)) invokeRestart("muffleWarning") zeta <- no_prior_zeta(zeta, input$spec$type)}) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type)40: if (!automatic_lambda) collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, validate_grid(lambda, "lambda", lower = 0) lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores")41: validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE)eval(code, test_env) validate_scad_tol(scad_a, tol, penalty)42: validate_count(max_iter, "max_iter")eval(code, test_env) validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start")43: control <- validate_prior_control(prior_control)withCallingHandlers({ validate_seed(seed) eval(code, test_env) rng <- kir_seed_begin(seed) new_expectations <- the$test_expectations > starting_expectations on.exit(kir_seed_restore(rng), add = TRUE) if (snapshot_skipped) { foldid <- draw_folds(n, nfolds) skip("On CRAN") inner <- if (input$spec$type == "prior_vars") { } draw_prior_folds(n, control, outer = foldid) } else if (!new_expectations && skip_on_empty) { else NULL skip_empty() kir_seed_reset(seed) } opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, }, expectation = handle_expectation, packageNotFoundError = function(e) { nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, if (on_cran()) { tol = tol) skip(paste0("{", e$package, "} is not installed.")) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", }}, snapshot_on_cran = function(cnd) { foldid = inner$full, rule = control$rule) snapshot_skipped <<- TRUE tuning <- list(lambda_source = "supplied") invokeRestart("muffle_cran_snapshot") if (automatic_lambda) {}, skip = handle_skip, warning = handle_warning, message = handle_message, path <- kiqr_automatic_lambda(x = input$x, y = input$y, error = handle_error, interrupt = handle_interrupt) y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, 44: huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, doTryCatch(return(expr), name, parentenv, handler) rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda45: tuning <- path$tuningtryCatchOne(expr, names, parentenv, handlers[[1L]]) } tuning$lambda <- lambda46: tuning$zeta <- zetatryCatchList(expr, classes, parentenv, handlers) tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start47: tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == tryCatch(withCallingHandlers({ "y_prior" eval(code, test_env) prior$record$zeta_one_excluded <- tuning$zeta_one_excluded new_expectations <- the$test_expectations > starting_expectations fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, if (snapshot_skipped) { inner_foldid = inner$by_fold[[i]], rule = control$rule) skip("On CRAN") } } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, else if (!new_expectations && skip_on_empty) { tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, skip_empty() foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, } cores = cores, gamma = huber_gamma, max_iter = max_iter, }, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, skip(paste0("{", e$package, "} is not installed.")) penalty = penalty, Y_p = prior$y, warm_start = warm_start, } a = scad_a, tol = tol)}, snapshot_on_cran = function(cnd) { if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { snapshot_skipped <<- TRUE prior$record$fold_coefficients <- result$fold_prior_coefficients invokeRestart("muffle_cran_snapshot") }}, skip = handle_skip, warning = handle_warning, message = handle_message, tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se))48: if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", doWithOneRestart(return(expr), restart) "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" }49: else "supply a `lambda` grid with a larger upper bound"withOneRestart(expr, restarts[[1L]]) warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE)50: }withRestarts(tryCatch(withCallingHandlers({ coefficient_names <- c("(Intercept)", input$predictor_names) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), if (snapshot_skipped) { coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), skip("On CRAN") coefficient_names)) } fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, else if (!new_expectations && skip_on_empty) { `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, skip_empty() `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", } penalty = penalty, predictor_names = input$predictor_names, }, expectation = handle_expectation, packageNotFoundError = function(e) { nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, if (on_cran()) { fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, skip(paste0("{", e$package, "} is not installed.")) foldid = result$foldid, folds = result$nfolds, seed = seed, } prior = prior$record, convergence = list(min = result$convergence.min, }, snapshot_on_cran = function(cnd) { `1se` = result$convergence.1se)), class = c("kiqr_cv", snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot") "kiqr"))}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) end_test = function() { }) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)51: })(x = c(-0.591031102584369, 0.026594369016167, -1.51655309708187, test_code(code, parent.frame())-1.36265334929581, 1.17848915603162, -0.934151319673365, 1.32360564621202, 0.624917789944714, -0.0457229557060947, -1.00412057567228, -0.828433236663958, -0.348351725172981, -1.53829339708705, -0.255565245464953, -1.14994503270755, 0.0123269676794679, -0.222969540747622, 0.887771647911303, -0.592155279876746, 52: test_that("quantreg non-unique warnings are reported once with counts", -0.655718118580886, -0.682517622215019, -0.0158581927282744, {-0.442604785355045, 0.352557499448816, 0.0731705822914032, 0.0071588003806459, d <- review_data()-0.187600110602252, -0.76570064552539, -0.221056820744958, -0.983588587470196, runs <- c("serial", kir_test_backends())-1.10428404215097, -0.938150214178364, 0.678624244182574, -1.57749786529483, for (run in runs) {-0.869938458225642, 0.484677045357101, -0.186052698644391, 1.54555470018366, cores <- if (run == "serial") -0.6113800701282, -0.347756487336345, -1.63651630553942, 0.0203814401000371, 1L0.891742680167841, -0.872749683252251, 0.890050829839478, -0.343874346129348, else 2L old <- options(kir.parallel = if (run == "serial") -2.186781368328, 0.880058181492043, 0.723856556146425, 0.219852680260502, "auto"0.78987057400076, -0.229993900077565, -0.818502482627721, 0.499734157285632, else run)0.159192348086018, 0.542626428177669, -0.156645054182717, 0.438793320642639, out <- collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, 1.48787059522956, 0.0601650977954321, -0.849012867932317, 2.3396930572073, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, -0.121202952207389, -1.95020737105763, 0.538711490308542, 1.69351481682805, 0.5, 1), cores = cores))-0.790968220502282, -1.0752606000877, -0.607875122371882, 0.754401660588849, options(old)0.453476062515215, -0.12343368044626, -0.76309682228376, 0.22827008805461, q <- out$value$quantreg_nonunique1.11946191647044, 0.156573183627664, -0.688772134082379, 0.45294960414968, expect_true(q$fits > 0L)-1.06754665004997, 0.40156514874452, -0.064773690927254, 0.31549629010048, expect_false(any(grepl("Solution may be nonunique", -0.60568155466456, -0.907584691581957, 2.26160897578211, -0.603226708199307, out$warnings, fixed = TRUE))) if (q$nonunique > 0L) {-1.29786209560729, 0.506451202763822, -0.853334262388665, -1.50603178934849, 1.20232889939251, -1.0278653857247, 0.938269957785018, -0.543154658413624, expect_length(out$warnings, 1L)0.513095125060458, -0.352590882519352, 1.32653328660507, -1.14015184737515, expect_match(out$warnings, sprintf("in %d of %d quantile-regression fits", 1.41310993795933, -0.602178783855351, -0.441668618861122, 0.243638772981765, q$nonunique, q$fits), fixed = TRUE)0.596781151552077, -0.120040713979049, -2.06974347624009, 0.585625585340276, printed <- capture.output(print(summary(out$value), 0.489391420294719, -1.00659629419074, 1.26965329080706, 1.12391572124242, details = TRUE))0.842483763135379, 1.62060965216855, 0.447665842415645, -2.29890543636378, -0.0791636557813867, -0.523064416390043, -0.417579736179349, expect_true(any(grepl("possibly non-unique solutions", 0.30487780447769, -0.0313740549538529, 0.10512464987343, 2.46252211409212, printed)))-0.639988814672429, 1.21138919161606, 0.71116326022022, -0.202617819731427, }1.41124016652594, 1.28880733773623, 0.585472792092364, 1.27898075858866, if (cores == 1L) -0.873896086126546, -0.138602737817888, -1.19519933379972, 0.32941007299964, -1.08243363479137, -0.517320328175245, -0.0781526686297915, -0.349262803591145, counts_serial <- q-2.25830413757063, -0.286532789591887, 0.280600911826615, -1.55612911873253, else expect_identical(q, counts_serial)0.544179732652263, -1.53850780252623, -0.292459929280143, -0.111195954189926, }0.25856016426853, 0.389029071285452, 2.0155416760087, -0.323668977512006, })0.378662065091522, -1.59591537837665, 0.671073724102061, 0.425723468271415, 0.689596579577318, -0.990719145101699, 0.841735344548856, 1.6976340685188, 53: 1.58640018968795, -0.766393980020216, -0.281924781619278, 0.00601074598927869, eval(code, test_env)-0.565968490200937, 0.585311324573246, 0.106557758745421, -1.30834898551151, -0.0976619358928339, -1.4186867561377, -0.252912722456529, 0.0311465455672697, 54: -0.0350279244241573, 0.515815648320885, 0.332384409215427, 0.943117509956653, eval(code, test_env)0.311647466302197, -1.08940511998598, 1.06251939182712, -0.990664282291747, 1.14956086662167, 0.881918801332212, 1.16199951732311, -0.0975175762236416, -0.0932320248340282, 0.669602677456627, -0.724744472330573, 2.27612056631615, 55: withCallingHandlers({-0.265823185198619, -0.386299431192284, -0.150796105603069, -0.514244013452848, eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations0.343247266220106, -0.0302282215915427, -0.49782414830986, 0.871486865882586, if (snapshot_skipped) {0.074272805513109, 0.415102103813952, 2.7713820861761, 1.71423333026475, skip("On CRAN")-1.23416605007213, 0.174288114115666, 0.983210854883472, 0.658280963931637, }1.6519984790595, -1.25586749806704, 0.881040288183123, 0.742550527843682, else if (!new_expectations && skip_on_empty) {0.00874156116443356, -0.361468251189953, -0.529600211031989, skip_empty()-1.0428576337799, -1.27349634060697, 0.732037330726618, 0.677262471344541, }-0.845015487649319, -0.498274750112178, 1.42302871042578, -0.480506954012273, }, expectation = handle_expectation, packageNotFoundError = function(e) {-0.771268652413693, 0.938922062221907, -1.01471312207972, -0.157114037087788, if (on_cran()) {0.136448620191636, 0.365970650786999, 0.366380810417199, -0.420786855167701, skip(paste0("{", e$package, "} is not installed."))-0.899572390614362, -0.0253200951818512, 0.0248139759795345, }0.561003817282416, -1.63889606880835, -0.625944959411033, 0.969328438022189, }, snapshot_on_cran = function(cnd) {0.0429000719587969, -2.04013379709133, 0.285952287820425, -1.88282766956995, snapshot_skipped <<- TRUE-0.15071111772361, -0.133243874305348, 1.37539682070027, -1.0176746005728, 0.809377489293562, 0.956915831868467, 0.638131349174454, 1.79197290706804, invokeRestart("muffle_cran_snapshot")1.17179272004281, 1.44011834104833, -1.3062799631651, -0.0247597816198378, }, skip = handle_skip, warning = handle_warning, message = handle_message, 0.490431109972915, -1.68627076518603, -0.829620828933711, -0.238654125576964, error = handle_error, interrupt = handle_interrupt)-0.0257958838562224, 0.900170667043693, 1.42927873774721, 0.0594457822358079, -0.548887950270233, 0.818184409669585, -0.445460941455792, -0.360500355932039, 56: -0.159547758190255, 0.357706152482205, -2.22376258208559, -0.115372825486446, doTryCatch(return(expr), name, parentenv, handler) -1.22403834511744, -1.1951542674148, 0.631337247585679, -1.69665002159048, 57: 0.227301516675197, -0.310209536983869, 1.22453842424653, -0.658199629531311, tryCatchOne(expr, names, parentenv, handlers[[1L]])-0.326082409258126, 2.65076184606774, 0.838799943338105, -0.802962786970869, -0.156717323599945, -1.03630108518638, -1.4153066216368, 0.908108596964723, -0.59922785350864, -0.393417116411639, -1.02156633137411, -0.164512802159358, 0.0310750763469802, 0.000848999425567642, 1.34345582777401, -1.65334228451632, 58: 1.6324982037773, 0.481806535961803, -1.64022351077949, -1.04125034329438, tryCatchList(expr, classes, parentenv, handlers)0.0803375767690832, 0.154902757379373, 0.641111910950676, 0.1274287396582, 59: 1.57046515324945, 0.191960608321051, -0.454277536315632, -0.818878987885141, tryCatch(withCallingHandlers({0.30114351448628, -1.55005090160424, -0.72519599476199, -0.797741726688203, eval(code, test_env)2.06550044725063, 2.04925872291846, 0.786209454002233, 0.180870969788242, -0.679377494412951, 1.46378330659275, 0.44470118685535, -1.58363734000052, 0.120832955460222, -0.729606528263807, -0.516810356092618, 1.13520998312328, new_expectations <- the$test_expectations > starting_expectations-0.318695466230325, 0.092775340607271, 0.627523394963977, -0.287241679815022, if (snapshot_skipped) {0.276924545339165, 0.358783696955915, -0.922000345109948, -0.998950602390343, skip("On CRAN") }-0.277454746901607, 0.153750787820796, -1.10651395716324, -0.129230344755356, else if (!new_expectations && skip_on_empty) {1.29274044847617, 0.155493169075694, 0.138991329543313, -0.925818058934539, skip_empty()-0.637474716672803, -2.38451955993373, 0.207068446842626, 0.0879848794802258, }}, expectation = handle_expectation, packageNotFoundError = function(e) {0.669134520790577, -1.86699096741038, -1.52312605001272, 2.21778959004011, if (on_cran()) {-2.2185450748282, -1.53874401269311, 0.633034071175666, 0.411134597421937, skip(paste0("{", e$package, "} is not installed."))-0.583943269741735, 0.942578304685943, -0.53446994539148, -1.4474161300306, -0.679668866316591, -0.0786438655603861, -0.156476923799872, }0.177034979712513, -0.221341777694144, 0.901519800134285, -0.0493141925062218, -0.437957469271032, 0.471701948482876, 0.714834222047201, 0.201292100781617, }, snapshot_on_cran = function(cnd) {-0.413182587809343, 0.343263735624697), y = c(-1.0452895993915, snapshot_skipped <<- TRUE0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, invokeRestart("muffle_cran_snapshot")-2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, }, skip = handle_skip, warning = handle_warning, message = handle_message, -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, error = handle_error, interrupt = handle_interrupt), error = handle_fatal)-2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.56077625698081, 60: -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, doWithOneRestart(return(expr), restart)1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, 0.837211052912362, -0.16193066288313, 0.236582446962088, -0.131939153301765, 61: 0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, withOneRestart(expr, restarts[[1L]])0.473939300920076, -1.41861211613841, -0.374344426655121, -0.0726485429797235, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, -0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 62: 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, withRestarts(tryCatch(withCallingHandlers({-0.664674301588493, 1.81521439870693, 0.61493427504324), beta_prior = c(0.8, eval(code, test_env)-0.4, 0, 0, 0, 0), tau = 0.5, lambda = c(0.05, 0.2), zeta = c(0, new_expectations <- the$test_expectations > starting_expectations0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 1, standardize = TRUE, if (snapshot_skipped) { cores = 2L) skip("On CRAN") }37: else if (!new_expectations && skip_on_empty) {do.call(fitter, args) skip_empty() } }, expectation = handle_expectation, packageNotFoundError = function(e) {38: kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) 0.2), zeta = c(0, 0.5, 1), cores = cores) } }, snapshot_on_cran = function(cnd) {39: snapshot_skipped <<- TRUEwithCallingHandlers(expr, warning = function(w) { invokeRestart("muffle_cran_snapshot") messages <<- c(messages, conditionMessage(w))}, skip = handle_skip, warning = handle_warning, message = handle_message, invokeRestart("muffleWarning") error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() {}) }) 40: collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, 63: lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores))test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 41: 64: eval(code, test_env)source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call)42: eval(code, test_env)65: 43: withCallingHandlers({FUN(X[[i]], ...) eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations66: if (snapshot_skipped) {lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }67: }, expectation = handle_expectation, packageNotFoundError = function(e) {doTryCatch(return(expr), name, parentenv, handler) if (on_cran()) { skip(paste0("{", e$package, "} is not installed."))68: }tryCatchOne(expr, names, parentenv, handlers[[1L]])}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE69: invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, tryCatchList(expr, classes, parentenv, handlers) error = handle_error, interrupt = handle_interrupt) 70: 44: tryCatch(code, testthat_abort_reporter = function(cnd) {doTryCatch(return(expr), name, parentenv, handler) cat(conditionMessage(cnd), "\n") NULL45: })tryCatchOne(expr, names, parentenv, handlers[[1L]]) 71: 46: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call))tryCatchList(expr, classes, parentenv, handlers) 47: 72: tryCatch(withCallingHandlers({test_files_serial(test_dir = test_dir, test_package = test_package, eval(code, test_env) test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, new_expectations <- the$test_expectations > starting_expectations env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, if (snapshot_skipped) { desc = desc, load_package = load_package, shuffle = shuffle, skip("On CRAN") error_call = error_call) } else if (!new_expectations && skip_on_empty) { skip_empty()73: }test_files(test_dir = path, test_paths = test_paths, test_package = package, }, expectation = handle_expectation, packageNotFoundError = function(e) { reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, if (on_cran()) { load_package = load_package, parallel = parallel, shuffle = shuffle) skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE74: invokeRestart("muffle_cran_snapshot")test_dir("testthat", package = package, reporter = reporter, }, skip = handle_skip, warning = handle_warning, message = handle_message, ..., load_package = "installed") error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 75: test_check("kir")48: doWithOneRestart(return(expr), restart)An irrecoverable exception occurred. R is aborting now ... 49: withOneRestart(expr, restarts[[1L]]) 50: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 51: test_code(code, parent.frame()) 52: test_that("quantreg non-unique warnings are reported once with counts", { d <- review_data() runs <- c("serial", kir_test_backends()) for (run in runs) { cores <- if (run == "serial") 1L else 2L old <- options(kir.parallel = if (run == "serial") "auto" else run) out <- collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) options(old) q <- out$value$quantreg_nonunique expect_true(q$fits > 0L) expect_false(any(grepl("Solution may be nonunique", out$warnings, fixed = TRUE))) if (q$nonunique > 0L) { expect_length(out$warnings, 1L) expect_match(out$warnings, sprintf("in %d of %d quantile-regression fits", q$nonunique, q$fits), fixed = TRUE) printed <- capture.output(print(summary(out$value), details = TRUE)) expect_true(any(grepl("possibly non-unique solutions", printed))) } if (cores == 1L) counts_serial <- q else expect_identical(q, counts_serial) } }) 53: eval(code, test_env) 54: eval(code, test_env) 55: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 56: doTryCatch(return(expr), name, parentenv, handler) 57: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 58: tryCatchList(expr, classes, parentenv, handlers) 59: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 60: doWithOneRestart(return(expr), restart) 61: withOneRestart(expr, restarts[[1L]]) 62: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 63: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 64: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 65: FUN(X[[i]], ...) 66: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 67: doTryCatch(return(expr), name, parentenv, handler) 68: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 69: tryCatchList(expr, classes, parentenv, handlers) 70: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 71: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 72: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 73: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 74: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 75: test_check("kir") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: rq.pen.modelreturn(hqModel$beta, x, y, tau, lambda, penalty.factor, "LASSO", a) 2: rq.lasso.huber.onetau(x, y, tau = subtau, lambda = lambda, penalty.factor = penf, scalex = scalex, max.iter, converge.eps, a = a[j], lambda.discard, ...) 3: rq.lasso.huber(x, y, tau, lambda, penalty.factor, scalex, tau.penalty.factor, max.iter, converge.eps, lambda.discard = lambda.discard, ...) 4: rq.lasso(x, y, tau, alg = alg, lambda = lambda, scalex = scalex, penalty.factor = penalty.factor, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 5: rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) 6: (function (x, y, tau = 0.5, lambda = NULL, penalty = c("LASSO", "Ridge", "ENet", "aLASSO", "SCAD", "MCP"), a = NULL, nlambda = 100, eps = ifelse(nrow(x) < ncol(x), 0.05, 0.01), penalty.factor = rep(1, ncol(x)), alg = c("huber", "br", "fn"), scalex = TRUE, tau.penalty.factor = rep(1, length(tau)), coef.cutoff = 1e-08, max.iter = 5000, converge.eps = 1e-04, lambda.discard = TRUE, weights = NULL, ...) { penalty <- match.arg(penalty) alg <- match.arg(alg) if (length(tau) > length(unique(tau))) { stop("All entries of tau should be unique") } if (is.unsorted(tau)) { stop("Quantile values should be entered in ascending order") } if (length(y) != nrow(x)) { stop("length of x and number of rows in x are not the same") } if (min(apply(x, 2, sd)) == 0) { stop("At least one of the x predictors has a standard deviation of zero") } if (is.null(weights) == FALSE) { if (penalty == "ENet" | penalty == "Ridge") { stop("Cannot use weights with elastic net or ridge penalty. Can use it with lasso, though may be much slower than unweighted version.") } if (penalty == "aLASSO") { warning("Weights are ignored when getting initial (Ridge) estimates for adaptive Lasso") } if (length(weights) != length(y)) { stop("number of weights does not match number of responses") } if (sum(weights <= 0) > 0) { stop("all weights most be positive") } } if (is.matrix(y) == TRUE) { y <- as.numeric(y) } if (min(penalty.factor) < 0 | min(tau.penalty.factor) < 0) { stop("Penalty factors must be non-negative.") } if (sum(penalty.factor) == 0 | sum(tau.penalty.factor) == 0) { stop("Cannot have zero for all entries of penalty factors. This would be an unpenalized model") } if (scalex) { x <- scale(x) } if (penalty == "LASSO") { fit <- rq.lasso(x, y, tau, lambda, nlambda, eps, penalty.factor, alg, scalex = FALSE, tau.penalty.factor, coef.cutoff, max.iter, converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } else if (penalty == "Ridge") { if (alg != "huber") { stop("huber alg is only option for Ridge penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a = 0, max.iter, converge.eps, lambda.discard = lambda.discard, ...) } else if (penalty == "ENet") { if (alg != "huber") { stop("huber alg is only option for ENet penalty") } if (is.null(a)) { stop("Specify a value for a for ENet penalty") } fit <- rq.enet(x, y, tau, lambda, nlambda, eps, penalty.factor, scalex = FALSE, tau.penalty.factor, a, max.iter, converge.eps, gamma, lambda.discard = lambda.discard, ...) } else if (penalty == "aLASSO" | penalty == "SCAD" | penalty == "MCP") { fit <- rq.nc(x, y, tau, penalty, a, lambda, nlambda = nlambda, eps = eps, penalty.factor = penalty.factor, alg = alg, scalex = FALSE, tau.penalty.factor = tau.penalty.factor, coef.cutoff = coef.cutoff, max.iter = max.iter, converge.eps = converge.eps, lambda.discard = lambda.discard, weights = weights, ...) } if (scalex) { for (i in 1:length(fit$models)) { if (!is.null(dim(fit$models[[i]]$coefficients))) { fit$models[[i]]$coefficients <- apply(fit$models[[i]]$coefficients, 2, transform_coefs, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } else { fit$models[[i]]$coefficients <- transform_coefs(fit$models[[i]]$coefficients, attributes(x)$`scaled:center`, attributes(x)$`scaled:scale`) } } } if (lambda.discard) { lmin <- min(sapply(fit$models, lambdanum)) fit$lambda <- fit$lambda[1:lmin] for (j in 1:length(fit$models)) { fit$models[[j]]$coefficients <- fit$models[[j]]$coefficients[, 1:lmin] fit$models[[j]]$rho <- fit$models[[j]]$rho[1:lmin] fit$models[[j]]$PenRho <- fit$models[[j]]$PenRho[1:lmin] fit$models[[j]]$nzero <- fit$models[[j]]$nzero[1:lmin] } } fit$weights <- weights fit$call <- match.call() fit})(x = c(-0.480929964184092, 0.260519766567896, -1.59200466103378, -1.40725041787884, 1.64335146467444, -0.892840424931319, 1.81756154427673, 0.978797687004774, 0.173703947905053, -0.976837423770878, -0.765927517696757, -0.189597162487224, -1.61810355158559, -0.0782084430118756, -1.15189740652332, -0.0390778086750066, 1.29434963746335, -0.558585716414447, -0.590758101893177, 0.651833412794388, 0.316433783039526, 0.237187670023245, 0.00338263970996021, -0.952189092663698, -1.09708210062877, 1.04327144637081, -0.81575388783004, 0.810440863822785, 2.0840079165118, -0.505358581849998, -0.188882588762531, 0.253061242456012, 1.29911679965598, -0.819128719560444, 1.29708575976511, -0.184222138886314, -2.39660323105394, 1.2850897415188, 1.09757213031115, 0.492523350335849, 1.17682092754277, -0.754005802604193, 0.828516691486403, 0.419701569133166, 0.880008192673729, 0.0405437013938304, 0.755358169051026, 2.01475904959565, -0.837491161464251, 2.32561807403787, -0.115523592122234, -1.92984604921306, 0.539093521141975, 1.68462689833557, -0.779912455660777, -1.06192273586877, -0.598289100215227, 0.753052282356617, 0.454542303445962, -0.117736413642914, -0.752264789434704, 0.23114412423776, 1.11518209112638, -0.678536727582994, 0.454020071118106, 0.403048093999773, -0.0595473052841988, -0.895592811687222, 2.24816079672845, -0.593678000243985, -1.28273734306206, -1.48923599683666, 1.19738387616164, 0.935444614114769, 0.513682786066848, -0.34505410278588, -1.12629308183889, 1.40647291272127, -0.592638487900015, 0.246389440165875, 0.596697039965637, -0.114370683525385, -2.04842260257209, 0.585631022797479, 0.490169357980235, -0.993809618751362, 1.26416783468821, 1.11960014388449, 0.84042732370201, 0.448778723709004, -2.27574501157137, -0.0738217576160378, -0.514159194962561, -0.409521271613194, 0.307136887765479, -0.0264157781098175, 2.42595424675667, -0.744375892135879, 1.14747223558578, 0.636311636002868, -0.297444203907775, 1.35169184466744, 1.22658270048902, 0.507873642253097, 1.21654131763847, -0.983396249976296, -0.232029786942293, -1.31172301278579, 0.24621353067705, -1.19649231661486, -0.619025938900027, -0.447294767764776, -2.39806671231901, 0.196337427651516, -1.6805425275174, -0.389250213357483, -0.204023905854089, 0.173814881278103, 0.307135768005431, 0.296542144665709, -1.72119849326892, 0.344632284654097, -1.10277299780746, 0.769737955442115, 1.53068077115633, -0.873544206000083, -0.37848477306934, -0.668737523423983, 0.507708645141382, 0.0184897854190604, -1.42734605465849, -0.190194041240307, -1.54009574924658, -0.348838525991777, -0.0585698760740088, -0.126190884172312, 0.436693831010392, 0.873336280127636, 0.228062643008582, -1.20361619470353, 0.995348222527196, -1.10271693572617, 1.08429237686244, 0.810799800847407, -0.134738532916573, -0.130259600993283, 0.666997132075878, -0.790268314901752, 2.34600727653217, -0.310638737201563, -0.436551333999957, -0.190421194112009, -0.57026926707334, 0.325915311596853, -0.064412824236531, -0.553108474568718, 0.877991110246356, 0.0448036904574768, 0.40101251535969, 1.75876553094505, -1.32267695022682, 0.994756514610935, 0.655164539365328, 0.887975619642803, 0.74323666956593, -0.0236845752526422, -0.410599675813112, -1.36378197448477, 0.732249076628045, -0.915966420229162, 1.45442064053784, -0.53500986197262, 0.94846924157143, -1.093321463503, -0.197024214923906, 0.349664062525036, 0.350092730132617, -0.47259496296446, -0.972985140134891, -0.0592832243177925, -0.00688691136878618, 0.553497874350005, -1.74566994142626, -0.687010588604653, 0.980247669797378, -2.16501305661807, 0.266034963779649, -2.00060867262392, -0.190332371253106, -0.172076938743874, 1.40463941705858, -1.0964165752767, 0.972051319507345, 0.656368681552279, 1.79898310148832, 1.18483740721526, 1.45055215955865, -1.26912307125113, -7.23693975609212e-05, 0.51010559890879, -1.64541647727544, -0.797101937637874, -0.211885473264558, -0.00109839012607603, 0.915858297903235, 1.43981802803642, 0.0833138553766202, 0.834669785259211, -0.41668001229606, -0.133548828630418, 0.378672085115843, -1.18768168265036, -1.1590786535223, 0.649640688100547, -1.65569474117988, 1.23706988384999, -0.627348705073184, 2.64941583089529, -0.770703284421041, -0.130745934805482, -1.37708887580633, 0.923718989980203, -0.568950737699092, -0.987179767154307, -0.138465561604632, 0.055219202839128, 0.0252872324466324, 1.35483019428629, -1.61280839813112, 1.64106012294032, 0.501564943943222, -1.59981727301431, -1.00667224920994, 0.177842012675469, 0.65932024179183, 0.150635323328018, 1.57963066795073, 0.214539282389954, -0.425410819704295, -0.78646461711948, -1.45505073934713, -0.617743014082345, -0.691383967506924, 2.21508451762438, 2.19859759229711, 0.916480093230269, 0.302002825739899, -0.571232792728185, 1.60428326504309, 0.569816082442537, -1.48914423154807, 0.241058418681867, -0.622220133322318, -0.406211381494906, 1.2707494765249, 0.212577218565332, 0.755398353857206, 0.399506520245378, 0.482601497875709, -0.16324222534558, 0.274473210914837, -1.00481772631638, -0.0127800822943463, 0.25949092938393, -0.821393865640373, -2.30211735471764, 0.20771443594019, 0.797637682037914, -1.42771940379687, 2.36967276662897, -2.13363715605127, 0.760992224640061, 0.535742738863866, -0.47435779943055, 1.0752096413995, -0.424137577268592, -1.35086649263108, -0.571528563467765, 0.0385700999892817, -0.0404380024106825, 0.298108923796898, 1.03353127740633, 0.0683425625448555, -0.32616805418065, 0.597224474041138, 0.84402731079208, 0.322732254149139, -0.301019146817286), y = c(-1.0452895993915, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, -2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, -2.5469205657653, -0.42615219461289, 1.09568905836738, -0.840334478862128, -1.07785207524724, -1.56077625698081, 1.37170614929101, -0.881394598453857, 1.16467390795061, 1.95746740934544, 0.837211052912362, -0.16193066288313, -0.131939153301765, -0.685275799280433, 1.16251120027416, 0.473939300920076, -1.41861211613841, -0.374344426655121, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, -0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, 1.72645142029684, -0.859355646799327, 0.542511301313889, 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, -0.664674301588493, 1.81521439870693), tau = 0.5, penalty = "SCAD", a = 3.7) 7: do.call(rqPen::rq.pen, args) 8: withCallingHandlers(expr, warning = function(w) { if (quantreg_is_nonunique(w)) { if (!flagged) { flagged <<- TRUE .quantreg_notes$nonunique <- .quantreg_notes$nonunique + 1L .quantreg_notes$stages <- union(.quantreg_notes$stages, stage) } invokeRestart("muffleWarning") }}) 9: quantreg_call("start", do.call(rqPen::rq.pen, args)) 10: initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a) 11: doTryCatch(return(expr), name, parentenv, handler) 12: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13: tryCatchList(expr, classes, parentenv, handlers) 14: tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e))}) 15: FUN(X[[i]]) 16: doTryCatch(return(expr), name, parentenv, handler) 17: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 18: tryCatchList(expr, classes, parentenv, handlers) 19: tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e))) 20: FUN(X[[i]], ...) 21: lapply(ii, function(i) { before <- quantreg_notes_counts() tryCatch(list(ok = TRUE, value = FUN(X[[i]]), quantreg = quantreg_notes_delta(before)), error = function(e) list(ok = FALSE, message = conditionMessage(e)))}) 22: kir_run_chunk(ii, X, FUN) 23: FUN(X[[nexti]], ...) 24: eval(expr, env) 25: doTryCatch(return(expr), name, parentenv, handler) 26: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 27: tryCatchList(expr, classes, parentenv, handlers) 28: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 29: try(eval(expr, env), silent = TRUE) 30: serialize(what, NULL, xdr = FALSE) 31: sendMaster(try(eval(expr, env), silent = TRUE), FALSE) 32: mcparallel(list(FUN(X[[nexti]], ...)), mc.set.seed = mc.set.seed, silent = mc.silent, mc.affinity = affinity.list[[nexti]]) 33: parallel::mclapply(chunks, function(ii) kir_run_chunk(ii, X, FUN), mc.cores = cores, mc.preschedule = FALSE, mc.allow.recursive = FALSE) 34: kir_lapply(seq_len(nfolds), function(i) { if (!isTRUE(fold_priors[[i]]$valid)) { return(fold_priors[[i]]) } train_idx <- which(fold_indices != i) X_train <- X[train_idx, , drop = FALSE] Y_train <- Y[train_idx] init_attempt <- tryCatch(list(ok = TRUE, value = initial_quantile_coefficients(X_train, Y_train, tau = tau, penalty = penalty, a = a)), error = function(e) { list(ok = FALSE, message = conditionMessage(e)) }) if (!init_attempt$ok) { return(cv_fold_failure("init_error", init_attempt$message)) } beta_y <- init_attempt$value if (!is.numeric(beta_y) || length(beta_y) != ncol(X_train) + 1L || anyNA(beta_y) || any(!is.finite(beta_y))) { return(cv_fold_failure("invalid_init", "Training-fold initial coefficients must be finite and include an intercept.")) } list(valid = TRUE, beta_y = beta_y)}, cores = cores) 35: kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) 36: (function (x, y, beta_prior = NULL, tau, lambda = NULL, zeta = NULL, nfolds = 5, prior_vars = NULL, y_prior = NULL, seed = NULL, beta_init = NULL, penalty_factor = NULL, cores = 1, huber_gamma = 0.01, scad_a = 3.7, max_iter = 1e+05, tol = 1e-04, rqpen_control = list(), nlambda = 30, lambda_min_ratio = NULL, penalty = c("SCAD", "LASSO"), lambda_scale = c("observed", "combined"), prior_control = list(), standardize = TRUE, warm_start = TRUE, ...) { quantreg_scope_enter() on.exit(quantreg_scope_exit(returnValue(NULL)), add = TRUE) kir_parallel_enter() on.exit(kir_parallel_exit(), add = TRUE) if (missing(tau)) stop_missing_tau(beta_prior, "kiqr_cv") dots <- kir_deprecated_dots(list(...), c("folds", "half_life"), "kiqr_cv") nfolds <- resolve_nfolds(nfolds, dots, !missing(nfolds)) penalty <- match.arg(kir_penalty_case(penalty), c("SCAD", "LASSO")) lambda_scale <- match.arg(lambda_scale) input <- validate_kiqr_inputs(x = x, y = y, beta_prior = beta_prior, prior_vars = prior_vars, y_prior = y_prior, tau = tau, beta_init = beta_init, penalty_factor = penalty_factor) std <- kiqr_standardize_input(input, standardize) input <- std$input n <- nrow(input$x) automatic_lambda <- is.null(lambda) zeta <- no_prior_zeta(zeta, input$spec$type) automatic_zeta <- is.null(zeta) if (automatic_zeta) zeta <- default_zeta_grid(input$spec$type) if (!automatic_lambda) validate_grid(lambda, "lambda", lower = 0) validate_zeta(zeta, arg = "zeta") check_y_prior_zeta_one(zeta, input$x, input$spec) nfolds <- validate_folds(nfolds, n) validate_count(cores, "cores") validate_scalar(huber_gamma, "huber_gamma", lower = 0, lower_open = TRUE) validate_scad_tol(scad_a, tol, penalty) validate_count(max_iter, "max_iter") validate_rqpen_control(rqpen_control) validate_flag(warm_start, "warm_start") control <- validate_prior_control(prior_control) validate_seed(seed) rng <- kir_seed_begin(seed) on.exit(kir_seed_restore(rng), add = TRUE) foldid <- draw_folds(n, nfolds) inner <- if (input$spec$type == "prior_vars") { draw_prior_folds(n, control, outer = foldid) } else NULL kir_seed_reset(seed) opts <- kiqr_prior_options(penalty, huber_gamma, rqpen_control, nlambda, lambda_min_ratio, max_iter, cores = cores, scad_a = scad_a, tol = tol) prior <- kiqr_resolve_prior(input, tau, opts, selection = "cv", foldid = inner$full, rule = control$rule) tuning <- list(lambda_source = "supplied") if (automatic_lambda) { path <- kiqr_automatic_lambda(x = input$x, y = input$y, y_prior = prior$y, tau = tau, zeta = zeta, penalty_factor = input$penalty_factor, huber_gamma = huber_gamma, nlambda = nlambda, lambda_min_ratio = lambda_min_ratio, rqpen_control = rqpen_control, lambda_scale = lambda_scale) lambda <- path$lambda tuning <- path$tuning } tuning$lambda <- lambda tuning$zeta <- zeta tuning$zeta_source <- zeta_source_label(automatic_zeta, input$spec$type) tuning$warm_start <- warm_start tuning$zeta_one_excluded <- automatic_zeta && input$spec$type == "y_prior" prior$record$zeta_one_excluded <- tuning$zeta_one_excluded fold_prior_fun <- function(i) { kiqr_fold_prior(input, prior, foldid != i, tau, opts, inner_foldid = inner$by_fold[[i]], rule = control$rule) } result <- kiqr_cv_grid(X = input$x, Y = input$y, beta_p = prior$beta, tau = tau, lambda_grid = lambda, zeta_grid = zeta, nfolds = nfolds, foldid = foldid, beta_int = input$beta_init, penalty_factor = input$penalty_factor, cores = cores, gamma = huber_gamma, max_iter = max_iter, fold_prior_fun = fold_prior_fun, rqpen_control = rqpen_control, penalty = penalty, Y_p = prior$y, warm_start = warm_start, a = scad_a, tol = tol) if (!is.null(result$fold_prior_coefficients) && (input$spec$type == "prior_vars" || identical(input$spec$form, "slopes"))) { prior$record$fold_coefficients <- result$fold_prior_coefficients } tuning$boundary <- c(min = kiqr_lambda_boundary(lambda, result$lambda.min, result$zeta.min), `1se` = kiqr_lambda_boundary(lambda, result$lambda.1se, result$zeta.1se)) if (automatic_lambda && tuning$boundary[["min"]] %in% c("lower", "upper")) { advice <- if (tuning$boundary[["min"]] == "lower") { "decrease `lambda_min_ratio` or supply a wider `lambda` grid" } else "supply a `lambda` grid with a larger upper bound" warning(sprintf("Minimum-CV lambda is at the %s automatic path boundary; %s.", tuning$boundary[["min"]], advice), call. = FALSE) } coefficient_names <- c("(Intercept)", input$predictor_names) coefficients <- list(min = stats::setNames(as.numeric(result$beta.min), coefficient_names), `1se` = stats::setNames(as.numeric(result$beta.1se), coefficient_names)) fit <- structure(list(coefficients = coefficients, lambda = c(min = result$lambda.min, `1se` = result$lambda.1se), zeta = c(min = result$zeta.min, `1se` = result$zeta.1se), tau = tau, selection = "cross-validation", penalty = penalty, predictor_names = input$predictor_names, nobs = n, call = match.call(), tuning = tuning, param_grid = result$param_grid, fold_losses = result$fold_losses, fold_diagnostics = result$fold_diagnostics, foldid = result$foldid, folds = result$nfolds, seed = seed, prior = prior$record, convergence = list(min = result$convergence.min, `1se` = result$convergence.1se)), class = c("kiqr_cv", "kiqr")) fit <- store_penalty_factor(fit, penalty_factor, input$predictor_names) fit <- kiqr_finish_scaling(store_fitted(fit, input$x), std$scaling) quantreg_scope_record(fit)})(x = c(-0.591031102584369, 0.026594369016167, -1.51655309708187, -1.36265334929581, 1.17848915603162, -0.934151319673365, 1.32360564621202, 0.624917789944714, -0.0457229557060947, -1.00412057567228, -0.828433236663958, -0.348351725172981, -1.53829339708705, -0.255565245464953, -1.14994503270755, 0.0123269676794679, -0.222969540747622, 0.887771647911303, -0.592155279876746, -0.655718118580886, -0.682517622215019, -0.0158581927282744, -0.442604785355045, 0.352557499448816, 0.0731705822914032, 0.0071588003806459, -0.187600110602252, -0.76570064552539, -0.221056820744958, -0.983588587470196, -1.10428404215097, -0.938150214178364, 0.678624244182574, -1.57749786529483, -0.869938458225642, 0.484677045357101, -0.186052698644391, 1.54555470018366, -0.6113800701282, -0.347756487336345, -1.63651630553942, 0.0203814401000371, 0.891742680167841, -0.872749683252251, 0.890050829839478, -0.343874346129348, -2.186781368328, 0.880058181492043, 0.723856556146425, 0.219852680260502, 0.78987057400076, -0.229993900077565, -0.818502482627721, 0.499734157285632, 0.159192348086018, 0.542626428177669, -0.156645054182717, 0.438793320642639, 1.48787059522956, 0.0601650977954321, -0.849012867932317, 2.3396930572073, -0.121202952207389, -1.95020737105763, 0.538711490308542, 1.69351481682805, -0.790968220502282, -1.0752606000877, -0.607875122371882, 0.754401660588849, 0.453476062515215, -0.12343368044626, -0.76309682228376, 0.22827008805461, 1.11946191647044, 0.156573183627664, -0.688772134082379, 0.45294960414968, -1.06754665004997, 0.40156514874452, -0.064773690927254, 0.31549629010048, -0.60568155466456, -0.907584691581957, 2.26160897578211, -0.603226708199307, -1.29786209560729, 0.506451202763822, -0.853334262388665, -1.50603178934849, 1.20232889939251, -1.0278653857247, 0.938269957785018, -0.543154658413624, 0.513095125060458, -0.352590882519352, 1.32653328660507, -1.14015184737515, 1.41310993795933, -0.602178783855351, -0.441668618861122, 0.243638772981765, 0.596781151552077, -0.120040713979049, -2.06974347624009, 0.585625585340276, 0.489391420294719, -1.00659629419074, 1.26965329080706, 1.12391572124242, 0.842483763135379, 1.62060965216855, 0.447665842415645, -2.29890543636378, -0.0791636557813867, -0.523064416390043, -0.417579736179349, 0.30487780447769, -0.0313740549538529, 0.10512464987343, 2.46252211409212, -0.639988814672429, 1.21138919161606, 0.71116326022022, -0.202617819731427, 1.41124016652594, 1.28880733773623, 0.585472792092364, 1.27898075858866, -0.873896086126546, -0.138602737817888, -1.19519933379972, 0.32941007299964, -1.08243363479137, -0.517320328175245, -0.0781526686297915, -0.349262803591145, -2.25830413757063, -0.286532789591887, 0.280600911826615, -1.55612911873253, 0.544179732652263, -1.53850780252623, -0.292459929280143, -0.111195954189926, 0.25856016426853, 0.389029071285452, 2.0155416760087, -0.323668977512006, 0.378662065091522, -1.59591537837665, 0.671073724102061, 0.425723468271415, 0.689596579577318, -0.990719145101699, 0.841735344548856, 1.6976340685188, 1.58640018968795, -0.766393980020216, -0.281924781619278, 0.00601074598927869, -0.565968490200937, 0.585311324573246, 0.106557758745421, -1.30834898551151, -0.0976619358928339, -1.4186867561377, -0.252912722456529, 0.0311465455672697, -0.0350279244241573, 0.515815648320885, 0.332384409215427, 0.943117509956653, 0.311647466302197, -1.08940511998598, 1.06251939182712, -0.990664282291747, 1.14956086662167, 0.881918801332212, 1.16199951732311, -0.0975175762236416, -0.0932320248340282, 0.669602677456627, -0.724744472330573, 2.27612056631615, -0.265823185198619, -0.386299431192284, -0.150796105603069, -0.514244013452848, 0.343247266220106, -0.0302282215915427, -0.49782414830986, 0.871486865882586, 0.074272805513109, 0.415102103813952, 2.7713820861761, 1.71423333026475, -1.23416605007213, 0.174288114115666, 0.983210854883472, 0.658280963931637, 1.6519984790595, -1.25586749806704, 0.881040288183123, 0.742550527843682, 0.00874156116443356, -0.361468251189953, -0.529600211031989, -1.0428576337799, -1.27349634060697, 0.732037330726618, 0.677262471344541, -0.845015487649319, -0.498274750112178, 1.42302871042578, -0.480506954012273, -0.771268652413693, 0.938922062221907, -1.01471312207972, -0.157114037087788, 0.136448620191636, 0.365970650786999, 0.366380810417199, -0.420786855167701, -0.899572390614362, -0.0253200951818512, 0.0248139759795345, 0.561003817282416, -1.63889606880835, -0.625944959411033, 0.969328438022189, 0.0429000719587969, -2.04013379709133, 0.285952287820425, -1.88282766956995, -0.15071111772361, -0.133243874305348, 1.37539682070027, -1.0176746005728, 0.809377489293562, 0.956915831868467, 0.638131349174454, 1.79197290706804, 1.17179272004281, 1.44011834104833, -1.3062799631651, -0.0247597816198378, 0.490431109972915, -1.68627076518603, -0.829620828933711, -0.238654125576964, -0.0257958838562224, 0.900170667043693, 1.42927873774721, 0.0594457822358079, -0.548887950270233, 0.818184409669585, -0.445460941455792, -0.360500355932039, -0.159547758190255, 0.357706152482205, -2.22376258208559, -0.115372825486446, -1.22403834511744, -1.1951542674148, 0.631337247585679, -1.69665002159048, 0.227301516675197, -0.310209536983869, 1.22453842424653, -0.658199629531311, -0.326082409258126, 2.65076184606774, 0.838799943338105, -0.802962786970869, -0.156717323599945, -1.03630108518638, -1.4153066216368, 0.908108596964723, -0.59922785350864, -0.393417116411639, -1.02156633137411, -0.164512802159358, 0.0310750763469802, 0.000848999425567642, 1.34345582777401, -1.65334228451632, 1.6324982037773, 0.481806535961803, -1.64022351077949, -1.04125034329438, 0.0803375767690832, 0.154902757379373, 0.641111910950676, 0.1274287396582, 1.57046515324945, 0.191960608321051, -0.454277536315632, -0.818878987885141, 0.30114351448628, -1.55005090160424, -0.72519599476199, -0.797741726688203, 2.06550044725063, 2.04925872291846, 0.786209454002233, 0.180870969788242, -0.679377494412951, 1.46378330659275, 0.44470118685535, -1.58363734000052, 0.120832955460222, -0.729606528263807, -0.516810356092618, 1.13520998312328, -0.318695466230325, 0.092775340607271, 0.627523394963977, -0.287241679815022, 0.276924545339165, 0.358783696955915, -0.922000345109948, -0.998950602390343, -0.277454746901607, 0.153750787820796, -1.10651395716324, -0.129230344755356, 1.29274044847617, 0.155493169075694, 0.138991329543313, -0.925818058934539, -0.637474716672803, -2.38451955993373, 0.207068446842626, 0.0879848794802258, 0.669134520790577, -1.86699096741038, -1.52312605001272, 2.21778959004011, -2.2185450748282, -1.53874401269311, 0.633034071175666, 0.411134597421937, -0.583943269741735, 0.942578304685943, -0.53446994539148, -1.4474161300306, -0.679668866316591, -0.0786438655603861, -0.156476923799872, 0.177034979712513, -0.221341777694144, 0.901519800134285, -0.0493141925062218, -0.437957469271032, 0.471701948482876, 0.714834222047201, 0.201292100781617, -0.413182587809343, 0.343263735624697), y = c(-1.0452895993915, 0.0448627666042494, 0.0363078802313261, 0.367679857721344, -0.491397921673926, -2.06488706198297, 1.72969641494695, 1.70470730010384, -0.208081528452669, -3.13798440514384, -0.51130098112415, 1.07596881345409, -2.08708500499336, -2.5469205657653, -0.42615219461289, -0.42196794034535, 1.09568905836738, -0.840334478862128, -0.429370220618968, -1.07785207524724, -1.56077625698081, -0.373025118995136, 1.08246073319612, 1.37170614929101, -0.881394598453857, 1.16467390795061, 1.95746740934544, 0.133931068403801, 0.157225011614585, 0.837211052912362, -0.16193066288313, 0.236582446962088, -0.131939153301765, 0.705725879821486, -0.685275799280433, 1.16251120027416, -0.663263819670189, 0.473939300920076, -1.41861211613841, -0.374344426655121, -0.0726485429797235, -1.14129810719626, 1.77623836983434, -3.61483612448731, 2.96552569684401, -0.418792999565742, -1.8020408761339, 0.425069805391752, -1.56633881582512, 1.72645142029684, -0.859355646799327, -0.276657946582118, 0.542511301313889, 2.84463116713737, 0.272882674851505, 0.095384303368777, -0.445805065205247, -0.664674301588493, 1.81521439870693, 0.61493427504324), beta_prior = c(0.8, -0.4, 0, 0, 0, 0), tau = 0.5, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), prior_vars = NULL, y_prior = NULL, seed = 1, standardize = TRUE, cores = 2L) 37: do.call(fitter, args) 38: kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores) 39: withCallingHandlers(expr, warning = function(w) { messages <<- c(messages, conditionMessage(w)) invokeRestart("muffleWarning")}) 40: collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) 41: eval(code, test_env) 42: eval(code, test_env) 43: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 44: doTryCatch(return(expr), name, parentenv, handler) 45: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 46: tryCatchList(expr, classes, parentenv, handlers) 47: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 48: doWithOneRestart(return(expr), restart) 49: withOneRestart(expr, restarts[[1L]]) 50: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 51: test_code(code, parent.frame()) 52: test_that("quantreg non-unique warnings are reported once with counts", { d <- review_data() runs <- c("serial", kir_test_backends()) for (run in runs) { cores <- if (run == "serial") 1L else 2L old <- options(kir.parallel = if (run == "serial") "auto" else run) out <- collect_warnings(kiqr(d$x, d$y, d$prior, tau = 0.5, seed = 1, lambda = c(0.05, 0.2), zeta = c(0, 0.5, 1), cores = cores)) options(old) q <- out$value$quantreg_nonunique expect_true(q$fits > 0L) expect_false(any(grepl("Solution may be nonunique", out$warnings, fixed = TRUE))) if (q$nonunique > 0L) { expect_length(out$warnings, 1L) expect_match(out$warnings, sprintf("in %d of %d quantile-regression fits", q$nonunique, q$fits), fixed = TRUE) printed <- capture.output(print(summary(out$value), details = TRUE)) expect_true(any(grepl("possibly non-unique solutions", printed))) } if (cores == 1L) counts_serial <- q else expect_identical(q, counts_serial) } }) 53: eval(code, test_env) 54: eval(code, test_env) 55: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 56: doTryCatch(return(expr), name, parentenv, handler) 57: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 58: tryCatchList(expr, classes, parentenv, handlers) 59: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 60: doWithOneRestart(return(expr), restart) 61: withOneRestart(expr, restarts[[1L]]) 62: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 63: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 64: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 65: FUN(X[[i]], ...) 66: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 67: doTryCatch(return(expr), name, parentenv, handler) 68: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 69: tryCatchList(expr, classes, parentenv, handlers) 70: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 71: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 72: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 73: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 74: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 75: test_check("kir") An irrecoverable exception occurred. R is aborting now ... Saving _problems/test-review-messages-25.R Saving _problems/test-scad-tol-24.R Saving _problems/test-scad-tol-28.R Saving _problems/test-scad-tol-31.R Saving _problems/test-scad-tol-34.R Saving _problems/test-scad-tol-37.R Saving _problems/test-scad-tol-39.R Saving _problems/test-scad-tol-24.R Saving _problems/test-scad-tol-28.R Saving _problems/test-scad-tol-31.R Saving _problems/test-scad-tol-34.R Saving _problems/test-scad-tol-37.R Saving _problems/test-scad-tol-39.R [ FAIL 16 | WARN 16 | SKIP 5 | PASS 3834 ] ══ Skipped tests (5) ═══════════════════════════════════════════════════════════ • "psock" %in% kir_test_backends() is not TRUE (2): 'test-parallel-backends.R:21:3', 'test-parallel-backends.R:80:3' • On CRAN (3): 'test-loadbalance.R:56:3', 'test-parallel-backends.R:51:3', 'test-prior-inputs.R:225:3' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-loadbalance.R:46:9'): CV and HBIC restore all prior grids under dynamic scheduling ── Error: Parallel worker failed to return task results. Backtrace: ▆ 1. ├─kir:::with_backend(...) at test-loadbalance.R:45:7 2. ├─base::suppressWarnings(do.call(get(model), c(args, list(cores = 2)))) at test-loadbalance.R:46:9 3. │ └─base::withCallingHandlers(...) 4. ├─base::do.call(get(model), c(args, list(cores = 2))) 5. └─kir (local) `<fn>`(...) 6. ├─base::do.call(fitter, args) 7. └─kir (local) `<fn>`(...) 8. └─kir:::kiqr_cv_grid(...) 9. └─kir:::kir_lapply(...) ── Error ('test-prior-inputs.R:113:3'): kiqr folds with seed equal hand-built folds and are core-independent ── Error: Parallel worker failed to return task results. Backtrace: ▆ 1. ├─base::suppressWarnings(...) at test-prior-inputs.R:113:3 2. │ └─base::withCallingHandlers(...) 3. └─kir::kiqr_cv(...) 4. └─kir:::kiqr_cv_grid(...) 5. └─kir:::kir_lapply(...) ── Error ('test-pure-r-speedup.R:25:7'): all prior types retain serial/parallel quantile CV and HBIC results ── Error: Parallel worker failed to return task results. Backtrace: ▆ 1. ├─kir:::with_backend(...) at test-pure-r-speedup.R:24:5 2. ├─base::suppressWarnings(do.call(kiqr, c(args, list(cores = 2)))) at test-pure-r-speedup.R:25:7 3. │ └─base::withCallingHandlers(...) 4. ├─base::do.call(kiqr, c(args, list(cores = 2))) 5. └─kir (local) `<fn>`(...) 6. ├─base::do.call(fitter, args) 7. └─kir (local) `<fn>`(...) 8. └─kir:::kiqr_cv_grid(...) 9. └─kir:::kir_lapply(...) ── Error ('test-review-messages.R:23:5'): quantreg non-unique warnings are reported once with counts ── Error: Parallel worker failed to return task results. Backtrace: ▆ 1. ├─kir (local) collect_warnings(...) at test-review-messages.R:23:5 2. │ └─base::withCallingHandlers(...) at test-review-messages.R:10:3 3. └─kir::kiqr(...) 4. ├─base::do.call(fitter, args) 5. └─kir (local) `<fn>`(...) 6. └─kir:::kiqr_cv_grid(...) 7. └─kir:::kir_lapply(...) ── Failure ('test-scad-tol.R:22:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [1] 0.896276340833993990 - 0.896276340833993879 [1] [2] 0.802304741491581153 - 0.802304741491581042 [2] [3] -0.503084322788197258 - -0.503084322788197147 [3] [4] -0.000000000000000000 | -0.000000000000000000 [4] [5] -0.000000000000000000 | -0.000000000000000000 [5] [6] -0.000016048266169734 - -0.000016048266169721 [6] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.193415938323770215 - 0.486174131556155409 + 0.486174131556155464 actual$param_grid$cv_mean | expected$param_grid$cv_mean [1] 0.574949879221273163 | 0.574949879221273163 [1] [2] 0.582795601292687260 - 0.582795601292687482 [2] [3] 0.578539173414054142 - 0.578539173414054475 [3] [4] 0.572165034609017353 - 0.572165034602038935 [4] [5] 0.428134203840957961 - 0.428134203840958016 [5] [6] 0.427988228664689108 - 0.427988228664689163 [6] [7] 0.428018695773561275 | 0.428018695773561275 [7] [8] 0.428025216314554313 - 0.428025216314554202 [8] [9] 0.428241543468867059 | 0.428241543468867059 [9] [10] 0.428241543468867059 | 0.428241543468867059 [10] ... ... ... and 1 more ... actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.0244649680946936454 - 0.0244649680946936593 [1] [2] 0.0359868783566013178 - 0.0359868783566015121 [2] [3] 0.0329711927863419463 - 0.0329711927863416687 [3] [4] 0.0347205303391830838 - 0.0347205303444413638 [4] [5] 0.0148664173481753304 - 0.0148664173481753339 [5] [6] 0.0150725258701146694 - 0.0150725258701147006 [6] [7] 0.0151001107603413558 - 0.0151001107603413679 [7] [8] 0.0151080245917397261 - 0.0151080245917396723 [8] [9] 0.0147459948103965521 | 0.0147459948103965521 [9] [10] 0.0147459948103965521 | 0.0147459948103965521 [10] ... ... ... and 1 more ... actual$fold_losses | expected$fold_losses [1] 0.548165734389805204 | 0.548165734389805204 [1] [2] 0.623804060723443965 | 0.623804060723443965 [2] [3] 0.552879842550570322 - 0.552879842550570211 [3] [4] 0.575909203072420439 - 0.575909203072420550 [4] [5] 0.648283940270681258 - 0.648283940270681924 [5] [6] 0.524193660534959971 | 0.524193660534959971 [6] [7] 0.573810481402261985 | 0.573810481402261985 [7] [8] 0.637864280169395892 | 0.637864280169395892 [8] [9] 0.523942758670504549 - 0.523942758670505548 [9] [10] 0.558789818898112856 | 0.558789818898112856 [10] ... ... ... and 16 more ... actual$fold_diagnostics$loss[1:26] vs expected$fold_diagnostics$loss[1:26] 0.548165734389805204 0.623804060723443965 - 0.552879842550570322 + 0.552879842550570211 - 0.575909203072420439 + 0.575909203072420550 - 0.648283940270681258 + 0.648283940270681924 0.524193660534959971 0.573810481402261985 0.637864280169395892 - 0.523942758670504549 + 0.523942758670505548 0.558789818898112856 and 16 more ... `actual$convergence$min$objective`: 0.194293803006652055 `expected$convergence$min$objective`: 0.194293803006652027 `actual$convergence$min$stationarity`: 0.0000787266252082 `expected$convergence$min$stationarity`: 0.0000787266252046 `actual$convergence$min$scaled_stationarity`: 0.0000787266252082 `expected$convergence$min$scaled_stationarity`: 0.0000787266252046 `actual$convergence$min$max_update`: 0.00000240254593531 `expected$convergence$min$max_update`: 0.00000240254593520 `actual$convergence$1se$initial_objective`: 0.284240899612282549 `expected$convergence$1se$initial_objective`: 0.284240899612282494 actual$fitted_values$min | expected$fitted_values$min [1] 1.245394885703648313 | 1.245394885703648313 [1] [2] 0.907368629015440464 | 0.907368629015440464 [2] [3] -0.769092555264027533 - -0.769092555264027311 [3] [4] 0.242078070979880211 - 0.242078070979880433 [4] [5] 1.394034156270470115 - 1.394034156270469893 [5] [6] 0.319801667640894405 - 0.319801667640894516 [6] [7] 3.058369617888738734 - 3.058369617888737846 [7] [8] 0.954911431309628189 - 0.954911431309628078 [8] [9] 0.495431211483209955 | 0.495431211483209955 [9] [10] -0.019938232681702805 - -0.019938232681702642 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.242691466993902649 - 1.242691466993902871 [1] [2] 0.906861281075739045 | 0.906861281075739045 [2] [3] -0.766515382661366429 - -0.766515382661366318 [3] [4] 0.241470812239064414 - 0.241470812239064386 [4] [5] 1.393827672290924191 | 1.393827672290924191 [5] [6] 0.319658930651842421 | 0.319658930651842421 [6] [7] 3.052747687299966373 | 3.052747687299966373 [7] [8] 0.955269720332554750 - 0.955269720332554639 [8] [9] 0.496211150255380318 - 0.496211150255380373 [9] [10] -0.019043816590412654 - -0.019043816590412668 [10] ... ... ... and 30 more ... kiqr cv Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:22:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:25:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [1] 0.68262702412056275 | 0.68262702412056275 [1] [2] 0.89709253053952132 - 0.89709253053952120 [2] [3] -0.57905494825587767 | -0.57905494825587767 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] actual$coefficients$1se | expected$coefficients$1se [1] 0.68262702412056275 | 0.68262702412056275 [1] [2] 0.89709253053952132 - 0.89709253053952120 [2] [3] -0.57905494825587767 | -0.57905494825587767 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.20690657861355813 - 0.48279357487037849 + 0.48279357487037838 actual$param_grid$cv_mean | expected$param_grid$cv_mean [1] 0.525747365230064601 | 0.525747365230064601 [1] [2] 0.418054847264368867 - 0.418054847264368812 [2] [3] 0.439797550509248347 | 0.439797550509248347 [3] [4] 0.442132127881869896 - 0.442132127881869841 [4] [5] 0.499178755886113046 | 0.499178755886113046 [5] [6] 0.498044554695966146 - 0.498044554695966091 [6] [7] 0.497892804116643994 - 0.497892804116643939 [7] [8] 0.497806473978896491 - 0.497806473978896380 [8] actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.0797107975988638889 | 0.0797107975988638889 [1] [2] 0.0566253325419308062 - 0.0566253325419308132 [2] [3] 0.0430315542860806380 | 0.0430315542860806380 [3] [4] 0.0437717344901544930 - 0.0437717344901544445 [4] [5] 0.0562029524409426023 | 0.0562029524409426023 [5] [6] 0.0562595736479657160 - 0.0562595736479656675 [6] [7] 0.0562793803245991708 - 0.0562793803245991847 [7] [8] 0.0562437033324902982 - 0.0562437033324903607 [8] actual$fold_losses | expected$fold_losses [1] 0.379240191430979479 | 0.379240191430979479 [1] [2] 0.544565947026322550 | 0.544565947026322550 [2] [3] 0.653435957232891829 | 0.653435957232891829 [3] [4] 0.361001393561203532 - 0.361001393561203476 [4] [5] 0.361858717566739707 | 0.361858717566739707 [5] [6] 0.531304430665163308 | 0.531304430665163308 [6] [7] 0.398295667513725637 | 0.398295667513725637 [7] [8] 0.395254240547197655 | 0.395254240547197655 [8] [9] 0.525842743466821805 | 0.525842743466821805 [9] [10] 0.401541844003435344 - 0.401541844003435400 [10] ... ... ... and 14 more ... actual$fold_diagnostics$loss vs expected$fold_diagnostics$loss 0.379240191430979479 0.544565947026322550 0.653435957232891829 - 0.361001393561203532 + 0.361001393561203476 0.361858717566739707 0.531304430665163308 0.398295667513725637 0.395254240547197655 0.525842743466821805 - 0.401541844003435344 + 0.401541844003435400 and 14 more ... actual$prior$fold_coefficients[1:16] vs expected$prior$fold_coefficients[1:16] - 0.694212127957706593 + 0.694212127957706815 1.568398115299724394 - -0.275356451846270223 + -0.275356451846270278 0.000000000000000000 0.000000000000000000 0.000000000000000000 - 0.369549261289338182 + 0.369549261289338238 0.763547263146861721 - -0.003130347565907985 + -0.003130347565908004 0.000000000000000000 and 6 more ... actual$fitted_values$min | expected$fitted_values$min [1] 1.098441337388203598 | 1.098441337388203598 [1] [2] 0.846181804768095791 | 0.846181804768095791 [2] [3] -1.350906301350283778 | -1.350906301350283778 [3] [4] -0.062952607061926624 - -0.062952607061926472 [4] [5] 1.574672978730432327 - 1.574672978730432105 [5] [6] 0.069871262192841621 - 0.069871262192841843 [6] [7] 3.516046158171439728 - 3.516046158171439284 [7] [8] 0.801334050902477668 | 0.801334050902477668 [8] [9] 0.214119235625980509 - 0.214119235625980453 [9] [10] -0.336092508388802336 - -0.336092508388802225 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.098441337388203598 | 1.098441337388203598 [1] [2] 0.846181804768095791 | 0.846181804768095791 [2] [3] -1.350906301350283778 | -1.350906301350283778 [3] [4] -0.062952607061926624 - -0.062952607061926472 [4] [5] 1.574672978730432327 - 1.574672978730432105 [5] [6] 0.069871262192841621 - 0.069871262192841843 [6] [7] 3.516046158171439728 - 3.516046158171439284 [7] [8] 0.801334050902477668 | 0.801334050902477668 [8] [9] 0.214119235625980509 - 0.214119235625980453 [9] [10] -0.336092508388802336 - -0.336092508388802225 [10] ... ... ... and 30 more ... kiqr cv prior_vars Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:25:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:29:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients | expected$coefficients [1] 0.96394203954569235 - 0.96394203954569280 [1] [2] 0.95901860402109951 - 0.95901860402110095 [2] [3] -0.69853499173657141 - -0.69853499173657219 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] [6] -0.07426843960292991 - -0.07426843960293091 [6] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.193415938323770215 - 0.486174131556155409 + 0.486174131556155464 actual$fitted_values | expected$fitted_values [1] 1.53984971185345043 - 1.53984971185345132 [1] [2] 1.01724298173418970 - 1.01724298173419059 [2] [3] -1.15684421902180268 - -1.15684421902180556 [3] [4] 0.25886444104844852 - 0.25886444104844769 [4] [5] 1.56957245336010787 - 1.56957245336011053 [5] [6] 0.31553500812731905 - 0.31553500812731849 [6] [7] 3.86621143536876577 - 3.86621143536877110 [7] [8] 0.96728182480275093 - 0.96728182480275182 [8] [9] 0.41214053558820585 - 0.41214053558820557 [9] [10] -0.15000159410392211 - -0.15000159410392327 [10] ... ... ... and 30 more ... kiqr hbic Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:29:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:32:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients | expected$coefficients [1] 0.89763215841602295164 | 0.89763215841602295164 [1] [2] 0.80415027275616823843 - 0.80415027275616812741 [2] [3] -0.50498886336290582655 - -0.50498886336290571553 [3] [4] -0.00000000000000000000 | -0.00000000000000000000 [4] [5] -0.00000000000000000000 | -0.00000000000000000000 [5] [6] -0.00011622687914622435 - -0.00011622687914622340 [6] `actual$convergence$initial_objective`: 0.241880907858480154 `expected$convergence$initial_objective`: 0.241880907858480099 `actual$convergence$stationarity`: 0.0000588595304088 `expected$convergence$stationarity`: 0.0000588595304104 `actual$convergence$scaled_stationarity`: 0.0000588595304088 `expected$convergence$scaled_stationarity`: 0.0000588595304104 `actual$convergence$max_update`: 0.00000398847692129 `expected$convergence$max_update`: 0.00000398847692140 actual$fitted_values | expected$fitted_values [1] 1.248776146464390502 | 1.248776146464390502 [1] [2] 0.908791407995646172 - 0.908791407995646061 [2] [3] -0.772292579630303733 - -0.772292579630303511 [3] [4] 0.242570581577834510 - 0.242570581577834732 [4] [5] 1.396000843102607636 - 1.396000843102607414 [5] [6] 0.320098186038693999 - 0.320098186038694110 [6] [7] 3.066475126988311484 - 3.066475126988310596 [7] [8] 0.955769784141780820 - 0.955769784141780709 [8] [9] 0.495320911521790475 - 0.495320911521790530 [9] [10] -0.020850760316622474 - -0.020850760316622301 [10] ... ... ... and 30 more ... kiqr fit Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:32:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:35:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [3] -0.637652789761201544 | -0.637652789761201544 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.036501647206234202 - -0.036501647206234174 [6] actual$coefficients$1se | expected$coefficients$1se [3] -0.637652789761201544 | -0.637652789761201544 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.036501647206234202 - -0.036501647206234174 [6] actual$tuning$lambda | expected$tuning$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] `actual$tuning$lambda_max`: 0.84856685878224170 `expected$tuning$lambda_max`: 0.84856685878224147 actual$param_grid$lambda | expected$param_grid$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] [9] 0.001828181877371848 | 0.001828181877371848 [9] [10] 0.000848566858782242 | 0.000848566858782242 [10] ... ... ... and 98 more ... actual$param_grid$cv_mean | expected$param_grid$cv_mean [2] 1.22744791810574205 | 1.22744791810574205 [2] [3] 0.90329982221229266 | 0.90329982221229266 [3] [4] 1.02892979248751559 | 1.02892979248751559 [4] [5] 1.09838501969910141 - 1.09838501969910118 [5] [6] 1.11896753038750907 | 1.11896753038750907 [6] [7] 1.11945794482186201 - 1.11945794482186178 [7] [8] 1.11945847246097219 - 1.11945847246097197 [8] [9] 1.11945889653559072 - 1.11945889653559050 [9] [10] 1.11945913936213048 - 1.11945913936213026 [10] [11] 1.90815677654474447 - 1.90815677654474425 [11] ... ... ... and 92 more ... actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.1425745216758834422 - 0.1425745216758835809 [1] [2] 0.0464398081578327182 - 0.0464398081578327737 [2] [3] 0.0656908038014153983 - 0.0656908038014154955 [3] [4] 0.1015171565253345648 - 0.1015171565253345370 [4] [5] 0.1112131128098085703 - 0.1112131128098084870 [5] [6] 0.1066073831171569508 - 0.1066073831171568814 [6] [7] 0.1061800754354026710 - 0.1061800754354027126 [7] [8] 0.1061778242350803897 - 0.1061778242350804313 [8] [9] 0.1061769581978930788 - 0.1061769581978931204 [9] [10] 0.1061766227764474185 - 0.1061766227764473075 [10] ... ... ... and 100 more ... actual$fold_losses | expected$fold_losses [1] 2.27527056459969224 | 2.27527056459969224 [1] [2] 1.78173778280028405 - 1.78173778280028361 [2] [3] 2.04482878845703286 | 2.04482878845703286 [3] [4] 1.31438650985969696 | 1.31438650985969696 [4] [5] 1.15567264595010055 - 1.15567264595010033 [5] [6] 1.21228459850742865 | 1.21228459850742865 [6] [7] 0.86467928321323562 | 0.86467928321323562 [7] [8] 1.03136295644555998 - 1.03136295644556020 [8] [9] 0.81385722697808238 - 0.81385722697808227 [9] [10] 0.91738652458508396 - 0.91738652458508407 [10] ... ... ... and 320 more ... actual$fold_diagnostics$lambda[1:18] vs expected$fold_diagnostics$lambda[1:18] - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 0.182818187737184779 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 and 8 more ... actual$fold_diagnostics$lambda[28:48] vs expected$fold_diagnostics$lambda[28:48] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[58:78] vs expected$fold_diagnostics$lambda[58:78] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[88:108] vs expected$fold_diagnostics$lambda[88:108] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[118:138] vs expected$fold_diagnostics$lambda[118:138] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[148:168] vs expected$fold_diagnostics$lambda[148:168] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[178:198] vs expected$fold_diagnostics$lambda[178:198] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[208:228] vs expected$fold_diagnostics$lambda[208:228] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[238:258] vs expected$fold_diagnostics$lambda[238:258] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[268:288] vs expected$fold_diagnostics$lambda[268:288] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[298:318] vs expected$fold_diagnostics$lambda[298:318] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$loss vs expected$fold_diagnostics$loss 2.27527056459969224 - 1.78173778280028405 + 1.78173778280028361 2.04482878845703286 1.31438650985969696 - 1.15567264595010055 + 1.15567264595010033 1.21228459850742865 0.86467928321323562 - 1.03136295644555998 + 1.03136295644556020 - 0.81385722697808238 + 0.81385722697808227 - 0.91738652458508396 + 0.91738652458508407 and 320 more ... actual$prior$coefficients | expected$prior$coefficients [1] 0.91068406869685159 | 0.91068406869685159 [1] [2] 1.09956190176415114 | 1.09956190176415114 [2] [3] -0.40446048400418205 - -0.40446048400418189 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] [6] 0.00000000000000000 | 0.00000000000000000 [6] `actual$prior$fit$lambda`: 0.30612510822516076 `expected$prior$fit$lambda`: 0.30612510822516092 actual$prior$fold_coefficients | expected$prior$fold_coefficients [1] 0.999100738160318969 - 0.999100738160318858 [1] [2] 1.158842301481219472 | 1.158842301481219472 [2] [3] -0.355247432631706439 - -0.355247432631706161 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.076887361946862048 - -0.076887361946861979 [6] [7] 0.855276973688822384 | 0.855276973688822384 [7] [8] 1.088254813263168197 | 1.088254813263168197 [8] [9] -0.454641095970279130 | -0.454641095970279130 [9] actual$convergence$min$lambda_path[1:8] vs expected$convergence$min$lambda_path[1:8] - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 - 0.039386984562975236 + 0.039386984562975257 0.018281818773718483 0.008485668587822418 0.003938698456297524 actual$convergence$1se$lambda_path[1:8] vs expected$convergence$1se$lambda_path[1:8] - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 - 0.039386984562975236 + 0.039386984562975257 0.018281818773718483 0.008485668587822418 0.003938698456297524 actual$fitted_values$min | expected$fitted_values$min [1] 1.322816851681429373 | 1.322816851681429373 [1] [2] 0.958950191476270808 | 0.958950191476270808 [2] [3] -1.317154358132468506 | -1.317154358132468506 [3] [4] -0.007151471989323976 - -0.007151471989324134 [4] [5] 1.684397380126478438 | 1.684397380126478438 [5] [6] 0.129138352489088781 - 0.129138352489088865 [6] [7] 3.808216241075809805 - 3.808216241075809361 [7] [8] 1.050133983965602091 - 1.050133983965601869 [8] [9] 0.409923325882013967 | 0.409923325882013967 [9] [10] -0.308714362033197576 | -0.308714362033197576 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.322816851681429373 | 1.322816851681429373 [1] [2] 0.958950191476270808 | 0.958950191476270808 [2] [3] -1.317154358132468506 | -1.317154358132468506 [3] [4] -0.007151471989323976 - -0.007151471989324134 [4] [5] 1.684397380126478438 | 1.684397380126478438 [5] [6] 0.129138352489088781 - 0.129138352489088865 [6] [7] 3.808216241075809805 - 3.808216241075809361 [7] [8] 1.050133983965602091 - 1.050133983965601869 [8] [9] 0.409923325882013967 | 0.409923325882013967 [9] [10] -0.308714362033197576 | -0.308714362033197576 [10] ... ... ... and 30 more ... kir cv Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:35:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:38:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: `actual$lambda`: 0.084856685878224147 `expected$lambda`: 0.084856685878224189 actual$tuning$lambda | expected$tuning$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] `actual$tuning$lambda_max`: 0.84856685878224170 `expected$tuning$lambda_max`: 0.84856685878224147 actual$tuning$scores$lambda | expected$tuning$scores$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] [9] 0.001828181877371848 | 0.001828181877371848 [9] [10] 0.000848566858782242 | 0.000848566858782242 [10] ... ... ... and 98 more ... actual$tuning$scores$rss | expected$tuning$scores$rss [1] 78.4730639369173133 | 78.4730639369173133 [1] [2] 43.4704102594808361 - 43.4704102594808433 [2] [3] 31.7397200716364161 | 31.7397200716364161 [3] [4] 30.4859009064019304 | 30.4859009064019304 [4] [5] 30.2971855993967765 - 30.2971855993967729 [5] [6] 30.1933800962020342 - 30.1933800962020413 [6] [7] 30.1790611414747580 | 30.1790611414747580 [7] [8] 30.1790611351330575 | 30.1790611351330575 [8] [9] 30.1790611347986548 - 30.1790611347986513 [9] [10] 30.1790611347807420 | 30.1790611347807420 [10] ... ... ... and 2 more ... actual$tuning$scores$rss | expected$tuning$scores$rss [13] 31.8419757781129107 | 31.8419757781129107 [13] [14] 30.6577508570612132 | 30.6577508570612132 [14] [15] 30.3564437539951157 | 30.3564437539951157 [15] [16] 30.2548089225643366 - 30.2548089225643437 [16] [17] 30.2349149271222117 | 30.2349149271222117 [17] [18] 30.2347636056454334 | 30.2347636056454334 [18] [19] 30.2347615892141768 - 30.2347615892141697 [19] [20] 30.2347623312220968 - 30.2347623312221003 [20] [21] 70.6563853522132632 - 70.6563853522132490 [21] [22] 41.2767803344883433 - 41.2767803344883362 [22] ... ... ... and 81 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [16] 3.62909044221170385 | 3.62909044221170385 [16] [17] 3.62843267772235611 | 3.62843267772235611 [17] [18] 3.62842767285113954 | 3.62842767285113954 [18] [19] 3.62842760615866089 - 3.62842760615866045 [19] [20] 3.62842763070021057 - 3.62842763070021102 [20] [21] 4.30171554466487560 | 4.30171554466487560 [21] [22] 3.80807424144758944 | 3.80807424144758944 [22] [23] 3.59844352298338244 | 3.59844352298338244 [23] actual$tuning$scores$hbic | expected$tuning$scores$hbic [24] 3.56324238041988517 | 3.56324238041988517 [24] [25] 3.59405277795755707 | 3.59405277795755707 [25] [26] 3.63484399006344283 | 3.63484399006344283 [26] [27] 3.63397742303121563 - 3.63397742303121518 [27] [28] 3.63393912322660073 | 3.63393912322660073 [28] [29] 3.63393927197776501 | 3.63393927197776501 [29] [30] 3.63393929915135283 - 3.63393929915135239 [30] [31] 4.27943071298093169 - 4.27943071298093081 [31] [32] 3.78501646975764583 - 3.78501646975764539 [32] [33] 3.60675526605228081 - 3.60675526605228125 [33] ... ... ... and 5 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [45] 3.61606477510475699 | 3.61606477510475699 [45] [46] 3.65696457105760331 | 3.65696457105760331 [46] [47] 3.65581355245447082 | 3.65581355245447082 [47] [48] 3.65568656420099636 - 3.65568656420099591 [48] [49] 3.65568702756266672 | 3.65568702756266672 [49] [50] 3.65568711083834463 | 3.65568711083834463 [50] [51] 4.08137164085573811 | 4.08137164085573811 [51] actual$tuning$scores$hbic | expected$tuning$scores$hbic [52] 3.74370715299529522 | 3.74370715299529522 [52] [53] 3.62900275054249866 | 3.62900275054249866 [53] [54] 3.60247679155568346 | 3.60247679155568346 [54] [55] 3.63355811308974008 - 3.63355811308974053 [55] [56] 3.67302913694924271 | 3.67302913694924271 [56] [57] 3.67185037638377221 - 3.67185037638377176 [57] [58] 3.67169241557580284 | 3.67169241557580284 [58] [59] 3.67169300299279522 - 3.67169300299279566 [59] [60] 3.67169310854038322 - 3.67169310854038278 [60] [61] 3.98506779880711859 | 3.98506779880711859 [61] ... ... ... and 17 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [79] 3.71316390992829781 | 3.71316390992829781 [79] [80] 3.71316406934643384 | 3.71316406934643384 [80] [81] 3.80690130091500478 | 3.80690130091500478 [81] [82] 3.69077192457781722 - 3.69077192457781766 [82] [83] 3.67375815895872782 | 3.67375815895872782 [83] [84] 3.65991234811186805 - 3.65991234811186850 [84] [85] 3.65579868298590283 | 3.65579868298590283 [85] [86] 3.73974328894301822 | 3.73974328894301822 [86] [87] 3.73853784913726095 | 3.73853784913726095 [87] [88] 3.73828541083684529 - 3.73828541083684485 [88] ... ... ... and 3 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [94] 3.68314453321363411 | 3.68314453321363411 [94] [95] 3.68097263584044621 | 3.68097263584044621 [95] [96] 3.76718649209881518 | 3.76718649209881518 [96] [97] 3.76622962910194170 - 3.76622962910194214 [97] [98] 3.76598007343806973 | 3.76598007343806973 [98] [99] 3.76591832627516787 | 3.76591832627516787 [99] [100] 3.76591183081816627 - 3.76591183081816672 [100] [101] 3.66430197099821431 | 3.66430197099821431 [101] [102] 3.66430197099821431 | 3.66430197099821431 [102] [103] 3.66430197099821431 | 3.66430197099821431 [103] actual$convergence$lambda_path | expected$convergence$lambda_path [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] actual$fitted_values | expected$fitted_values [1] 1.411040236659359515 | 1.411040236659359515 [1] [2] 1.062932974541120013 | 1.062932974541120013 [2] [3] -1.372000519969465593 - -1.372000519969465371 [3] [4] 0.061776625082330838 - 0.061776625082330609 [4] [5] 1.840775071973730803 | 1.840775071973730803 [5] [6] 0.200271382383203300 | 0.200271382383203300 [6] [7] 4.075918037390362514 | 4.075918037390362514 [7] [8] 1.064357121646794191 - 1.064357121646793969 [8] [9] 0.404439728258958020 - 0.404439728258958076 [9] [10] -0.263151793130486200 - -0.263151793130486311 [10] ... ... ... and 30 more ... kir hbic Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:38:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:22:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [1] 0.896276340833993990 - 0.896276340833993879 [1] [2] 0.802304741491581153 - 0.802304741491581042 [2] [3] -0.503084322788197258 - -0.503084322788197147 [3] [4] -0.000000000000000000 | -0.000000000000000000 [4] [5] -0.000000000000000000 | -0.000000000000000000 [5] [6] -0.000016048266169734 - -0.000016048266169721 [6] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.193415938323770215 - 0.486174131556155409 + 0.486174131556155464 actual$param_grid$cv_mean | expected$param_grid$cv_mean [1] 0.574949879221273163 | 0.574949879221273163 [1] [2] 0.582795601292687260 - 0.582795601292687482 [2] [3] 0.578539173414054142 - 0.578539173414054475 [3] [4] 0.572165034609017353 - 0.572165034602038935 [4] [5] 0.428134203840957961 - 0.428134203840958016 [5] [6] 0.427988228664689108 - 0.427988228664689163 [6] [7] 0.428018695773561275 | 0.428018695773561275 [7] [8] 0.428025216314554313 - 0.428025216314554202 [8] [9] 0.428241543468867059 | 0.428241543468867059 [9] [10] 0.428241543468867059 | 0.428241543468867059 [10] ... ... ... and 1 more ... actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.0244649680946936454 - 0.0244649680946936593 [1] [2] 0.0359868783566013178 - 0.0359868783566015121 [2] [3] 0.0329711927863419463 - 0.0329711927863416687 [3] [4] 0.0347205303391830838 - 0.0347205303444413638 [4] [5] 0.0148664173481753304 - 0.0148664173481753339 [5] [6] 0.0150725258701146694 - 0.0150725258701147006 [6] [7] 0.0151001107603413558 - 0.0151001107603413679 [7] [8] 0.0151080245917397261 - 0.0151080245917396723 [8] [9] 0.0147459948103965521 | 0.0147459948103965521 [9] [10] 0.0147459948103965521 | 0.0147459948103965521 [10] ... ... ... and 1 more ... actual$fold_losses | expected$fold_losses [1] 0.548165734389805204 | 0.548165734389805204 [1] [2] 0.623804060723443965 | 0.623804060723443965 [2] [3] 0.552879842550570322 - 0.552879842550570211 [3] [4] 0.575909203072420439 - 0.575909203072420550 [4] [5] 0.648283940270681258 - 0.648283940270681924 [5] [6] 0.524193660534959971 | 0.524193660534959971 [6] [7] 0.573810481402261985 | 0.573810481402261985 [7] [8] 0.637864280169395892 | 0.637864280169395892 [8] [9] 0.523942758670504549 - 0.523942758670505548 [9] [10] 0.558789818898112856 | 0.558789818898112856 [10] ... ... ... and 16 more ... actual$fold_diagnostics$loss[1:26] vs expected$fold_diagnostics$loss[1:26] 0.548165734389805204 0.623804060723443965 - 0.552879842550570322 + 0.552879842550570211 - 0.575909203072420439 + 0.575909203072420550 - 0.648283940270681258 + 0.648283940270681924 0.524193660534959971 0.573810481402261985 0.637864280169395892 - 0.523942758670504549 + 0.523942758670505548 0.558789818898112856 and 16 more ... `actual$convergence$min$objective`: 0.194293803006652055 `expected$convergence$min$objective`: 0.194293803006652027 `actual$convergence$min$stationarity`: 0.0000787266252082 `expected$convergence$min$stationarity`: 0.0000787266252046 `actual$convergence$min$scaled_stationarity`: 0.0000787266252082 `expected$convergence$min$scaled_stationarity`: 0.0000787266252046 `actual$convergence$min$max_update`: 0.00000240254593531 `expected$convergence$min$max_update`: 0.00000240254593520 `actual$convergence$1se$initial_objective`: 0.284240899612282549 `expected$convergence$1se$initial_objective`: 0.284240899612282494 actual$fitted_values$min | expected$fitted_values$min [1] 1.245394885703648313 | 1.245394885703648313 [1] [2] 0.907368629015440464 | 0.907368629015440464 [2] [3] -0.769092555264027533 - -0.769092555264027311 [3] [4] 0.242078070979880211 - 0.242078070979880433 [4] [5] 1.394034156270470115 - 1.394034156270469893 [5] [6] 0.319801667640894405 - 0.319801667640894516 [6] [7] 3.058369617888738734 - 3.058369617888737846 [7] [8] 0.954911431309628189 - 0.954911431309628078 [8] [9] 0.495431211483209955 | 0.495431211483209955 [9] [10] -0.019938232681702805 - -0.019938232681702642 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.242691466993902649 - 1.242691466993902871 [1] [2] 0.906861281075739045 | 0.906861281075739045 [2] [3] -0.766515382661366429 - -0.766515382661366318 [3] [4] 0.241470812239064414 - 0.241470812239064386 [4] [5] 1.393827672290924191 | 1.393827672290924191 [5] [6] 0.319658930651842421 | 0.319658930651842421 [6] [7] 3.052747687299966373 | 3.052747687299966373 [7] [8] 0.955269720332554750 - 0.955269720332554639 [8] [9] 0.496211150255380318 - 0.496211150255380373 [9] [10] -0.019043816590412654 - -0.019043816590412668 [10] ... ... ... and 30 more ... kiqr cv Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:22:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:25:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [1] 0.68262702412056275 | 0.68262702412056275 [1] [2] 0.89709253053952132 - 0.89709253053952120 [2] [3] -0.57905494825587767 | -0.57905494825587767 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] actual$coefficients$1se | expected$coefficients$1se [1] 0.68262702412056275 | 0.68262702412056275 [1] [2] 0.89709253053952132 - 0.89709253053952120 [2] [3] -0.57905494825587767 | -0.57905494825587767 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.20690657861355813 - 0.48279357487037849 + 0.48279357487037838 actual$param_grid$cv_mean | expected$param_grid$cv_mean [1] 0.525747365230064601 | 0.525747365230064601 [1] [2] 0.418054847264368867 - 0.418054847264368812 [2] [3] 0.439797550509248347 | 0.439797550509248347 [3] [4] 0.442132127881869896 - 0.442132127881869841 [4] [5] 0.499178755886113046 | 0.499178755886113046 [5] [6] 0.498044554695966146 - 0.498044554695966091 [6] [7] 0.497892804116643994 - 0.497892804116643939 [7] [8] 0.497806473978896491 - 0.497806473978896380 [8] actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.0797107975988638889 | 0.0797107975988638889 [1] [2] 0.0566253325419308062 - 0.0566253325419308132 [2] [3] 0.0430315542860806380 | 0.0430315542860806380 [3] [4] 0.0437717344901544930 - 0.0437717344901544445 [4] [5] 0.0562029524409426023 | 0.0562029524409426023 [5] [6] 0.0562595736479657160 - 0.0562595736479656675 [6] [7] 0.0562793803245991708 - 0.0562793803245991847 [7] [8] 0.0562437033324902982 - 0.0562437033324903607 [8] actual$fold_losses | expected$fold_losses [1] 0.379240191430979479 | 0.379240191430979479 [1] [2] 0.544565947026322550 | 0.544565947026322550 [2] [3] 0.653435957232891829 | 0.653435957232891829 [3] [4] 0.361001393561203532 - 0.361001393561203476 [4] [5] 0.361858717566739707 | 0.361858717566739707 [5] [6] 0.531304430665163308 | 0.531304430665163308 [6] [7] 0.398295667513725637 | 0.398295667513725637 [7] [8] 0.395254240547197655 | 0.395254240547197655 [8] [9] 0.525842743466821805 | 0.525842743466821805 [9] [10] 0.401541844003435344 - 0.401541844003435400 [10] ... ... ... and 14 more ... actual$fold_diagnostics$loss vs expected$fold_diagnostics$loss 0.379240191430979479 0.544565947026322550 0.653435957232891829 - 0.361001393561203532 + 0.361001393561203476 0.361858717566739707 0.531304430665163308 0.398295667513725637 0.395254240547197655 0.525842743466821805 - 0.401541844003435344 + 0.401541844003435400 and 14 more ... actual$prior$fold_coefficients[1:16] vs expected$prior$fold_coefficients[1:16] - 0.694212127957706593 + 0.694212127957706815 1.568398115299724394 - -0.275356451846270223 + -0.275356451846270278 0.000000000000000000 0.000000000000000000 0.000000000000000000 - 0.369549261289338182 + 0.369549261289338238 0.763547263146861721 - -0.003130347565907985 + -0.003130347565908004 0.000000000000000000 and 6 more ... actual$fitted_values$min | expected$fitted_values$min [1] 1.098441337388203598 | 1.098441337388203598 [1] [2] 0.846181804768095791 | 0.846181804768095791 [2] [3] -1.350906301350283778 | -1.350906301350283778 [3] [4] -0.062952607061926624 - -0.062952607061926472 [4] [5] 1.574672978730432327 - 1.574672978730432105 [5] [6] 0.069871262192841621 - 0.069871262192841843 [6] [7] 3.516046158171439728 - 3.516046158171439284 [7] [8] 0.801334050902477668 | 0.801334050902477668 [8] [9] 0.214119235625980509 - 0.214119235625980453 [9] [10] -0.336092508388802336 - -0.336092508388802225 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.098441337388203598 | 1.098441337388203598 [1] [2] 0.846181804768095791 | 0.846181804768095791 [2] [3] -1.350906301350283778 | -1.350906301350283778 [3] [4] -0.062952607061926624 - -0.062952607061926472 [4] [5] 1.574672978730432327 - 1.574672978730432105 [5] [6] 0.069871262192841621 - 0.069871262192841843 [6] [7] 3.516046158171439728 - 3.516046158171439284 [7] [8] 0.801334050902477668 | 0.801334050902477668 [8] [9] 0.214119235625980509 - 0.214119235625980453 [9] [10] -0.336092508388802336 - -0.336092508388802225 [10] ... ... ... and 30 more ... kiqr cv prior_vars Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:25:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:29:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients | expected$coefficients [1] 0.96394203954569235 - 0.96394203954569280 [1] [2] 0.95901860402109951 - 0.95901860402110095 [2] [3] -0.69853499173657141 - -0.69853499173657219 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] [6] -0.07426843960292991 - -0.07426843960293091 [6] actual$tuning$lambda_thresholds$threshold vs expected$tuning$lambda_thresholds$threshold 0.193415938323770215 - 0.486174131556155409 + 0.486174131556155464 actual$fitted_values | expected$fitted_values [1] 1.53984971185345043 - 1.53984971185345132 [1] [2] 1.01724298173418970 - 1.01724298173419059 [2] [3] -1.15684421902180268 - -1.15684421902180556 [3] [4] 0.25886444104844852 - 0.25886444104844769 [4] [5] 1.56957245336010787 - 1.56957245336011053 [5] [6] 0.31553500812731905 - 0.31553500812731849 [6] [7] 3.86621143536876577 - 3.86621143536877110 [7] [8] 0.96728182480275093 - 0.96728182480275182 [8] [9] 0.41214053558820585 - 0.41214053558820557 [9] [10] -0.15000159410392211 - -0.15000159410392327 [10] ... ... ... and 30 more ... kiqr hbic Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:29:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:32:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients | expected$coefficients [1] 0.89763215841602295164 | 0.89763215841602295164 [1] [2] 0.80415027275616823843 - 0.80415027275616812741 [2] [3] -0.50498886336290582655 - -0.50498886336290571553 [3] [4] -0.00000000000000000000 | -0.00000000000000000000 [4] [5] -0.00000000000000000000 | -0.00000000000000000000 [5] [6] -0.00011622687914622435 - -0.00011622687914622340 [6] `actual$convergence$initial_objective`: 0.241880907858480154 `expected$convergence$initial_objective`: 0.241880907858480099 `actual$convergence$stationarity`: 0.0000588595304088 `expected$convergence$stationarity`: 0.0000588595304104 `actual$convergence$scaled_stationarity`: 0.0000588595304088 `expected$convergence$scaled_stationarity`: 0.0000588595304104 `actual$convergence$max_update`: 0.00000398847692129 `expected$convergence$max_update`: 0.00000398847692140 actual$fitted_values | expected$fitted_values [1] 1.248776146464390502 | 1.248776146464390502 [1] [2] 0.908791407995646172 - 0.908791407995646061 [2] [3] -0.772292579630303733 - -0.772292579630303511 [3] [4] 0.242570581577834510 - 0.242570581577834732 [4] [5] 1.396000843102607636 - 1.396000843102607414 [5] [6] 0.320098186038693999 - 0.320098186038694110 [6] [7] 3.066475126988311484 - 3.066475126988310596 [7] [8] 0.955769784141780820 - 0.955769784141780709 [8] [9] 0.495320911521790475 - 0.495320911521790530 [9] [10] -0.020850760316622474 - -0.020850760316622301 [10] ... ... ... and 30 more ... kiqr fit Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:32:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:35:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: actual$coefficients$min | expected$coefficients$min [3] -0.637652789761201544 | -0.637652789761201544 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.036501647206234202 - -0.036501647206234174 [6] actual$coefficients$1se | expected$coefficients$1se [3] -0.637652789761201544 | -0.637652789761201544 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.036501647206234202 - -0.036501647206234174 [6] actual$tuning$lambda | expected$tuning$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] `actual$tuning$lambda_max`: 0.84856685878224170 `expected$tuning$lambda_max`: 0.84856685878224147 actual$param_grid$lambda | expected$param_grid$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] [9] 0.001828181877371848 | 0.001828181877371848 [9] [10] 0.000848566858782242 | 0.000848566858782242 [10] ... ... ... and 98 more ... actual$param_grid$cv_mean | expected$param_grid$cv_mean [2] 1.22744791810574205 | 1.22744791810574205 [2] [3] 0.90329982221229266 | 0.90329982221229266 [3] [4] 1.02892979248751559 | 1.02892979248751559 [4] [5] 1.09838501969910141 - 1.09838501969910118 [5] [6] 1.11896753038750907 | 1.11896753038750907 [6] [7] 1.11945794482186201 - 1.11945794482186178 [7] [8] 1.11945847246097219 - 1.11945847246097197 [8] [9] 1.11945889653559072 - 1.11945889653559050 [9] [10] 1.11945913936213048 - 1.11945913936213026 [10] [11] 1.90815677654474447 - 1.90815677654474425 [11] ... ... ... and 92 more ... actual$param_grid$cv_se | expected$param_grid$cv_se [1] 0.1425745216758834422 - 0.1425745216758835809 [1] [2] 0.0464398081578327182 - 0.0464398081578327737 [2] [3] 0.0656908038014153983 - 0.0656908038014154955 [3] [4] 0.1015171565253345648 - 0.1015171565253345370 [4] [5] 0.1112131128098085703 - 0.1112131128098084870 [5] [6] 0.1066073831171569508 - 0.1066073831171568814 [6] [7] 0.1061800754354026710 - 0.1061800754354027126 [7] [8] 0.1061778242350803897 - 0.1061778242350804313 [8] [9] 0.1061769581978930788 - 0.1061769581978931204 [9] [10] 0.1061766227764474185 - 0.1061766227764473075 [10] ... ... ... and 100 more ... actual$fold_losses | expected$fold_losses [1] 2.27527056459969224 | 2.27527056459969224 [1] [2] 1.78173778280028405 - 1.78173778280028361 [2] [3] 2.04482878845703286 | 2.04482878845703286 [3] [4] 1.31438650985969696 | 1.31438650985969696 [4] [5] 1.15567264595010055 - 1.15567264595010033 [5] [6] 1.21228459850742865 | 1.21228459850742865 [6] [7] 0.86467928321323562 | 0.86467928321323562 [7] [8] 1.03136295644555998 - 1.03136295644556020 [8] [9] 0.81385722697808238 - 0.81385722697808227 [9] [10] 0.91738652458508396 - 0.91738652458508407 [10] ... ... ... and 320 more ... actual$fold_diagnostics$lambda[1:18] vs expected$fold_diagnostics$lambda[1:18] - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 0.182818187737184779 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 and 8 more ... actual$fold_diagnostics$lambda[28:48] vs expected$fold_diagnostics$lambda[28:48] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[58:78] vs expected$fold_diagnostics$lambda[58:78] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[88:108] vs expected$fold_diagnostics$lambda[88:108] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[118:138] vs expected$fold_diagnostics$lambda[118:138] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[148:168] vs expected$fold_diagnostics$lambda[148:168] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[178:198] vs expected$fold_diagnostics$lambda[178:198] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[208:228] vs expected$fold_diagnostics$lambda[208:228] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[238:258] vs expected$fold_diagnostics$lambda[238:258] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[268:288] vs expected$fold_diagnostics$lambda[268:288] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$lambda[298:318] vs expected$fold_diagnostics$lambda[298:318] 0.000848566858782242 0.000848566858782242 0.000848566858782242 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 and 11 more ... actual$fold_diagnostics$loss vs expected$fold_diagnostics$loss 2.27527056459969224 - 1.78173778280028405 + 1.78173778280028361 2.04482878845703286 1.31438650985969696 - 1.15567264595010055 + 1.15567264595010033 1.21228459850742865 0.86467928321323562 - 1.03136295644555998 + 1.03136295644556020 - 0.81385722697808238 + 0.81385722697808227 - 0.91738652458508396 + 0.91738652458508407 and 320 more ... actual$prior$coefficients | expected$prior$coefficients [1] 0.91068406869685159 | 0.91068406869685159 [1] [2] 1.09956190176415114 | 1.09956190176415114 [2] [3] -0.40446048400418205 - -0.40446048400418189 [3] [4] 0.00000000000000000 | 0.00000000000000000 [4] [5] 0.00000000000000000 | 0.00000000000000000 [5] [6] 0.00000000000000000 | 0.00000000000000000 [6] `actual$prior$fit$lambda`: 0.30612510822516076 `expected$prior$fit$lambda`: 0.30612510822516092 actual$prior$fold_coefficients | expected$prior$fold_coefficients [1] 0.999100738160318969 - 0.999100738160318858 [1] [2] 1.158842301481219472 | 1.158842301481219472 [2] [3] -0.355247432631706439 - -0.355247432631706161 [3] [4] 0.000000000000000000 | 0.000000000000000000 [4] [5] 0.000000000000000000 | 0.000000000000000000 [5] [6] -0.076887361946862048 - -0.076887361946861979 [6] [7] 0.855276973688822384 | 0.855276973688822384 [7] [8] 1.088254813263168197 | 1.088254813263168197 [8] [9] -0.454641095970279130 | -0.454641095970279130 [9] actual$convergence$min$lambda_path[1:8] vs expected$convergence$min$lambda_path[1:8] - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 - 0.039386984562975236 + 0.039386984562975257 0.018281818773718483 0.008485668587822418 0.003938698456297524 actual$convergence$1se$lambda_path[1:8] vs expected$convergence$1se$lambda_path[1:8] - 0.848566858782241695 + 0.848566858782241473 - 0.393869845629752469 + 0.393869845629752413 0.182818187737184779 - 0.084856685878224147 + 0.084856685878224189 - 0.039386984562975236 + 0.039386984562975257 0.018281818773718483 0.008485668587822418 0.003938698456297524 actual$fitted_values$min | expected$fitted_values$min [1] 1.322816851681429373 | 1.322816851681429373 [1] [2] 0.958950191476270808 | 0.958950191476270808 [2] [3] -1.317154358132468506 | -1.317154358132468506 [3] [4] -0.007151471989323976 - -0.007151471989324134 [4] [5] 1.684397380126478438 | 1.684397380126478438 [5] [6] 0.129138352489088781 - 0.129138352489088865 [6] [7] 3.808216241075809805 - 3.808216241075809361 [7] [8] 1.050133983965602091 - 1.050133983965601869 [8] [9] 0.409923325882013967 | 0.409923325882013967 [9] [10] -0.308714362033197576 | -0.308714362033197576 [10] ... ... ... and 30 more ... actual$fitted_values$1se | expected$fitted_values$1se [1] 1.322816851681429373 | 1.322816851681429373 [1] [2] 0.958950191476270808 | 0.958950191476270808 [2] [3] -1.317154358132468506 | -1.317154358132468506 [3] [4] -0.007151471989323976 - -0.007151471989324134 [4] [5] 1.684397380126478438 | 1.684397380126478438 [5] [6] 0.129138352489088781 - 0.129138352489088865 [6] [7] 3.808216241075809805 - 3.808216241075809361 [7] [8] 1.050133983965602091 - 1.050133983965601869 [8] [9] 0.409923325882013967 | 0.409923325882013967 [9] [10] -0.308714362033197576 | -0.308714362033197576 [10] ... ... ... and 30 more ... kir cv Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:35:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 ── Failure ('test-scad-tol.R:38:5'): default scad_a and tol reproduce kir 0.3.1.0001 (11cf0f5) ── Expected `actual` to be identical to `expected`. Differences: `actual$lambda`: 0.084856685878224147 `expected$lambda`: 0.084856685878224189 actual$tuning$lambda | expected$tuning$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] `actual$tuning$lambda_max`: 0.84856685878224170 `expected$tuning$lambda_max`: 0.84856685878224147 actual$tuning$scores$lambda | expected$tuning$scores$lambda [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] [9] 0.001828181877371848 | 0.001828181877371848 [9] [10] 0.000848566858782242 | 0.000848566858782242 [10] ... ... ... and 98 more ... actual$tuning$scores$rss | expected$tuning$scores$rss [1] 78.4730639369173133 | 78.4730639369173133 [1] [2] 43.4704102594808361 - 43.4704102594808433 [2] [3] 31.7397200716364161 | 31.7397200716364161 [3] [4] 30.4859009064019304 | 30.4859009064019304 [4] [5] 30.2971855993967765 - 30.2971855993967729 [5] [6] 30.1933800962020342 - 30.1933800962020413 [6] [7] 30.1790611414747580 | 30.1790611414747580 [7] [8] 30.1790611351330575 | 30.1790611351330575 [8] [9] 30.1790611347986548 - 30.1790611347986513 [9] [10] 30.1790611347807420 | 30.1790611347807420 [10] ... ... ... and 2 more ... actual$tuning$scores$rss | expected$tuning$scores$rss [13] 31.8419757781129107 | 31.8419757781129107 [13] [14] 30.6577508570612132 | 30.6577508570612132 [14] [15] 30.3564437539951157 | 30.3564437539951157 [15] [16] 30.2548089225643366 - 30.2548089225643437 [16] [17] 30.2349149271222117 | 30.2349149271222117 [17] [18] 30.2347636056454334 | 30.2347636056454334 [18] [19] 30.2347615892141768 - 30.2347615892141697 [19] [20] 30.2347623312220968 - 30.2347623312221003 [20] [21] 70.6563853522132632 - 70.6563853522132490 [21] [22] 41.2767803344883433 - 41.2767803344883362 [22] ... ... ... and 81 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [16] 3.62909044221170385 | 3.62909044221170385 [16] [17] 3.62843267772235611 | 3.62843267772235611 [17] [18] 3.62842767285113954 | 3.62842767285113954 [18] [19] 3.62842760615866089 - 3.62842760615866045 [19] [20] 3.62842763070021057 - 3.62842763070021102 [20] [21] 4.30171554466487560 | 4.30171554466487560 [21] [22] 3.80807424144758944 | 3.80807424144758944 [22] [23] 3.59844352298338244 | 3.59844352298338244 [23] actual$tuning$scores$hbic | expected$tuning$scores$hbic [24] 3.56324238041988517 | 3.56324238041988517 [24] [25] 3.59405277795755707 | 3.59405277795755707 [25] [26] 3.63484399006344283 | 3.63484399006344283 [26] [27] 3.63397742303121563 - 3.63397742303121518 [27] [28] 3.63393912322660073 | 3.63393912322660073 [28] [29] 3.63393927197776501 | 3.63393927197776501 [29] [30] 3.63393929915135283 - 3.63393929915135239 [30] [31] 4.27943071298093169 - 4.27943071298093081 [31] [32] 3.78501646975764583 - 3.78501646975764539 [32] [33] 3.60675526605228081 - 3.60675526605228125 [33] ... ... ... and 5 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [45] 3.61606477510475699 | 3.61606477510475699 [45] [46] 3.65696457105760331 | 3.65696457105760331 [46] [47] 3.65581355245447082 | 3.65581355245447082 [47] [48] 3.65568656420099636 - 3.65568656420099591 [48] [49] 3.65568702756266672 | 3.65568702756266672 [49] [50] 3.65568711083834463 | 3.65568711083834463 [50] [51] 4.08137164085573811 | 4.08137164085573811 [51] actual$tuning$scores$hbic | expected$tuning$scores$hbic [52] 3.74370715299529522 | 3.74370715299529522 [52] [53] 3.62900275054249866 | 3.62900275054249866 [53] [54] 3.60247679155568346 | 3.60247679155568346 [54] [55] 3.63355811308974008 - 3.63355811308974053 [55] [56] 3.67302913694924271 | 3.67302913694924271 [56] [57] 3.67185037638377221 - 3.67185037638377176 [57] [58] 3.67169241557580284 | 3.67169241557580284 [58] [59] 3.67169300299279522 - 3.67169300299279566 [59] [60] 3.67169310854038322 - 3.67169310854038278 [60] [61] 3.98506779880711859 | 3.98506779880711859 [61] ... ... ... and 17 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [79] 3.71316390992829781 | 3.71316390992829781 [79] [80] 3.71316406934643384 | 3.71316406934643384 [80] [81] 3.80690130091500478 | 3.80690130091500478 [81] [82] 3.69077192457781722 - 3.69077192457781766 [82] [83] 3.67375815895872782 | 3.67375815895872782 [83] [84] 3.65991234811186805 - 3.65991234811186850 [84] [85] 3.65579868298590283 | 3.65579868298590283 [85] [86] 3.73974328894301822 | 3.73974328894301822 [86] [87] 3.73853784913726095 | 3.73853784913726095 [87] [88] 3.73828541083684529 - 3.73828541083684485 [88] ... ... ... and 3 more ... actual$tuning$scores$hbic | expected$tuning$scores$hbic [94] 3.68314453321363411 | 3.68314453321363411 [94] [95] 3.68097263584044621 | 3.68097263584044621 [95] [96] 3.76718649209881518 | 3.76718649209881518 [96] [97] 3.76622962910194170 - 3.76622962910194214 [97] [98] 3.76598007343806973 | 3.76598007343806973 [98] [99] 3.76591832627516787 | 3.76591832627516787 [99] [100] 3.76591183081816627 - 3.76591183081816672 [100] [101] 3.66430197099821431 | 3.66430197099821431 [101] [102] 3.66430197099821431 | 3.66430197099821431 [102] [103] 3.66430197099821431 | 3.66430197099821431 [103] actual$convergence$lambda_path | expected$convergence$lambda_path [1] 0.848566858782241695 - 0.848566858782241473 [1] [2] 0.393869845629752469 - 0.393869845629752413 [2] [3] 0.182818187737184779 | 0.182818187737184779 [3] [4] 0.084856685878224147 - 0.084856685878224189 [4] [5] 0.039386984562975236 - 0.039386984562975257 [5] [6] 0.018281818773718483 | 0.018281818773718483 [6] [7] 0.008485668587822418 | 0.008485668587822418 [7] [8] 0.003938698456297524 | 0.003938698456297524 [8] actual$fitted_values | expected$fitted_values [1] 1.411040236659359515 | 1.411040236659359515 [1] [2] 1.062932974541120013 | 1.062932974541120013 [2] [3] -1.372000519969465593 - -1.372000519969465371 [3] [4] 0.061776625082330838 - 0.061776625082330609 [4] [5] 1.840775071973730803 | 1.840775071973730803 [5] [6] 0.200271382383203300 | 0.200271382383203300 [6] [7] 4.075918037390362514 | 4.075918037390362514 [7] [8] 1.064357121646794191 - 1.064357121646793969 [8] [9] 0.404439728258958020 - 0.404439728258958076 [9] [10] -0.263151793130486200 - -0.263151793130486311 [10] ... ... ... and 30 more ... kir hbic Backtrace: ▆ 1. └─kir (local) expect_same_as_fixture(...) at test-scad-tol.R:38:5 2. └─testthat::expect_identical(actual, expected, info = info) at test-scad-tol.R:10:5 [ FAIL 16 | WARN 16 | SKIP 5 | PASS 3834 ] Error: ! Test failures. Execution halted Flavor: r-oldrel-macos-arm64