Software

The following collection of my MATLAB scripts is provided “as is” and should work with MATLAB releases 2011a onwards. If you find any bugs or issues with this code, please email me.

Hodges-Lehmann Estimator of the one sample location parameter

Implementation of the Hodges and Lehmann [1,2] estimator for the location parameter. The ZIP file includes both a (pure) MATLAB implementation and a C implementation that can be executed within MATLAB; to compile the C code, type “mex hhodglehm.cpp”. [code]

References:

1. Estimates of Location Based on Rank Tests, J. L. Hodges and E. L. Lehmann, Annals of Mathematical Statistics, Vol. 34, No. 2, pp. 598-611, 1963.

2. Theory of Point Estimation, E. L. Lehmann and G. Casella, Springer, 2003.

Contingency tables

Implementation of the Casella and Moreno  Bayes test for independence in two-way contingency tables using an intrinsic prior. Tables of size a x b (a,b>1) are allowed and some usage examples included. [code]

References:

1. Assessing Robustness of Intrinsic Tests of Independence in Two-Way Contingency Tables, G. Casella and E. Moreno, Journal of the American Statistical Association , Vol. 104, No. 487, pp. 1261-1271, 2009.

Sparse covariance matrix estimation

Implementation of the Cai and Liu  estimator for sparse covariance matrices. Cross-validation is used to select the user settable parameter. Currently, the script uses the adaptive LASSO thresholding function and can be changed to use any other hard/soft threshold. A simple simulation script is included to test the estimator. [code]

References:

1. Adaptive Thresholding for Sparse Covariance Matrix Estimation, T. Cai and W. Liu, Journal of the American Statistical Association, Vol. 106, No. 494, pp. 672-684, 2011.

MML Single-Factor Analysis

This script implements the Minimum Message Length method for parameter estimation and model selection in single-factor analysis. The single factor analysis model is a special case of the multivariate Gaussian model where the correlation structure is modelled by a single common factor. [code]

References:

1. Single-Factor Analysis by Minimum Message Length Estimation, C. S. Wallace and P. R. Freeman, Journal of the Royal Statistical Society (Series B), Vol. 54, No. 1, pp. 195-209, 1992.

Linear Regression

Bayesian ridge regression, Bayesian LASSO, Bayesian group LASSO, Bayesian fused LASSO and Bayesian elastic net
Implementation of Bayesian ridge regression, Bayesian LASSO, Bayesian group LASSO, Bayesian fused LASSO and Bayesian elastic net based on the Gibbs sampler from ; note, the paper contains at least three typographical errors in the Gibbs conditionals. This code uses the MATLAB Central “randraw()” function to sample from an inverse Gaussian distribution. The ZIP file includes an example script showing how to run the main function. [code]

The Bayesian LASSO
Please note, the previous MATLAB script also implements the Bayesian LASSO. This script is an implementation of the Bayesian LASSO for parameter estimation and subset selection in linear regression based on . This code uses the MATLAB Central “randraw()” function to sample from an inverse Gaussian distribution. [code]

References:

1. The Bayesian LASSO, T. Park and G. Casella, Journal of the American Statistical Association, Vol. 103, No. 482, pp. 681-686, 2008.

1. Penalized Regression, Standard Errors, and Bayesian Lassos, M. Kyung, J. Gill, M. Ghosh and G. Casella, Bayesian Analysis, Vol. 5, No. 2, pp. 369-412, 2010.

The Non-negative Garotte

Leo Breiman’s non-negative garotte method for parameter estimation and subset selection in linear regression. The garotte constraint is estimated using k-fold cross validation or the little bootstrap. [code]

References:

1. Better Subset Regression Using the Nonnegative Garrote, Leo Breiman, Technometrics, Vol. 37, No. 4, pp. 373-384, 1995.

Logistic Regression

LASSO
Compute the Least Absolute Shrinkate and Selection Operator (LASSO) coefficients in a logisitic regression model. A C++ mex function is included and can be compiled to significantly speed up the numerical search. [code]

The lasso_kcv() function can be used to estimate the penalty parameter with k-fold cross-validation.

Ridge Regression
The above LASSO code is easily modified to do other penalized logistic models. As an example, I’ve implemented the ridge regression method. This package also includes a function to estimate the ridge penalty parameter by cross validation. [code]

Bayesian Regularized Logistic Regression
This program implements the Bayesian regularized logistic regression Gibbs sampling approach published in . This is actually a conversion of R and C code to MATLAB and C/C++. The original program was written by Robert B. Gramacy and kindly provided to this author. The ZIP file includes an example on how to run the program. For more information about the sampling method, see . [code]

References:

1. The Bayesian LASSO, R. Tibshirani, Journal of the Royal Statistical Society (Series B), Vol. 58, No. 1, pp. 267-288, 1996.

2. Large-Scale Bayesian Logistic Regression for Text Categorization, A. Genkin, D. D. Lewis and D. Madigan,Technometrics, Vol. 49, No. 3, pp. 291-304, 2007.

3. Ridge regression. A. Hoerl and R. Kennard,Encyclopedia of Statistical Sciences, Vol. 8, pp. 129-136, 1988.

4. Simulation-based regularized logistic regression. R. B. Gramacy and N. G. Polson, arXiv:1005.3430v1, 2010.

Stochastic Complexity of a Multinomial Distribution

Compute the stochastic complexity of a multinomial distribution in linear time. [code]

References:

1. A linear-time algorithm for computing the multinomial stochastic complexity, Petri Kontkanen and Petri Myllymaki, Information Processing Letters, Vol. 103, No. 6, pp. 227-233, 2007.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7747502,"math_prob":0.83973885,"size":5742,"snap":"2019-43-2019-47","text_gpt3_token_len":1402,"char_repetition_ratio":0.13367027,"word_repetition_ratio":0.09239766,"special_character_ratio":0.23963776,"punctuation_ratio":0.20213713,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9936651,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-19T15:02:52Z\",\"WARC-Record-ID\":\"<urn:uuid:a74af354-f42a-4385-b151-ded4f91f1720>\",\"Content-Length\":\"22144\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cfb1acc0-c443-422e-b79a-c9cc5ade3b39>\",\"WARC-Concurrent-To\":\"<urn:uuid:847863b6-df5a-402e-b851-f20f8291abb9>\",\"WARC-IP-Address\":\"208.113.154.62\",\"WARC-Target-URI\":\"http://www.emakalic.org/blog/?page_id=7\",\"WARC-Payload-Digest\":\"sha1:OHQMCJHFMVRMRFVK75WXLJ72PKTUGRES\",\"WARC-Block-Digest\":\"sha1:RGBQ5P6C5X5CMG2WJAOP24JMDKC4VVB6\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570986696339.42_warc_CC-MAIN-20191019141654-20191019165154-00521.warc.gz\"}"}