I can't find a detailed answer regarding how to compute a batting average. What I found says, divide the number of bases by the number of times at bat. So, if you get a walk, does your average go down?
A simple way to compute a player's batting average is to divide the player's total hits (not the number of bases) by his/her total at bats. A walk does not count as an at bat or hit, and does not affect a player's batting average.
—The Fact Monster