bambi/priors.py
Killed 157 out of 260 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 290
--- bambi/priors.py
+++ bambi/priors.py
@@ -29,7 +29,7 @@
"""
def __init__(self, name, prior, link, parent):
- self.name = name
+ self.name = None
self.prior = prior
self.link = link
self.parent = parent
Mutant 295
--- bambi/priors.py
+++ bambi/priors.py
@@ -35,7 +35,7 @@
self.parent = parent
fams = {
"bernoulli": genmod_families.Binomial,
- "gamma": genmod_families.Gamma,
+ "XXgammaXX": genmod_families.Gamma,
"gaussian": genmod_families.Gaussian,
"wald": genmod_families.InverseGaussian,
"negativebinomial": genmod_families.NegativeBinomial,
Mutant 297
--- bambi/priors.py
+++ bambi/priors.py
@@ -37,7 +37,7 @@
"bernoulli": genmod_families.Binomial,
"gamma": genmod_families.Gamma,
"gaussian": genmod_families.Gaussian,
- "wald": genmod_families.InverseGaussian,
+ "XXwaldXX": genmod_families.InverseGaussian,
"negativebinomial": genmod_families.NegativeBinomial,
"poisson": genmod_families.Poisson,
"t": None, # not implemented in statsmodels
Mutant 298
--- bambi/priors.py
+++ bambi/priors.py
@@ -38,7 +38,7 @@
"gamma": genmod_families.Gamma,
"gaussian": genmod_families.Gaussian,
"wald": genmod_families.InverseGaussian,
- "negativebinomial": genmod_families.NegativeBinomial,
+ "XXnegativebinomialXX": genmod_families.NegativeBinomial,
"poisson": genmod_families.Poisson,
"t": None, # not implemented in statsmodels
}
Mutant 299
--- bambi/priors.py
+++ bambi/priors.py
@@ -39,7 +39,7 @@
"gaussian": genmod_families.Gaussian,
"wald": genmod_families.InverseGaussian,
"negativebinomial": genmod_families.NegativeBinomial,
- "poisson": genmod_families.Poisson,
+ "XXpoissonXX": genmod_families.Poisson,
"t": None, # not implemented in statsmodels
}
self.smfamily = fams[name] if name in fams.keys() else None
Mutant 300
--- bambi/priors.py
+++ bambi/priors.py
@@ -40,7 +40,7 @@
"wald": genmod_families.InverseGaussian,
"negativebinomial": genmod_families.NegativeBinomial,
"poisson": genmod_families.Poisson,
- "t": None, # not implemented in statsmodels
+ "XXtXX": None, # not implemented in statsmodels
}
self.smfamily = fams[name] if name in fams.keys() else None
Mutant 304
--- bambi/priors.py
+++ bambi/priors.py
@@ -58,7 +58,7 @@
def __init__(self, name, scale=None, **kwargs):
self.name = name
- self._auto_scale = True
+ self._auto_scale = False
self.scale = scale
self.args = {}
self.update(**kwargs)
Mutant 305
--- bambi/priors.py
+++ bambi/priors.py
@@ -58,7 +58,7 @@
def __init__(self, name, scale=None, **kwargs):
self.name = name
- self._auto_scale = True
+ self._auto_scale = None
self.scale = scale
self.args = {}
self.update(**kwargs)
Mutant 306
--- bambi/priors.py
+++ bambi/priors.py
@@ -59,7 +59,7 @@
def __init__(self, name, scale=None, **kwargs):
self.name = name
self._auto_scale = True
- self.scale = scale
+ self.scale = None
self.args = {}
self.update(**kwargs)
Mutant 344
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"XXnarrowXX": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 345
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 1.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 346
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "XXmediumXX": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 347
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 1.4, "wide": 3 ** -0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 349
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 0.4, "wide": 4 ** -0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 351
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** +0.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 352
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -1.5, "superwide": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 353
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "XXsuperwideXX": 0.8}
def __init__(self, model, taylor):
self.model = model
Mutant 354
--- bambi/priors.py
+++ bambi/priors.py
@@ -188,7 +188,7 @@
class PriorScaler:
# Default is 'wide'. The wide prior sigma is sqrt(1/3) = .577 on the partial
# corr scale, which is the sigma of a flat prior over [-1,1].
- names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 0.8}
+ names = {"narrow": 0.2, "medium": 0.4, "wide": 3 ** -0.5, "superwide": 1.8}
def __init__(self, model, taylor):
self.model = model
Mutant 360
--- bambi/priors.py
+++ bambi/priors.py
@@ -201,7 +201,7 @@
}
)
self.priors = {}
- missing = "drop" if self.model.dropna else "none"
+ missing = "XXdropXX" if self.model.dropna else "none"
self.mle = GLM(
endog=self.model.y.data,
exog=self.dm,
Mutant 361
--- bambi/priors.py
+++ bambi/priors.py
@@ -201,7 +201,7 @@
}
)
self.priors = {}
- missing = "drop" if self.model.dropna else "none"
+ missing = "drop" if self.model.dropna else "XXnoneXX"
self.mle = GLM(
endog=self.model.y.data,
exog=self.dm,
Mutant 362
--- bambi/priors.py
+++ bambi/priors.py
@@ -201,7 +201,7 @@
}
)
self.priors = {}
- missing = "drop" if self.model.dropna else "none"
+ missing = None
self.mle = GLM(
endog=self.model.y.data,
exog=self.dm,
Mutant 367
--- bambi/priors.py
+++ bambi/priors.py
@@ -210,7 +210,7 @@
).fit()
self.taylor = taylor
with open(join(dirname(__file__), "config", "derivs.txt"), "r") as file:
- self.deriv = [next(file).strip("\n") for x in range(taylor + 1)]
+ self.deriv = [next(file).strip("XX\nXX") for x in range(taylor + 1)]
def _get_slope_stats(self, exog, predictor, sigma_corr, full_mod=None, points=4):
"""
Mutant 369
--- bambi/priors.py
+++ bambi/priors.py
@@ -210,7 +210,7 @@
).fit()
self.taylor = taylor
with open(join(dirname(__file__), "config", "derivs.txt"), "r") as file:
- self.deriv = [next(file).strip("\n") for x in range(taylor + 1)]
+ self.deriv = [next(file).strip("\n") for x in range(taylor + 2)]
def _get_slope_stats(self, exog, predictor, sigma_corr, full_mod=None, points=4):
"""
Mutant 371
--- bambi/priors.py
+++ bambi/priors.py
@@ -212,7 +212,7 @@
with open(join(dirname(__file__), "config", "derivs.txt"), "r") as file:
self.deriv = [next(file).strip("\n") for x in range(taylor + 1)]
- def _get_slope_stats(self, exog, predictor, sigma_corr, full_mod=None, points=4):
+ def _get_slope_stats(self, exog, predictor, sigma_corr, full_mod=None, points=5):
"""
Parameters
----------
Mutant 374
--- bambi/priors.py
+++ bambi/priors.py
@@ -230,7 +230,7 @@
keeps = [
i
for i, x in enumerate(list(exog.columns))
- if not np.array_equal(predictor, exog[x].values.flatten())
+ if np.array_equal(predictor, exog[x].values.flatten())
]
i = [x for x in range(exog.shape[1]) if x not in keeps][0]
Mutant 376
--- bambi/priors.py
+++ bambi/priors.py
@@ -232,7 +232,7 @@
for i, x in enumerate(list(exog.columns))
if not np.array_equal(predictor, exog[x].values.flatten())
]
- i = [x for x in range(exog.shape[1]) if x not in keeps][0]
+ i = [x for x in range(exog.shape[1]) if x in keeps][0]
# get log-likelihood values from beta=0 to beta=MLE
values = np.linspace(0.0, full_mod.params[i], points)
Mutant 379
--- bambi/priors.py
+++ bambi/priors.py
@@ -235,7 +235,7 @@
i = [x for x in range(exog.shape[1]) if x not in keeps][0]
# get log-likelihood values from beta=0 to beta=MLE
- values = np.linspace(0.0, full_mod.params[i], points)
+ values = np.linspace(1.0, full_mod.params[i], points)
# if there are multiple predictors, use statsmodels to optimize the LL
if keeps:
null = [
Mutant 385
--- bambi/priors.py
+++ bambi/priors.py
@@ -260,7 +260,7 @@
# c: intercept, d: shift parameter
# a: quartic coefficient, b: quadratic coefficient
- intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
+ intercept, shift_parameter = log_likelihood[+1], -(full_mod.params[i].item())
X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
Mutant 386
--- bambi/priors.py
+++ bambi/priors.py
@@ -260,7 +260,7 @@
# c: intercept, d: shift parameter
# a: quartic coefficient, b: quadratic coefficient
- intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
+ intercept, shift_parameter = log_likelihood[-2], -(full_mod.params[i].item())
X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
Mutant 387
--- bambi/priors.py
+++ bambi/priors.py
@@ -260,7 +260,7 @@
# c: intercept, d: shift parameter
# a: quartic coefficient, b: quadratic coefficient
- intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
+ intercept, shift_parameter = log_likelihood[-1], +(full_mod.params[i].item())
X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
Mutant 389
--- bambi/priors.py
+++ bambi/priors.py
@@ -261,7 +261,7 @@
# a: quartic coefficient, b: quadratic coefficient
intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
- X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
+ X = np.array([(values - shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
[np.linalg.inv(np.dot(X.T, X)), X.T, (log_likelihood[:, None] - intercept)]
Mutant 390
--- bambi/priors.py
+++ bambi/priors.py
@@ -261,7 +261,7 @@
# a: quartic coefficient, b: quadratic coefficient
intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
- X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
+ X = np.array([(values + shift_parameter) * 4, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
[np.linalg.inv(np.dot(X.T, X)), X.T, (log_likelihood[:, None] - intercept)]
Mutant 391
--- bambi/priors.py
+++ bambi/priors.py
@@ -261,7 +261,7 @@
# a: quartic coefficient, b: quadratic coefficient
intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
- X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
+ X = np.array([(values + shift_parameter) ** 5, (values + shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
[np.linalg.inv(np.dot(X.T, X)), X.T, (log_likelihood[:, None] - intercept)]
Mutant 392
--- bambi/priors.py
+++ bambi/priors.py
@@ -261,7 +261,7 @@
# a: quartic coefficient, b: quadratic coefficient
intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
- X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
+ X = np.array([(values + shift_parameter) ** 4, (values - shift_parameter) ** 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
[np.linalg.inv(np.dot(X.T, X)), X.T, (log_likelihood[:, None] - intercept)]
Mutant 393
--- bambi/priors.py
+++ bambi/priors.py
@@ -261,7 +261,7 @@
# a: quartic coefficient, b: quadratic coefficient
intercept, shift_parameter = log_likelihood[-1], -(full_mod.params[i].item())
- X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) ** 2]).T
+ X = np.array([(values + shift_parameter) ** 4, (values + shift_parameter) * 2]).T
coef_a, coef_b = np.squeeze(
np.linalg.multi_dot(
[np.linalg.inv(np.dot(X.T, X)), X.T, (log_likelihood[:, None] - intercept)]
Mutant 399
--- bambi/priors.py
+++ bambi/priors.py
@@ -271,7 +271,7 @@
# m, v: mean and variance of beta distribution of correlations
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
- variance = sigma_corr ** 2 / 4
+ variance = sigma_corr * 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
Mutant 400
--- bambi/priors.py
+++ bambi/priors.py
@@ -271,7 +271,7 @@
# m, v: mean and variance of beta distribution of correlations
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
- variance = sigma_corr ** 2 / 4
+ variance = sigma_corr ** 3 / 4
p = mean * (mean * (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
Mutant 401
--- bambi/priors.py
+++ bambi/priors.py
@@ -271,7 +271,7 @@
# m, v: mean and variance of beta distribution of correlations
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
- variance = sigma_corr ** 2 / 4
+ variance = sigma_corr ** 2 * 4
p = mean * (mean * (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
Mutant 402
--- bambi/priors.py
+++ bambi/priors.py
@@ -271,7 +271,7 @@
# m, v: mean and variance of beta distribution of correlations
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
- variance = sigma_corr ** 2 / 4
+ variance = sigma_corr ** 2 / 5
p = mean * (mean * (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
Mutant 404
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean / (mean * (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 405
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean * (mean / (1 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 406
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean * (mean * (2 - mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 407
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean * (mean * (1 + mean) / variance - 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 409
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean * (mean * (1 - mean) / variance + 1)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 410
--- bambi/priors.py
+++ bambi/priors.py
@@ -272,7 +272,7 @@
# p, q: corresponding shape parameters of beta distribution
mean = 0.5
variance = sigma_corr ** 2 / 4
- p = mean * (mean * (1 - mean) / variance - 1)
+ p = mean * (mean * (1 - mean) / variance - 2)
q = (1 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
Mutant 412
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (2 - mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 413
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 + mean) * (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 414
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) / (mean * (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 415
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) * (mean / (1 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 416
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) * (mean * (2 - mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 417
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) * (mean * (1 + mean) / variance - 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 419
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) * (mean * (1 - mean) / variance + 1)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 420
--- bambi/priors.py
+++ bambi/priors.py
@@ -273,7 +273,7 @@
mean = 0.5
variance = sigma_corr ** 2 / 4
p = mean * (mean * (1 - mean) / variance - 1)
- q = (1 - mean) * (mean * (1 - mean) / variance - 1)
+ q = (1 - mean) * (mean * (1 - mean) / variance - 2)
# function to return central moments of rescaled beta distribution
def moment(k):
Mutant 422
--- bambi/priors.py
+++ bambi/priors.py
@@ -277,7 +277,7 @@
# function to return central moments of rescaled beta distribution
def moment(k):
- return (2 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
+ return (3 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
# evaluate the derivatives of beta = f(correlation).
# dict 'point' gives points about which to Taylor expand. We want to
Mutant 424
--- bambi/priors.py
+++ bambi/priors.py
@@ -277,7 +277,7 @@
# function to return central moments of rescaled beta distribution
def moment(k):
- return (2 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
+ return (2 * p * (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
# evaluate the derivatives of beta = f(correlation).
# dict 'point' gives points about which to Taylor expand. We want to
Mutant 426
--- bambi/priors.py
+++ bambi/priors.py
@@ -277,7 +277,7 @@
# function to return central moments of rescaled beta distribution
def moment(k):
- return (2 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
+ return (2 * p / (p + q)) * k * hyp2f1(p, -k, p + q, (p + q) / p)
# evaluate the derivatives of beta = f(correlation).
# dict 'point' gives points about which to Taylor expand. We want to
Mutant 431
--- bambi/priors.py
+++ bambi/priors.py
@@ -277,7 +277,7 @@
# function to return central moments of rescaled beta distribution
def moment(k):
- return (2 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) / p)
+ return (2 * p / (p + q)) ** k * hyp2f1(p, -k, p + q, (p + q) * p)
# evaluate the derivatives of beta = f(correlation).
# dict 'point' gives points about which to Taylor expand. We want to
Mutant 433
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 15), 2 ** np.linspace(-1, 5, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 434
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 3 ** np.linspace(-1, 5, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 435
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 * np.linspace(-1, 5, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 436
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 ** np.linspace(+1, 5, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 437
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 ** np.linspace(-2, 5, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 438
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 6, 13) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 439
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 14) / 100))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 441
--- bambi/priors.py
+++ bambi/priors.py
@@ -285,7 +285,7 @@
# do not exist at 0. Evaluating at a point very close to 0 (e.g., .001)
# generally gives good results, but the higher order the expansion, the
# further from 0 we need to evaluate the derivatives, or they blow up.
- point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 100))
+ point = dict(zip(range(1, 14), 2 ** np.linspace(-1, 5, 13) / 101))
vals = dict(a=coef_a, b=coef_b, n=len(self.model.y.data), r=point[self.taylor])
_deriv = [eval(x, globals(), vals) for x in self.deriv] # pylint: disable=eval-used
Mutant 451
--- bambi/priors.py
+++ bambi/priors.py
@@ -298,7 +298,7 @@
/ np.math.factorial(j)
* _deriv[i]
* _deriv[j]
- * (moment(i + j) - moment(i) * moment(j))
+ * (moment(i + j) + moment(i) * moment(j))
)
terms = [term(i, j) for i in range(1, self.taylor + 1) for j in range(1, self.taylor + 1)]
Mutant 460
--- bambi/priors.py
+++ bambi/priors.py
@@ -302,7 +302,7 @@
)
terms = [term(i, j) for i in range(1, self.taylor + 1) for j in range(1, self.taylor + 1)]
- return np.array(terms).sum() ** 0.5
+ return np.array(terms).sum() * 0.5
def _get_intercept_stats(self, add_slopes=True):
# start with mean and variance of Y on the link scale
Mutant 461
--- bambi/priors.py
+++ bambi/priors.py
@@ -302,7 +302,7 @@
)
terms = [term(i, j) for i in range(1, self.taylor + 1) for j in range(1, self.taylor + 1)]
- return np.array(terms).sum() ** 0.5
+ return np.array(terms).sum() ** 1.5
def _get_intercept_stats(self, add_slopes=True):
# start with mean and variance of Y on the link scale
Mutant 462
--- bambi/priors.py
+++ bambi/priors.py
@@ -304,7 +304,7 @@
terms = [term(i, j) for i in range(1, self.taylor + 1) for j in range(1, self.taylor + 1)]
return np.array(terms).sum() ** 0.5
- def _get_intercept_stats(self, add_slopes=True):
+ def _get_intercept_stats(self, add_slopes=False):
# start with mean and variance of Y on the link scale
mod = GLM(
endog=self.model.y.data,
Mutant 463
--- bambi/priors.py
+++ bambi/priors.py
@@ -308,7 +308,7 @@
# start with mean and variance of Y on the link scale
mod = GLM(
endog=self.model.y.data,
- exog=np.repeat(1, len(self.model.y.data)),
+ exog=np.repeat(2, len(self.model.y.data)),
family=self.model.family.smfamily(),
missing="drop" if self.model.dropna else "none",
).fit()
Mutant 464
--- bambi/priors.py
+++ bambi/priors.py
@@ -310,7 +310,7 @@
endog=self.model.y.data,
exog=np.repeat(1, len(self.model.y.data)),
family=self.model.family.smfamily(),
- missing="drop" if self.model.dropna else "none",
+ missing="XXdropXX" if self.model.dropna else "none",
).fit()
mu = mod.params
# multiply SE by sqrt(N) to turn it into (approx.) sigma(Y) on link scale
Mutant 465
--- bambi/priors.py
+++ bambi/priors.py
@@ -310,7 +310,7 @@
endog=self.model.y.data,
exog=np.repeat(1, len(self.model.y.data)),
family=self.model.family.smfamily(),
- missing="drop" if self.model.dropna else "none",
+ missing="drop" if self.model.dropna else "XXnoneXX",
).fit()
mu = mod.params
# multiply SE by sqrt(N) to turn it into (approx.) sigma(Y) on link scale
Mutant 468
--- bambi/priors.py
+++ bambi/priors.py
@@ -314,7 +314,7 @@
).fit()
mu = mod.params
# multiply SE by sqrt(N) to turn it into (approx.) sigma(Y) on link scale
- sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
+ sigma = (mod.cov_params()[0] / len(mod.mu)) ** 0.5
# modify mu and sigma based on means and sigmas of slope priors.
if len(self.model.fixed_terms) > 1 and add_slopes:
Mutant 469
--- bambi/priors.py
+++ bambi/priors.py
@@ -314,7 +314,7 @@
).fit()
mu = mod.params
# multiply SE by sqrt(N) to turn it into (approx.) sigma(Y) on link scale
- sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
+ sigma = (mod.cov_params()[0] * len(mod.mu)) * 0.5
# modify mu and sigma based on means and sigmas of slope priors.
if len(self.model.fixed_terms) > 1 and add_slopes:
Mutant 470
--- bambi/priors.py
+++ bambi/priors.py
@@ -314,7 +314,7 @@
).fit()
mu = mod.params
# multiply SE by sqrt(N) to turn it into (approx.) sigma(Y) on link scale
- sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
+ sigma = (mod.cov_params()[0] * len(mod.mu)) ** 1.5
# modify mu and sigma based on means and sigmas of slope priors.
if len(self.model.fixed_terms) > 1 and add_slopes:
Mutant 472
--- bambi/priors.py
+++ bambi/priors.py
@@ -317,7 +317,7 @@
sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
# modify mu and sigma based on means and sigmas of slope priors.
- if len(self.model.fixed_terms) > 1 and add_slopes:
+ if len(self.model.fixed_terms) >= 1 and add_slopes:
means = np.array([x["mu"] for x in self.priors.values()])
sigmas = np.array([x["sigma"] for x in self.priors.values()])
# add to intercept prior
Mutant 473
--- bambi/priors.py
+++ bambi/priors.py
@@ -317,7 +317,7 @@
sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
# modify mu and sigma based on means and sigmas of slope priors.
- if len(self.model.fixed_terms) > 1 and add_slopes:
+ if len(self.model.fixed_terms) > 2 and add_slopes:
means = np.array([x["mu"] for x in self.priors.values()])
sigmas = np.array([x["sigma"] for x in self.priors.values()])
# add to intercept prior
Mutant 474
--- bambi/priors.py
+++ bambi/priors.py
@@ -317,7 +317,7 @@
sigma = (mod.cov_params()[0] * len(mod.mu)) ** 0.5
# modify mu and sigma based on means and sigmas of slope priors.
- if len(self.model.fixed_terms) > 1 and add_slopes:
+ if len(self.model.fixed_terms) > 1 or add_slopes:
means = np.array([x["mu"] for x in self.priors.values()])
sigmas = np.array([x["sigma"] for x in self.priors.values()])
# add to intercept prior
Mutant 481
--- bambi/priors.py
+++ bambi/priors.py
@@ -322,7 +322,7 @@
sigmas = np.array([x["sigma"] for x in self.priors.values()])
# add to intercept prior
index = list(self.priors.keys())
- mu -= np.dot(means, self.stats["mean_x"][index])
+ mu += np.dot(means, self.stats["mean_x"][index])
sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
return mu, sigma
Mutant 483
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma * 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
return mu, sigma
Mutant 484
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 3 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
return mu, sigma
Mutant 486
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas * 2, self.stats["mean_x"][index] ** 2)) ** 0.5
return mu, sigma
Mutant 487
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas ** 3, self.stats["mean_x"][index] ** 2)) ** 0.5
return mu, sigma
Mutant 489
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] * 2)) ** 0.5
return mu, sigma
Mutant 490
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 3)) ** 0.5
return mu, sigma
Mutant 491
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) * 0.5
return mu, sigma
Mutant 492
--- bambi/priors.py
+++ bambi/priors.py
@@ -323,7 +323,7 @@
# add to intercept prior
index = list(self.priors.keys())
mu -= np.dot(means, self.stats["mean_x"][index])
- sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 0.5
+ sigma = (sigma ** 2 + np.dot(sigmas ** 2, self.stats["mean_x"][index] ** 2)) ** 1.5
return mu, sigma
Mutant 494
--- bambi/priors.py
+++ bambi/priors.py
@@ -330,7 +330,7 @@
def _scale_fixed(self, term):
# these defaults are only defined for Normal priors
- if term.prior.name != "Normal":
+ if term.prior.name == "Normal":
return
mu = []
Mutant 495
--- bambi/priors.py
+++ bambi/priors.py
@@ -330,7 +330,7 @@
def _scale_fixed(self, term):
# these defaults are only defined for Normal priors
- if term.prior.name != "Normal":
+ if term.prior.name != "XXNormalXX":
return
mu = []
Mutant 501
--- bambi/priors.py
+++ bambi/priors.py
@@ -337,7 +337,7 @@
sigma = []
sigma_corr = term.prior.scale
for pred in term.data.T:
- mu += [0]
+ mu += [1]
sigma += [self._get_slope_stats(exog=self.dm, predictor=pred, sigma_corr=sigma_corr)]
# save and set prior
Mutant 506
--- bambi/priors.py
+++ bambi/priors.py
@@ -348,7 +348,7 @@
def _scale_intercept(self, term):
# default priors are only defined for Normal priors
- if term.prior.name != "Normal":
+ if term.prior.name == "Normal":
return
# get prior mean and sigma for fixed intercept
Mutant 507
--- bambi/priors.py
+++ bambi/priors.py
@@ -348,7 +348,7 @@
def _scale_intercept(self, term):
# default priors are only defined for Normal priors
- if term.prior.name != "Normal":
+ if term.prior.name != "XXNormalXX":
return
# get prior mean and sigma for fixed intercept
Mutant 510
--- bambi/priors.py
+++ bambi/priors.py
@@ -360,7 +360,7 @@
def _scale_random(self, term):
# these default priors are only defined for HalfNormal priors
- if term.prior.args["sigma"].name != "HalfNormal":
+ if term.prior.args["sigma"].name == "HalfNormal":
return
sigma_corr = term.prior.scale
Mutant 511
--- bambi/priors.py
+++ bambi/priors.py
@@ -360,7 +360,7 @@
def _scale_random(self, term):
# these default priors are only defined for HalfNormal priors
- if term.prior.args["sigma"].name != "HalfNormal":
+ if term.prior.args["sigma"].name != "XXHalfNormalXX":
return
sigma_corr = term.prior.scale
Mutant 516
--- bambi/priors.py
+++ bambi/priors.py
@@ -371,7 +371,7 @@
# handle intercepts and cell means
if term.constant:
_, sigma = self._get_intercept_stats()
- sigma *= sigma_corr
+ sigma = sigma_corr
# handle slopes
else:
exists = [
Mutant 517
--- bambi/priors.py
+++ bambi/priors.py
@@ -371,7 +371,7 @@
# handle intercepts and cell means
if term.constant:
_, sigma = self._get_intercept_stats()
- sigma *= sigma_corr
+ sigma /= sigma_corr
# handle slopes
else:
exists = [
Mutant 519
--- bambi/priors.py
+++ bambi/priors.py
@@ -380,7 +380,7 @@
if np.array_equal(fix_data, self.dm[x].values)
]
# handle case where there IS a corresponding fixed effect
- if exists and exists[0] in self.priors.keys():
+ if exists and exists[0] not in self.priors.keys():
sigma = self.priors[exists[0]]["sigma"]
# handle case where there IS NOT a corresponding fixed effect
else:
Mutant 520
--- bambi/priors.py
+++ bambi/priors.py
@@ -380,7 +380,7 @@
if np.array_equal(fix_data, self.dm[x].values)
]
# handle case where there IS a corresponding fixed effect
- if exists and exists[0] in self.priors.keys():
+ if exists or exists[0] in self.priors.keys():
sigma = self.priors[exists[0]]["sigma"]
# handle case where there IS NOT a corresponding fixed effect
else:
Mutant 527
--- bambi/priors.py
+++ bambi/priors.py
@@ -426,7 +426,7 @@
def scale(self):
# classify all terms
fixed_intercepts = [
- t for t in self.model.terms.values() if not t.random and t.data.sum(1).var() == 0
+ t for t in self.model.terms.values() if not t.random and t.data.sum(1).var() != 0
]
fixed_slopes = [
t for t in self.model.terms.values() if not t.random and not t.data.sum(1).var() == 0
Mutant 528
--- bambi/priors.py
+++ bambi/priors.py
@@ -426,7 +426,7 @@
def scale(self):
# classify all terms
fixed_intercepts = [
- t for t in self.model.terms.values() if not t.random and t.data.sum(1).var() == 0
+ t for t in self.model.terms.values() if not t.random and t.data.sum(1).var() == 1
]
fixed_slopes = [
t for t in self.model.terms.values() if not t.random and not t.data.sum(1).var() == 0
Mutant 544
--- bambi/priors.py
+++ bambi/priors.py
@@ -445,7 +445,7 @@
for t, term_type in zip(term_list, term_types):
if t.prior.scale is None:
# pylint: disable=protected-access
- if not t.prior._auto_scale or not self.model.auto_scale:
+ if t.prior._auto_scale or not self.model.auto_scale:
continue
t.prior.scale = "wide"
Mutant 545
--- bambi/priors.py
+++ bambi/priors.py
@@ -445,7 +445,7 @@
for t, term_type in zip(term_list, term_types):
if t.prior.scale is None:
# pylint: disable=protected-access
- if not t.prior._auto_scale or not self.model.auto_scale:
+ if not t.prior._auto_scale or self.model.auto_scale:
continue
t.prior.scale = "wide"
Mutant 546
--- bambi/priors.py
+++ bambi/priors.py
@@ -445,7 +445,7 @@
for t, term_type in zip(term_list, term_types):
if t.prior.scale is None:
# pylint: disable=protected-access
- if not t.prior._auto_scale or not self.model.auto_scale:
+ if not t.prior._auto_scale and not self.model.auto_scale:
continue
t.prior.scale = "wide"