Learn R Programming

RItools (version 0.3-3)

print.xbal: Printing xBalance and balanceTest Objects

Description

A print method for balance test objects produced by xBalance and balanceTest.

Usage

# S3 method for xbal
print(
  x,
  which.strata = dimnames(x$results)[["strata"]],
  which.stats = dimnames(x$results)[["stat"]],
  which.vars = dimnames(x$results)[["vars"]],
  print.overall = TRUE,
  digits = NULL,
  printme = TRUE,
  show.signif.stars = getOption("show.signif.stars"),
  show.pvals = !show.signif.stars,
  horizontal = TRUE,
  report = NULL,
  ...
)

Value

vartable

The formatted table of variable-by-variable statistics for each stratification.

overalltable

If the overall Chi-squared statistic is requested, a formatted version of that table is returned.

Arguments

x

An object of class "xbal" which is the result of a call to xBalance.

which.strata

The stratification candidates to include in the printout. Default is all.

which.stats

The test statistics to include. Default is all those requested from the call to xBalance.

which.vars

The variables for which test information should be displayed. Default is all.

print.overall

Should the omnibus test be reported? Default is TRUE.

digits

To how many digits should the results be displayed? Default is max(2,getOptions("digits")-4).

printme

Print the table to the console? Default is TRUE.

show.signif.stars

Use stars to indicate z-statistics larger than conventional thresholds. Default is TRUE.

show.pvals

Instead of stars, use p-values to summarize the information in the z-statistics. Default is FALSE.

horizontal

Display the results for different candidate stratifications side-by-side (Default, TRUE), or as a list for each stratification (FALSE).

report

What to report.

...

Other arguements. Not currently used.

See Also

xBalance, balanceTest

Examples

Run this code
data(nuclearplants)


xb1 <- balanceTest(pr ~ date + t1 + t2 + cap + ne + ct + bw + cum.n + strata(pt),
         data = nuclearplants)

print(xb1)

print(xb1, show.pvals = TRUE)

print(xb1, horizontal = FALSE)

## The following doesn't work yet.
if (FALSE) print(xb1, which.vars=c("date","t1"),
         which.stats=c("adj.means","z.scores","p.values"))

## The following example prints the adjusted means
## labeled as "treatmentvar=0" and "treatmentvar=1" using the
## formula provided to xBalance().

# This is erroring with the change to devtools, FIXME
if (FALSE) print(xb1,
      which.vars = c("date", "t1"),
      which.stats = c("pr=0", "pr=1", "z", "p"))

## Only printing out a specific stratification factor
xb2 <- balanceTest(pr~ date + t1 + t2 + cap + ne + ct + bw + cum.n + strata(pt),
         data = nuclearplants)

print(xb2, which.strata = "pt")

Run the code above in your browser using DataLab