Compute posterior additive summary

additive_summary(
  summaryCall,
  fhatSamples,
  fhat = rowMeans(fhatSamples),
  df = NULL,
  alpha = 0.05,
  fast = TRUE,
  quants = seq(0, 1, by = 0.005),
  grid_size = 100,
  verbose = FALSE,
  return_samples = TRUE,
  meta = NA
)

Arguments

summaryCall

A gam fomula for the additive summary to be computed. Should be in the form of fhat ~ s(x1) + s(x2) + .... See ?mgcv::formula.gam

fhatSamples

N NMC matrix of posterior draws of the function f, where N is the number of observations and NMC is the number of Monte Carlo posterior samples

fhat

A point estimate (posterior mean) for the function f

df

The dataframe from which the summary will be computed. This should include all the inputs of f

alpha

The function will return the alpha/2 and 1-alpha/2 credible intervals for the summary.

fast

If TRUE, the function will compute the summary on a grid, specifically for quantiles of the covariates as specified in quants, of the data rather than for the whole dataset

quants

The quantiles of the covariates in df on which to compute the summary when fast=TRUE

grid_size
verbose

If TRUE, the function will print out the progress of summary computation

return_samples

If TRUE, the function will of the design matrix for the summary

meta

A tag for the dataframe of the summary

Details

This function computes the point estimate and credible intervals for the summary of the function f. At a minimum, the user must specify the form of the summary, a matrix of posterior draws of f, and the dataframe which contains the inputs of f

Author

Spencer Woody