From an aikido standpoint
When dealing with punches, kicks, grabs, training knives and training sword attacks, getting off the line of attack is one of the first things executed. Usually, this is done simultaneously laterally and forward, closing distance, getting off line of attack, and moving to the flank.
Since physical attacks require movement on the attacker's part, the attacker has to be able to quickly shift direction and still keep on balance in order to complete a strike.
It's not hard to make somebody miss completely, or, failing that, end up landing only a glancing strike (although even a glance with a blade can be bad).
Obviously, less physical movement is required for an attacker to fire a weapon. Odds are much less that his balance will be taken when he moves to track the defender's motion. However, it would make sense that if you can make somebody miss a punch via movement, that you should reduce their odds of a hit with a gun.
Next point I'd like to make here is that not all attackers will use a gun. Against somebody using a knife, baseball bat, bottle, etc, movement is definitely better than non-movement, assuming you don't already have your weapon in hand.
Last point is that while it is a very good idea to have weapon in hand at first hint of a threat, it's entirely possible that the first hint will be when the bad guy makes his approach from rear or flank. There may be no warning. I'd rather train to where my first instinct when something moves on me from behind is to move off the X, because if I don't train that way, the odds of effectively freezing go up when startled.