Hi Mike,
Well, as far as I understand it, everything that's made of steel has its own magnetic field which can influence a compass, which measures its surrounding magnetic field. In my case I know that our boat has a strong magnetic field, because I "measured" it with several compasses. Depending on where in the boat I measure, the compass is off by many degrees (up to 50 degrees deviation both west and east depending on cardinal direction both the boat AND the compass point) or is simply "stuck" in one direction until it suddenly "jumps" to another direction once a certain threshold in cardinal direction is overcome. You may read more informed information on that here:
msi.nga.mil/MSISiteContent/StaticFiles/HoMCA.pdf
The way we found out which place works best for us was simply by trying, with the
rule that the further away from anything that is made of steel or otherwise magnetic, the better. In our case it was on the
cabin top where the main sheets tend to sweep over - so not very good.
A
fluxgate compass would be ideal I heard, but I don't really know how these things
work and read somewhere that these are so expensive that they only pay off for
commercial vessels. Any electronic compass is fine, too, because you can install a few meters above
deck on/ in the
mast, well away from magnetic
interference. That might also help you to work with an
electric autopilot if you wish that. I think in Moitessiers book "The Long Way" he mentions somewhere that a friend of his has installed a compass (not electric) a few meters up on the
mast to get it working right. I don't know how that was read, maybe with mirrors? If I remember rightly, Moitessier himself didn't have a compass, he used the stars and sun.
However, in my opinion, using an electronic compass solution is undermining the whole idea of installing a compass, which function it is (among others) to be independent of electricity. Instead, you could just use any GPS solution you want and use COG, which in many cases is even better than compass heading.
Hope that helps and good luck finding a reliable solution!
Cheers,
Phil