power.r.plot {biology}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

power.r.plot(r = NULL, power = NULL, n = NULL)

Arguments

r ~~Describe r here~~
power ~~Describe power here~~
n ~~Describe n here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use
comp1 Description of 'comp1'
comp2 Description of 'comp2'
...

Note

~~further notes~~

~Make other sections like Warning with Warning .... ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (r = NULL, power = NULL, n = NULL) 
{
    library(pwr)
    library(R.utils)
    if (getBuiltinOs.GString() == "windows") 
        windows(height = 4, width = 4)
    else X11(height = 4, width = 4)
    old_par <- par(mar = c(4, 4, 2, 1))
    if (length(n) > 0) {
        power_val <- numeric(length(n))
        j <- 0
        for (i in n) {
            j <- j + 1
            power_val[j] <- pwr.r.test(n = i, r = r)$power
        }
        plot(n, power_val, axes = F, xlab = "", ylab = "", lwd = 2, 
            type = "l", main = substitute(paste("r = ", r), list(r = r)))
    }
    else {
        n_val <- numeric(length(power))
        j <- 0
        for (i in power) {
            j <- j + 1
            n_val[j] <- pwr.r.test(power = i, r = r)$n
        }
        plot(n_val, power, axes = F, xlab = "", ylab = "", lwd = 2, 
            type = "l", main = substitute(paste("r = ", r), list(r = r)))
    }
    axis(1, tick = T, tcl = -0.2, lab = T, cex.axis = 1, lwd = 2)
    mtext("n", 1, font = 2, cex = 1.5, line = 3)
    axis(2, tick = T, tcl = -0.2, lab = T, cex.axis = 1, lwd = 2, 
        las = 1)
    mtext("power", 2, font = 2, cex = 1.5, line = 3)
    lines(c(0, max(n)), c(0.8, 0.8), lty = 2)
    box(bty = "l", lwd = 2)
  }

[Package biology version 1.0 Index]