The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Geographically Weighted Non-Negative Principal Components Analysis
Version: 0.0.5
Description: Implements a geographically weighted non-negative principal components analysis, which consists of the fusion of geographically weighted and sparse non-negative principal components analyses <doi:10.17608/k6.auckland.9850826.v1>.
License: GPL (≥ 3)
URL: https://github.com/naru-T/GWnnegPCA
BugReports: https://github.com/naru-T/GWnnegPCA/issues
Depends: R (≥ 3.5.0)
Imports: geodist, methods, nsprcomp, sf
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
RoxygenNote: 7.3.2
SystemRequirements: C++11, GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0)
NeedsCompilation: no
Packaged: 2025-02-05 13:20:19 UTC; nt
Author: Narumasa Tsutsumida ORCID iD [aut, cre]
Maintainer: Narumasa Tsutsumida <rsnaru.jp@gmail.com>
Repository: CRAN
Date/Publication: 2025-02-05 13:40:05 UTC

Geographically Weighted Non-negative Principal Component Analysis

Description

Implementation of geographically weighted non-negative principal component analysis, which consists of the fusion of GWPCA and sparse non-negative PCA.

Usage

gw_nsprcomp(
  data,
  elocat,
  vars,
  bw,
  k = 2,
  kernel = "gaussian",
  adaptive = TRUE,
  p = 2,
  theta = 0,
  longlat = FALSE,
  geodisic_measure = "cheap",
  dMat = NULL,
  n.obs = NA,
  n.iter = 1,
  ncomp = k,
  nneg = TRUE,
  localcenter = TRUE,
  localscale = FALSE,
  ...
)

Arguments

data

An sf object containing the spatial data and attributes for analysis

elocat

Two-column numeric array or sf object for providing evaluation locations

vars

Character vector of variable names to be used in the analysis

bw

Bandwidth used in the weighting function

k

The number of retained components (default: 2)

kernel

Kernel function type: "gaussian", "exponential", "bisquare", "tricube", or "boxcar"

adaptive

If TRUE, calculate adaptive kernel (default: TRUE)

p

Power of the Minkowski distance (default: 2)

theta

Angle in radians to rotate coordinate system (default: 0)

longlat

If TRUE, great circle distances will be calculated (default: FALSE)

geodisic_measure

Method for geodesic distance calculation (default: "cheap")

dMat

Pre-specified distance matrix (default: NULL)

n.obs

Number of observations for correlation matrix (default: NA)

n.iter

Number of bootstrap iterations (default: 1)

ncomp

Number of principal components to compute (default: k)

nneg

If TRUE, constrain loadings to be non-negative (default: TRUE)

localcenter

If TRUE, center local weighted x (default: TRUE)

localscale

If TRUE, scale local weighted x (default: FALSE)

...

Additional arguments passed to methods

Value

A list containing:

loadings

The localized loadings matrix

score

The PC score matrix from the localized non-negative PCA

sdev

The localized standard deviation vector of the principal components

Examples

# Read North Carolina SIDS data from sf package
nc <- sf::st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)

# Scale selected variables for analysis
vars_to_use <- c("SID74", "NWBIR74", "BIR74")
Data.scaled <- scale(as.matrix(sf::st_drop_geometry(nc[, vars_to_use])))

# Create sf object with scaled data
nc_scaled <- nc
nc_scaled[vars_to_use] <- Data.scaled

gwnnegpca_ans <- gw_nsprcomp(
  data = nc_scaled,
  vars = vars_to_use,
  bw = 0.25,
  k = 3,
  longlat = TRUE,
  kernel = "bisquare",
  adaptive = TRUE,
  nneg = TRUE,
  geodisic_measure = "geodesic"
)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.