t XtY = math.multiply(math.transpose(X), Y);
            const beta = math.multiply(math.inv(XtX), XtY);

            // Compute residuals
            const residuals = math.subtract(Y, math.multiply(X, beta));

            // Compute standard error of beta[1] (the coefficient we're interested in)
            const df = n - lag - 2;
            const sigma2 = math.sum(math.dotPow(residuals, 2)) / df;
            const se = math.sqrt(sigma2 * math.inv(XtX).get([1, 1]));

            // Compute ADF statistic
