From 37f2a3268342a5357e72484fdb446dfbe14f2fa0 Mon Sep 17 00:00:00 2001 From: Federico Blasi <33967974+blasif@users.noreply.github.com> Date: Mon, 4 Aug 2025 08:58:11 +0000 Subject: [PATCH] 0.1.5 : add warning for old info$lambda --- R/checkFunctions.R | 6 ++++++ R/cocons.R | 4 ++-- R/optim.R | 2 -- man/coco.Rd | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/R/checkFunctions.R b/R/checkFunctions.R index 06997d1..03821ef 100644 --- a/R/checkFunctions.R +++ b/R/checkFunctions.R @@ -269,6 +269,12 @@ .cocons.check.info <- function(type, info, model.list, data){ + if (!is.null(info$lambda)) { + info$lambda.reg <- info$lambda + warning("The regularization parameter lambda is now called lambda.reg . Seee help(coco)") + info$lambda <- NULL + } + if (is.null(info$smooth.limits) & is.formula(model.list[6]$smooth)) { stop("smooth limits not specified.") } diff --git a/R/cocons.R b/R/cocons.R index 02124ca..6c31dbe 100644 --- a/R/cocons.R +++ b/R/cocons.R @@ -26,7 +26,7 @@ #' \eqn{\nu_{l}}, and \eqn{\nu_{u}} are the lower and upper bounds limiting the range of variation of the spatially-varying smoothness, and where \eqn{\boldsymbol{X}_{\ell}} relates to the design matrix defined by the specific models for each of the source of nonstationarity. #' #' Lastly, arguments for the \code{"info"} list argument involve: \itemize{ -#' \item \code{"lambda.reg"}: (\code{numeric}) a positive scalar specifying the regularization parameter. Larger values regularize highly-smoothed long-tailed covariance functions. +#' \item \code{"lambda.reg"}: (\code{numeric}) a positive scalar specifying the regularization parameter. Larger values discourage highly-smoothed long-tailed covariance functions. #' \item \code{"lambda.Sigma"}: (\code{numeric}) a positive scalar specifying the penalization parameter for the covariate-driven covariance parameters. #' \item \code{"lambda.betas"}: (\code{numeric}) a positive scalar specifying the penalization parameter for the covariate-driven spatial mean parameters. #' \item \code{"sparse.point"}: (\code{numeric}) a cutting point for which smaller coefficients in absolute value will be set to zero after the smoothed L1 penalization optimization. Used in combination with \code{lambda.Sigma} and \code{lambda.betas}. By default, it is set to \code{1e-4}. @@ -151,7 +151,7 @@ coco <- function(type, } if(any(c(info$lambda.betas,info$lambda.Sigma) > 0) && (is.null(info$sparse.point))){ - info$sparse.point <- 1e-4 + info$sparse.point <- getOption("cocons.sparse.point") } if(T){ diff --git a/R/optim.R b/R/optim.R index 1cdae1d..ebff647 100644 --- a/R/optim.R +++ b/R/optim.R @@ -382,7 +382,6 @@ cocoOptim <- function(coco.object, boundaries = list(), parallel::setDefaultCluster(cl = cl) parallel::clusterEvalQ(cl, library("cocons")) parallel::clusterEvalQ(cl, library("spam")) - #parallel::clusterEvalQ(cl, library("spam64")) parallel::clusterEvalQ(cl, options(spam.cholupdatesingular = "error")) parallel::clusterEvalQ(cl, options(spam.cholsymmetrycheck = FALSE)) @@ -547,7 +546,6 @@ cocoOptim <- function(coco.object, boundaries = list(), parallel::setDefaultCluster(cl = cl) parallel::clusterEvalQ(cl, library("cocons")) parallel::clusterEvalQ(cl, library("spam")) - #parallel::clusterEvalQ(cl, library("spam64")) parallel::clusterEvalQ(cl, options(spam.cholupdatesingular = "error")) parallel::clusterEvalQ(cl, options(spam.cholsymmetrycheck = FALSE)) diff --git a/man/coco.Rd b/man/coco.Rd index 54c4278..af92a21 100644 --- a/man/coco.Rd +++ b/man/coco.Rd @@ -52,7 +52,7 @@ where \eqn{\boldsymbol{\beta}}, \eqn{\boldsymbol{\alpha}}, \eqn{\boldsymbol{\the \eqn{\nu_{l}}, and \eqn{\nu_{u}} are the lower and upper bounds limiting the range of variation of the spatially-varying smoothness, and where \eqn{\boldsymbol{X}_{\ell}} relates to the design matrix defined by the specific models for each of the source of nonstationarity. Lastly, arguments for the \code{"info"} list argument involve: \itemize{ -\item \code{"lambda.reg"}: (\code{numeric}) a positive scalar specifying the regularization parameter. Larger values regularize highly-smoothed long-tailed covariance functions. +\item \code{"lambda.reg"}: (\code{numeric}) a positive scalar specifying the regularization parameter. Larger values discourage highly-smoothed long-tailed covariance functions. \item \code{"lambda.Sigma"}: (\code{numeric}) a positive scalar specifying the penalization parameter for the covariate-driven covariance parameters. \item \code{"lambda.betas"}: (\code{numeric}) a positive scalar specifying the penalization parameter for the covariate-driven spatial mean parameters. \item \code{"sparse.point"}: (\code{numeric}) a cutting point for which smaller coefficients in absolute value will be set to zero after the smoothed L1 penalization optimization. Used in combination with \code{lambda.Sigma} and \code{lambda.betas}. By default, it is set to \code{1e-4}.