Fit¶

class
brmp.fit.
Fit
[source]¶ 
fitted
(what='expectation', data=None, seed=None)[source]¶ Produces predictions from the fitted model.
Predicted values are computed for each sample collected during inference, and for each row in the data set.
Parameters:  what (str) –
The value to predict. Valid arguments and their effect are described below:
'expectation'
Computes the expected value of the response distribution. 'sample'
Draws a sample from the response distribution. 'response'
Computes the output of the model followed by any inverse link function. i.e. The value of the location parameter of the response distribution. 'linear'
Computes the output of the model prior to the application of any inverse link function.  data (pandas.DataFrame) – The data from which to compute the predictions. When omitted, the data on which the model was fit is used.
 seed (int) – Random seed. Used only when
'sample'
is given as the'what'
argument.
Returns: An array with shape
(S, N)
. WhereS
is the number of samples taken during inference andN
is the number of rows in the data set used for prediction.Return type:  what (str) –

marginals
(qs=[0.025, 0.25, 0.5, 0.75, 0.975])[source]¶ Produces a table containing statistics of the marginal distibutions of the parameters of the fitted model.
Parameters: qs (list) – A list of quantiles to include in the output. Returns: A table of marginal statistics. Return type: brmp.fit.ArrReprWrapper Example:
fit = brm('y ~ x', df).fit() print(fit.marginals()) # mean sd 2.5% 25% 50% 75% 97.5% n_eff r_hat # b_x 0.42 0.33 0.11 0.14 0.48 0.65 0.88 5.18 1.00 # sigma 0.78 0.28 0.48 0.61 0.68 0.87 1.32 5.28 1.10

get_scalar_param
(name, preserve_chains=False)[source]¶ Extracts the values sampled for a single parameter from a model fit.
Parameters: Returns: An array with shape
(S,)
whenpreserve_chains=False
,(C, S)
otherwise. WhereS
is the number of samples taken during inference, andC
is the number of MCMC chains run.Return type:
