# NOT RUN {
library(rgl)
library(sphereplot)
library(geosphere)
#### example 2: waveform data
n <- 200
alpha <- 1/3; freq <- 4 # amplitude and frequency of wave
sigma1 <- 2; sigma2 <- 10 # noise levels
lon <- seq(-180, 180, length.out = n) # uniformly sampled longitude
lat <- alpha * 180/pi * sin(freq * lon * pi/180) + 10. # latitude vector
## add Gaussian noises on latitude vector
lat1 <- lat + sigma1 * rnorm(length(lon)); lat2 <- lat + sigma2 * rnorm(length(lon))
wave1 <- cbind(lon, lat1); wave2 <- cbind(lon, lat2)
## implement SPC to the (noisy) waveform data
# }
# NOT RUN {
SPC(wave1, q = 0.05)
# }
# NOT RUN {
SPC(wave2, q = 0.05)
# }
# NOT RUN {
#### example 1: earthquake data
data(Earthquake)
names(Earthquake)
earthquake <- cbind(Earthquake$longitude, Earthquake$latitude)
# }
# NOT RUN {
SPC(earthquake, q = 0.1)
## options 1: plot the projection lines (use option of plot.proj = TRUE)
SPC(earthquake, q = 0.1, plot.proj = TRUE)
## option 2: open principal curves (use option of deletePoints = TRUE)
SPC(earthquake, q = 0.04, deletePoints = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab