summary.causal_model {CausalQueries} | R Documentation |
Summarizing causal models
Description
summary method for class "causal_model
".
Usage
## S3 method for class 'causal_model'
summary(object, include = NULL, ...)
## S3 method for class 'summary.causal_model'
print(x, what = NULL, ...)
Arguments
object |
An object of |
include |
A character string specifying the additional objects to include in summary. Defaults to |
... |
Further arguments passed to or from other methods. |
x |
An object of |
what |
A character string specifying the objects summaries to print. Defaults to |
Details
In addition to the default objects included in 'summary.causal_model' users can request additional objects via 'include' argument. Note that these additional objects can be large for complex models and can increase computing time. The 'include' argument can be a vector of any of the following additional objects:
-
"parameter_matrix"
A matrix mapping from parameters into causal types, -
"parameter_mapping"
a matrix mapping from parameters into data types, -
"causal_types"
A data frame listing causal types and the nodal types that produce them, -
"prior_distribution"
A data frame of the parameter prior distribution, -
"ambiguities_matrix"
A matrix mapping from causal types into data types, -
"type_prior"
A matrix of type probabilities using priors.
print.summary.causal_model
reports causal statement, full specification of nodal types and summary of model restrictions. By specifying 'what' argument users can instead print a custom summary of any set of the following objects contained in the 'summary.causal_model':
-
"statement"
A character string giving the causal statement, -
"nodes"
A list containing the nodes in the model, -
"parents"
A list of parents of all nodes in a model, -
"parents_df"
A data frame listing nodes, whether they are root nodes or not, and the number and names of parents they have, -
"parameters"
A vector of 'true' parameters, -
"parameters_df"
A data frame containing parameter information, -
"parameter_names"
A vector of names of parameters, -
"parameter_mapping"
A matrix mapping from parameters into data types, -
"parameter_matrix"
A matrix mapping from parameters into causal types, -
"causal_types"
A data frame listing causal types and the nodal types that produce them, -
"nodal_types"
A list with the nodal types of the model, -
"data_types"
A list with the all data types consistent with the model; for options see '"?get_all_data_types"', -
"prior_hyperparameters"
A vector of alpha values used to parameterize Dirichlet prior distributions; optionally provide node names to reduce output ‘inspect(prior_hyperparameters, c(’M', 'Y'))' -
"prior_distribution"
A data frame of the parameter prior distribution, -
"prior_event_probabilities"
A vector of data (event) probabilities given a single (sepcified) parameter vector; for options see '"?get_event_probabilities"', -
"ambiguities_matrix"
A matrix mapping from causal types into data types, -
"type_prior"
A matrix of type probabilities using priors, -
"type_distribution"
A matrix of type probabilities using posteriors, -
"posterior_distribution"
A data frame of the parameter posterior distribution, -
"posterior_event_probabilities"
A sample of data (event) probabilities from the posterior, -
"data"
A data frame with data that was used to update model. -
"stanfit"
A 'stanfit' object generated by Stan, -
"stan_summary"
A 'stanfit' summary with updated parameter names, -
"stan_objects"
A list of Stan outputs that includes 'stanfit', 'data', and, if requested when updating the model, posterior 'event_probabilities' and 'type_distribution'.
Value
Returns the object of class summary.causal_model
that preserves the list structure of causal_model
class and adds the following additional objects:
-
"parents"
a list of parents of all nodes in a model, -
"parameters"
a vector of 'true' parameters, -
"parameter_names"
a vector of names of parameters, -
"data_types"
a list with the all data types consistent with the model; for options see"?get_all_data_types"
, -
"prior_event_probabilities"
a vector of prior data (event) probabilities given a parameter vector; for options see"?get_event_probabilities"
, -
"prior_hyperparameters"
a vector of alpha values used to parameterize Dirichlet prior distributions; optionally provide node names to reduce output"inspect(prior_hyperparameters, c('M', 'Y'))"
Examples
model <-
make_model("X -> Y")
model |>
update_model(
keep_event_probabilities = TRUE,
keep_fit = TRUE,
data = make_data(model, n = 100)
) |>
summary()
model <-
make_model("X -> Y") |>
update_model(
keep_event_probabilities = TRUE,
keep_fit = TRUE,
data = make_data(model, n = 100)
)
print(summary(model), what = "type_distribution")
print(summary(model), what = "posterior_distribution")
print(summary(model), what = "posterior_event_probabilities")
print(summary(model), what = "data_types")
print(summary(model), what = "ambiguities_matrix")
print(summary(model), what = "prior_hyperparameters")
print(summary(model), what = c("statement", "nodes"))
print(summary(model), what = "parameters_df")
print(summary(model), what = "posterior_event_probabilities")
print(summary(model), what = "posterior_distribution")
print(summary(model), what = "data")
print(summary(model), what = "stanfit")
print(summary(model), what = "type_distribution")