How to obtain the variance estimations in Linear Regression models

I’m working through the PyMC linear regression example here which defines normal distributions as priors. I can obtain the point estimates using find_MAP. At this point, I was wondering how to obtain the corresponding estimated standard deviation of the normal distribution. Or are they not varied but given with the prior?


If you sample from the model trace = pm.sample(), you can get the standard deviation of each posterior estimation by doing summary(trace) (see in the same notebook). Notice that this is the standard deviation of your posterior mean, it doesnt means your posterior distribution is Normally distributed.

Thanks for your reply! That makes sense. Is there an easy way to access these values, e.g. in a dictionary, apart from printing them out?

I think I found the answer myself …

 sample = trace.get_values('beta')

There is also pm.trace_to_dataframe(trace) which turns the trace into a pandas dataframe.

Thanks for your help, I’ll check this out!