Prior/posterior predictive check plots #319
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"ppcplot" function was added for plotting prior/posterior predictive checks for one or more dependent variables. As
args
this function receivesyobs_data
, the observed data for dependet variables (a vector or matrix), andypred_data
, the posterior/prior predictive results (Chains
object). It plots the observed data, a sample of predictions and the predictions mean.As kwargs, this function receives:
yvar_name
(vector ofSymbol
) which contains the name of the dependent variables to be plotted,plot_type
which can take:density
,:cumulative
, and:histogram
as values,predictive_check
for plot titles and can be:prior
or:posterior
(default value is:posterior
)n_samples
which established the number o samples to be plotted (default value is 50, but when plotting it is redefined as the minimum between 50 and sample size in ypred_data).For more than one dependet variable in a single model,
yvar_name
must be provided and the order in which names variables appear must be the same as in the observed data matrix. This was done in order to separate predictions for every dependent variable, becausepredict
does not return predictions ordered by variable.The following is a working example for a model with one dependent variable
And for posterior predictive check
Plot_type = :density
Plot_type = :cumulative
Plot_type = :histogram
Aditionally, this is a working example for a model with two dependent variables