We propose a direct numerical method to calculate the statistics of the
number of transitions in stochastic processes, without having to resort to
Monte Carlo calculations. The method is based on a generating function method,
and arbitrary moments of the probability distribution of the number of
transitions are in principle calculated by solving numerically a system of
coupled differential equations. As an example, a two state model with a
time-dependent transition matrix is considered and the first, second and third
moments of the current are calculated. This calculation scheme is applicable
for any stochastic process with a finite state space, and it would be helpful
to study current statistics in nonequilibrium systems.Comment: 8 pages, 2 figure