*! version 0.31

Title

matrixtools -- A set of Stata commands and Mata functions to build,
present and style Stata and Mata matrices.

Description

Commands to build, present and style Stata matrices and present data in
easy ways. And using Mata to do so.
Most of the commands relies heavily on the Mata code in lmatrixtools.mlib.
The sourcecode to lmatrixtools.mlib is in lmatrixtools.mata.

confmat
Given a binary variable for the gold standard and a binary variable for
the test confmat returns sensitivity, specificity, prevalence, accuracy,
ppv and npv (ie derived values from the confusion matrix) with confidence intervals.
When a binary grouping variable is specified in option by the
confusion matrix for each grouping values is reported as well as comparison tests.

crossmat is wrapper for tabulate.
All tables possible from tabulate are accessible as Stata
matrices.

dummynizer generates Stata dummy variables using Mata
matrix syntax.

filaby marks for each value of first variable first and
last value for second variable within a frame of maxdist.

marktop
A categorical variable is collapsed into a new variable keeping the top
most frequent and/or a subsample of old variable values as single values while
collapsing the remaining values into one value with a common label.

matprint presents Stata matrices in the log.
It has a simple but powerfull way of setting decimals cellwise.
matprint can export Stata matrices in styles smcl,
csv, latex, html and markdown. This way output from can be integrated into
documents generated by log2markup.

mat2xl convert a matrix expression into a string formatted
Mata matrix and inserts the string matrix into a sheet in an Excelbook.

matrix2stata converts a matrix into variables. The
key difference to mkmat is that roweq and rownames becomes
categorized variables, ie integervalued with a value label. The purpose is to
ease graphing matrix content.

metadata is a mesh-up of describe and
codebook. It can be used on the current file in the data window,
and using the using modifier on can specify a non-opened dataset or a
path to get a description of the contents of all datasets there.

The metadata can be saved into a dataset or styled in latex, html markdown, csv,
or smcl and saved as such.

This way output from can be integrated into documents generated by
log2markup.

onewai is immediate oneway analysis of variance similar to
oneway and loneway.
However, here all results are gathered in matrices.
Input is either a matrix of n's, means and standard deviations or n's, means
and standard deviations given separately.

regmat (regression with specified outcome) and
stregmat (stset regression date) are prefix command to a
regression template.

A regression template is simply a regression command.

Each combination of one outcome variable, one exposure variable and one
adjustment set is inserted just after the regression command.

Then all regression estimates of exposures are placed in a matrix ordered by
outcome and exposure variables rowwise and adjustment columnwise.

The resulting matrix is saved in the return list for further
usage.

The matprint options makes it easy to integrate the
result table into a log2markup.

Together with the basetable
the command regmat generates the two typical tables for reporting
epidemiological research.

The resulting tables are easy to integrate into the final text using eg.
log2markup or
putexcel.

subselect generates a marker variable with name specified
by option generate(name).
The grouping variable is specified the varname argument.
The marker marks all group ids, where at least one row per group id satisfies
the conditions in if and in.

strofnum transform a numeric variable to a string variable using
the value label if it exists. Otherwise the format is used.

strtonum replaces a string variable with a categorical numeric
variable with a value label.

sumat generates a summary matrix based in part on the command
sumarize. Statistics like eg unique values and missing values are
added. The resulting matrix are saved for futher use.
sumat is using matprint for the output.

which_edit finds and opens the code file or the help
file in the Do-file Editor.

lmatrixtools is the back bone of this package. It is written in
Mata.

ltoxl_v13 is the Stata 13 and up Mata code for mat2xl.

ltoxl_v14 is the Stata 14 and up extension Mata code for
mat2xl.

Requires: Stata 12 and up.

lmatrixtools source code

lmatrixtools.mata

ltoxl_v13 source code

ltoxl_v13.mata

ltoxl_v14 source code

ltoxl_v14.mata

Authors and support

Author:

Niels Henrik Bruun,

Aalborg University Hospital

Support:

niels.henrik.bruun@gmail.com