This study investigates the association between financing constraints/agency problem (agency costs) and corporate R&D investment in China by using the two‐tier stochastic frontier model initially developed by Kumbhakar and Parmeter (2009) in light of the Euler equation analysis framework. The results show that there is a significantly negative association between financing constraints and firms' R&D investments and a significantly positive relationship between agency costs and R&D investments. Thus, financing constraints lead to R&D underinvestment, while agency costs cause R&D overinvestment by the sample firms. However, government subsidies have a positive moderating effect on the relationships. The impact of financing constraints and agency costs on R&D investment varies slightly by firms in different geographical regions, industries, business ownerships, and years.