optraShapes | R Documentation |

The Hartigan-Wong version of the k-means algorithm uses two auxiliary algorithms: the optimal transfer stage (optra) and the quick transfer stage (qtran).

This function is the optra subroutine adapted to the shape analysis context. It is used within `HartiganShapes`

. See Hartigan and Wong (1979) for details of the original k-means algorithm and Amaral et al. (2010) for details about its adaptation to shape analysis.

optraShapes(array3D,n,c,numClust,ic1,ic2,nc,an1,an2,ncp,d,itran,live,indx)

`array3D` |
Array with the 3D landmarks of the sample objects. |

`n` |
Number of sample objects. |

`c` |
Array of centroids. |

`numClust` |
Number of clusters. |

`ic1` |
The cluster to each object belongs. |

`ic2` |
This vector is used to remember the cluster which each object is most likely to be transferred to at each step. |

`nc` |
Number of objects in each cluster. |

`an1` |
$an1(l) = nc(l) / (nc(l) - 1), l=1,...,numClust$. |

`an2` |
$an2(l) = nc(l) / (nc(l) + 1), l=1,...,numClust$. |

`ncp` |
In the optimal transfer stage, ncp(l) stores the step at which cluster l is last updated, $l=1,...,numClust$. |

`d` |
Vector of distances from each object to every centroid. |

`itran` |
itran(l) = 1 if cluster l is updated in the quick-transfer stage (0 otherwise), $l=1,...,numClust$. |

`live` |
Vector that indicates whether a cluster is included in the live set or not. |

`indx` |
Number of steps since a transfer took place. |

A list with the following elements: *c,ic1,ic2,nc,an1,an2,ncp,d,itran,live,indx*, updated after the optimal transfer stage.

This function belongs to `HartiganShapes`

and it is not solely used. That is why there is no section of *examples* in this help page.

This function is based on the optra.m file available from https://github.com/johannesgerer/jburkardt-m/tree/master/asa136.

Guillermo Vinue

Vinue, G., Simo, A., and Alemany, S., (2016). The k-means algorithm for 3D shapes with an application to apparel design, *Advances in Data Analysis and Classification* **10(1)**, 103–132.

Hartigan, J. A., and Wong, M. A., (1979). A K-Means Clustering Algorithm, *Applied Statistics*, 100–108.

Amaral, G. J. A., Dore, L. H., Lessa, R. P., and Stosic, B., (2010). k-Means Algorithm in Statistical Shape Analysis, *Communications in Statistics - Simulation and Computation* **39(5)**, 1016–1026.

Dryden, I. L., and Mardia, K. V., (1998). *Statistical Shape Analysis*, Wiley, Chichester.

`HartiganShapes`

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.