# Simplest example using all the default arguments:
dta <- GRD()
head(dta)
hist(dta$DV)
# Renaming the dependant variable and setting the group size:
dta <- GRD( RenameDV = "score", SubjectsPerGroup = 200 )
hist(dta$score )
# Examples for a between-subject design and for a within-subject design:
dta <- GRD( BSFactors = '3', SubjectsPerGroup = 20)
dta <- GRD( WSFactors = "Moment (2)", SubjectsPerGroup = 20)
# A complex, 3 x 2 x (2) mixed design with a variable amount of participants in the 6 groups:
dta <- GRD(BSFactors = "difficulty(3) : gender (2)",
WSFactors="day(2)",
SubjectsPerGroup=c(20,24,12,13,28,29)
)
# Defining population characteristics :
dta <- GRD(
RenameDV = "IQ",
SubjectsPerGroup = 20,
Population=list(
mean=100, # will set GM to 100
stddev=15 # will set STDDEV to 15
)
)
hist(dta$IQ)
# This example adds an effect along the "Difficulty" factor with a slope of 15
dta <- GRD(BSFactors="Difficulty(5)", SubjectsPerGroup = 100,
Population=list(mean=50,stddev=5),
Effects = list("Difficulty" = slope(15) ) )
# show the mean performance as a function of difficulty:
superb(DV ~ Difficulty, dta )
# An example in which the moments are correlated
dta <- GRD( BSFactors = "Difficulty(2)",WSFactors = "Moment (2)",
SubjectsPerGroup = 250,
Effects = list("Difficulty" = slope(3), "Moment" = slope(1) ),
Population=list(mean=50,stddev=20,rho=0.85)
)
# the mean plot on the raw data...
superb(cbind(DV.1,DV.2) ~ Difficulty, dta, WSFactors = "Moment(2)",
plotStyle="line",
adjustments = list (purpose="difference") )
# ... and the mean plot on the decorrelated data;
# because of high correlation, the error bars are markedly different
superb(cbind(DV.1,DV.2) ~ Difficulty, dta, WSFactors = "Moment(2)",
plotStyle="line",
adjustments = list (purpose="difference", decorrelation = "CM") )
# This example creates a dataset in a 3 x 2 design. It has various effects,
# one effect of difficulty, with an overall effect of 10 more (+3.33 per level),
# one effect of gender, whose slope is 10 points (+10 points for each additional gender),
# and finally one interacting effect, which is 0 for the last three cells of the design:
GRD(
SubjectsPerGroup = 10,
BSFactors = c("difficulty(3)","gender(2)"),
Population = list(mean=100,stddev=15),
Effects = list(
"difficulty" = extent(10),
"gender"=slope(10),
"difficulty*gender"=custom(-300,+200,-100,0,0,0)
)
)
Run the code above in your browser using DataLab