calculateEffects function

Internal: Calculate direct, indirect and total effect