Delegates to brms's posterior_epred() (response-scale posterior
mean) or posterior_linpred() (linear-predictor scale) on the
live brmsfit carried at $brms. The parent
predict.flexybayes() path uses a $glm$linear.predictors
point estimate that handles only the original-data case. This
subclass override accepts newdata and returns the posterior-mean
prediction (per-row mean over draws), or the full posterior
matrix when summary = FALSE.
Arguments
- object
A
flexybayes_brmsobject.- newdata
Optional data.frame at which to predict. When omitted, returns the in-sample posterior summary. On a model with an
offset()brms evaluates the offset onnewdata, sonewdataneeds every column the offset reads. An absent one refuses withnewdata_offset_missinginstead of being taken as zero.- type
"response"(default. posterior_epred) or"link"(posterior_linpred).- re_formula
Forwarded to brms;
NULL(default) includes all random effects,NAexcludes them (population-level).- se.fit
Logical: if
TRUE, returns a list withfit(posterior mean) andse.fit(posterior SD).- summary
Logical: if
TRUE(default), summarise across draws to a numeric vector. IfFALSE, return thedraws x rowsposterior matrix.- classify
The factors to break a predicted-value table down by: a character value (
"Variety","Variety:env") or a one-sided formula (~ Variety). The factors may be fixed or random, and the table follows ASReml's default rules, described underpredict.flexybayes_inla(). On this engine the values come from the posterior draws. A level combination the data never held is drawn from its fitted normal distribution.NULL(the default) is the historical behaviour.- level
Credible level for the classify table's interval, or for the predictive interval with
allow_new_levels = TRUE, as a proportion. Default0.95.- allow_new_levels
Logical.
TRUEreturns the posterior predictive of the rows ofnewdata, observation noise included, in which a level the fit did not see is drawn from its fitted standard deviation:brms::posterior_predict(allow_new_levels = TRUE, sample_new_levels = "gaussian"). The table matches the INLA method's. Seepredict.flexybayes_inla()for the structures it is built for and the refusals. Itsestimate,sd,lowerandupperare the mean, standard deviation and quantiles of the draws.FALSE(the default) leaves the paths above unchanged.- mean_by
With
allow_new_levels = TRUE, the columns ofnewdatawhose combinations define the sets of rows to average, as a character vector or a one-sided formula (~ TRIAL).NULLpredicts each row.- n_draws
With
allow_new_levels = TRUE, the number of posterior draws used, at most the number the fit holds. Default1000.- ...
Forwarded to
brms::posterior_epred()/brms::posterior_linpred().
Value
One of five shapes, by argument. With classify set, the
marginal-means table for those factors. With allow_new_levels = TRUE,
the fb_predict_new table described in predict.flexybayes_inla().
Otherwise with
summary = FALSE, the draws x rows posterior matrix. With
se.fit = TRUE, a list of fit (posterior mean per row) and
se.fit (posterior SD per row). And by default a numeric vector of
posterior means, one per row of newdata or of the fitted data.