
lpc(X, h, t0 = mean(h), x0, way = "two", scaled = TRUE,
weights=1, pen = 2, depth = 1, control=lpc.control())
scaled =TRUE
then t0=h
, if h
is a scalar, and t0=mean(h)
, if h
is a vector.x0=1
will select one suitable starting point automatically (in
form of a local density mode). The second built-in option x0=0
will
use all local density modlpc.control
.lpc.control()
[2] Einbeck, J., Tutz, G., & Evers, L. (2005): Exploring Multivariate Data Structures with Local Principal Curves. In: Weihs, C. and Gaul, W. (Eds.): Classification - The Ubiquitous Challenge. Springer, Heidelberg, pages 256-263.
data(calspeedflow)
lpc1 <- lpc(calspeedflow[,3:4])
plot(lpc1)
data(mussels, package="dr")
lpc2 <- lpc(mussels[,-3], x0=as.numeric(mussels[49,-3]),scaled=FALSE)
plot(lpc2, curvecol=2)
data(gaia)
s <- sample(nrow(gaia),200)
gaia.pc <- princomp(gaia[s,5:20])
lpc3 <- lpc(gaia.pc$scores[,c(2,1,3)],scaled=FALSE)
plot(lpc3, curvecol=2, type=c("curve","mass"))
# Simulated letter 'E' with branched LPC
ex<- c(rep(0,40), seq(0,1,length=20), seq(0,1,length=20), seq(0,1,length=20))
ey<- c(seq(0,2,length=40), rep(0,20), rep(1,20), rep(2,20))
sex<-rnorm(100,0,0.01); sey<-rnorm(100,0,0.01)
eex<-rnorm(100,0,0.1); eey<-rnorm(100,0,0.1)
ex1<-ex+sex; ey1<-ey+sey
ex2<-ex+eex; ey2<-ey+eey
e1<-cbind(ex1,ey1); e2<-cbind(ex2,ey2)
lpc.e1 <- lpc(e1, h= c(0.1,0.1), depth=2, scaled=FALSE)
plot(lpc.e1, type=c("curve","mass", "start"))
Run the code above in your browser using DataLab