Software for the ENAR Short Course on Measurement Error Models

Stata Programs

How to download the measurement error programs for regression calibration, SIMEX and Instrumental Variables into Stata for eventual runs. This also points to many worked examples, and if you go to Stata's web page (http://www.stata.com) you can get more detailed help.

Regression Calibration in Stata With Replicates
This program and output illustrates how to run a logistic regression using regression calibration in the Framingham data set with replicates of what we call W. The factors measured without error are age (AGE) and smoking status (SMOKE). The replicated prodictors of transformed systolic blood pressure are LSBP2 and LSBP3.

SIMEX in Stata With Replicates
This program and output illustrates how to run a logistic regression using SIMEX in the Framingham data set with replicates of what we call W. The facotrs measured without error are age (AGE) and smoking status (SMOKE). The replicated prodictors of transformed systolic blood pressure are LSBP2 and LSBP3.

Regression Calibration and SIMEX in Stata With Replicates or Without Replicates and With Known Measurement error variance
This material is more or less lifted directly from our book. Make sure you start by opening the Framingham data

Instrumental variables in Stata for linear regression, nondifferential error
This material uses the WISH Data (I have created a fake version of it)

Instrumental variables in Stata for logistic regression, nondifferential error
This material uses the CHDCholesterolLDL Data

Structural Modeling via GLLAMM in Stata
The software package gllamm in Stata allows you to fit measurement error models in a structural framework with normally distributed measurement error and normally distributed true X given the other covariates. The implementations given here are restricted to a scalar covariate measured with error, although it is possible to extend this.

Overview of what GLLAMM does, with reference to Framingham

The Framingham data as a Stata data set

Command for GLLAMM when there are replicates. Includes how to get the GLLAMM software

Command for GLLAMM when there are No replicates.

Output for GLLAMM when there are replicates. Note that this gives you the exposential of the parameter estimates, i.e., the odds ratio.

Output for GLLAMM when there are No replicates. Note that this gives you the exposential of the parameter estimates, i.e., the odds ratio.

SAS Proc Mixed Program for the OPEN Data set
This program was written by Doug Midthune of the National Cancer Institute. Fitting measurement error models in PROC Mixed is possible, but as the example shows, the latent variable nature of the problem makes it a complex task. The program basically computes the mean and covariance matrix of the data and then does maximum likelihood.

R2WinBUGS Programs

The OPEN data without covariates. The data is simulated.

The Framingham data without covariates.

The Nevada Test Site (simulated) data without covariates.

R Programs for SIMEX
There is an R package for SIMEX that handles at least generalized linear models. What is illustrated there is the Framingham example.

The Framingham data suitable for R

Directions for using SIMEX in R. You have to input the measurement error variance.

The R script for the Framingham data

The output from R

The SIMEX trace plot
