chambrlnp
New Member

State tax filing

You are right.  That will teach me to read questions more carefully and not make assumptions.  
I would analyze your case as follows: when you were a student on a J visa (up to Oct 1017) you were not counting days under the substantial presence test  - IRC 7701(b) (5)(D)(II).  When you became a trainee, you started counting days because you had already been exempted as a J visa holder for parts of two calendar years (IRC 7701(b)(5)(E)(I), namely 2016 and 2017.  In 2017 you would thus have had about 90 days of presence, not enough by itself to qualify as a resident.  In 2018, however, you counted all the days and thus qualified as a resident.
Note that if you qualify for 2018, you may be able to qualify for 2017 under the "first-year election" rules; see Pub 519 for details.  Whether it is worth amending your 2017 return would depend on your circumstances.