month periods ended September 30, 2017 were $2,704,923 and $7,970,603 respectively, including stock-based compensation expense in each of the three and nine-month periods of $192,796 and $622,700, respectively. Research and development expenses, in the aggregate, represented approximately 55% and 56% of total operating costs and expenses for the three and nine-month periods ended September 30, 2018 and 63% and 61% for the three and nine-month periods ended September 30, 2017, respectively. The stock-based compensation isnon-cash and relates to the expense of stock options awards to certain employees.
Expenses for research and development for the nine months ended September 30, 2018, excluding stock-based compensation, increased compared to amounts expended in the same period in 2017. The increase in research and development expenses for the nine months ended September 30, 2018 when compared to the same period in 2017 is primarily due to increases in consulting expenses as we prepared to submit our NDA for Firdapse® during the first quarter of 2018, milestone expenses relating to the acceptance of our NDA submission in May 2018, expenses from our medical affairs program, and compensation and related personnel costs as we expand our headcount to support our currently ongoing trials and programs. We expect that research and development costs will continue to be substantial during the balance 2018 as we work towards completing trials evaluating Firdapse® for the treatment of CMS,MuSK-MG and SMA Type 3, continue our Expanded Access Program for Firdapse® and our other development programs, and prosecute our NDA submission for Firdapse® for LEMS.
Selling and Marketing Expenses.
We had no selling expenses for the three and nine-month periods ended September 30, 2018 and 2017.
During the fourth quarter of 2017, as we moved closer to submitting an NDA submission for Firdapse®, were-started the development of our commercialization plans for Firdapse® and following the acceptance of our NDA for Firdapse® for the treatment of LEMS, we accelerated our efforts to build our commercial team for a potential launch of Firdapse® in the first quarter of 2019.Pre-commercialization costs are included in general and administrative expenses.
General and Administrative Expenses.
General and administrative expenses for the three and nine months ended September 30, 2018 were $3,644,234 and $8,949,663, respectively, including stock-based compensation expense in each of the three and nine-month periods ending September 30, 2018 of $518,054 and $1,700,961, respectively. General and administrative expenses for the three and nine months ended September 30, 2017 were $1,601,785 and $5,197,247, respectively, including stock-based compensation expense in each of the three and nine-month periods ending September 30, 2017 of $336,942 and $1,299,751, respectively. General and administrative expenses represented 45% and 44% of total operating costs and expenses for the three and nine months ended September 30, 2018 and 37% and 39% for the three and nine months ended September 30, 2017, respectively. The stock-based compensation isnon-cash and relates to the expense of stock options awards and othernon-cash stock compensation to certain employees. The increase in general and administrative expenses for the nine months ended September 30, 2018 when compared to the same period in 2017 is primarily due to increases inpre-commercialization expenses, headcount and corporate expenses as we build up our infrastructure and commercial programs in preparation for a potential Firdapse® launch in 2019. We expect that general and administrative costs, includingpre-commercialization costs, will continue to increase in 2018 compared with the general and administrative costs incurred in 2017, as we continue to expand our operations in preparation for a potential launch of Firdapse® in early 2019.
As discussed above,pre-commercialization expenses are included in general and administrative expenses, and amounted to $1,458,559 and $2,921,758 respectively, for the three and nine-month periods ended September 30, 2018 and $156,219 and $563,508 respectively, for the three and nine-month periods ended September 30, 2017.
Stock-Based Compensation.
Total stock-based compensation for the three and nine-month periods ended September 30, 2018 were $758,176 and $2,521,023 and for the three and nine-month periods ended September 30, 2017 were $529,738 and $1,922,451, respectively. The increase in stock-based compensation for the nine-month periods ended September 30, 2018, when compared to the same period in 2017, is primarily due to the expense of options granted to employees and directors during the first quarter of 2018 in connection with 2017year-end grants and the effect of grants to new
21