def model_returns_normal(data, samples=<NUM_LIT>, progressbar=True):
with pm.Model() as model:<EOL><INDENT>mu = pm.Normal('<STR_LIT>', mu=<NUM_LIT:0>, sd=<NUM_LIT>, testval=data.mean())<EOL>sigma = pm.HalfCauchy('<STR_LIT>', beta=<NUM_LIT:1>, testval=data.std())<EOL>returns = pm.Normal('<STR_LIT>', mu=mu, sd=sigma, observed=data)<EOL>pm.Deterministic(<EOL>'<STR_LIT>',<EOL>returns.distribution.variance**<NUM_LIT> *<EOL>np.sqrt(<NUM_LIT>))<EOL>pm.Deterministic(<EOL>'<STR_LIT>',<EOL>returns.distribution.mean /<EOL>returns.distribution.variance**<NUM_LIT> *<EOL>np.sqrt(<NUM_LIT>))<EOL>trace = pm.sample(samples, progressbar=progressbar)<EOL><DEDENT>return model, trace<EOL>
Run Bayesian model assuming returns are normally distributed.

Parameters
----------
returns : pandas.Series
    Series of simple returns of an algorithm or stock.
samples : int (optional)
    Number of posterior samples to draw.

Returns
-------
model : pymc.Model object
    PyMC3 model containing all random variables.
trace : pymc3.sampling.BaseTrace object
    A PyMC3 trace object that contains samples for each parameter
    of the posterior.