fastDist: Functions to help in setting up an ICT design

View source: R/fastDist.R

fastDistR Documentation

Functions to help in setting up an ICT design

Description

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.

Usage

fastDist(fam, famParms, propErrVar, file = "fastDist.pdf")

setupDist(design, err, famParms, propErrVar, file = "setupDist")

Arguments

propErrVar

See polyICT.

file

A character string used to name output files. Extensions (e.g., pdf, csv) will be added later.

design

See designICT and polyICT.

err, fam, famParms

See armaErr. For famParms, a range of values can be specified using a numeric vector and the resulting distributions from all possible combinations will be plotted with the resulting

Value

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).

Author(s)

Stephen Tueller stueller@rti.org

Examples


## 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)


ICTatRTI/PersonAlyticsPower documentation built on Dec. 13, 2024, 11:08 p.m.