A system and method automatically calibrate a posture sensor, such as by detecting a walking state or a posture change. For example, a three-axis accelerometer can be used to detect a patients activity or posture. This information can be used to automatically calibrate subsequent posture or acceleration data.