mcsim: Monte Carlo Simulation of Data Analysis with Trial-by-Trial...

Description Usage Arguments Details Value

View source: R/simulation.R

Description

Monte Carlo Simulation of Data Analysis with Trial-by-Trial Variation

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mcsim(
  nmc,
  n_subj = 48L,
  n_obs = 48L,
  A = 0,
  B = 0,
  AB = 0,
  rint_range = blst_quantiles()[, "subj_int"],
  rslp_range = blst_quantiles()[, "subj_slp"],
  rcorr_range = c(-0.8, 0.8),
  version = 0L,
  os_always = is.character(version),
  m = NA,
  k = -1,
  bam_args = NULL,
  fit_blocked = TRUE,
  fit_lmem = TRUE,
 
    outfile = sprintf("acs_%05d_%03d_%03d_%0.2f_%0.2f_%0.2f_%0.2f_%0.2f_%0.2f_%0.2f_%s_%s_%s_%s.rds",
    nmc, n_subj, n_obs, A, B, AB, rint_range[1], rint_range[2], rslp_range[1],
    rslp_range[2], if (is.numeric(version)) sprintf("%02d", version) else version,
    format(Sys.time(), "%Y-%m-%d-%H-%M-%S"), Sys.info()[["nodename"]],
    Sys.getpid()),
  extra_args = NULL,
  rand_fn = "shuffle"
)

Arguments

nmc

Number of Monte Carlo runs.

n_subj

Number of subjects to simulate. Must be a positive integer that is a multiple of 2.

n_obs

Number of observations per subject. Must be a positive even integer.

A

Main effect of A (within-subject factor).

B

Main effect of B (between-subject factor).

AB

AB interaction effect.

rint_range

Range of random intercept variance.

rslp_range

Range of random slope variance (for factor A).

rcorr_range

Range of random correlation.

version

Autocorrelation case number; either an integer corresponding to Scenario number (see errsim) or the name of a user-defined function specified as a character string.

os_always

Whether to always fit an overall smooth, or only for errsim() versions 2, 7, 8, 12, 15, and 16. For user-defined functions, default is to fit a common smooth.

m

The m parameter to be passed on to any factor smooths (specified in the mgcv::s() function).

k

The k parameter to be passed on to any factor smooths (specified in the mgcv::s() function).

bam_args

List of additional arguments to be passed onto mgcv::bam().

fit_blocked

Whether to fit the blocked version in addition to the randomized version.

fit_lmem

Whether to fit the LMEM in addition to the GAMM.

outfile

Name of output file.

extra_args

Extra args to be passed along to any user-defined function for generating residuals.

rand_fn

Name of the function to randomize trial order (defaults to shuffle). This can be a user-supplied function; see shuffle for details on how this function should be constructed.

int

Intercept.

Details

The behavior of os_always depends on whether version has been specified as a scenario number, in which case it overrides the scenario-dependent selection of an overall smooth, always fitting an overall smooth. If version is the name of a user-defined function, then os_always determines whether the model includes an overall smooth.

Value

Returns NULL.


dalejbarr/autocorr documentation built on March 27, 2021, 3:03 a.m.