Learn R Programming

spherepc (version 0.1.7)

ExtrinsicMean: Finding Extrinsic Mean

Description

This function identifies the extrinsic mean of data on the unit 2-sphere.

Usage

ExtrinsicMean(data, weights = rep(1, nrow(data)))

Arguments

data

matrix or data frame consisting of spatial locations with two columns. Each row represents longitude and latitude (denoted by degrees).

weights

vector of weights.

Value

two-dimensional vector.

Details

This function identifies the extrinsic mean of data.

References

Jongmin Lee, Jang-Hyun Kim and Hee-Seok Oh. (2021). Spherical Principal Curves. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43, 2165-2171. <doi.org/10.1109/TPAMI.2020.3025327>. Jang-Hyun Kim, Jongmin Lee and Hee-Seok Oh. (2020). Spherical Principal Curves <arXiv:2003.02578>.

See Also

IntrinsicMean.

Examples

Run this code
# NOT RUN {
#### comparison of Intrinsic mean and extrinsic mean.
#### example: noisy circular data set.
library(rgl)
library(sphereplot)
library(geosphere)
n <- 500                  # the number of samples.
x <- 360 * runif(n) - 180
sigma <- 5
y <- 60 + sigma * rnorm(n)
simul.circle <- cbind(x, y)
data <- simul.circle
In.mean <- IntrinsicMean(data)
Ex.mean <- ExtrinsicMean(data)
## plot (color of data is "blue"; that of intrinsic mean is "red" and 
## that of extrinsic mean is "green".)
sphereplot::rgl.sphgrid()    
sphereplot::rgl.sphpoints(data, radius = 1, col = "blue", size = 12)
sphereplot::rgl.sphpoints(In.mean[1], In.mean[2], radius = 1, col = "red", size = 12)
sphereplot::rgl.sphpoints(Ex.mean[1], Ex.mean[2], radius = 1, col = "green", size = 12)
# }

Run the code above in your browser using DataLab