Critical bug fix for smcfcs in Stata

At a recent missing data course run by a colleague, users of my multiple imputation program smcfcs in Stata 15.1 found that when imputing on a simulated dataset, smcfcs took much longer to run and issued many more rejection sampling warnings than those running using Stata 14.1. Moreover, the point estimates for the substantive/analysis model obtained by those using Stata 15.1 were dramatically different to those using Stata 14.1, with the former being very biased relative to the true parameter values.

With help from Stata Technical Support and Tim Morris, we discovered the behaviour was due to a change in Stata 15 regarding the st_view function in Mata, Stata’s matrix programming language, which is used by smcfcs. The somewhat delicate way st_view works is something previously wrote about in 2014. Analyses previously performed using smcfcs in Stata 15 should not be used, and may have given estimates that were materially different to what they should have been.

Without going into too much detail, the (new) incorrect behaviour of smcfcs was caused by what a change in Stata 15 in the behaviour of objects created by st_view. This behaviour occurs even though smcfcs uses the version command, Stata’s version control is not absolute. In particular, as described in this post on Statalist, changes which are considered bug fixed are not subject to version control – i.e. if they fix something, quite reasonably in most cases version doesn’t revert back to the previous buggy behaviour, and apparently the previous behaviour of st_view/Mata in this respects was considered a type of bug.

The smcfcs code has now been modified to rectify the bug, and it now works on Stata 15 correctly. This fixed version can be downloaded from GitHub by typing the following in Stata’s command window:

net install smcfcs, from (https://raw.githubusercontent.com/jwb133/Stata-smcfcs/master/) replace

The updated version will be available on the SSC archive shortly.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.