Class GWSS
Defined in File GWSS.h
Inheritance Relationships
Base Types
public gwm::SpatialMonoscaleAlgorithm
(Class SpatialMonoscaleAlgorithm)public gwm::IMultivariableAnalysis
(Struct IMultivariableAnalysis)public gwm::IParallelizable
(Struct IParallelizable)public gwm::IParallelOpenmpEnabled
(Struct IParallelOpenmpEnabled)
Class Documentation
-
class GWSS : public gwm::SpatialMonoscaleAlgorithm, public gwm::IMultivariableAnalysis, public gwm::IParallelizable, public gwm::IParallelOpenmpEnabled
The class for Geographically Weighted Summary Statistics. Geographically Weighted Summary Statistics is an algorithm for calculating local weighted statistics. They are local mean, local standard deviation, local variance, local skewness, local coefficients of variation, local covariances, local correlations (Pearson’s), local correlations (Spearman’s), local medians, local interquartile ranges, local quantile imbalances and coordinates. To get these matrices, call these functions:
local mean <- GWSS::localMean()
local standard deviation <- GWSS::localSDev()
local variance <- GWSS::localVar()
local skewness <- GWSS::localSkewness()
local coefficients of variation <- GWSS::localCV()
local covariances <- GWSS::localCov()
local correlations (Pearson’s) <- GWSS::localCorr()
local correlations (Spearman’s) <- GWSS::localSCorr()
local medians <- GWSS::localMedian()
local interquartile ranges <- GWSS::iqr()
local quantile imbalances and coordinates <- GWSS::qi()
Public Types
Public Functions
-
inline GWSS(const arma::mat x, const arma::mat coords, const SpatialWeight &spatialWeight)
Construct a new GWSS object.
-
inline bool quantile() const
Get whether use quantile algorithms. if use quantile algorithms if not to use quantile algorithms.
-
inline void setQuantile(bool quantile)
Get whether use quantile algorithms. Whether use quantile algorithms.
-
inline bool isCorrWithFirstOnly() const
Get whether calculate correlation between the first variable and others. Yes No.
-
inline void setIsCorrWithFirstOnly(bool corrWithFirstOnly)
Set whether calculate correlation between the first variable and others. Whether calculate correlation between the first variable and others.
-
inline const arma::mat &localMean() const
Get local mean on each sample. Local mean on each sample.
-
inline const arma::mat &localSDev() const
Get local standard deviation on each sample. Local standard deviation on each sample.
-
inline const arma::mat &localSkewness() const
Get local skewness on each sample. Local skewness on each sample.
-
inline const arma::mat &localCV() const
Get local coefficients of variation on each sample. Local coefficients of variation on each sample.
-
inline const arma::mat &localVar() const
Get local variance on each sample. Local variance on each sample.
-
inline const arma::mat &localMedian() const
Get local median on each sample. Local median on each sample.
-
inline const arma::mat &iqr() const
Get local interquartile ranges on each sample. Local interquartile ranges on each sample.
-
inline const arma::mat &qi() const
Get local quantile imbalances and coordinates on each sample. Local quantile imbalances and coordinates on each sample.
-
inline const arma::mat &localCov() const
Get local coefficients of variation on each sample. Local coefficients of variation on each sample. If corrWithFirstOnly is set true, the number of columns is the (number of fields) - 1; if not, the number of columns is the (((number of fields) - 1) * (number of fields)) / 2. For variables \(v_1, v_2, v_3, ... , v_{k-1}, v_k\), the fields are arranged as: \(cov(v_1,v_2), cov(v_1,v_3), ... , cov(v_1,v_k), cov(v_2,v_3), ... , cov(v_2,v_k), ... , cov(v_{k-1},vk)\).
-
inline const arma::mat &localCorr() const
Get local correlations (Pearson’s) on each sample. Local correlations (Pearson’s) on each sample. If corrWithFirstOnly is set true, the number of columns is the (number of fields) - 1; if not, the number of columns is the (((number of fields) - 1) * (number of fields)) / 2. For variables \(v_1, v_2, v_3, ... , v_{k-1}, v_k\), the fields are arranged as: \(corr(v_1,v_2), corr(v_1,v_3), ... , corr(v_1,v_k), corr(v_2,v_3), ... , corr(v_2,v_k), ... , corr(v_{k-1},vk)\).
-
inline const arma::mat &localSCorr() const
Get local correlations (Spearman’s) on each sample. Local correlations (Spearman’s) on each sample. If corrWithFirstOnly is set true, the number of columns is the (number of fields) - 1; if not, the number of columns is the (((number of fields) - 1) * (number of fields)) / 2. For variables \(v_1, v_2, v_3, ... , v_{k-1}, v_k\), the fields are arranged as: \(corr(v_1,v_2), corr(v_1,v_3), ... , corr(v_1,v_k), corr(v_2,v_3), ... , corr(v_2,v_k), ... , corr(v_{k-1},vk)\).
-
virtual bool isValid() override
Check whether the algorithm’s configuration is valid.
- Returns:
true if the algorithm’s configuration is valid.
- Returns:
false if the algorithm’s configuration is invalid.
-
inline virtual const arma::mat &variables() const override
Get variables.
- Returns:
Vector of variables.
-
inline virtual void setVariables(const arma::mat &x) override
set variables variables for gwss
-
virtual void run() override
Run analysis algorithm.
-
inline virtual int parallelAbility() const override
Return the parallel ability of this algorithm.
- Returns:
Bitwise OR of aviliable parallel types of this algorithm.
-
inline virtual ParallelType parallelType() const override
Return the parallel type of this algorithm.
- Returns:
Parallel type of this algorithm
-
virtual void setParallelType(const ParallelType &type) override
Set the parallel type of this algorithm.
Use gwmodel_set_gwss_openmp() to set parallel type of this algorithm to ParallelType::OpenMP in shared build.
- Parameters:
type – Parallel type of this algorithm.
-
inline virtual void setOmpThreadNum(const int threadNum) override
Set the thread numbers while paralleling.
Use gwmodel_set_gwss_openmp() to set this property in shared build.
- Parameters:
threadNum – Number of threads.
-
void updateCalculator()
Update calculator function according to parallel type and mode.
Public Static Functions
-
static inline double covwt(const arma::mat &x1, const arma::mat &x2, const arma::vec &w)
Calculate weighted covariances for two matrices. Matrix \( X_1 \) Matrix \( X_2 \) Weight vector \( w \) Weighted covariances.
\[ cov(X_1,X_2) = \frac{\sum_{i=1}^n w_i(x_{1i} - \bar{x}_1) \sum_{i=1}^n w_i(x_{2i} - \bar{x}_2)}{1 - \sum_{i=1}^n w_i} \]
-
static inline double corwt(const arma::mat &x1, const arma::mat &x2, const arma::vec &w)
Calculate weighted correlation for two matrices. Matrix \( X_1 \) Matrix \( X_2 \) Weight vector \( w \) Weighted correlation.
\[ corr(X_1,X_2) = \frac{cov(X_1,X_2)}{\sqrt{cov(X_1,X_1) cov(X_2,X_2)}} \]加权相关系数\[ corr(X_1,X_2) = \frac{cov(X_1,X_2)}{\sqrt{cov(X_1,X_1) cov(X_2,X_2)}} \]
-
static arma::vec del(arma::vec x, arma::uword rowcount)
-
static inline arma::vec rank(arma::vec x)
Protected Static Functions
-
static arma::vec findq(const arma::mat &x, const arma::vec &w)