raw.means.plot2
.add.ps(data, col.id, col.offset, col.x, col.value, fun.aggregate = "mean",
ref.offset = 1, prefixes,
alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE,
lty = 0, ...)
data.frame
character
vector specifying the id column.character
vector specifying the offset column.character
vector specifying the x-axis column.character
vector specifying the data column."mean"
.numeric
indicating the reference level to be tested against. The default is 1 corresponding to levels(factor(d[,col.offset]))[1]
.character
vector of the indices for the p-values. If missing corresponds to levels(factor(d.new[,col.offset]))[-ref.offset]
.t.test
t.test
t.test
t.test
raw.means.plot2
and should be used in addition to it. Note that values are ordered according to the col.id
so paired = TRUE
should be fine.raw.means.plot
as the accompanying main functions.#The examples uses the OBrienKaiser dataset from car and needs reshape.
# This extends the examples from raw.means.plot
require(reshape)
require(car)
data(OBrienKaiser)
OBKnew <- cbind(factor(1:nrow(OBrienKaiser)), OBrienKaiser)
colnames(OBKnew)[1] <- "id"
OBK.long <- melt(OBKnew)
OBK.long[, c("measurement", "time")] <- t(vapply(strsplit(as.character(OBK.long$variable), "\\."), "[", c("", "")))
# For this example the position at each x-axis are within-subject comparisons!
raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
add.ps(OBK.long, "id", "measurement", "gender", "value", paired = TRUE) #reference is "fup"
raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
add.ps(OBK.long, "id", "measurement", "gender", "value", ref.offset = 2, paired = TRUE) #reference is "post"
# Use R's standard (i.e., Welch test)
raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
add.ps(OBK.long, "id", "treatment", "gender", "value", prefixes = c("p(control vs. A)", "p(control vs. B)"))
# Use standard t-test
raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
add.ps(OBK.long, "id", "treatment", "gender", "value", var.equal = TRUE, prefixes = c("p(control vs. A)", "p(control vs. B)"))
Run the code above in your browser using DataLab