ppclp3D: 3D prbabilistic principal curve with length penalty

Description Usage Arguments Examples

View source: R/ppclp.R

Description

This function applies the probabilistic principal curve algorithm with length penalty to 3D data

Usage

1
2
ppclp3D(x, y, z, x_fix, y_fix, z_fix, K = 200, degree_free = 50,
  lambda = 100, T = 20)

Arguments

x

The coordinate of the x axis

y

The coordinate of the y axis

z

The coordinate of the z axis

x_fix

The x coordinate of the starting and endingpoint of the curve

y_fix

The y coordinate of the starting and endingpoint of the curve

z_fix

The z coordinate of the starting and endingpoint of the curve

K

the number of knots of the curve

degree_free

the degree of freedom of the B spline

lambda

The magnitude value added to the length penalty

T

The total number of iterations to do the EM algorithm

Examples

1
2
3
4
5
6
data("spectExample")
tmpCurve = ppclp3D(spectExample$x, spectExample$y, spectExample$z, spectExample$xFix, spectExample$yFix, spectExample$zFix)
plot_ly() %>% add_trace(x = spectExample$x, y = spectExample$y, z = spectExample$z, type = "scatter3d", mode = "markers", name = 'points', marker = list(size = 1, color = 'rgba(0, 0, 0, .9)', opacity = 0.4)) %>%
 add_trace(x = spectExample$xFix[1], y = spectExample$yFix[1], z = spectExample$zFix[1], type = "scatter3d", mode = "markers", name = 'A', marker = list(size = 10, color = 'rgba(0, 255, 0, .9)', opacity = 1)) %>%
 add_trace(x = spectExample$xFix[2], y = spectExample$yFix[2], z = spectExample$zFix[2], type = "scatter3d", mode = "markers", name = 'M', marker = list(size = 10, color = 'rgba(0, 0, 255, .9)', opacity = 1)) %>%
 add_trace(x = as.vector(tmpCurve$xFit), y = as.vector(tmpCurve$yFit), z = as.vector(tmpCurve$zFit), type = "scatter3d", mode = "lines", name = "theoretical line", line = list(width = 5, color = 'rgba(255, 0, 0, .9)'))

CHuanSite/ppclp documentation built on May 8, 2021, 3:21 a.m.