A step-by-step tutorial on active inference and its application to empirical data