' Generates 2 random walks, x and y, without/with drift ' with 2 uncorrelated white noise innovations and ' estimates the relation between the levels and the differences: ' level: y = a + b x + eps ' difference: d(y) = c + f d(x) + eta smpl @all series x = 0 series ux = nrnd series y = 0 series uy = nrnd !driftx = 0 !drifty = 0 smpl 2 @last x = !driftx + x(-1) + ux y = !drifty + y(-1) + uy series dx = x - x(-1) series dy = y - y(-1) smpl 2 100 equation level.ls y c x equation level1.ls y c x ar(1) equation diff.ls dy c dx show level show level1 show diff