Learn R Programming

broom (version 0.4.0)

binDesign_tidiers: Tidy a binDesign object

Description

Tidy a binDesign object from the "binGroup" package, which determines the sample size needed for a particular power.

Usage

## S3 method for class 'binDesign':
tidy(x, ...)

## S3 method for class 'binDesign': glance(x, ...)

Arguments

x
A "binDesign" object
...
Extra arguments (not used)

Value

  • All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.

    The tidy method returns a data.frame with one row for each iteration that was performed, with columns

  • nNumber of trials in this iteration
  • powerThe power achieved for this n
  • The glance method returns a one-row data.frame with columns
  • powerThe power achieved by the analysis
  • nThe sample size used to achieve this power
  • power.reachedWhether the desired power was reached
  • maxitNumber of iterations performed

Examples

Run this code
if (require("binGroup", quietly = TRUE)) {
    des <- binDesign(nmax = 300, delta = 0.06,
                     p.hyp = 0.1, power = .8)

    glance(des)
    head(tidy(des))

    # the ggplot2 equivalent of plot(des)
    library(ggplot2)
    ggplot(tidy(des), aes(n, power)) +
        geom_line()
}

Run the code above in your browser using DataLab