Description Usage Arguments Value Author(s) References Examples

The local pivotal method provides a way to perform balanced sampling. This implementation replace linear searches in lpm2, with k-d trees. K-d trees are binary trees used to effectively search high dimensional spaces, and reduce the average computational complexity of lpm2 from O(N^2) to O(N log(N)). Both nearest neighbor and approximate nearest neighbor searching algorithms are provided.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
lpm2_kdtree(
prob,
x,
m=40,
algorithm = "kdtree",
maxCheck = 4,
termDist = 0.1,
inOrder = FALSE,
resample = 1,
probTree = FALSE,
returnTree = FALSE,
returnBounds = FALSE
)
``` |

`prob` |
An array of length N such that the sum of prob is equal to the sample size,
where the N is the number of rows of |

`x` |
A matrix of N rows and p columns, each row is assumed to be a sampling unit. |

`m` |
Max leaf size used as a terminal condition for building the k-d tree. When
probTree is |

`algorithm` |
The algorithm used to search the k-d tree. The algorithms include "kdtree", "kdtree-count", and "kdtree-dist". The "kdtree" algorithm reproduces the lpm2 using a k-d tree for nearest neighbor search. "kdtree-count" and "kdtree-dist" use approximate nearest neighor searches based on number of nodes to check and minimal sufficient distance respectfully. |

`maxCheck` |
A positive integer scalar parameter only used when the algorithm "kdtree-count" is specified. This parameter is the maximum number of non-empty leaf nodes to check for a nearest neighbor. |

`termDist` |
A positive valued scalar parameter only used when the algorithm "kdtree-dist" is specified. This parameter specifies a minimal sufficient distance to be considered a nearest neighbor. No tie handling is performed; the first nearest neighbor found will be used. |

`inOrder` |
A boolean value, |

`resample` |
The number of samples to return. Resampling builds the k-d tree exactly once for all samples. Each sample will be a distinct column in a matrix. |

`probTree` |
A boolean value, |

`returnTree` |
A boolean value, |

`returnBounds` |
A boolean value, |

A vector of selected indexes from the matrix x. If using default values for `inOrder`

,
`resample`

, and `algorithm`

, the results identical to the lpm2 function when no
ties exist in the distance function exist. `inOrder=TRUE`

will return results in order
of selection, and `resample > 1`

will return a matrix with each set of samples returned
as a column vector.

A list is returned includiing this vector if returnTree or returnBounds is set to TRUE.

Jonathan Lisic

Lisic, L. and Cruze, N. (2016). Local Pivotal Methods for Large Surveys. In proceedings, ICES V, Geneva Switzerland 2016.

1 2 3 4 5 6 7 8 9 |

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.