diff --git a/pyfixest/utils.py b/pyfixest/utils.py index 8bcbdc75..ffa1dd1d 100644 --- a/pyfixest/utils.py +++ b/pyfixest/utils.py @@ -222,63 +222,4 @@ def get_data(N=1000, seed=1234, beta_type="1", error_type="1", model="Feols"): df["weights"] = rng.uniform(0, 1, N) # df["weights"].iloc[] - return df - - -def get_poisson_data(N=1000, seed=4320): - """ - Generate data following a Poisson regression DGP. - - Parameters - ---------- - N : int, optional - Number of observations. Default is 1000. - seed : int, optional - Seed for the random number generator. Default is 4320. - - Returns - ------- - pandas.DataFrame - Generated data with columns 'Y', 'X1', 'X2', 'X3', and 'X4'. - """ - # create data - np.random.seed(seed) - X1 = np.random.normal(0, 1, N) - X2 = np.random.choice([0, 1], N, True) - X3 = np.random.choice([0, 1, 2, 3, 4, 5, 6], N, True) - X4 = np.random.choice([0, 1], N, True) - beta = np.array([1, 0, 1, 0]) - u = np.random.normal(0, 1, N) - mu = np.exp(1 + X1 * beta[0] + X2 * beta[1] + X3 * beta[2] + X4 * beta[3] + u) - - Y = np.random.poisson(mu, N) - - return pd.DataFrame({"Y": Y, "X1": X1, "X2": X2, "X3": X3, "X4": X4}) - - -def absolute_diff(x, y, tol=1e-03): - """ - - Calculate the absolute difference between two values. - - Parameters - ---------- - x : numpy.ndarray - Numeric array representing the reference value. - y : numpy.ndarray - Numeric array representing the value to compare against. - tol : float, optional - Tolerance value used to determine if two values are different. Default is 1e-03. - - Returns - ------- - bool - True if the absolute difference is greater than the tolerance and there - is a non-zero value in y, False otherwise. - """ - absolute_diff = (np.abs(x - y) > tol).any() - if not any(y == 0): - relative_diff = (np.abs(x - y) / np.abs(y) > tol).any() - return absolute_diff and relative_diff - else: - return absolute_diff + return df \ No newline at end of file