From 6823a270f5c6a61c21b5486f1b18087994fe8f99 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:29:49 +0800 Subject: [PATCH 1/6] export significance of interaction detector --- R/geodetector.R | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/R/geodetector.R b/R/geodetector.R index bf7571fa..46bd8a2e 100644 --- a/R/geodetector.R +++ b/R/geodetector.R @@ -85,9 +85,13 @@ factor_detector = \(y,x,confintv = FALSE,alpha = 0.95){ #' interaction_detector = \(y,x1,x2){ x12 = paste0(x1,x2,'_') - qv1 = gdverse::factor_detector(y,x1)[[1]] - qv2 = gdverse::factor_detector(y,x2)[[1]] - qv12 = gdverse::factor_detector(y,x12)[[1]] + g1 = gdverse::factor_detector(y,x1) + g2 = gdverse::factor_detector(y,x2) + g12 = gdverse::factor_detector(y,x12) + + qv1 = g1[[1]] + qv2 = g2[[1]] + qv12 = g12[[1]] if (qv12 < min(qv1, qv2)) { interaction = c("Weaken, nonlinear") @@ -100,10 +104,11 @@ interaction_detector = \(y,x1,x2){ } else { interaction = c("Enhance, nonlinear") } - interd = list(qv1,qv2,qv12,interaction) + interd = list(qv1,qv2,qv12,interaction,g1[[1]],g2[[1]],g12[[1]]) names(interd) = c("Variable1 Q-statistics","Variable2 Q-statistics", "Variable1 and Variable2 interact Q-statistics", - "Interaction") + "Interaction", "Variable1 P-value","Variable2 P-value", + "Variable1 and Variable2 interact P-value") return(interd) } From 143238ee22b16abec06d2edc2e05d018bb282e9e Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:30:52 +0800 Subject: [PATCH 2/6] export significance of interaction detector --- R/geodetector.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/geodetector.R b/R/geodetector.R index 46bd8a2e..a69a954a 100644 --- a/R/geodetector.R +++ b/R/geodetector.R @@ -104,7 +104,7 @@ interaction_detector = \(y,x1,x2){ } else { interaction = c("Enhance, nonlinear") } - interd = list(qv1,qv2,qv12,interaction,g1[[1]],g2[[1]],g12[[1]]) + interd = list(qv1,qv2,qv12,interaction,g1[[2]],g2[[2]],g12[[2]]) names(interd) = c("Variable1 Q-statistics","Variable2 Q-statistics", "Variable1 and Variable2 interact Q-statistics", "Interaction", "Variable1 P-value","Variable2 P-value", From 74734376c90d9b76bdf6ff55b862adeb1a291466 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:33:24 +0800 Subject: [PATCH 3/6] export significance of interaction detector --- R/geodetector.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/geodetector.R b/R/geodetector.R index a69a954a..5bdcd2e6 100644 --- a/R/geodetector.R +++ b/R/geodetector.R @@ -75,6 +75,9 @@ factor_detector = \(y,x,confintv = FALSE,alpha = 0.95){ #' \item{\code{Variable2 Q-statistics}}{Q-statistics for variable2} #' \item{\code{Variable1 and Variable2 interact Q-statistics}}{Q-statistics for variable1 and variable2 interact} #' \item{\code{Interaction}}{the interact result type} +#' \item{\code{Variable1 P-value}}{P-value of the Q-statistic for Variable1} +#' \item{\code{Variable2 P-value}}{P-value of the Q-statistic for Variable2} +#' \item{\code{Variable1 and Variable2 interact P-value}}{P-value of the Q-statistic for variable1 and variable2 interact} #' } #' @export #' From 2596457d74ed3af0a5dcae6c6783c8d465047c2b Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:36:24 +0800 Subject: [PATCH 4/6] remove unnecessary `c()` of a constant --- R/geodetector.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/geodetector.R b/R/geodetector.R index 5bdcd2e6..db90ce3c 100644 --- a/R/geodetector.R +++ b/R/geodetector.R @@ -97,15 +97,15 @@ interaction_detector = \(y,x1,x2){ qv12 = g12[[1]] if (qv12 < min(qv1, qv2)) { - interaction = c("Weaken, nonlinear") + interaction = "Weaken, nonlinear" } else if (qv12 >= min(qv1, qv2) & qv12 <= max(qv1, qv2)) { - interaction = c("Weaken, uni-") + interaction = "Weaken, uni-" } else if (qv12 > max(qv1, qv2) & (qv12 < qv1 + qv2)) { - interaction = c("Enhance, bi-") + interaction = "Enhance, bi-" } else if (qv12 == qv1 + qv2) { - interaction = c("Independent") + interaction = "Independent" } else { - interaction = c("Enhance, nonlinear") + interaction = "Enhance, nonlinear" } interd = list(qv1,qv2,qv12,interaction,g1[[2]],g2[[2]],g12[[2]]) names(interd) = c("Variable1 Q-statistics","Variable2 Q-statistics", From c39b7bea2026ca153e2b4c269b57f5028b77a674 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:37:48 +0800 Subject: [PATCH 5/6] remove unnecessary `c()` of a constant --- R/gozh.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/gozh.R b/R/gozh.R index e44d80f3..7391bd67 100644 --- a/R/gozh.R +++ b/R/gozh.R @@ -169,15 +169,15 @@ gozh_detector = \(formula, data, cores = 1, } interact_type = \(qv1,qv2,qv12){ if (qv12 < min(qv1, qv2)) { - interaction = c("Weaken, nonlinear") + interaction = "Weaken, nonlinear" } else if (qv12 >= min(qv1, qv2) & qv12 <= max(qv1, qv2)) { - interaction = c("Weaken, uni-") + interaction = "Weaken, uni-" } else if (qv12 > max(qv1, qv2) & (qv12 < qv1 + qv2)) { - interaction = c("Enhance, bi-") + interaction = "Enhance, bi-" } else if (qv12 == qv1 + qv2) { - interaction = c("Independent") + interaction = "Independent" } else { - interaction = c("Enhance, nonlinear") + interaction = "Enhance, nonlinear" } return(interaction) } From fca6aa21b6535b5bec670653a79b7bfb31a27722 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 5 Jan 2026 11:41:20 +0800 Subject: [PATCH 6/6] export significance of interaction detector --- man/interaction_detector.Rd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/interaction_detector.Rd b/man/interaction_detector.Rd index cd1ea4bc..56ec11c3 100644 --- a/man/interaction_detector.Rd +++ b/man/interaction_detector.Rd @@ -20,6 +20,9 @@ A list. \item{\code{Variable2 Q-statistics}}{Q-statistics for variable2} \item{\code{Variable1 and Variable2 interact Q-statistics}}{Q-statistics for variable1 and variable2 interact} \item{\code{Interaction}}{the interact result type} +\item{\code{Variable1 P-value}}{P-value of the Q-statistic for Variable1} +\item{\code{Variable2 P-value}}{P-value of the Q-statistic for Variable2} +\item{\code{Variable1 and Variable2 interact P-value}}{P-value of the Q-statistic for variable1 and variable2 interact} } } \description{