# The first example generate scorse for 20 particants in one factor having
# two categories (low and high):
design <- list( A=c("low","high"))
GRP( design, props = c(0.1, 0.9), n = 20 )
# This example has two factors, with factor A having levels a, b, c
# and factor B having 2 levels, for a total of 6 conditions;
# with 40 participants per group, it represents 240 observations:
design <- list( A=letters[1:3], B = c("low","high"))
GRP( design, props = c(0.1, 0.15, 0.20, 0.80, 0.85, 0.90), n = 40 )
# groups can be unequal:
design <- list( A=c("low","high"))
GRP( design, props = c(0.1, 0.9), n = c(5, 35) )
# Finally, repeated-measures can be generated
# but note that correlated scores cannot be generated with `GRP()`
wsDesign = list( Moment = c("pre", "post") )
GRP( WSDesign=wsDesign, props = c(0.1, 0.9), n = 10 )
# This last one has three factors, for a total of 3 x 2 x 2 = 12 cells
design <- list( A=letters[1:3], B = c("low","high"), C = c("cat","dog"))
GRP( design, n = 30, props = rep(0.5,12) )
# To specify unequal probabilities, use
design <- list( A=letters[1:3], B = c("low","high"))
expProp <- c(.05, .05, .35, .35, .10, .10 )
GRP( design, n = 30, props=expProp )
# The name of the column containing the proportions can be changed
GRP( design, n=30, props=expProp, sname="patate")
# Examples of use of rBernoulli
t <- rBernoulli(50, 0.1)
mean(t)
Run the code above in your browser using DataLab