I always wondered how a compass in a gun stock is supposed to work. Not only is it right next to a big chunk of steel, but it is also bashed around with the recoil of every shot.
Magnetic declination can mess with compasses too. Where I live there is less than 2 degrees declination, but far out east or west there can be many degrees of declination. Magnetic north is not the geographic north pole but some big magnetic mass in far north central canada. Most compasses come with a scale to compensate for declination, because most maps are drawn to coencide with a properly ajusted compass.
this should show a declination chart as of 2000. It changes slowly.
Magnetic dip is another phenomenon I have to deal with. I do some orienteering on the Marquette Iron Range. Standing on a mountain of iron ore can mess up a compass as well. When the area was first surveyed they did it with solar compasses because needle dip would cause their magnetic equipment to give very wrong readings.
Sometimes the machine can be wrong, but I would wager that it is most likely operator error. I'd still trust myself with a good map and compass over some of the fellas I know and their GPSs.