The rSC
function generates random (multiple) single-case data frames for test and demonstration purposes.
rSC(n = 1, MT = 20, B.start = 6, m = 50, s = 10, prob = 0.5, d.trend = 0, d.level = 0,
d.slope = 0, rtt = 0.8, concise = TRUE, cases = 1, round = NA, extreme.p = 0,
extreme.d = c(-4, -3), missing.p = 0, distribution = "normal",
start.values.fixed = FALSE, random.names = FALSE, output.long = FALSE)
Number of cases to be created (Default is n = 1
).
Number of measurements (in each study). Default is MT = 20
.
Phase B starting point. The default setting B.start = 6
would assign the first five scores (of each case) to phase A, and all following scores to phase B. To assign different starting points for a set of multiple single-cases, use a vector of starting values (e.g. B.start = c(6, 7, 8)
). If the number of cases exceeds the length of the vector, values will be repeated.
Mean of the sample distribution the scores are drawn from. Default is m = 50
. To assign different means to several single-cases, use a vector of values (e.g. m = c(50, 42, 56)
). If the number of cases exceeds the length of the vector, values are repeated.
Standard deviation of the sample distribution the scores are drawn from. Set to s = 10
by default. To assign different variances to several single-cases, use a vector of values (e.g. s = c(5, 10, 15)
). If the number of cases exceeds the length of the vector, values are repeated.
If distribution
(see below) is set "binomial"
, prob
passes the probability of occurrence.
Defines the effect size d of a trend per MT added across the whole data-set. To assign different trends to several single-cases, use a vector of values (e.g. d.trend = c(.1, .3, .5)
). If the number of cases exceeds the length of the vector, values are repeated. While using a binomial or poisson distribution, d.trend
indicates an increase in points / counts per MT.
Defines the level increase (effect size d) at the beginning of phase B. To assign different level effects to several single-cases, use a vector of values (e.g. d.level = c(.2, .4, .6)
). If the number of cases exceeds the length of the vector, values are repeated. While using a binomial or poisson distribution, d.level
indicates an increase in points / counts per MT.
Defines the increase in scores - starting with phase B - expressed as effect size d per MT. d.slope = .1
generates an incremental increase of 0.1 standard deviations per MT for all phase B measurements. To assign different slope effects to several single-cases, use a vector of values (e.g. d.slope = c(.1, .2, .3)
). If the number of cases exceeds the length of the vector, values are repeated. While using a binomial or poisson distribution, d.slope
indicates an increase in points / counts per MT.
Reliability of the underlying simulated measurements. Set rtt = .8
by default. To assign different reliabilities to several single-cases, use a vector of values (e.g. rtt = c(.6, .7, .8)
). If the number of cases exceeds the length of the vector, values are repeated. rtt
has no effect when you're using binomial or poisson distributed scores.
TRUE
by default. If set concise = FALSE
, input parameters (see above) for the sampling distribution are printed to the output.
Number of cases per study. rSC(n = 10, cases = 3, B.start = c(7,9,11))
creates 10 multiple-baseline designs, each with three cases (with phase B starting points at MT 7, 9, and 11).
Rounds the scores to the defined decimal. To round to the second decimal, set round = 2
.
Probability of extreme values. extreme.p = .05
gives a five percent probability of an extreme value. A vector of values assigns different probabilities to multiple cases. If the number of cases exceeds the length of the vector, values are repeated.
Range for extreme values, expressed as effect size d. extreme.d = c(-7,-6)
uses extreme values within a range of -7 and -6 standard deviations. In case of a binomial or poisson distribution, extreme.d
indicates points / counts. Caution: the first value must be smaller than the second, otherwise the procedure will fail.
Portion of missing values. missing.p = 0.1
creates 10% of all values as missing). A vector of values assigns different probabilities to multiple cases. If the number of cases exceeds the length of the vector, values are repeated.
Distribution of the scores. Default is distribution = "normal"
. Possible values are "normal"
, "binomial"
, and "poisson"
. If set to "normal"
, the sample of scores will be normally distributed with the parameters m
and s
as mean and standard deviation of the sample, including a measurement error defined by rtt
. If set to "binomial"
, data are drawn from a binomial distribution with the expectation value m
. This setting is useful for generating criterial data like correct answers in a test. If set to "poisson"
, data are drawn from a poisson distribution, which is very common for count-data like behavioral observations. There's no measurement error is included. m
defines the expectation value of the poisson distribution, lambda.
If set TRUE
, the true value at the first measurement of each case is set to m
. The default setting is start.value.fixed = FALSE
, which results in a true value for each case drawn from a distribution (defined above: distribution
) with the expected value m
and standard deviation s
.
Is FALSE
by default. If set random.names = TRUE
cases are assigned random first names. The names are drawn from the 2,000 most popular names for newborns in 2012 in the U.S. (1,000 male and 1,000 female names).
If set TRUE
, the true value, implemented trend, level and slope effect, as well as error values are included for each MT. Default is output.long = FALSE
.
A single-case data frame or a list of single-case data frames. See makeSCDF
to learn about this format.
# NOT RUN {
## Create random single-case data and inspect it
dat <- rSC(n = 3, rtt = 0.75, round = 1, d.slope = 0.1, extreme.p = 0.1,
missing.p = 0.1, random.names = TRUE)
describeSC(dat)
plotSC(dat)
## And now have a look at poisson-distributed data
dat <- rSC(n = 3, B.start = c(6,10,14), MT = c(12,20,22), m = 10,
distribution = "poisson", d.level = -5, missing.p = 0.1)
pand(dat, correction = FALSE)
# }
Run the code above in your browser using DataLab