Calibrating Accelerometer Sensor
there are varius calculation.

At the end of the day, if take a point in every position (under no acceleration), you should end up with a sphere, or matematically speacking, wthe lenght of the vector should be equal to gravity, so sqrt(x*x+y*y+z*z) = G or, to do less computing x*x+y*y+z*z = G*G (same apply for magnetometer, but using local magnetic force, or gyroscope, using a know-speed rotation like a LP player)

To create that spere you have to take many point, and find a multiplicator (or function) for each axes. That is particualary important when one axes has differnet precision of others, you are linearizing the axis output, and then normalizig its value relative to others axes.

Once you have corrected the vector lenght to have a spere, you should look at the offset of the sphere; if its center point is not on the origin point 0,0,0 then the differece between center and origin is the correction you talk about. This is offset correction.

Also many (well, all) sensor are affected on their temperature; many claim to be "thermocompensated", that means this difference is less evident due to some some sort of hardware and/or software filtering.