I messed with this some today, using armies that had generals with irrelevant stats (Sam Houston and his +6 defense and -25% speed was leading the attack, against a general who gave morale and speed) each leading three brigades of infantry. The defender had the same 1/1 dig-in to start every battle off, and the attackers always used 5 atk/5 def infantry.
When going up against 5 atk/5 def defenders, the results were about even. Despite the dig-in bonus, after twenty battles the defenders averaged a few more casualties, but it's all within the margin of error and could easily be a statistical fluke.
Then I set the attackers against 5 atk/14 def defenders (obtained by unlocking all inventions that give a only defensive boost, but not the techs that go with them). Well, the AI would terminate the attack immediately, so I had to control them. The attackers' losses were about as horrible as you'd expect: on average, the casualties went 3:1 in favor of the defenders. I ran this test only ten times, because the closest the attackers came to a win was only suffering 6,792 losses versus the defenders' 3,630. No matter how you cut it, the defensive stat
clearly allowed the defenders to not only win the fight but dominate it.
After that, I unlocked all of the attack-only inventions to give the defenders 11 atk/5 def. This was the question we all wanted to answer, and I can only give you an educated guess: the AI stack was just as afraid of the 11/5 defenders as it was of the 5/14, so again I had to control it. It's a safe bet that if the AI is programmed not to attack them, the battle calculation takes their Attack value into account. The average casualties also imply that the Attack value matters: the casualties were 5:4 in the defenders' favor.
That's a very small difference for such a large increase in stats, though, and I was only able to run that test fifteen times before I got frustrated (it takes longer and longer to resign and load as you do it over and over). I calculated confidence intervals for this and for the even-stats run, and they overlap significantly: that means that I cannot say with full confidence that the average casualties between the two cases are actually different and that the apparent difference isn't just a statistical oddity.
I'm almost certain to run this test more, but I'd have to run forty-five more tests for the Up Attack scenario to cut the confidence range in half. If anyone wants to try it themselves, I've uploaded the saves I used to Google Drive, and you can get the package
here).
Note that the one that says Texas, you'll load by default as Mexico (just sit there and let the Texans finish their move order to begin the attack). The two that mention Mexico (Attack Up is the 11/5 Infantry, Defense Up is the 5/14) you'll need to deliberately load as Texas, because the AI will not willingly allow that attack to continue if it's in charge. Again, just let the army finish their attack order, and the battle will begin quickly.
If you want to share your outcomes with me, just write down the losses of both sides in some format I can easily paste into a spreadsheet, with Texas's casualties on the left (a text file where you put a tab in between the two should do the trick, and you can post it directly into the forum if you use the Code tag). Don't count the battle if a leader dies during it (Sam Houston has died on me a few times) or if Mexico gets more troops into the fight.
Make sure to let me know which scenario your numbers are for. Obviously, the Attack Up scenario is the one I most need data for, but to compare it to the base scenario (Texas1836_01_17.v2) it would be helpful if the
both had skinnier confidence intervals.