Intellectual property rights, distance to the frontier, and R&D: evidence from microdata