  In this work we have developed a new stochastic model for the fluctuations in
lightcurves of accreting black holes. The model is based on a linear
combination of stochastic processes and is also the solution to the linear
diffusion equation perturbed by a spatially correlated noise field. This allows
flexible modeling of the power spectral density (PSD), and we derive the
likelihood function for the process, enabling one to estimate the parameters of
the process, including break frequencies in the PSD. Our statistical technique
is computationally efficient, unbiased by aliasing and red noise leak, and
fully accounts for irregular sampling and measurement errors. We show that our
stochastic model provides a good approximation to the X-ray lightcurves of
galactic black holes, and the optical and X-ray lightcurves of AGN. We use the
estimated time scales of our stochastic model to recover the correlation
between characteristic time scale of the high frequency X-ray fluctuations and
black hole mass for AGN, including two new `detections' of the time scale for
Fairall 9 and NGC 5548. We find a tight anti-correlation between the black hole
mass and the amplitude of the driving noise field, which is proportional to the
amplitude of the high frequency X-ray PSD, and we estimate that this parameter
gives black hole mass estimates to within ~ 0.2 dex precision, potentially the
most accurate method for AGN yet. We also find evidence that ~ 13% of AGN
optical PSDs fall off flatter than 1 / f^2, and, similar to previous work, find
that the optical fluctuations are more suppressed on short time scales compared
to the X-rays, but are larger on long time scales, suggesting the optical
fluctuations are not solely due to reprocessing of X-rays.
