There are two things to consider: the Offensive/ Defensive Shock/Fire/Morale stats and the shock and fire multipliers.
This is roughly how combat works: every phase, both sides throw a die. To that result, a bunch of modifiers are added, such as terrain and leadership. What is also added is offensive and defensive stats of units. So if unit A and B battle each other, A's offensive stat is added to A's die roll while B's defensive stat is subtracted from A's die roll. The same thing around for B's roll.
This modified roll is then multiplied by the shock or fire multiplier. So if the battle is in the shock phase, all the modified rolls are multiplied by the shock multiplier. This final resul determines casualties.
Okay, that's the theory. In practice, you'll see that cavalry has a huge shock multiplier compared to infantry and is even higher than infantry's shock+fire multipliers. So with even fire/shock stats, cavalry will do much more damage. Even if infantry has a bit better stats, cavalry will probably come on top in term of dealing damage.
What complicates this, are other factors. Ottomans have an NI that improve cavalry, for example, so for them cavalry is relatively good. If you have Ideas that improve general's shock value, cavalry will benefit more. Fire bonusses are basically worthless for cavalry, but will help late-game infantry and artillery.
So the short answer is: it depends. I hope this information will help you decide for yourself.