How can do I get traceplot to show the prior’s value for all variables? Traceplot takes has a priors argument, but I can’t get the syntax right. I’m trying to use pymc3 for bayesian a/b testing and want to the choice prior values and hyperprior distributions effects the posterior, if at all. Also any suggestions for other ways to see how priors influence the posterior.
EXPERIMENT_NAME = "Global Search"
# a
variant_name_a = "Control"
n_a = 110198
hto_orders_a = 5555
sales_orders_a = 3361
# b
variant_name_b = "Variant"
n_b = 110062
hto_orders_b = 5533
sales_orders_b = 3407
samples = 10000
burnin=1000
with pm.Model() as unadjusted_web_only_model:
######### prior #########
### HTO COVR ###
hto_alpha = pm.HalfCauchy("hto_alpha",1)
hto_beta = pm.HalfCauchy("hto_beta",19)
hto_conversion_a = pm.Beta('hto_conversion_a', alpha=hto_alpha, beta=hto_beta)
hto_conversion_b = pm.Beta('hto_conversion_b', alpha=hto_alpha, beta=hto_beta)
hto_lift = pm.Deterministic("hto_lift", hto_conversion_b-hto_conversion_a)
###Sales COVR ###
sales_alpha = pm.HalfCauchy("sales_alpha",1)
sales_beta = pm.HalfCauchy("sales_beta",32)
sales_conversion_a = pm.Beta('sales_conversion_a', alpha=sales_alpha, beta=sales_beta)
sales_conversion_b = pm.Beta('sales_conversion_b', alpha=sales_alpha, beta=sales_beta)
unadjusted_sales_lift = pm.Deterministic("unadjusted_sales_lift", sales_conversion_b-sales_conversion_a)
## Liklihoods
hto_y_a = pm.Binomial('hto_y_a', n=model_n_a, p=hto_conversion_a, observed=model_hto_orders_a)
sales_y_a = pm.Binomial('sales_y_a', n=model_n_a,p=sales_conversion_a, observed=model_sales_orders_a)
hto_y_b = pm.Binomial('hto_y_b', n=model_n_b, p=hto_conversion_b, observed=model_hto_orders_b)
sales_y_b = pm.Binomial('sales_y_b',n=model_n_b, p=sales_conversion_b, observed=model_sales_orders_b)
start = pm.find_MAP()
step = pm.Metropolis()
trace = pm.sample(samples,start=start,step=step)
chain = trace[burnin:]
pm.traceplot(chain, priors=chain.varnames)
'''
I get an error when priors is a list of variables and when it is a string of the name of variables. What am I doing wrong?