design | R Documentation |
This function combines information regarding the data, type of model, and the model specification.
design(
formula = NULL,
factors = NULL,
Rlevels = NULL,
model,
data = NULL,
contrasts = NULL,
matchfun = NULL,
constants = NULL,
covariates = NULL,
functions = NULL,
report_p_vector = TRUE,
custom_p_vector = NULL,
transform = NULL,
bound = NULL,
...
)
formula |
A list. Contains the design formulae in the
format |
factors |
A named list containing all the factor variables that span
the design cells and that should be taken into account by the model.
The name Example: |
Rlevels |
A character vector. Contains the response factor levels.
Example: |
model |
A function, specifies the model type.
Choose from the drift diffusion model ( |
data |
A data frame. |
contrasts |
Optional. A named list specifying a design matrix.
Example for supplying a customized design matrix:
|
matchfun |
A function. Only needed for race models. Specifies whether a
response was correct or not. Example: |
constants |
A named vector that sets constants. Any parameter in
|
covariates |
Names of numeric covariates. |
functions |
List of functions to create new factors based on those in
the factors argument. These new factors can then be used in |
report_p_vector |
Boolean. If TRUE (default), it returns the vector of parameters to be estimated. |
custom_p_vector |
A character vector. If specified, a custom likelihood function can be supplied. |
transform |
A list with custom transformations to be applied to the parameters of the model,
if the conventional transformations aren't desired.
See |
bound |
A list with custom bounds to be applied to the parameters of the model,
if the conventional bound aren't desired.
see |
... |
Additional, optional arguments |
A design list.
# load example dataset
dat <- forstmann
# create a function that takes the latent response (lR) factor (d) and returns a logical
# defining the correct response for each stimulus. Here the match is simply
# such that the S factor equals the latent response factor
matchfun <- function(d)d$S==d$lR
# When working with lM and lR, it can be useful to design an
# "average and difference" contrast matrix. For binary responses, it has a
# simple canonical form
ADmat <- matrix(c(-1/2,1/2),ncol=1,dimnames=list(NULL,"diff"))
# Create a design for a linear ballistic accumulator model (LBA) that allows
# thresholds to be a function of E and lR. The final result is a 9 parameter model.
design_LBABE <- design(data = dat,model=LBA,matchfun=matchfun,
formula=list(v~lM,sv~lM,B~E+lR,A~1,t0~1),
contrasts=list(v=list(lM=ADmat)),
constants=c(sv=log(1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.