Table:
|  |  | Year Ended December 31, |  |
| --- | --- | --- | --- |
|  | 2019 | 2018 | 2017 |
|  |  | (in thousands) |  |
| Net cash provided by (used in): |  |  |  |
| Operating activities | $(156,832) | $113,207 | $64,241 |
| Investing activities | 25,761 | 17,496 | (28,718) |
| Financing activities | (8,406) | 1,287 | 4,635 |
| Net change in cash and cash equivalents | $(139,477) | $131,990 | $40,158 |
Paragraphs:
Cash Flows
The following table summarizes our cash flows for the periods indicated:
Cash Flows from Operating Activities
Net cash used in operating activities of $156.8 million in 2019 was primarily due to a net loss of $320.7 million, as well as an increase in net operating assets and liabilities of $3.3 million, partially offset by total non-cash adjustments of $167.2 million. The increase in net operating assets and liabilities included a $21.3 million increase in accounts receivable primarily due to an increase in days sales outstanding, an $18.5 million increase in inventories primarily due to Fitbit Versa Lite Edition, Fitbit Inspire, Fitbit Inspire HR and Fitbit Versa 2, and a $22.9 million decrease in lease liabilities, partially offset by a $40.7 million net increase in accounts payable and accrued liabilities and other liabilities primarily related to higher rebates and promotional activities in the fourth quarter of 2019, a $15.1 million decrease in prepaid expenses and other assets, and a $4.0 million increase in deferred revenue. Our days sales outstanding in accounts receivable, calculated as the number of days represented by the accounts receivable balance as of period end, increased from 70 days as of December 31, 2018 to 74 days as of December 31, 2019, due to lower collections during the fourth quarter of 2019 compared to the fourth quarter of 2018. The $167.2 million total non-cash adjustments for 2019 included stock-based compensation expense of $77.7 million, depreciation and amortization expense of $62.8 million, and non-cash lease expense of $19.2 million.
Net cash used in operating activities was $156.8 million in 2019, compared to net cash provided by operating activities of $113.2 million in 2018, primarily due to a $134.9 million increase in net loss for 2019 compared to 2018, an increase of $126.0 million in change in net operating assets and liabilities compared to 2018 primarily related to a $72.2 million income tax refund received in 2018 and increases in accounts receivable and inventories in 2019, as well as a decrease of $9.1 million for non-cash adjustments to net loss in 2019 compared to 2018.
Cash Flows from Investing Activities
Net cash provided by investing activities for 2019 of $25.8 million was primarily due to maturities and sales of marketable securities of $414.7 million, partially offset by purchases of marketable securities of $347.6 million, purchases of property and equipment of $36.5 million, payment of $2.2 million for the cash portion of an acquisition, net of cash acquired, and acquisition-related holdback payments of $2.6 million.
Net cash provided by investing activities for 2018 of $17.5 million was primarily due to maturities and sales of marketable securities of $443.6 million, partially offset by purchases of marketable securities of $353.9 million, purchases of property and equipment of $52.9 million, payment of $13.6 million for the cash portion of an acquisition, net of cash acquired, and acquisition-related holdback payments of $5.6 million.
We may continue to use cash in the future to acquire businesses and technologies that enhance and expand our product offerings. Due to the nature of these transactions, it is difficult to predict the amount and timing of such cash requirements to complete such transactions. We may be required to raise additional funds to complete future acquisitions.
Cash Flows from Financing Activities
Net cash used in financing activities for 2019 of $8.4 million was primarily due to $18.2 million in net cash used for payment of taxes on common stock issued under our employee equity incentive plans and $2.7 million used for financing lease payments, offset in part by $13.0 million in proceeds from the exercise of stock options and from stock purchases made through our 2015 Employee Stock Purchase Plan, or 2015 ESPP.
Question:
What factors led to net cash used in operating activities of $156.8 million in 2019?
Answer: Due to a net loss of $320.7 million, as well as an increase in net operating assets and liabilities of $3.3 million, partially offset by total non-cash adjustments of $167.2 million.