You are considered a resident alien if you met one of the following two tests for the calendar year:
The green card test - You are considered to have met the green card test if at any time during the calendar year, you were a lawful permanent resident of the United States according to the immigration laws, and this status has not been rescinded or administratively or judicially determined to have been abandoned.
The substantial presence test - For the purposes of this test, the term United States does not include U.S. possessions and territories or U.S. airspace. The United States includes the following areas:
All 50 states and the District of Columbia,
The territorial waters of the United States, and
The seabed and subsoil of those submarine areas that are adjacent to U.S. territorial waters and over which the United States has exclusive rights under international law to explore and exploit natural resources.