# Measurement Error Correction with the Multivariate NCI Method


Version: 3.1.1


## Authors

* Amer Moosa (moosaa@imsweb.com)
* Bill Wheeler (wheelerb@imsweb.com)
* Brian Barrett (barrettb@imsweb.com)
* Matthew Chaloux (chalouxm@imsweb.com)
* Kevin Dodd (doddk@mail.nih.gov)


This software is developed for the National Cancer Institute.


## Description

Measurement error correction using the multivariate method developed by the 
National Cancer Institute (NCI). Both episodically consumed foods and daily consumed 
nutrients can be handled. Includes functions to fit a measurement error model using 
a Markov Chain Monte Carlo (MCMC) procedure and to generate a dataset of simulated
usual intakes used to represent the distribution of true usual intakes. Also provides
tools for preparing the data for the MCMC algorithm as well as statistical 
summary functions. 


Please cite Zhang, S., et al. (2011) <doi:10.1214/10-AOAS446> for the MCMC algorithm 
and Bhadra, A., et al. (2024) <doi:10.1007/s10985-024-09627-w> for models with
never-consumers for an episodically consumed food. 


Other references are listed.
Truncated Normal Sampler: Robert, C. (1995) <doi:10.1007/BF00143942>.
Bivariate Normal Cumulative Distribution: Kotz, S., Balakrishnan, N., and Johnson, N.L. (2000) <ISBN:9780471722069>.
Multivariate Normal Cumulative Distribution: Bhat, C.R. (2018) <doi:10.1016/j.trb.2018.01.011>.
Rank 1 Update to LDLt Decomposition: Gill, P.E., Golub, G.H., Murray, W., and Saunders, M.A. (1974) <https://www.ams.org/journals/mcom/1974-28-126/S0025-5718-1974-0343558-6>.
Gelman-Rubin Test: Gelman, A. and Rubin, D. (1992) <doi:10.1214/ss/1177011136>.
Gelman-Rubin Convergence Criteria: Gelman, et al. (2004) <ISBN:158488388X>.


## Requirements

The macros in this package have been developed and tested with the following SAS products:

* SAS 9.4 M5
* SAS/STAT 14.3
* SAS/IML 14.3


Other SAS products with equivalent functionality could also be used.


## Installing the Package

1. Download the package and unzip it to a folder.
2. In SAS, use the following code to load the macros:

   %include "/path/to/package/folder/macros/ncimultivar.sas";

   The /path/to/package/folder part of the path should be replaced with the unzipped folder from Step #1.


## Core Workflow Functions

The following macros form the core workflow of the multivariate NCI method, in order:

1. %boxcox_survey()
2. %nci_multivar_preprocessor()
3. %nci_multivar_mcmc()
4. %nci_multivar_distrib()
5. %nci_multivar_summary()


## Vignettes

Vignettes are included with the macros to introduce the concepts of the NCI method and provide examples of workflows.  
They can be found in the /vignettes folder.  
It is recommended to begin with "daily_nutrient_analysis.sas" for an introduction to the NCI method.