s1);
            const XtX = math.multiply(math.transpose(X), X);
            const Xty = math.multiply(math.transpose(X), y);
            const beta = math.multiply(math.inv(XtX), Xty);
            return beta.get([1]);
        }

        function adfTest(data, lag = 1) {
            const n = data.length;
            const y = data.slice(1);
            const x = data.slice(0, -1);

            // Compute differences
            const dy = y.map((v, i) => v - x[i]);

            // Create lag matrix
     