We generalize Einstein's master equation for random-walk processes by considering that the probability for a particle at position r to make a jump of length j lattice sites, Pj(r), is a functional of the particle distribution function f(r, t). By multiscale expansion, we obtain a generalized advection-diffusion equation. We show that the power law Pj(r)[?]f(r)a-1 (with a>1) follows from the requirement that the generalized equation admits scaling solutions (f(r;t)=t[?]gph(r/tg)). The solutions have a q-exponential form and are found to be in agreement with the results of Monte Carlo simulations, so providing a microscopic basis validating the nonlinear diffusion equation. Although its hydrodynamic limit is equivalent to the phenomenological porous media equation, there are extra terms which, in general, cannot be neglected as evidenced by the Monte Carlo computations.