Internal and External R&D: A Sample Selection Approach*