mdes.plot {biology}R Documentation

~~function to do ... ~~

Description

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

Usage

mdes.plot(power = 0.8, sd, n)

Arguments

power ~~Describe power here~~
sd ~~Describe sd 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 (power = 0.8, sd, n) 
{
    library(R.utils)
    delta <- numeric(length(n))
    j <- 0
    if (length(power) == 1) 
        constant <- "power"
    else constant <- "sd"
    if (constant == "sd") 
        for (i in n) {
            j <- j + 1
            delta[j] <- power.t.test(n = i, sd = sd, power = power[1])$delta
        }
    else for (i in n) {
        j <- j + 1
        delta[j] <- power.t.test(n = i, sd = sd[1], power = power)$delta
    }
    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 (constant == "sd") 
        plot(n, delta, axes = F, xlab = "", ylab = "", lwd = 2, 
            type = "n", main = substitute(paste("sd = ", sd), 
                list(sd = sd)))
    else plot(n, delta, axes = F, xlab = "", ylab = "", lwd = 2, 
        type = "n", main = substitute(paste("power = ", power), 
            list(power = power)))
    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("Minimum detectable effect size", 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)
    if (constant == "sd") {
        if (length(power) > 0) {
            kk <- 0
            for (k in power) {
                kk <- kk + 1
                delta <- numeric(length(n))
                j <- 0
                for (i in n) {
                  j <- j + 1
                  delta[j] <- power.t.test(n = i, sd = sd, power = power[kk])$delta
                }
                points(n, delta, col = "black", pch = 16, lwd = 2, 
                  type = "l", lty = kk)
            }
        }
        legend("topright", title = "Power", legend = power, lty = seq(1, 
            length(power), by = 1))
    }
    else {
        if (length(sd) > 0) {
            kk <- 0
            for (k in sd) {
                kk <- kk + 1
                delta <- numeric(length(n))
                j <- 0
                for (i in n) {
                  j <- j + 1
                  delta[j] <- power.t.test(n = i, sd = sd[kk], 
                    power = power)$delta
                }
                points(n, delta, col = "black", pch = 16, lwd = 2, 
                  type = "l", lty = kk)
            }
        }
        legend("topright", title = "sd", legend = sd, lty = seq(1, 
            length(sd), by = 1))
    }
  }

[Package biology version 1.0 Index]