In general
For purposes of this title (other than subtitle B)—
(A) Resident alien An alien individual shall be treated as a resident of the United States with respect to any calendar year if (and only if) such individual meets the requirements of clause (i), (ii), or (iii): (i) Lawfully admitted for permanent residence Such individual is a lawful permanent resident of the United States at any time during such calendar year. (ii) Substantial presence test Such individual meets the substantial presence test of paragraph (3). (iii) First year election Such individual makes the election provided in paragraph (4).
(B) Nonresident alien An individual is a nonresident alien if such individual is neither a citizen of the United States nor a resident of the United States (within the meaning of subparagraph (A)).