Substantial Presence Test
You will be considered a U.S. resident for tax purposes if you meet the substantial presence test for the calendar year. To meet this test, you must be physically present in the United States on at least:
31 days during the current year, and
183 days during the 3-year period that includes the current year and the 2 years immediately before that, counting:
All the days you were present in the current year, and
1/3 of the days you were present in the first year before the current year, and
1/6 of the days you were present in the second year before the current year.
Example:
You were physically present in the United States on 120 days in each of the years 2007, 2008, and 2009. To determine if you meet the substantial presence test for 2009, count the full 120 days of presence in 2009, 40 days in 2008 (1/3 of 120), and 20 days in 2007 (1/6 of 120). Since the total for the 3-year period is 180 days, you are not considered a resident under the substantial presence test for 2009.
http://www.irs.gov/businesses/small/international/article/0,,id=96352,00.html