I felt like this needed it's own thread for easier access for those who use the search function. The following is data collected and analyzed by jlhy.
Currently I'm working on the goal godly where you need to obtain a defense score of 34,000, so I can see my defense stat as it applies to defending attacks from rivals. I can see the increase in defense stats as I add equipment, defense buildings, and defense building upgrades and can see the decrease when I sell off a defense building.
I found that when you first buy a defense building (level 1) you get the full stats of the building applied to your attack defense score. When you upgrade that building you get half of the defense stats applied to your defense score. For example the Bodyguard agency. When you first buy the Bodyguard agency you get 10 defense added to both your profile defense and your 10 your attack defense. When you upgrade the bodyguard agency to level 2 you get 20 defense added to your profile defense and 5 added to your attack defense. Upgrading to level 3 your profile defense goes up 30 and your attack defense goes up by 5.
Level 4 Abandoned Building would increase your attack defense by 5 (2+1+1+1=5)
Level 4 Guard Tower would increase your attack defense by 7.5 (3+1.5+1.5+1.5=7.5)
Level 4 Bodyguard Agency would increase your attack defense by 25 points (10+5+5+5=25).
Level 4 Muay Thai center would increase your attack defense by 45 (18+9+9+9=45)
Level 4 Gattling Turret would increase your attack defense by 62.5 (25+12.5+12.5+12.5=62.5)
Level 4 Sniper's Den would increase your attack defense by 80 (32+16+16+16=80)
I noticed the tycoon bonus did not apply to attack defense only to total defense (the one that shows in your profile). When I built a Sniper's Den I got an increase of 32 defense rather than 36(tycoon). Same with the missile turret, received 42 attack defense rather than 47(tycoon).
I also tested by deleting a few buildings. I deleted my level 7 Abandoned Building and my attack defense dropped 8 points while my profile defense dropped 69 points.
The stats listed on the defense building upgrades seem to only apply to defense against robberies and seem to be a separate calculation from attack defense.
Peacock can you confirm if these are similar to your findings.
If anyone else that currently has a defense goal can do some checks as well that would be extremely helpful.