Well... this has been debated at length in the past and you can make a decent sized thread on the subject. But just when you think you understand it another factor pops up to blow your argument out of the water (excuse the pun).
Ship combat can be quite unpredictable and the ins and outs of stacking or not stacking ships has been a matter of much debate in the past.
Also as you have said the flagship's command rating seems to be the principle factor in determining victory in most cases.
Bookmarks