```help moremata
-------------------------------------------------------------------------------

Title

moremata -- Various Mata functions

Contents

Online
help entry       Function           Purpose
---------------------------------------------------------------------------

+------------------+
---| Scalar functions |----------------------------------------------------
+------------------+

mm_kern()        mm_kern()          various kernel functions
mm_kint()          kernel integral functions
mm_kdel0()         canonical bandwidth of kernel

+-----------------------+
---| Statistical functions |-----------------------------------------------
+-----------------------+

Quantiles, ranks, frequencies, & summary statistics

mm_quantile()    mm_quantile()      quantile function
mm_median()        median
mm_iqrange()       inter-quartile range

mm_ecdf()        mm_ecdf()          cumulative distribution function
mm_ranks()         ranks/cumulative frequencies

mm_freq()        mm_freq()          compute frequency counts

mm_histogram()   mm_histogram()     produce histogram data

mm_mgof()        mm_mgof()          multinomial goodness-of-fit tests

mm_collapse()    mm_collapse()      summary statistics by subgroups
_mm_collapse()     summary statistics by subgroups

mm_gini()        mm_gini()          Gini coefficient

Sampling, resampling, & combinations

mm_sample()      mm_sample()        draw random sample
mm_srswr()         SRS with replacement
mm_srswor()        SRS without replacement
mm_upswr()         UPS with replacement
mm_upswor()        UPS without replacement

mm_bs()          mm_bs()            bootstrap estimation
mm_bs2()           bootstrap estimation
mm_bs_report()     report bootstrap results

mm_jk()          mm_jk()            jackknife estimation
mm_jk_report()     report jackknife results

mm_subset()      mm_subset()        obtain subsets, one at a time
mm_composition()   obtain compositions, one by one
mm_ncompositions() determine number of compositions
mm_partition()     obtain partitions, one at a time
mm_npartitionss()  determine number of partitions
mm_rsubset()       draw random subset
mm_rcomposition()  draw random composition

Means, variances, & correlations

mm_colvar()      mm_colvar()        variance, by column
mm_meancolvar()    mean and variance, by column
mm_variance0()     population variance
mm_meanvariance0() mean and population variance
mm_mse()           mean squared error
mm_colmse()        mean squared error, by column
mm_sse()           sum of squared errors
mm_colsse()        sum of squared errors, by column

Densities & distributions

mm_benford()     mm_benford()       Benford distribution

mm_cauchy()      mm_cauchy()        cumulative Cauchy-Lorentz dist.
mm_cauchyden()     Cauchy-Lorentz density
mm_cauchytail()    reverse cumulative Cauchy-Lorentz
mm_invcauchy()     inverse cumulative Cauchy-Lorentz

mm_rbinomial()   mm_rbinomial()     generate binomial random numbers
mm_cebinomial()    cond. expect. of binomial r.v.

+------------------------------+
---| Other mathematical functions |----------------------------------------
+------------------------------+

mm_root()        mm_root()          Brent's univariate zero finder

mm_nrroot()      mm_nrroot()        Newton-Raphson zero finder

mm_finvert()     mm_finvert()       univariate function inverter

+---------------------+
---| Graphical functions |-------------------------------------------------
+---------------------+

mm_plot()        mm_plot()          Draw twoway plot
_mm_plot()         Draw twoway plot

+--------------------------+
---| Matrix utility functions |--------------------------------------------
+--------------------------+

mm_panels()      mm_panels()        identify nested panel structure
_mm_panels()       identify panel sizes
mm_npanels()       identify number of panels

mm_nunique()     mm_nunique()       count number of distinct values
mm_nuniqrows()     count number of unique rows

mm_isconstant()  mm_isconstant()    whether matrix is constant

mm_nobs()        mm_nobs()          number of observations

mm_colrunsum()   mm_colrunsum()     running sum of each column

mm_linbin()      mm_linbin()        linear binning
mm_fastlinbin()    fast linear binning
mm_exactbin()      exact binning
mm_makegrid()      equally spaced grid points

mm_cut()         mm_cut()           categorize data vector

mm_posof()       mm_posof()         find element in vector

mm_which()       mm_which()         positions of nonzero elements

mm_locate()      mm_locate()        search an ordered vector
mm_hunt()          consecutive search

mm_ipolate()     mm_ipolate()       linear interpolation

mm_polint()      mm_polint()        polynomial inter-/extrapolation

+-------------------------------+
---| Matrix manipulation functions |---------------------------------------
+-------------------------------+

mm_cond()        mm_cond()          matrix conditional operator

mm_expand()      mm_expand()        duplicate single rows/columns
_mm_expand()       duplicate rows/columns in place
mm_repeat()        duplicate contents as a whole
_mm_repeat()       duplicate contents in place

mm_unorder2()    mm_unorder2()      stable version of unorder()
mm_jumble2()       stable version of jumble()
mm__jumble2()      stable version of _jumble()

+------------------+
---| String functions |----------------------------------------------------
+------------------+

mm_pieces()      mm_pieces()        break string into pieces
mm_npieces()       count number of pieces
_mm_npieces()      count number of pieces

mm_invtokens()   mm_invtokens()     reverse of tokens()

mm_realofstr()   mm_realofstr()     convert string into real

mm_strexpand()   mm_strexpand()     expand string argument

+---------------+
---| I/O functions |-------------------------------------------------------
+---------------+

mm_matlist()     mm_matlist()       display a (real) matrix

+-----------------------+
---| Programming functions |-----------------------------------------------
+-----------------------+

mm_callf()       mm_callf()         pass optional args to function
mm_callf_setup()   setup for mm_callf()
---------------------------------------------------------------------------

Description

The functions above are general-purpose add-ons to official Mata.

Author

Ben Jann, ETH Zurich, jannb@ethz.ch

The Cauchy-Lorentz distribution functions were provided by Christopher F
Baum, Boston College.

Thanks for citing this software as follows:

Jann, B. 2005. moremata: Stata module (Mata) to provide various
functions. Available from
http://ideas.repec.org/c/boc/bocode/s455001.html.

Also see

```