generate_data: Generate datasets according to the model structure

View source: R/generate_data.R

generate_dataR Documentation

Generate datasets according to the model structure

Description

Generate datasets according to the model structure

Usage

generate_data(
  M = 100,
  N = 61,
  I = 10,
  J = 12,
  K = c(4),
  Z.type = c("symmetric"),
  Z.contrast = "treatment",
  Z.formula = NULL,
  sigmax = 1,
  lambda = 1,
  yT = pi/4,
  yD = (3 * pi)/4,
  kappa_bnds = c(120, 300),
  priors = "default",
  gfunction = c("logistic", "gompertz"),
  ...
)

Arguments

M

(integer) number of simulated datasets

N

(integer) length of the Y-trajectories

I

(integer) number of individuals

J

(integer) number of trials

K

(array of integers) list of length Q of the number of levels for each categorical variable

Z.type

(array of characters) list of length Q of the methods (symmetric or random) to generate the matrix (see generate_Z)

Z.contrast

(character) type of contrasts (default: treatment) for the model matrix Z (see model.matrix)

Z.formula

(character) a formula of the contrasts for the model matrix Z (see model.matrix)

sigmax

(numeric) fixed value for the model parameter sigmax

lambda

(numeric) fixed value for the model parameter lambda

yT

(numeric) position in angles of the target

yD

(numeric) position in angles of the distractor

kappa_bnds

(array) array containing the lower and upper bounds for the kappa parameter (default = c(120,300))

priors

(list) a list of arguments specifying priors for each parameter involved in the model (see check_prior). If priors="default" then pre-defined priors will be used.

gfunction

(character) type of link function between latent states and observed data: 'logistic', 'gompertz' (default = 'logistic').

...

other stan arguments (e.g., 'init', 'algorithm', 'sample_file'. See sampling)

Details

The function generates simulated datasets via Stan according to the model structure.

Value

a datalist containing simulated data and parameters

Examples


## Not run: 
## Generate mouse-tracking data for an univariate experimental design 
## with K = 3 categorical levels, J = 30 trials, I = 8 subjects
X1 <- generate_data(I=5,J=12,K=3,Z.formula="~Z1",M=50)

## Generate mouse-tracking data for an univariate experimental design 
## by varying priors of parameters
priors_list = list("normal(0,1)T(0,Inf)","normal(0,1)","normal(-2,0.5)")
X1 <- generate_data(I=5,J=12,K=3,Z.formula="~Z1",M=50,priors=priors_list)

## Generate mouse-tracking data with two experimental factors Z1 and Z2, J = 9 trials, 
## K_Z1 = 3, K_Z2 = 3, I = 5 subjects
X2 <- generate_data(I=5,J=9,K=c(3,3),Z.formula="~Z1*Z2",
Z.type=c("symmetric","random"),M=50) # design with interaction

## End(Not run)

ssMousetrack documentation built on April 5, 2023, 5:11 p.m.