A MRPModel
object is an R6 object created by the
$create_model()
method of a
MRPWorkflow
object. Each MRPModel
object represents a
multilevel regression model with methods for sampling, diagnostics,
and post-stratification.
Format
An R6 generator object.
Methods
Method new()
Creates a new instance of the MRPModel class with specified effects, data, and metadata for Bayesian model fitting.
Usage
MRPModel$new(effects, mrp, metadata, linkdata, plotdata)
Arguments
effects
List containing model effects specification including intercept, fixed effects, varying effects, and interactions
mrp
List containing the MRP data structure with input sample data and new post-stratification data
metadata
List containing metadata about the analysis including family, time variables, and special cases
linkdata
List containing information about data linking including geography and ACS year
plotdata
List containing data prepared for visualization including dates and geojson objects
Method effects()
Retrieves the effects specification used in the model, including intercept, fixed effects, varying effects, and interactions.
Method formula()
Retrieves the model formula constructed from the effects specification.
Method mrp()
Retrieves the MRP data structure containing input sample data and post-stratification data.
Method metadata()
Retrieves the metadata associated with the model, including information about family, time variables, and fitting parameters.
Method plotdata()
Retrieves the data prepared for visualization, including dates and geojson objects.
Method summary()
Retrieves a summary of the fitted model parameters including posterior means, credible intervals, and diagnostics.
Method diagnostics()
Retrieves MCMC diagnostics including convergence statistics and sampling efficiency measures.
Method ppc()
Runs posterior predictive checks to assess model fit by generating replicated data from the posterior predictive distribution.
Method loo()
Runs leave-one-out cross-validation to assess model predictive performance and enable model comparison.
Method poststratify()
Runs post-stratification using the fitted model to generate population-level estimates across different subgroups and geographies.
Method save()
Saves a fitted MRPModel object to a file for later use.