help anymatch

-------------------------------------------------------------------------------

Title

anymatch -- distance matching based on any metric

Syntax

anymatch [varlist], id( ) metric( ) [options]

Description

anymatch provides a fast and easy way to perform distance matching based on any metric of choice. It mathces identifiers or attributes from one to another based on the metric distance. It also counts the number of nearest observations that lay within a certain metric distance.

anymatch is also capable of sibling matching, extracting id and attributes of siblings within a family.

Options

+------+ ----+ Main +-------------------------------------------------------------

id(varname) unique identifiers. They cannot be missing.

metric(varname) any metric of choice.

donor(varname) an indicator for donor. Neighbors will be found for them. The default is 1 for everyone.

recipient(varname) an indicator for recipients. They are candidate to be someone's neighbor. The default is 1 for everyone.

nearest(#) the number of nearest neighbors to be found. nearest(.) will make it look until it runs out of potential neighbors. The default is 5.

minimum(#) the minimum distance in the metric provided.

maximum(#) the maximum distance in the metric provided.

count count the number of neighbors within the area upto nearest(#)

noisily display the progress on the screen.

+--------------+ ----+ Nomenclature +-----------------------------------------------------

dist( ) name of variables to contain distances/differences. The default is "dist"

count( ) name of variable to contain the number of neighbors. The default is "count".

prefix( ) prefix. The default is "_".

suffix( ) non-index suffix before the indices. The default is none.

Hints

If you have more than one datasets, they need to be appeneded into one dataset. They should have the same name for metric so that it will appear in the same column.

Use donor( ) option to indicate the potential pool from which a match will be found. See an example below.

Use recipient( ) option to indicate locations for which a match will be found. See an example below.

Use noisily option to see the progress on the screen.

Examples

* suggestions on how to create unique identifier gen id = _n egen id = group(state county)

* The nearest price and the difference from it sysuse auto, clear gen id=_n keep price id anymatch price, id(id) metric(price) near(1) dist(price_diff) browse

* sibling matching with family id as metric and the maximum distance of 0 sysuse auto, clear ren mpg family ren price income gen id=_n sort family id keep family id income anymatch income, id(id) met(family) max(0) near(10) browse

Remarks

minimum( ) and maximum( ) are inclusive, i.e. >= and <=. Conflicts between options should be reported with detailed examples to the address below.

Author

Roy Wada roywada@hotmail.com