Skip to content

Commit baf6d6c

Browse files
authored
Merge branch 'master' into fac2
2 parents c4009a0 + 5fdcac5 commit baf6d6c

2 files changed

Lines changed: 67 additions & 46 deletions

File tree

R/constrainedX.R

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -862,9 +862,7 @@ NULL
862862
args2 <- environment(bl2$dpp)$args
863863
l1 <- args1$lambda
864864
l2 <- args2$lambda
865-
if (xor(is.null(l1), is.null(l2)))
866-
stop("you cannot mix lambda and df in ",
867-
sQuote("%A0%"))
865+
868866
if (!is.null(l1) && !is.null(l2)) {
869867
### there is no common lambda!
870868
args <- list(lambda = NA, df = NA)
@@ -877,27 +875,35 @@ NULL
877875
args <- list(lambda = NULL,
878876
df = ifelse(is.null(df1), 1, df1) *
879877
ifelse(is.null(df2), 1, df2))
880-
881-
## case that df equals nr columns of design matrix -> no penalty -> lambda = 0
882-
if( ncol(environment(bl1$dpp)$X) - df1 < .Machine$double.eps*10^10){
883-
args$lambda1 <- 0
884-
if( ncol(environment(bl1$dpp)$X) - df1 < - .Machine$double.eps*10^10){
885-
warning("Specified df in ", bl1$get_call(), " are higher than the number of columns, ",
886-
"which is ", ncol(environment(bl1$dpp)$X), ".")
878+
879+
if(!is.null(l1)) {
880+
args$lambda1 <- l1
881+
} else {
882+
## case that df equals nr columns of design matrix -> no penalty -> lambda = 0
883+
if( ncol(environment(bl1$dpp)$X) - df1 < .Machine$double.eps*10^10){
884+
args$lambda1 <- 0
885+
if( ncol(environment(bl1$dpp)$X) - df1 < - .Machine$double.eps*10^10){
886+
warning("Specified df in ", bl1$get_call(), " are higher than the number of columns, ",
887+
"which is ", ncol(environment(bl1$dpp)$X), ".")
888+
}
889+
}else{
890+
args$lambda1 <- 1
887891
}
888-
}else{
889-
args$lambda1 <- 1
890892
}
891893

892-
## case that df equals nr columns of design matrix
893-
if( ncol(environment(bl2$dpp)$X) - df2 < .Machine$double.eps*10^10){
894-
args$lambda2 <- 0
895-
if( ncol(environment(bl2$dpp)$X) - df2 < - .Machine$double.eps*10^10){
896-
warning("Specified df in ", bl2$get_call(), " are higher than the number of columns, ",
897-
"which is ", ncol(environment(bl2$dpp)$X), ".")
894+
if(!is.null(l2)) {
895+
args$lambda2 <- l2
896+
} else {
897+
## case that df equals nr columns of design matrix
898+
if( ncol(environment(bl2$dpp)$X) - df2 < .Machine$double.eps*10^10){
899+
args$lambda2 <- 0
900+
if( ncol(environment(bl2$dpp)$X) - df2 < - .Machine$double.eps*10^10){
901+
warning("Specified df in ", bl2$get_call(), " are higher than the number of columns, ",
902+
"which is ", ncol(environment(bl2$dpp)$X), ".")
903+
}
904+
}else{
905+
args$lambda2 <- 1
898906
}
899-
}else{
900-
args$lambda2 <- 1
901907
}
902908

903909
if(args$lambda1 != 0 & args$lambda2 != 0)
@@ -1021,10 +1027,6 @@ NULL
10211027
l1 <- args1$lambda
10221028
l2 <- args2$lambda
10231029

1024-
if (xor(is.null(l1), is.null(l2)))
1025-
stop("you cannot mix lambda and df in ",
1026-
sQuote("%Xa0%"))
1027-
10281030
if (!is.null(l1) && !is.null(l2)) {
10291031
args <- list(lambda = 1, df = NULL)
10301032

@@ -1037,27 +1039,34 @@ NULL
10371039
args <- list(lambda = NULL,
10381040
df = ifelse(is.null(df1), 1, df1) *
10391041
ifelse(is.null(df2), 1, df2))
1040-
1041-
## case that df equals nr columns of design matrix -> no penalty -> lambda = 0
1042-
if( ncol(environment(bl1$dpp)$X) - df1 < .Machine$double.eps*10^10){
1043-
args$lambda1 <- 0
1044-
if( ncol(environment(bl1$dpp)$X) - df1 < - .Machine$double.eps*10^10){
1045-
warning("Specified df in ", bl1$get_call(), " are higher than the number of columns, ",
1046-
"which is ", ncol(environment(bl1$dpp)$X), ".")
1042+
if(!is.null(l1)) {
1043+
args$lambda1 <- l1
1044+
} else {
1045+
## case that df equals nr columns of design matrix -> no penalty -> lambda = 0
1046+
if( ncol(environment(bl1$dpp)$X) - df1 < .Machine$double.eps*10^10){
1047+
args$lambda1 <- 0
1048+
if( ncol(environment(bl1$dpp)$X) - df1 < - .Machine$double.eps*10^10){
1049+
warning("Specified df in ", bl1$get_call(), " are higher than the number of columns, ",
1050+
"which is ", ncol(environment(bl1$dpp)$X), ".")
1051+
}
1052+
}else{
1053+
args$lambda1 <- 1
10471054
}
1048-
}else{
1049-
args$lambda1 <- 1
10501055
}
10511056

1052-
## case that df equals nr columns of design matrix
1053-
if( ncol(environment(bl2$dpp)$X) - df2 < .Machine$double.eps*10^10){
1054-
args$lambda2 <- 0
1055-
if( ncol(environment(bl2$dpp)$X) - df2 < - .Machine$double.eps*10^10){
1056-
warning("Specified df in ", bl2$get_call(), " are higher than the number of columns, ",
1057-
"which is ", ncol(environment(bl2$dpp)$X), ".")
1057+
if(!is.null(l2)) {
1058+
args$lambda2 <- l2
1059+
} else {
1060+
## case that df equals nr columns of design matrix
1061+
if( ncol(environment(bl2$dpp)$X) - df2 < .Machine$double.eps*10^10){
1062+
args$lambda2 <- 0
1063+
if( ncol(environment(bl2$dpp)$X) - df2 < - .Machine$double.eps*10^10){
1064+
warning("Specified df in ", bl2$get_call(), " are higher than the number of columns, ",
1065+
"which is ", ncol(environment(bl2$dpp)$X), ".")
1066+
}
1067+
}else{
1068+
args$lambda2 <- 1
10581069
}
1059-
}else{
1060-
args$lambda2 <- 1
10611070
}
10621071

10631072
if(args$lambda1 != 0 & args$lambda2 != 0)

inst/NEWS.Rd

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
\name{NEWS}
22
\title{News for Package 'FDboost'}
33

4-
\section{Changes in FDboost version 1.0-3 (2022-06-15)}{
4+
\section{Changes in FDboost version 1.1-0 (2022-07-12)}{
5+
\subsection{Miscellaneous}{
6+
\itemize{
7+
\item Anisotropic tensor-product operators \code{b1 \%A0\% b2} and \code{b1 \%Xa0\% b2} now
8+
also working when \code{lambda} is specified for \code{b1} and \code{df} is specified for \code{b2}
9+
(or vice versa).
10+
}
11+
}
512
\subsection{New feature}{
6-
\itemize{
7-
\item Function \code{factorize} added for tensor-product factorization of
13+
\itemize{
14+
\item New function \code{clr} to compute the centered-log-ratio transform and its
15+
inverse for density-on-scalar regression in Bayes spaces.
16+
\item New dataset \code{birthDistribution}.
17+
\item New vignette illustrating density-on-function regression on
18+
the \code{birthDistribution} data.
19+
\item Function \code{factorize} added for tensor-product factorization of
820
estimated effects or models.
9-
}
10-
}
21+
}
22+
}
1123
}
1224

1325
\section{Changes in FDboost version 0.3-4 (2020-08-31)}{

0 commit comments

Comments
 (0)