Code to run functional mediation analysis