The issue here is that Sublime Text's CLI and your terminal point to different versions of Python.
In your terminal the result of import sys; sys.executable
is
/Users/username/anaconda/bin/python'
but in the Sublime Text CLI you would see:
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
The Sublime Text CLI python path does not have the statsmodels
package whereas the anaconda python does. It is possible to change the default python path in Sublime Text. See this question for more details on how to do that. I would recommend just running python from your terminal and not the sublime text CLI to keep things simple.