random walk regression code