Class GWRBase

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class GWRBase : public gwm::SpatialMonoscaleAlgorithm, public gwm::IRegressionAnalysis

Interface for monoscale geographically weighted regression algorithm. This class provides some commmon interfaces of geographically weighted regression algorithm. It could not be constructed.

Subclassed by gwm::GTWR, gwm::GWRBasic, gwm::GWRGeneralized, gwm::GWRLocalCollinearity, gwm::GWRScalable

Public Functions

inline GWRBase()

Construct a new CGwmGWRBase object.

inline GWRBase(const arma::mat &x, const arma::vec &y, const SpatialWeight &spatialWeight, const arma::mat &coords)

Construct a new CGwmGWRBase object.

Parameters:
  • x – Independent variables.

  • y – Dependent variable.

  • spatialWeight – Spatial weighting configuration.

  • coords – Coordinate matrix.

inline ~GWRBase()

Destroy the CGwmGWRBase object.

inline const arma::mat &betas() const

Get coefficient estimates.

Returns:

arma::mat Coefficient estimates.

inline virtual const arma::vec &dependentVariable() const override

Get the Dependent Variable object.

Returns:

arma::vec Dependent Variable.

inline virtual void setDependentVariable(const arma::vec &y) override

Set the Dependent Variable object.

Parameters:

y

inline virtual const arma::mat &independentVariables() const override

Get the Independent Variables object.

Returns:

arma::mat Independent Variables.

inline virtual void setIndependentVariables(const arma::mat &x) override

Set the Independent Variables object.

Parameters:

x

inline virtual bool hasIntercept() const override

Get whether has intercept.

Returns:

true if has intercept.

Returns:

false if doesnot has intercept.

inline virtual void setHasIntercept(const bool has) override

Set the Has Intercept object.

Parameters:

has – true if has intercept, otherwise false.

inline virtual RegressionDiagnostic diagnostic() const override

Get diagnostic information.

Returns:

RegressionDiagnostic Diagnostic information.

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.

Public Static Functions

static inline arma::vec Fitted(const arma::mat &x, const arma::mat &betas)

Calculate fitted values of dependent varialbe by given \(X\) and \(\beta\).

Parameters:
  • x – Independent variables \(X\).

  • betas – Coefficient estimates \(\beta\).

Returns:

vec Fitted values of dependent varialbe.

static inline double RSS(const arma::mat &x, const arma::mat &y, const arma::mat &betas)

Calculate sum of squared residuals by given \(X\), \(y\), and \(\beta\).

Parameters:
  • x – Independent variables \(X\).

  • y – Dependent variable \(y\).

  • betas – Coefficient estimates \(\beta\).

Returns:

double Sum of squared residuals.

static inline double AICc(const arma::mat &x, const arma::mat &y, const arma::mat &betas, const arma::vec &shat)

Calculate AICc value according to given \(X\), \(y\), \(\beta\), \(tr(S)\) and \(tr(SS^T)\).

Parameters:
  • x – Independent variables \(X\).

  • y – Dependent variable \(y\).

  • betas – Coefficient estimates \(\beta\).

  • shat – A vector of 2 elements: \(tr(S)\) and \(tr(SS^T)\).

Returns:

double AICc value.

Protected Attributes

arma::mat mX

Independent variables \(X\).

arma::vec mY

Dependent varialbe \(y\).

arma::mat mBetas

Coefficient estimates \(\beta\).

bool mHasIntercept = true

Indicator of whether has intercept or not.

RegressionDiagnostic mDiagnostic

Diagnostic information.