Description Usage Arguments Details Value See Also Examples
Generates data for a simulated experiment given population parameters and information about the design (one-factor design).
1 2 3 | mkDf(nsubj = 24, nitem = 24, wsbi = FALSE,
mcr.params = randParams(genParamRanges(), 1)[1, ],
missMeth = "random", rigen = FALSE, verbose = FALSE)
|
nsubj |
number of subjects in the experiment |
nitem |
number of items in the experiment |
wsbi |
whether the design is between-items (TRUE) or within-items (FALSE) |
mcr.params |
population parameters (typically a row from the matrix
generated by |
missMeth |
method used for generating missing data (default is 'random'; alternatives are 'none', 'randomBig', 'bysubj', 'bycond', bysubjcond'; see Details) |
rigen |
use a 'random-intercepts-only' generative model (default FALSE) |
verbose |
Return all randomly generated values as well as the data. |
Note that for between-items designs, the variable w11
in the
parameter vector is simply ignored. The default value for missMeth
of 'random' will randomly remove between 0-5% of the observations. The
option 'randomBig' will randomly remove 10-80%; 'bysubj' will randomly
remove 10-80% of each subject's data; 'bycond' will randomly remove 10-80%
of each condition's data; and 'bysubjcond' will randomly remove 10=80% of
each subject/condition combination's data.
If verbose = FALSE
(the default), a dataframe, with fields:
SubjID |
a factor, identifying subject number |
ItemID |
a factor, identifying item number |
Cond |
treatment condition, deviation coded (-.5, .5) |
Resp |
response variable |
;
If verbose = TRUE
, a list, with elements:
dat |
The data, with columns defined as above; |
subj_re |
by-subject random effects |
item_re |
by-item random effects |
err |
the residuals |
genParamRanges
, mkDf.facMixedAB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | nmc <- 10
pmx <- cbind(randParams(genParamRanges(), nmc, 1001), seed=mkSeeds(nmc, 1001))
x.df <- mkDf(nsubj=24, nitem=24, mcr.params=pmx[1,], wsbi=FALSE)
## set rate of missing observations manually
pmx[,"miss"] <- 0.4
x.df2 <- mkDf(nsubj=24, nitem=24, mcr.params=pmx[1,], wsbi=FALSE)
## by-condition missing observation rates
pmx[,"pMin"] <- 0.1
pmx[,"pMax"] <- 0.8
x.df3 <- mkDf(nsubj=24, nitem=24, mcr.params=pmx[1,], wsbi=FALSE,missMeth="bycond")
## by-subject missing observation rates
x.df4 <- mkDf(nsubj=24, nitem=24, mcr.params=pmx[1,], wsbi=FALSE,missMeth="bysubj")
## by-subject/condition pair missing observation rates
x.df5 <- mkDf(nsubj=24, nitem=24, mcr.params=pmx[1,], wsbi=FALSE,missMeth="bysubjcond")
## verbose version
x.df <- mkDf(verbose = TRUE)
print(x.df$dat) # the data
print(x.df$subj_re) # by-subject random effects
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.