fastDist | R Documentation |
setupDist
and fastDist
are used to check a range of parameters
for a non-normal residual distribution. setupDist
requires the user to
specify a complete design (e.g., polyICT
and residual
correlation struction (e.g., armaErr
), but is very slow.
fastDist
specifies a generic normal distribution (standing in for
the random effects) and an error distribution (with no residual autocorrelation)
which is less accurate but is much faster and can be used to ballpark inputs
for setupDist
. See the examples.
fastDist(fam, famParms, propErrVar, file = "fastDist.pdf")
setupDist(design, err, famParms, propErrVar, file = "setupDist")
propErrVar |
See |
file |
A character string used to name output files. Extensions (e.g., pdf, csv) will be added later. |
design |
See |
err , fam , famParms |
See |
For fastDist
and setupDist
,
a pdf (with the prefix specified in file
),
with density plots for normal data (standing in for the random effects
distribution), the error data (using the distribution in fam
and its
parameters extracted from the ranges in famParms
), and their
propErrVar
weighted combined distribution. The plots are sorted
left to right according to the values of propErrVar
, and rows according
to all possible combinations of the range of values in famParms
. The
resulting skewness and kurtosis are printed in the upper right corner of
each plot.
There is also a csv file (with the prefix specified in file
) is
created tabulating all the setting and the resulting skewness and kurtosis
in the 'observed' distribution (i.e., the distribution you wish to simulate).
Stephen Tueller stueller@rti.org
## Not run:
# Say we want to simulate data that has a skewness of 1.5. We'll first look
# at a large range of values passed to the Weibull (Type 3) distribution
# using `fastDist`.
fastDist(fam = "WEI3" ,
famParms = list(mu = 1:20,
sigma = c(.25,.5,.75,1) ) ,
propErrVar = c(.90, .75, .50 ) ,
file = 'fastDist'
)
## End(Not run)
# After looking at the output, we decide to try a condition that had a
# skewness of 2.53 because we know we need a larger skewness from `fastDist`
# than our target of 1.5
example(polyICT) # generate `myPolyICT` from ?polyICT
err <- armaErr$new(model = list(ar=c(.5), ma=c(.5)), fam = 'WEI3',
famParms = list(mu=1, sigma=.5))
myPolyICT$propErrVar <- c(randFx = .5, res = .49, mserr = .01)
myPolyICT$error <- err
datstat <- myPolyICT$designCheck(return='datstat', justData=TRUE, seed = 456)
datstat$descriptives
# rerun the `fastDist` example with a subset of parameters to WEI3
## Not run:
# regenerate `myPolyICT` from ?polyICT
example(polyICT)
# set up an error object, values for `famParms` are not needed and will be
# ignored by `setupDist`
skew <- armaErr$new(model = list(ar=c(.5), ma=c(.5)), fam = 'WEI3')
# use a subset of distributions
setupDist(design = myPolyICT ,
err = skew ,
famParms = list(mu = c(1,3,5) ,
sigma = c(.5, .75) ,
propErrVar = c(.90, .75, .50 ) ,
file = 'setupDist'
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.