lpc | R Documentation |
This is the main function which computes the actual local principal curve, i.e. a sequence of local centers of mass.
lpc(X, h, t0 = mean(h), x0, way = "two", scaled = 1,
weights=1, pen = 2, depth = 1, control=lpc.control())
X |
data matrix with |
h |
bandwidth. May be either specified as a single number, then the same bandwidth is used in
all dimensions, or as a |
t0 |
scalar step length. Default setting is |
x0 |
specifies the choice of starting points. The default
choice |
way |
"one": go only in direction of the first local eigenvector, "back": go only in opposite direction, "two": go from starting point in both directions. |
scaled |
if 1 (or |
weights |
a vector of observation weights (can also be used to exclude individual observations from the computation by setting their weight to zero.) |
pen |
power used for angle penalization (see [1]). If set to 0, the angle penalization is switched off. |
depth |
maximum depth of branches ( |
control |
Additional parameters steering particularly the starting-, boundary-, and convergence
behavior of the fitted curve. See |
A list of items:
LPC |
The coordinates of the local centers of mass of the fitted principal curve. |
Parametrization |
Curve parameters and branch labels for each local center of mass. |
h |
The bandwidth used for the curve estimation. |
to |
The constant |
starting.points |
The coordinates of the starting point(s) used. |
data |
The data frame used for curve estimation. |
scaled |
the user-supplied value, could be boolean or numerical |
weights |
The vector of weights used for curve estimation. |
control |
The settings used in |
Misc |
Miscellanea. |
All values provided in the output refer to the scaled data, unless scaled=0
or (equivalently) scaled=FALSE
. Use unscale
to convert the results back to the original data scale.
The default option scaled=1
or scaled=TRUE
scales the data by dividing each variable through their
range (differing from the scaling through
the standard deviation as common e.g. for PCA). The setting scaled=2
, and in fact all other settings scaled>0
, will scale the data by their standard deviation.
If scaled=1
or if no scaling is applied, then the default bandwidth setting is 10 percent of the data range in each direction. If the data are scaled through the standard deviation, then the default setting is 40 percent of the standard deviation in each direction.
J. Einbeck and L. Evers. See LPCM-package
for further acknowledgements.
[1] Einbeck, J., Tutz, G., & Evers, L. (2005). Local principal curves. Statistics and Computing 15, 301-313.
[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=0)
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=0)
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=0)
plot(lpc.e1, type=c("curve","mass", "start"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.