Learn R Programming

WhatIf (version 1.5-10)

summary.whatif: Summary of "whatif" Object

Description

Summarizes the information produced by the function whatif. The summary generated is returned as an output object and also printed to the screen.

Usage

# S3 method for whatif
summary(object, ...)

Arguments

object

An object of class "whatif", the output of the function whatif.

...

Further arguments passed to and from other methods.

Value

An object of class "summary.whatif", a list containing the following five elements:

call

The original call to whatif.

m

A scalar. The total number of counterfactuals evaluated.

m.inhull

A scalar. The number of counterfactuals evaluated that are in the convex hull of the observed covariate data.

mean.near

A scalar. The average percentage of data nearby each counterfactual, where the average is taken over all counterfactuals.

sum.df

A data frame with three columns and \(m\) rows, where \(m\) is the number of counterfactuals. The first column, cfact, indexes the counterfactuals. The second column, in.hull, contains the results of the convex hull test. The third column, per.near, contains the percentage of data points nearby each counterfactual.

This object is printed to the screen.

References

King, Gary and Langche Zeng. 2006. "The Dangers of Extreme Counterfactuals." Political Analysis 14 (2). Available from https://gking.harvard.edu.

King, Gary and Langche Zeng. 2007. "When Can History Be Our Guide? The Pitfalls of Counterfactual Inference." International Studies Quarterly 51 (March). Available from https://gking.harvard.edu.

See Also

whatif, plot.whatif, print.whatif, print.summary.whatif

Examples

Run this code
# NOT RUN {
##  Create example data sets and counterfactuals
my.cfact <- matrix(rnorm(3*5), ncol = 5)
my.data <- matrix(rnorm(100*5), ncol = 5)

##  Evaluate counterfactuals
my.result <- whatif(data = my.data, cfact = my.cfact, mc.cores = 1)

##  Print summary
summary(my.result)
# }

Run the code above in your browser using DataLab