R Under development (unstable) (2025-06-30 r88369 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(distfreereg) > all.equal.distfreereg <- distfreereg:::all.equal.distfreereg > test_dfr_functions <- distfreereg:::test_dfr_functions > > n <- 1e2 > > ### Poisson > > set.seed(20250302) > p_pois <- 2 > X_pois <- matrix(rexp(n*p_pois), ncol = p_pois) > theta_pois <- c(2,1) > means <- exp(colSums(theta_pois * t(X_pois)) + 1) > Y_pois <- rpois(n, means) > df_pois <- data.frame(y = Y_pois, x = X_pois[,1], z = X_pois[,2], + g = rep(1:10, 10)) > form_pois <- y ~ x + z > m_pois <- glm(form_pois, data = df_pois, family = "poisson", x = TRUE, y = TRUE) > > set.seed(20250302) > dfr_pois <- distfreereg(test_mean = m_pois, verbose = FALSE, + control = list(return_on_error = FALSE)) > > dfr_pois Number of observations: 100 Length of EPSP: 100 Monte Carlo simulations: 10000 Estimated parameter values: (Intercept) x z 9.989e-01 1.997e+00 1.008e+00 Observed statistics: Stat Value Pr(>Value) MCSE KS 5.661e-01 8.197e-01 3.844e-03 CvM 6.090e-02 7.963e-01 4.027e-03 --- `MCSE' is the Monte Carlo standard error of the estimated p-value. > > set.seed(20250302) > dfr_pois_x_false <- distfreereg(test_mean = update(m_pois, x = FALSE), + control = list(return_on_error = FALSE)) 'x' and/or 'y' not found in glm object; refitting model... Extracting covariance structure from glm object... Calculating Jacobian from 'glm' object... Calculating Jacobian from glm object... Retrieving fitted values from 'glm' object... Calculating the inverse square root of the covariance matrix... Calculating mu... Ordering observations by simplex method... Calculating transformation anchors... Calculating r_tilde... Calculating residuals... All covariate observations are unique; no grouping done... Calculating empirical partial sum process... Calculating observed statistic(s)... Running Monte Carlo simulation... ...1000 of 10000 ...2000 of 10000 ...3000 of 10000 ...4000 of 10000 ...5000 of 10000 ...6000 of 10000 ...7000 of 10000 ...8000 of 10000 ...9000 of 10000 ...10000 of 10000 > > set.seed(20250302) > dfr_pois_J <- distfreereg(test_mean = m_pois, + override = list(J = dfr_pois[["J"]]), + control = list(return_on_error = FALSE)) Extracting covariance structure from glm object... Using supplied Jacobian... Retrieving fitted values from 'glm' object... Calculating the inverse square root of the covariance matrix... Calculating mu... Ordering observations by simplex method... Calculating transformation anchors... Calculating r_tilde... Calculating residuals... All covariate observations are unique; no grouping done... Calculating empirical partial sum process... Calculating observed statistic(s)... Running Monte Carlo simulation... ...1000 of 10000 ...2000 of 10000 ...3000 of 10000 ...4000 of 10000 ...5000 of 10000 ...6000 of 10000 ...7000 of 10000 ...8000 of 10000 ...9000 of 10000 ...10000 of 10000 > > set.seed(20250302) > dfr_pois_fitted <- distfreereg(test_mean = m_pois, + override = list(fitted_values = dfr_pois[["fitted_values"]]), + control = list(return_on_error = FALSE)) Extracting covariance structure from glm object... Calculating Jacobian from 'glm' object... Calculating Jacobian from glm object... Using supplied fitted values... Calculating the inverse square root of the covariance matrix... Calculating mu... Ordering observations by simplex method... Calculating transformation anchors... Calculating r_tilde... Calculating residuals... All covariate observations are unique; no grouping done... Calculating empirical partial sum process... Calculating observed statistic(s)... Running Monte Carlo simulation... ...1000 of 10000 ...2000 of 10000 ...3000 of 10000 ...4000 of 10000 ...5000 of 10000 ...6000 of 10000 ...7000 of 10000 ...8000 of 10000 ...9000 of 10000 ...10000 of 10000 > > stopifnot(all.equal(dfr_pois, dfr_pois_x_false)) > stopifnot(all.equal(dfr_pois, dfr_pois_J)) > stopifnot(all.equal(dfr_pois, dfr_pois_fitted)) > > set.seed(20250516) > dfr_form_glm_verbose <- distfreereg(test_mean = form_pois, data = df_pois, + method = "glm", + method_args = list(family = "poisson"), + control = list(return_on_error = FALSE)) Extracting covariance structure from glm object... Calculating Jacobian from 'glm' object... Calculating Jacobian from glm object... Retrieving fitted values from 'glm' object... Calculating the inverse square root of the covariance matrix... Calculating mu... Ordering observations by simplex method... Calculating transformation anchors... Calculating r_tilde... Calculating residuals... All covariate observations are unique; no grouping done... Calculating empirical partial sum process... Calculating observed statistic(s)... Running Monte Carlo simulation... ...1000 of 10000 ...2000 of 10000 ...3000 of 10000 ...4000 of 10000 ...5000 of 10000 ...6000 of 10000 ...7000 of 10000 ...8000 of 10000 ...9000 of 10000 ...10000 of 10000 > > newdata_pois <- data.frame(y = rpois(10, lambda = 1), x = rexp(10), z = rexp(10)) > test_dfr_functions(dfr_pois, newdata = newdata_pois) (Intercept) x z 0.999 2.000 1.010 Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) 0.976 1.02 x 1.990 2.00 z 0.994 1.02 1 2 3 4 5 6 7 8 7.75e+00 7.41e+01 2.07e+02 8.65e+03 9.63e+00 1.27e+01 3.41e+01 4.03e+03 9 10 11 12 13 14 15 16 1.92e+01 3.57e+02 1.70e+03 1.82e+02 1.18e+01 7.23e+00 2.90e+01 1.30e+01 17 18 19 20 21 22 23 24 6.79e+00 4.60e+00 5.71e+01 8.76e+00 3.39e+06 4.86e+00 2.29e+02 1.34e+02 25 26 27 28 29 30 31 32 4.98e+00 1.28e+01 4.71e+00 1.20e+02 4.23e+01 7.83e+01 3.65e+00 7.09e+02 33 34 35 36 37 38 39 40 1.58e+02 4.01e+01 2.86e+01 4.29e+02 1.88e+01 7.42e+02 8.07e+00 2.40e+02 41 42 43 44 45 46 47 48 9.75e+00 4.10e+01 9.79e+00 7.51e+00 7.59e+03 6.48e+00 7.51e+01 1.88e+02 49 50 51 52 53 54 55 56 7.33e+00 7.16e+00 1.50e+01 1.87e+01 1.54e+01 2.53e+01 1.43e+01 1.12e+02 57 58 59 60 61 62 63 64 6.63e+01 6.19e+01 1.21e+01 7.92e+02 7.29e+00 4.13e+00 1.63e+01 9.27e+00 65 66 67 68 69 70 71 72 1.10e+01 5.04e+01 7.74e+00 3.05e+01 4.56e+00 6.35e+01 1.52e+01 5.05e+00 73 74 75 76 77 78 79 80 3.57e+00 9.96e+01 8.17e+02 1.23e+02 7.85e+00 5.20e+01 1.29e+02 1.12e+01 81 82 83 84 85 86 87 88 1.65e+01 1.35e+02 1.96e+01 9.71e+00 1.45e+02 4.97e+00 7.02e+00 1.44e+01 89 90 91 92 93 94 95 96 2.23e+01 2.94e+02 4.72e+01 9.15e+00 3.85e+01 2.70e+01 6.59e+01 2.10e+01 97 98 99 100 6.23e+01 3.02e+01 1.93e+01 2.06e+02 1 2 3 4 5 6 7 8 9 10 11 12 13 2.05 4.30 5.33 9.07 2.27 2.54 3.53 8.30 2.96 5.88 7.44 5.20 2.47 14 15 16 17 18 19 20 21 22 23 24 25 26 1.98 3.37 2.56 1.92 1.53 4.04 2.17 15.00 1.58 5.43 4.90 1.61 2.55 27 28 29 30 31 32 33 34 35 36 37 38 39 1.55 4.79 3.75 4.36 1.29 6.56 5.06 3.69 3.35 6.06 2.94 6.61 2.09 40 41 42 43 44 45 46 47 48 49 50 51 52 5.48 2.28 3.71 2.28 2.02 8.93 1.87 4.32 5.24 1.99 1.97 2.71 2.93 53 54 55 56 57 58 59 60 61 62 63 64 65 2.73 3.23 2.66 4.72 4.19 4.12 2.49 6.68 1.99 1.42 2.79 2.23 2.39 66 67 68 69 70 71 72 73 74 75 76 77 78 3.92 2.05 3.42 1.52 4.15 2.72 1.62 1.27 4.60 6.71 4.81 2.06 3.95 79 80 81 82 83 84 85 86 87 88 89 90 91 4.86 2.41 2.80 4.91 2.97 2.27 4.98 1.60 1.95 2.67 3.11 5.68 3.85 92 93 94 95 96 97 98 99 100 2.21 3.65 3.29 4.19 3.04 4.13 3.41 2.96 5.33 1 2 3 4 5 6 7 8 9 10 6.82 2.32 3.46 2.62 1.56 4.69 5.07 2.78 6.84 3.35 (Intercept) x z (Intercept) 1.32e-04 -2.97e-05 1.59e-05 x -2.97e-05 1.60e-05 -2.54e-05 z 1.59e-05 -2.54e-05 5.32e-05 > > set.seed(20250302) > dfr_form_pois <- distfreereg(test_mean = form_pois, data = df_pois, + method = "glm", + method_args = list(family = "poisson"), + verbose = FALSE, + control = list(return_on_error = FALSE)) > > dfr_form_pois Number of observations: 100 Length of EPSP: 100 Monte Carlo simulations: 10000 Estimated parameter values: (Intercept) x z 9.989e-01 1.997e+00 1.008e+00 Observed statistics: Stat Value Pr(>Value) MCSE KS 5.661e-01 8.197e-01 3.844e-03 CvM 6.090e-02 7.963e-01 4.027e-03 --- `MCSE' is the Monte Carlo standard error of the estimated p-value. > test_dfr_functions(dfr_form_pois, newdata = newdata_pois) (Intercept) x z 0.999 2.000 1.010 Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) 0.976 1.02 x 1.990 2.00 z 0.994 1.02 1 2 3 4 5 6 7 8 7.75e+00 7.41e+01 2.07e+02 8.65e+03 9.63e+00 1.27e+01 3.41e+01 4.03e+03 9 10 11 12 13 14 15 16 1.92e+01 3.57e+02 1.70e+03 1.82e+02 1.18e+01 7.23e+00 2.90e+01 1.30e+01 17 18 19 20 21 22 23 24 6.79e+00 4.60e+00 5.71e+01 8.76e+00 3.39e+06 4.86e+00 2.29e+02 1.34e+02 25 26 27 28 29 30 31 32 4.98e+00 1.28e+01 4.71e+00 1.20e+02 4.23e+01 7.83e+01 3.65e+00 7.09e+02 33 34 35 36 37 38 39 40 1.58e+02 4.01e+01 2.86e+01 4.29e+02 1.88e+01 7.42e+02 8.07e+00 2.40e+02 41 42 43 44 45 46 47 48 9.75e+00 4.10e+01 9.79e+00 7.51e+00 7.59e+03 6.48e+00 7.51e+01 1.88e+02 49 50 51 52 53 54 55 56 7.33e+00 7.16e+00 1.50e+01 1.87e+01 1.54e+01 2.53e+01 1.43e+01 1.12e+02 57 58 59 60 61 62 63 64 6.63e+01 6.19e+01 1.21e+01 7.92e+02 7.29e+00 4.13e+00 1.63e+01 9.27e+00 65 66 67 68 69 70 71 72 1.10e+01 5.04e+01 7.74e+00 3.05e+01 4.56e+00 6.35e+01 1.52e+01 5.05e+00 73 74 75 76 77 78 79 80 3.57e+00 9.96e+01 8.17e+02 1.23e+02 7.85e+00 5.20e+01 1.29e+02 1.12e+01 81 82 83 84 85 86 87 88 1.65e+01 1.35e+02 1.96e+01 9.71e+00 1.45e+02 4.97e+00 7.02e+00 1.44e+01 89 90 91 92 93 94 95 96 2.23e+01 2.94e+02 4.72e+01 9.15e+00 3.85e+01 2.70e+01 6.59e+01 2.10e+01 97 98 99 100 6.23e+01 3.02e+01 1.93e+01 2.06e+02 1 2 3 4 5 6 7 8 9 10 11 12 13 2.05 4.30 5.33 9.07 2.27 2.54 3.53 8.30 2.96 5.88 7.44 5.20 2.47 14 15 16 17 18 19 20 21 22 23 24 25 26 1.98 3.37 2.56 1.92 1.53 4.04 2.17 15.00 1.58 5.43 4.90 1.61 2.55 27 28 29 30 31 32 33 34 35 36 37 38 39 1.55 4.79 3.75 4.36 1.29 6.56 5.06 3.69 3.35 6.06 2.94 6.61 2.09 40 41 42 43 44 45 46 47 48 49 50 51 52 5.48 2.28 3.71 2.28 2.02 8.93 1.87 4.32 5.24 1.99 1.97 2.71 2.93 53 54 55 56 57 58 59 60 61 62 63 64 65 2.73 3.23 2.66 4.72 4.19 4.12 2.49 6.68 1.99 1.42 2.79 2.23 2.39 66 67 68 69 70 71 72 73 74 75 76 77 78 3.92 2.05 3.42 1.52 4.15 2.72 1.62 1.27 4.60 6.71 4.81 2.06 3.95 79 80 81 82 83 84 85 86 87 88 89 90 91 4.86 2.41 2.80 4.91 2.97 2.27 4.98 1.60 1.95 2.67 3.11 5.68 3.85 92 93 94 95 96 97 98 99 100 2.21 3.65 3.29 4.19 3.04 4.13 3.41 2.96 5.33 1 2 3 4 5 6 7 8 9 10 6.82 2.32 3.46 2.62 1.56 4.69 5.07 2.78 6.84 3.35 (Intercept) x z (Intercept) 1.32e-04 -2.97e-05 1.59e-05 x -2.97e-05 1.60e-05 -2.54e-05 z 1.59e-05 -2.54e-05 5.32e-05 > > stopifnot(all.equal(dfr_pois, dfr_form_pois)) > > set.seed(20250225) > cdfr_form_pois <- asymptotics(dfr_form_pois, reps = 5) Running simulation... Repetition 1 of 5 Repetition 2 of 5 Repetition 3 of 5 Repetition 4 of 5 Repetition 5 of 5 > set.seed(20250225) > cdfr_pois <- asymptotics(dfr_pois, reps = 5) Running simulation... Repetition 1 of 5 Repetition 2 of 5 Repetition 3 of 5 Repetition 4 of 5 Repetition 5 of 5 > > signif(rejection(cdfr_form_pois, alpha = c(0.1, 0.5))[,2:3], digits = 3) alpha rate 1 0.1 0.2 2 0.5 0.6 3 0.1 0.2 4 0.5 0.8 > signif(rejection(cdfr_pois, alpha = c(0.1, 0.5))[,2:3], digits = 3) alpha rate 1 0.1 0.2 2 0.5 0.6 3 0.1 0.2 4 0.5 0.8 > > > # Orderings > > set.seed(20250516) > dfr_pois_asis <- update(dfr_pois, ordering = "asis") > set.seed(20250516) > dfr_form_pois_asis <- update(dfr_form_pois, ordering = "asis") > stopifnot(all.equal(dfr_pois_asis, dfr_form_pois_asis)) > > set.seed(20250516) > dfr_pois_optimal <- update(dfr_pois, ordering = "optimal") > set.seed(20250516) > dfr_form_pois_optimal <- update(dfr_form_pois, ordering = "optimal") > stopifnot(all.equal(dfr_pois_optimal, dfr_form_pois_optimal)) > > set.seed(20250516) > dfr_pois_natural <- update(dfr_pois, ordering = "natural") > set.seed(20250516) > dfr_form_pois_natural <- update(dfr_form_pois, ordering = "natural") > stopifnot(all.equal(dfr_pois_natural, dfr_form_pois_natural)) > > set.seed(20250516) > dfr_pois_g <- update(dfr_pois, ordering = list("g")) > set.seed(20250516) > dfr_form_pois_g <- update(dfr_form_pois, ordering = list("g")) > stopifnot(all.equal(dfr_pois_g, dfr_form_pois_g)) > > df_pois[dfr_pois_g[["res_order"]],][["g"]] [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [26] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 [51] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [76] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 > df_pois[dfr_form_pois_g[["res_order"]],][["g"]] [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [26] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 [51] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [76] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 > > set.seed(20250516) > dfr_pois_g_grouped <- update(dfr_pois_g, group = TRUE) > set.seed(20250516) > dfr_form_pois_g_grouped <- update(dfr_form_pois_g, group = TRUE) > stopifnot(all.equal(dfr_pois_g_grouped, dfr_form_pois_g_grouped)) > > > > ### Partial output > > dfr_pois_partial <- distfreereg(test_mean = m_pois, verbose = FALSE, + control = list(orth_tol = 1e-100)) Warning message: Error encountered, partial results returned: Error in calc_mu(J = J_for_mu, solve_tol = solve_tol, orth_tol = orth_tol): crossprod(mu) is not equal to the identity matrix > names(dfr_pois_partial) [1] "call" "data" "test_mean" [4] "covariance" "theta_hat" "optimization_output" [7] "fitted_values" "J" "" > > > > ### Binomial > > theta_binom <- c(1,2,-1,-3)/30 > p_binom <- length(theta_binom) - 1 > set.seed(20250225) > X_binom <- cbind(1, matrix(rexp(n*p_binom, rate = 1/5), ncol = p_binom)) > probs <- 1/(1 + exp(-colSums(theta_binom * t(X_binom)) - 1)) > Y_binom <- rbinom(n, size = 1, prob = probs) > > df_binom <- as.data.frame(cbind(Y_binom, X_binom[,-c(1,4)], rep(1:10, 10)))# omit intercept and one covariate > colnames(df_binom) <- c("y", letters[1:(length(theta_binom)-2)], "g") > df_binom$a <- df_binom$a^2 > form_binom <- reformulate(termlabels = colnames(df_binom)[-1], response = "y") > m_binom <- glm(form_binom, data = df_binom, family = "binomial", x = TRUE, y = TRUE) > > set.seed(20250302) > dfr_binom <- distfreereg(test_mean = m_binom, verbose = FALSE, + control = list(return_on_error = TRUE)) > dfr_binom Number of observations: 100 Length of EPSP: 100 Monte Carlo simulations: 10000 Estimated parameter values: (Intercept) a b g 9.641e-01 2.881e-03 -2.705e-02 -4.173e-02 Observed statistics: Stat Value Pr(>Value) MCSE KS 8.406e-01 3.738e-01 4.838e-03 CvM 1.374e-01 4.148e-01 4.927e-03 --- `MCSE' is the Monte Carlo standard error of the estimated p-value. > newdata_binom <- data.frame(y = rbinom(10, size = 1, prob = runif(10)), + a = rexp(10, rate = 1/5), b = rexp(10, rate = 1/5)) > test_dfr_functions(dfr_binom, newdata = newdata_binom) (Intercept) a b g 0.96400 0.00288 -0.02710 -0.04170 Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) -0.02660 2.02000 a -0.00102 0.00953 b -0.12100 0.06940 g -0.19300 0.10700 1 2 3 4 5 6 7 8 9 10 11 12 13 0.692 0.712 0.653 0.680 0.692 0.633 0.814 0.616 0.622 0.591 0.722 0.785 0.939 14 15 16 17 18 19 20 21 22 23 24 25 26 0.691 0.680 0.651 0.758 0.641 0.642 0.568 0.713 0.975 0.695 0.667 0.726 0.660 27 28 29 30 31 32 33 34 35 36 37 38 39 0.677 0.679 0.611 0.582 0.739 0.699 0.699 0.686 0.604 0.665 0.650 0.639 0.783 40 41 42 43 44 45 46 47 48 49 50 51 52 0.618 0.691 0.712 0.696 0.883 0.715 0.672 0.632 0.613 0.661 0.624 0.761 0.706 53 54 55 56 57 58 59 60 61 62 63 64 65 0.728 0.690 0.684 0.713 0.618 0.652 0.633 0.618 0.696 0.761 0.703 0.869 0.702 66 67 68 69 70 71 72 73 74 75 76 77 78 0.770 0.646 0.677 0.611 0.528 0.651 0.702 0.646 0.653 0.726 0.661 0.629 0.643 79 80 81 82 83 84 85 86 87 88 89 90 91 0.641 0.772 0.701 0.704 0.736 0.653 0.688 0.666 0.698 0.660 0.521 0.619 0.715 92 93 94 95 96 97 98 99 100 0.660 0.576 0.653 0.614 0.665 0.626 0.630 0.646 0.629 1 2 3 4 5 6 7 8 9 10 11 0.8100 0.9040 0.6310 0.7530 0.8080 0.5440 1.4800 0.4730 0.4990 0.3690 0.9560 12 13 14 15 16 17 18 19 20 21 22 1.2900 2.7300 0.8040 0.7530 0.6250 1.1400 0.5800 0.5860 0.2740 0.9110 3.6500 23 24 25 26 27 28 29 30 31 32 33 0.8240 0.6930 0.9760 0.6630 0.7390 0.7490 0.4530 0.3330 1.0400 0.8430 0.8420 34 35 36 37 38 39 40 41 42 43 44 0.7830 0.4230 0.6870 0.6200 0.5720 1.2800 0.4830 0.8070 0.9060 0.8300 2.0200 45 46 47 48 49 50 51 52 53 54 55 0.9210 0.7170 0.5410 0.4590 0.6670 0.5070 1.1600 0.8740 0.9860 0.7990 0.7750 56 57 58 59 60 61 62 63 64 65 66 0.9080 0.4810 0.6270 0.5440 0.4830 0.8270 1.1600 0.8610 1.8900 0.8560 1.2100 67 68 69 70 71 72 73 74 75 76 77 0.6020 0.7410 0.4530 0.1100 0.6250 0.8550 0.6010 0.6340 0.9730 0.6690 0.5290 78 79 80 81 82 83 84 85 86 87 88 0.5880 0.5780 1.2200 0.8500 0.8660 1.0300 0.6340 0.7920 0.6900 0.8380 0.6650 89 90 91 92 93 94 95 96 97 98 99 0.0827 0.4860 0.9210 0.6640 0.3060 0.6320 0.4650 0.6840 0.5150 0.5300 0.6000 100 0.5300 NULL (Intercept) a b g (Intercept) 0.26900 -3.00e-04 -7.45e-03 -3.11e-02 a -0.00030 6.74e-06 -9.42e-07 6.48e-06 b -0.00745 -9.42e-07 2.23e-03 -4.36e-04 g -0.03110 6.48e-06 -4.36e-04 5.78e-03 > > set.seed(20250302) > dfr_form_binom <- distfreereg(test_mean = form_binom, data = df_binom, + method = "glm", + method_args = list(family = "binomial"), + verbose = FALSE, + control = list(return_on_error = FALSE)) > dfr_form_binom Number of observations: 100 Length of EPSP: 100 Monte Carlo simulations: 10000 Estimated parameter values: (Intercept) a b g 9.641e-01 2.881e-03 -2.705e-02 -4.173e-02 Observed statistics: Stat Value Pr(>Value) MCSE KS 8.406e-01 3.738e-01 4.838e-03 CvM 1.374e-01 4.148e-01 4.927e-03 --- `MCSE' is the Monte Carlo standard error of the estimated p-value. > test_dfr_functions(dfr_form_binom, newdata = newdata_binom) (Intercept) a b g 0.96400 0.00288 -0.02710 -0.04170 Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) -0.02660 2.02000 a -0.00102 0.00953 b -0.12100 0.06940 g -0.19300 0.10700 1 2 3 4 5 6 7 8 9 10 11 12 13 0.692 0.712 0.653 0.680 0.692 0.633 0.814 0.616 0.622 0.591 0.722 0.785 0.939 14 15 16 17 18 19 20 21 22 23 24 25 26 0.691 0.680 0.651 0.758 0.641 0.642 0.568 0.713 0.975 0.695 0.667 0.726 0.660 27 28 29 30 31 32 33 34 35 36 37 38 39 0.677 0.679 0.611 0.582 0.739 0.699 0.699 0.686 0.604 0.665 0.650 0.639 0.783 40 41 42 43 44 45 46 47 48 49 50 51 52 0.618 0.691 0.712 0.696 0.883 0.715 0.672 0.632 0.613 0.661 0.624 0.761 0.706 53 54 55 56 57 58 59 60 61 62 63 64 65 0.728 0.690 0.684 0.713 0.618 0.652 0.633 0.618 0.696 0.761 0.703 0.869 0.702 66 67 68 69 70 71 72 73 74 75 76 77 78 0.770 0.646 0.677 0.611 0.528 0.651 0.702 0.646 0.653 0.726 0.661 0.629 0.643 79 80 81 82 83 84 85 86 87 88 89 90 91 0.641 0.772 0.701 0.704 0.736 0.653 0.688 0.666 0.698 0.660 0.521 0.619 0.715 92 93 94 95 96 97 98 99 100 0.660 0.576 0.653 0.614 0.665 0.626 0.630 0.646 0.629 1 2 3 4 5 6 7 8 9 10 11 0.8100 0.9040 0.6310 0.7530 0.8080 0.5440 1.4800 0.4730 0.4990 0.3690 0.9560 12 13 14 15 16 17 18 19 20 21 22 1.2900 2.7300 0.8040 0.7530 0.6250 1.1400 0.5800 0.5860 0.2740 0.9110 3.6500 23 24 25 26 27 28 29 30 31 32 33 0.8240 0.6930 0.9760 0.6630 0.7390 0.7490 0.4530 0.3330 1.0400 0.8430 0.8420 34 35 36 37 38 39 40 41 42 43 44 0.7830 0.4230 0.6870 0.6200 0.5720 1.2800 0.4830 0.8070 0.9060 0.8300 2.0200 45 46 47 48 49 50 51 52 53 54 55 0.9210 0.7170 0.5410 0.4590 0.6670 0.5070 1.1600 0.8740 0.9860 0.7990 0.7750 56 57 58 59 60 61 62 63 64 65 66 0.9080 0.4810 0.6270 0.5440 0.4830 0.8270 1.1600 0.8610 1.8900 0.8560 1.2100 67 68 69 70 71 72 73 74 75 76 77 0.6020 0.7410 0.4530 0.1100 0.6250 0.8550 0.6010 0.6340 0.9730 0.6690 0.5290 78 79 80 81 82 83 84 85 86 87 88 0.5880 0.5780 1.2200 0.8500 0.8660 1.0300 0.6340 0.7920 0.6900 0.8380 0.6650 89 90 91 92 93 94 95 96 97 98 99 0.0827 0.4860 0.9210 0.6640 0.3060 0.6320 0.4650 0.6840 0.5150 0.5300 0.6000 100 0.5300 NULL (Intercept) a b g (Intercept) 0.26900 -3.00e-04 -7.45e-03 -3.11e-02 a -0.00030 6.74e-06 -9.42e-07 6.48e-06 b -0.00745 -9.42e-07 2.23e-03 -4.36e-04 g -0.03110 6.48e-06 -4.36e-04 5.78e-03 > > stopifnot(all.equal(dfr_binom, dfr_form_binom)) > > cdfr_form_binom <- asymptotics(dfr_form_binom, reps = 5) Running simulation... Repetition 1 of 5 Repetition 2 of 5 Repetition 3 of 5 Repetition 4 of 5 Repetition 5 of 5 > cdfr_binom <- asymptotics(dfr_binom, reps = 5) Running simulation... Repetition 1 of 5 Repetition 2 of 5 Repetition 3 of 5 Repetition 4 of 5 Repetition 5 of 5 > > signif(rejection(cdfr_form_binom, alpha = c(0.1, 0.5))[,2:3], digits = 3) alpha rate 1 0.1 0.0 2 0.5 0.4 3 0.1 0.0 4 0.5 0.4 > signif(rejection(cdfr_binom, alpha = c(0.1, 0.5))[,2:3], digits = 3) alpha rate 1 0.1 0.2 2 0.5 0.4 3 0.1 0.4 4 0.5 0.4 > > # Orderings > > set.seed(20250516) > dfr_binom_asis <- update(dfr_binom, ordering = "asis") > set.seed(20250516) > dfr_form_binom_asis <- update(dfr_form_binom, ordering = "asis") > stopifnot(all.equal(dfr_binom_asis, dfr_form_binom_asis)) > > set.seed(20250516) > dfr_binom_optimal <- update(dfr_binom, ordering = "optimal") > set.seed(20250516) > dfr_form_binom_optimal <- update(dfr_form_binom, ordering = "optimal") > stopifnot(all.equal(dfr_binom_optimal, dfr_form_binom_optimal)) > > set.seed(20250516) > dfr_binom_natural <- update(dfr_binom, ordering = "natural") > set.seed(20250516) > dfr_form_binom_natural <- update(dfr_form_binom, ordering = "natural") > stopifnot(all.equal(dfr_binom_natural, dfr_form_binom_natural)) > > set.seed(20250516) > dfr_binom_g <- update(dfr_binom, ordering = list("g")) > set.seed(20250516) > dfr_form_binom_g <- update(dfr_form_binom, ordering = list("g")) > stopifnot(all.equal(dfr_binom_g, dfr_form_binom_g)) > > df_binom[dfr_binom_g[["res_order"]],][["g"]] [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [26] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 [51] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [76] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 > df_binom[dfr_form_binom_g[["res_order"]],][["g"]] [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [26] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 [51] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 [76] 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 > > set.seed(20250516) > dfr_binom_g_grouped <- update(dfr_binom_g, group = TRUE) > set.seed(20250516) > dfr_form_binom_g_grouped <- update(dfr_form_binom_g, group = TRUE) > stopifnot(all.equal(dfr_binom_g_grouped, dfr_form_binom_g_grouped)) > > > > > ### Failures > > tryCatch(distfreereg(test_mean = form_pois, data = df_pois, + method = "glm", + method_args = list(family = "poisson", + weights = rep(1, n)), + verbose = FALSE, + control = list(return_on_error = FALSE)), + error = function(e) warning(e)) Warning message: In validate_args_distfreereg_glm(test_mean = test_mean, extra_arg_list = extra_arg_list) : 'weights' argument for glm() not supported > > proc.time() user system elapsed 25.29 0.70 26.00