From 3bd828c53bdc95772e25165e884188a22154cf0e Mon Sep 17 00:00:00 2001 From: OuGuangyu Date: Fri, 6 Jun 2025 12:19:35 +0800 Subject: [PATCH 1/3] add: gwda basic flow --- NAMESPACE | 1 + R/RcppExports.R | 4 ++ R/gwda.R | 115 +++++++++++++++++++++++++++++++++++++ man/gwda.Rd | 50 ++++++++++++++++ src/Makevars.in | 2 + src/Makevars.win | 2 + src/RcppExports.cpp | 23 ++++++++ src/gwda.cpp | 90 +++++++++++++++++++++++++++++ tests/testthat/test-gwda.R | 8 +++ 9 files changed, 295 insertions(+) create mode 100644 R/gwda.R create mode 100644 man/gwda.Rd create mode 100644 src/gwda.cpp create mode 100644 tests/testthat/test-gwda.R diff --git a/NAMESPACE b/NAMESPACE index 41ed6d0..7e717b8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,6 +24,7 @@ S3method(step,gwrm) export(gtdr) export(gtdr_config) export(gwaverage) +export(gwda) export(gwr_basic) export(gwr_multiscale) export(mgwr_config) diff --git a/R/RcppExports.R b/R/RcppExports.R index bace5f9..a616786 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -9,6 +9,10 @@ gwaverage_fit <- function(x, coords, bw, quantile, adaptive, kernel, longlat, p, .Call(`_GWmodel3_gwaverage_fit`, x, coords, bw, quantile, adaptive, kernel, longlat, p, theta, parallel_type, parallel_arg) } +gwda_cal <- function(x, y, coords, bw, adaptive, kernel, longlat, p, theta, method, parallel_type, parallel_arg) { + .Call(`_GWmodel3_gwda_cal`, x, y, coords, bw, adaptive, kernel, longlat, p, theta, method, parallel_type, parallel_arg) +} + gwr_basic_fit <- function(x, y, coords, bw, adaptive, kernel, longlat, p, theta, optim_bw_lower, optim_bw_upper, hatmatrix, intercept, parallel_type, parallel_arg, optim_bw, optim_bw_criterion, select_model, select_model_criterion, select_model_threshold, variable_names, verbose) { .Call(`_GWmodel3_gwr_basic_fit`, x, y, coords, bw, adaptive, kernel, longlat, p, theta, optim_bw_lower, optim_bw_upper, hatmatrix, intercept, parallel_type, parallel_arg, optim_bw, optim_bw_criterion, select_model, select_model_criterion, select_model_threshold, variable_names, verbose) } diff --git a/R/gwda.R b/R/gwda.R new file mode 100644 index 0000000..36aef5c --- /dev/null +++ b/R/gwda.R @@ -0,0 +1,115 @@ +#' Geographically Weighted Summary Statistics +#' +#' @param formula Regresison model. +#' @param data A `sf` objects. +#' @param bw Bandwidth value +#' @param adaptive Whether the bandwidth value is adaptive or not. +#' @param quantile Whether to calculate local quantiles. +#' @param kernel Kernel function used. +#' @param longlat Whether the coordinates +#' @param p Power of the Minkowski distance, +#' default to 2, i.e., Euclidean distance. +#' @param theta Angle in radian to roate the coordinate system, default to 0. +#' @param parallel_method Parallel method. +#' @param parallel_arg Parallel method argument. +#' +#' @return A `gwdam` object. +#' +#' @export +gwda <- function( + formula, + data, + bw, + adaptive = FALSE, + kernel = c("gaussian", "exp", "bisquare", "tricube", "boxcar"), + longlat = FALSE, + p = 2.0, + theta = 0.0, + method = c("wqda", "wlda"), + parallel_method = c("no", "omp"), + parallel_arg = c(0)) +{ + ### Check args + kernel <- match.arg(kernel) + parallel_method <- match.arg(parallel_method) + attr(data, "na.action") <- getOption("na.action") + + ### Extract coords + data <- do.call(na.action(data), args = list(data)) + coords <- as.matrix(sf::st_coordinates(sf::st_centroid(data))) + if (is.null(coords) || nrow(coords) != nrow(data)) { + stop("Missing coordinates.") + } + + ### Extract variables + mc <- match.call(expand.dots = FALSE) + mf <- model.frame(formula = formula(update(formula, ~ . - 1)), data = sf::st_drop_geometry(data)) + mt <- attr(mf, "terms") + y <- model.extract(mf, "response") + y <- as.character(y) + x <- model.matrix(mt, mf) + dep_var <- as.character(attr(terms(mf), "variables")[[2]]) + indep_vars <- colnames(x) + + ### Check whether bandwidth is valid. + if (missing(bw)) { + stop("Bandwidth is missing.") + } else if (is.numeric(bw) || is.integer(bw)) { + if (bw == 0) stop("Bandwidth must be non-zero.") + } else { + stop("Bandwidth must be a number.") + } + + method <- match.arg(method) + wqda_method <- ifelse(method == "wqda", TRUE, FALSE) + + c_results <- gwda_cal( + x, y, coords, bw, + adaptive, enum(kernel), + longlat, p, theta, + wqda_method, + enum_list(parallel_method, parallel_types), parallel_arg + ) + + sdf_data <- data.frame() + res <- c_results$res + group <- as.data.frame(c_results$group) + probs <- c_results$probs + pmax <- c_results$pmax + entropy <- c_results$entropy + + colnames(res) <- indep_vars + colnames(group) <- "groups" + colnames(probs) <- paste0(indep_vars, "_probs") + colnames(pmax) <- "pmax" + colnames(entropy) <- "entropy" + sdf_data <- as.data.frame(cbind(res, group, probs, pmax, entropy)) + + sdf_data$geometry <- sf::st_geometry(data) + sdf <- sf::st_sf(sdf_data) + + ### Return result + gwdam <- list( + SDF = sdf, + args = list( + x = x, + y = y, + correctRate = c_results$correctRate, + coords = coords, + bw = bw, + adaptive = adaptive, + kernel = kernel, + longlat = longlat, + p = p, + theta = theta, + method = method, + parallel_method = parallel_method, + parallel_arg = parallel_arg + ), + call = mc, + indep_vars = indep_vars, + dep_var = dep_var + ) + class(gwdam) <- "gwdam" + gwdam +} diff --git a/man/gwda.Rd b/man/gwda.Rd new file mode 100644 index 0000000..488b95d --- /dev/null +++ b/man/gwda.Rd @@ -0,0 +1,50 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gwda.R +\name{gwda} +\alias{gwda} +\title{Geographically Weighted Summary Statistics} +\usage{ +gwda( + formula, + data, + bw, + adaptive = FALSE, + kernel = c("gaussian", "exp", "bisquare", "tricube", "boxcar"), + longlat = FALSE, + p = 2, + theta = 0, + method = c("wqda", "wlda"), + parallel_method = c("no", "omp"), + parallel_arg = c(0) +) +} +\arguments{ +\item{formula}{Regresison model.} + +\item{data}{A \code{sf} objects.} + +\item{bw}{Bandwidth value} + +\item{adaptive}{Whether the bandwidth value is adaptive or not.} + +\item{kernel}{Kernel function used.} + +\item{longlat}{Whether the coordinates} + +\item{p}{Power of the Minkowski distance, +default to 2, i.e., Euclidean distance.} + +\item{theta}{Angle in radian to roate the coordinate system, default to 0.} + +\item{parallel_method}{Parallel method.} + +\item{parallel_arg}{Parallel method argument.} + +\item{quantile}{Whether to calculate local quantiles.} +} +\value{ +A \code{gwdam} object. +} +\description{ +Geographically Weighted Summary Statistics +} diff --git a/src/Makevars.in b/src/Makevars.in index 80bbf7d..5422459 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -46,6 +46,7 @@ OBJECTS_LIBGWMODEL = \ libgwmodel/src/gwmodelpp/GWRBasic.o \ libgwmodel/src/gwmodelpp/GWRMultiscale.o \ libgwmodel/src/gwmodelpp/GWAverage.o \ + libgwmodel/src/gwmodelpp/GWDA.o \ libgwmodel/src/gwmodelpp/SpatialAlgorithm.o \ libgwmodel/src/gwmodelpp/SpatialMonoscaleAlgorithm.o \ libgwmodel/src/gwmodelpp/SpatialMultiscaleAlgorithm.o \ @@ -63,6 +64,7 @@ OBJECTS_GWMODEL = \ gwr_multiscale.o \ gtdr.o \ gwaverage.o \ + gwda.o \ RcppExports.o OBJECTS_CXX = $(OBJECTS_LIBGWMODEL) $(OBJECTS_TELEGRAM) $(OBJECTS_GWMODEL) diff --git a/src/Makevars.win b/src/Makevars.win index c62d21b..8f975a9 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -48,6 +48,7 @@ OBJECTS_LIBGWMODEL = \ libgwmodel/src/gwmodelpp/GWRBasic.o \ libgwmodel/src/gwmodelpp/GWRMultiscale.o \ libgwmodel/src/gwmodelpp/GWAverage.o \ + libgwmodel/src/gwmodelpp/GWDA.o \ libgwmodel/src/gwmodelpp/SpatialAlgorithm.o \ libgwmodel/src/gwmodelpp/SpatialMonoscaleAlgorithm.o \ libgwmodel/src/gwmodelpp/SpatialMultiscaleAlgorithm.o \ @@ -65,6 +66,7 @@ OBJECTS_GWMODEL = \ gwr_multiscale.o \ gtdr.o \ gwaverage.o \ + gwda.o \ RcppExports.o diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 1ef9a6d..145d998 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -61,6 +61,28 @@ BEGIN_RCPP return rcpp_result_gen; END_RCPP } +// gwda_cal +List gwda_cal(const arma::mat& x, std::vector& y, const arma::mat& coords, double bw, bool adaptive, size_t kernel, bool longlat, double p, double theta, bool method, size_t parallel_type, const IntegerVector& parallel_arg); +RcppExport SEXP _GWmodel3_gwda_cal(SEXP xSEXP, SEXP ySEXP, SEXP coordsSEXP, SEXP bwSEXP, SEXP adaptiveSEXP, SEXP kernelSEXP, SEXP longlatSEXP, SEXP pSEXP, SEXP thetaSEXP, SEXP methodSEXP, SEXP parallel_typeSEXP, SEXP parallel_argSEXP) { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + Rcpp::traits::input_parameter< const arma::mat& >::type x(xSEXP); + Rcpp::traits::input_parameter< std::vector& >::type y(ySEXP); + Rcpp::traits::input_parameter< const arma::mat& >::type coords(coordsSEXP); + Rcpp::traits::input_parameter< double >::type bw(bwSEXP); + Rcpp::traits::input_parameter< bool >::type adaptive(adaptiveSEXP); + Rcpp::traits::input_parameter< size_t >::type kernel(kernelSEXP); + Rcpp::traits::input_parameter< bool >::type longlat(longlatSEXP); + Rcpp::traits::input_parameter< double >::type p(pSEXP); + Rcpp::traits::input_parameter< double >::type theta(thetaSEXP); + Rcpp::traits::input_parameter< bool >::type method(methodSEXP); + Rcpp::traits::input_parameter< size_t >::type parallel_type(parallel_typeSEXP); + Rcpp::traits::input_parameter< const IntegerVector& >::type parallel_arg(parallel_argSEXP); + rcpp_result_gen = Rcpp::wrap(gwda_cal(x, y, coords, bw, adaptive, kernel, longlat, p, theta, method, parallel_type, parallel_arg)); + return rcpp_result_gen; +END_RCPP +} // gwr_basic_fit List gwr_basic_fit(const arma::mat& x, const arma::vec& y, const arma::mat& coords, double bw, bool adaptive, size_t kernel, bool longlat, double p, double theta, double optim_bw_lower, double optim_bw_upper, bool hatmatrix, bool intercept, size_t parallel_type, const IntegerVector& parallel_arg, bool optim_bw, size_t optim_bw_criterion, bool select_model, size_t select_model_criterion, size_t select_model_threshold, const CharacterVector& variable_names, int verbose); RcppExport SEXP _GWmodel3_gwr_basic_fit(SEXP xSEXP, SEXP ySEXP, SEXP coordsSEXP, SEXP bwSEXP, SEXP adaptiveSEXP, SEXP kernelSEXP, SEXP longlatSEXP, SEXP pSEXP, SEXP thetaSEXP, SEXP optim_bw_lowerSEXP, SEXP optim_bw_upperSEXP, SEXP hatmatrixSEXP, SEXP interceptSEXP, SEXP parallel_typeSEXP, SEXP parallel_argSEXP, SEXP optim_bwSEXP, SEXP optim_bw_criterionSEXP, SEXP select_modelSEXP, SEXP select_model_criterionSEXP, SEXP select_model_thresholdSEXP, SEXP variable_namesSEXP, SEXP verboseSEXP) { @@ -156,6 +178,7 @@ END_RCPP static const R_CallMethodDef CallEntries[] = { {"_GWmodel3_gtdr_fit", (DL_FUNC) &_GWmodel3_gtdr_fit, 19}, {"_GWmodel3_gwaverage_fit", (DL_FUNC) &_GWmodel3_gwaverage_fit, 11}, + {"_GWmodel3_gwda_cal", (DL_FUNC) &_GWmodel3_gwda_cal, 12}, {"_GWmodel3_gwr_basic_fit", (DL_FUNC) &_GWmodel3_gwr_basic_fit, 22}, {"_GWmodel3_gwr_basic_predict", (DL_FUNC) &_GWmodel3_gwr_basic_predict, 14}, {"_GWmodel3_gwr_multiscale_fit", (DL_FUNC) &_GWmodel3_gwr_multiscale_fit, 25}, diff --git a/src/gwda.cpp b/src/gwda.cpp new file mode 100644 index 0000000..7265d64 --- /dev/null +++ b/src/gwda.cpp @@ -0,0 +1,90 @@ +// [[Rcpp::depends(RcppArmadillo)]] +#include +#include "utils.h" +#include "gwmodelpp/GWDA.h" + +using namespace std; +using namespace Rcpp; +using namespace arma; +using namespace gwm; + +// [[Rcpp::export]] +List gwda_cal( + const arma::mat &x, + std::vector &y, + const arma::mat &coords, + double bw, + bool adaptive, + size_t kernel, + bool longlat, + double p, + double theta, + bool method, + size_t parallel_type, + const IntegerVector ¶llel_arg) +{ + + // Make Spatial Weight + BandwidthWeight bandwidth(bw, adaptive, BandwidthWeight::KernelFunctionType((size_t)kernel)); + + Distance *distance = nullptr; + if (longlat) + { + distance = new CRSDistance(true); + } + else + { + if (p == 2.0 && theta == 0.0) + { + distance = new CRSDistance(false); + } + else + { + distance = new MinkwoskiDistance(p, theta); + } + } + + SpatialWeight spatial(&bandwidth, distance); + + GWDA algorithm; + algorithm.setCoords(coords); + algorithm.setVariables(x); + algorithm.setGroup(y); + algorithm.setSpatialWeight(spatial); + + vector vpar_args = as>(IntegerVector(parallel_arg)); + switch (ParallelType(size_t(parallel_type))) + { +#ifdef _OPENMP + case ParallelType::OpenMP: + algorithm.setParallelType(ParallelType::OpenMP); + algorithm.setOmpThreadNum(vpar_args[0]); + break; +#endif + default: + algorithm.setParallelType(ParallelType::SerialOnly); + break; + } + + algorithm.setIsWqda(method); + + try + { + algorithm.run(); + } + catch(const std::exception& e) + { + stop(e.what()); + } + + List results; + results = List::create( + Named("correctRate") = algorithm.correctRate(), + Named("group") = algorithm.group(), + Named("res") = algorithm.res(), + Named("probs") = algorithm.probs(), + Named("pmax") = algorithm.pmax(), + Named("entropy") = algorithm.entropy()); + + return results; +} \ No newline at end of file diff --git a/tests/testthat/test-gwda.R b/tests/testthat/test-gwda.R new file mode 100644 index 0000000..e9e01f9 --- /dev/null +++ b/tests/testthat/test-gwda.R @@ -0,0 +1,8 @@ +data(LondonHP) +m <- NULL + +test_that("GWDA: works", { + m <<- expect_no_error({ + gwda(TYPEDETCH~FLOORSZ+UNEMPLOY, LondonHP, 64, TRUE) + }) +}) \ No newline at end of file From b21ae6c5f18ae78a9040df69e7cb253a4a7a7f9e Mon Sep 17 00:00:00 2001 From: OuGuangyu Date: Fri, 6 Jun 2025 21:51:02 +0800 Subject: [PATCH 2/3] add: omp test and print format --- NAMESPACE | 1 + R/gwda.R | 61 ++++++++++++++++++++++++++++++++++++++ man/print.Rd | 9 ++++-- tests/testthat/test-gwda.R | 17 +++++++++-- 4 files changed, 83 insertions(+), 5 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 7e717b8..5f9f95e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,7 @@ S3method(plot,modelselcritl) S3method(predict,gwrm) S3method(print,gtdrm) S3method(print,gwavgm) +S3method(print,gwdam) S3method(print,gwrm) S3method(print,gwrmultiscalem) S3method(residuals,gtdrm) diff --git a/R/gwda.R b/R/gwda.R index 36aef5c..d1d6535 100644 --- a/R/gwda.R +++ b/R/gwda.R @@ -113,3 +113,64 @@ gwda <- function( class(gwdam) <- "gwdam" gwdam } + +#' Print description of a `gwdam` object +#' +#' @param x An `gwdam` object returned by [gwr_basic()]. +#' @param decimal_fmt The format string passing to [base::sprintf()]. +#' @inheritDotParams print_table_md +#' +#' @method print gwdam +#' @rdname print +#' @export +print.gwdam <- function(x, ..., decimal_fmt) { + if (!inherits(x, "gwdam")) { + stop("It's not a 'gwdam' object.") + } + + cat(" ***********************************************************************\n") + cat(" * Package GWmodel3 *\n") + cat(" ***********************************************************************\n") + cat(" * Results of Geographically Discriminant Analysis *\n") + cat(" ***********************************************************************\n") + cat("\n *********************Model Calibration Information*********************\n") + + cat(" Formula:", deparse(x$call$formula), fill = T) + cat(" Data:", deparse(x$call$data), fill = T) + cat(" Method:", x$args$method, fill = T) + cat(" Number of summary points:", nrow(x$args$x), fill = T) + cat(" Kernel function:", x$args$kernel, fill = T) + cat(" Bandwidth:", x$args$bw, + ifelse(x$args$adaptive, "(Nearest Neighbours)", "(Meters)"), + fill = T + ) + distance_type <- "Euclidean" + if (x$args$longlat) { + distance_type <- "Geodetic" + } else if (x$args$p == 2) { + distance_type <- "Euclidean" + } else if (x$args$p == 1) { + distance_type <- "Manhattan" + } else if (is.infinite(x$args$p)) { + distance_type <- "Chebyshev" + } else { + distance_type <- "Generalized Minkowski" + } + distance_rotated <- (x$args$theta != 0 && x$args$p != 2 && !x$args$longlat) + cat(" Distance:", distance_type, ifelse(distance_rotated, " (rotated)", ""), fill = T) + res <- st_drop_geometry(x$SDF) + group_counts <- as.data.frame(table(res$groups)) + cat(" Discrimination Result:", fill = T) + colnames(group_counts) <- c("Group", "Count") + output <- capture.output(print(group_counts, row.names = FALSE)) + output <- paste0(" ", output) + cat(output, sep = "\n") + + cat("\n ***********************Local Summary Statistics************************", fill = T) + numeric_res <- res[sapply(res, is.numeric)] + df <- as.data.frame(t(sapply(numeric_res, summary))) + output <- capture.output(print(df)) + output <- paste0(" ", output) + cat(output, sep = "\n") + cat(" ***********************************************************************\n") +} \ No newline at end of file diff --git a/man/print.Rd b/man/print.Rd index af43816..11539ab 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -1,9 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gtdr.R, R/gwaverage.R, R/gwr_basic.R, +% Please edit documentation in R/gtdr.R, R/gwaverage.R, R/gwda.R, R/gwr_basic.R, % R/gwr_multiscale.R \name{print.gtdrm} \alias{print.gtdrm} \alias{print.gwavgm} +\alias{print.gwdam} \alias{print.gwrm} \alias{print.gwrmultiscalem} \title{Print description of a \code{gtdrm} object} @@ -12,6 +13,8 @@ \method{print}{gwavgm}(x, ..., decimal_fmt) +\method{print}{gwdam}(x, ..., decimal_fmt) + \method{print}{gwrm}(x, decimal_fmt = "\%.3f", ...) \method{print}{gwrmultiscalem}(x, decimal_fmt = "\%.3f", ...) @@ -22,7 +25,7 @@ \item{decimal_fmt}{The format string passing to \code{\link[base:sprintf]{base::sprintf()}}.} \item{...}{ - Arguments passed on to \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}} + Arguments passed on to \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}}, \code{\link[=print_table_md]{print_table_md}} \describe{ \item{\code{col.sep}}{Column seperator. Default to \code{""}.} \item{\code{header.sep}}{Header seperator. Default to \code{"-"}.} @@ -39,6 +42,8 @@ Print description of a \code{gtdrm} object Print description of a \code{gwavgm} object +Print description of a \code{gwdam} object + Print description of a \code{gwrm} object Print description of a \code{gwrmultiscalem} object diff --git a/tests/testthat/test-gwda.R b/tests/testthat/test-gwda.R index e9e01f9..774c698 100644 --- a/tests/testthat/test-gwda.R +++ b/tests/testthat/test-gwda.R @@ -1,8 +1,19 @@ data(LondonHP) -m <- NULL -test_that("GWDA: works", { - m <<- expect_no_error({ +test_that("GWDA: wqda", { + m1 <<- expect_no_error({ gwda(TYPEDETCH~FLOORSZ+UNEMPLOY, LondonHP, 64, TRUE) }) +}) + +test_that("GWDA: wlda", { + m2 <<- expect_no_error({ + gwda(TYPEDETCH~FLOORSZ+UNEMPLOY, LondonHP, 64, TRUE, method = "wlda") + }) +}) + +test_that("GWDA: omp", { + expect_no_error({ + gwda(TYPEDETCH~FLOORSZ+UNEMPLOY, LondonHP, 64, TRUE, parallel_method = "omp", parallel_arg = 2) + }) }) \ No newline at end of file From 6280b228800d0b95cdfae67c66cbca785c4e79cb Mon Sep 17 00:00:00 2001 From: zyy <2711245442@qq.com> Date: Thu, 26 Jun 2025 20:56:54 +0800 Subject: [PATCH 3/3] Edit: R document --- R/gwda.R | 6 +++++- man/gwda.Rd | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/R/gwda.R b/R/gwda.R index d1d6535..3835453 100644 --- a/R/gwda.R +++ b/R/gwda.R @@ -1,4 +1,4 @@ -#' Geographically Weighted Summary Statistics +#' Geographically Weighted Discriminant Analysis #' #' @param formula Regresison model. #' @param data A `sf` objects. @@ -10,6 +10,10 @@ #' @param p Power of the Minkowski distance, #' default to 2, i.e., Euclidean distance. #' @param theta Angle in radian to roate the coordinate system, default to 0. +#' @param method Discriminant method for GWDA, can be set as +#' - `wqda`, weighted quadratic discriminant analysis +#' - `wlda`, weighted linear discriminant analysis +#' If not provided, this parameter will be set to `wqda`. #' @param parallel_method Parallel method. #' @param parallel_arg Parallel method argument. #' diff --git a/man/gwda.Rd b/man/gwda.Rd index 488b95d..4eb683e 100644 --- a/man/gwda.Rd +++ b/man/gwda.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/gwda.R \name{gwda} \alias{gwda} -\title{Geographically Weighted Summary Statistics} +\title{Geographically Weighted Discriminant Analysis} \usage{ gwda( formula, @@ -36,6 +36,13 @@ default to 2, i.e., Euclidean distance.} \item{theta}{Angle in radian to roate the coordinate system, default to 0.} +\item{method}{Discriminant method for GWDA, can be set as +\itemize{ +\item \code{wqda}, weighted quadratic discriminant analysis +\item \code{wlda}, weighted linear discriminant analysis +If not provided, this parameter will be set to \code{wqda}. +}} + \item{parallel_method}{Parallel method.} \item{parallel_arg}{Parallel method argument.} @@ -46,5 +53,5 @@ default to 2, i.e., Euclidean distance.} A \code{gwdam} object. } \description{ -Geographically Weighted Summary Statistics +Geographically Weighted Discriminant Analysis }