gendata: Generate Data for Simulation

View source: R/helperfunctions_simulation.R

gendataR Documentation

Generate Data for Simulation

Description

This function creates a new data set based on already a fitted model of type multiFAMM.

Usage

gendata(I = 10, J = 10, nested = FALSE, num_dim = 2, lamB, lamC, lamE,
  normal = TRUE, sigmasq = list(0.05, 4), dim_indep = TRUE,
  simple_sig = TRUE, mu = function(t) {
     t + sin(t)
 }, N_B = 1,
  N_C = 1, N_E = 1, phiB_fun, phiC_fun, phiE_fun, minsize = 10,
  maxsize = 20, min_grid = 0, max_grid = 1, grid_eval = 100,
  min_visit = 3, max_visit = 3, use_RI = FALSE, covariate = TRUE,
  num_cov = 4, interaction = FALSE, which_inter = matrix(NA),
  model = NULL, center_scores = FALSE, decor_scores = FALSE,
  nested_center = FALSE, trajectory = FALSE, equal_grid = FALSE)

Arguments

I

Number of levels for first grouping variable (individuals).

J

Number of levels for second grouping variable (set to NA for random intercept design).

nested

TRUE: second random effect is nested. FALSE: if it is a crossed effect. Defaults to FALSE.

num_dim

Number of dimensions.

lamB

Eigenvalues for first grouping variable.

lamC

Eigenvalues for second grouping variable. Can be NULL.

lamE

Eigenvalues for curves-specific deviations.

normal

TRUE: FPC weights are drawn from a normal distribution. FALSE: they are drawn from a mixture of normals. Defaults to TRUE.

sigmasq

Error variances for each dimension supplied as a list.

dim_indep

TRUE: Use rmvnorm to ensure that error variances are independent across the dimensions. FALSE: Prolonge Jona's implementation using . Defaults to TRUE.

simple_sig

TRUE: Random normal numbers weighted with sigma. FALSE: mvnorm. Defaults to TRUE.

mu

Mean function. Can be NULL if the GAM model is supplied, then defaults to t + sin(t). If GAM model is supplied, then this argument is redundant.

N_B

Number of FPCs for first grouping variable. Defaults to 1.

N_C

Number of FPCs for second grouping variable. Can be 0 and defaults to 1.

N_E

Number of FPCs for curves-specific deviations. Defaults to 1.

phiB_fun

Eigenfunctions of the first grouping variable as a multiFunData object.

phiC_fun

Eigenfunctions of the second grouping variable as a multiFunData object. Can be NULL.

phiE_fun

Eigenfunctions of the curve-specific deviations as a multiFunData object.

minsize

Minimal number of scalar observations per curve. Defaults to 10.

maxsize

Maximal number of observations per curve. Defaults to 20.

min_grid

Minimal value of grid range. Defaults to 0.

max_grid

Maximal value of grid range. Defaults to 1.

grid_eval

Length of the final grid to evaluate the functions. Defaults to 100.

min_visit

Minimal number of repetitions of each subject-word/session (first- and second grouping variable) combination (in case of random intercept design: minimal number of repetitions for first grouping variable). Defaults to 3.

max_visit

Maximal number of repetitions of each subject-word/session (first- and second grouping variable) combination (in case of random intercept design: maximal number of repetitions for first grouping variable). Defaults to 3.

use_RI

TRUE: data with a random intercept structure are generated. FALSE: data with crossed/nested random intercepts structure are generated (Additional layer "words"/"sessions" included). Defaults to FALSE.

covariate

If covariates shall be generated. Defaults to TRUE.

num_cov

Number of covariates if covariate = TRUE. Defaults to 4.

interaction

TRUE if there are interactions between covariates (as in the phonetic sparseFLMM). Defaults to FALSE.

which_inter

Symmetric matrix specifying the interaction terms (as in sparseFLMM). Defaults to missing matrix.

model

GAM model from which to extract the covariate functions. Can be NULL if mu is specified.

center_scores

TRUE: FPC weights are centered. Defaults to FALSE.

decor_scores

TRUE: FPC weights are decorrelated. Defaults to FALSE.

nested_center

TRUE: FPC weights of the nested effect are centered around zero for each subject. Defaults to FALSE.

trajectory

TRUE: All dimensions are observed at the same time points as would be (ideally) the case for the snooker data. Defaults to FALSE.

equal_grid

TRUE: Evaluation points are identical over the dimensions as would be for movement trajectories. Defaults to FALSE.


alexvolkmann/multifammPaper documentation built on Sept. 9, 2024, 8:47 p.m.