simulate: Simulate data for mediation hypotheses

View source: R/simulate.R

simulateR Documentation

Simulate data for mediation hypotheses

Usage

simulate(nobs, nexper, nhyp, config)

Arguments

nobs

Number of observations (may be a vector)

nexper

Number of experiments for each nobs value.

nhyp

Total number of hypotheses (nulls and alternatives) in each experiment.

config

A data frame, consists information about the different cases (values of true parameters) in the following columns:

  • altr: logical, indicating whether this is a case of the alternative.

  • gaddend and baddend; gfactor and bfactor; and gexp and bexp: numeric constants used to define the true parameters γ_n and β_n.

  • prop: numeric, discrete distribution for the different cases in the configuration.

Value

A tibble with length(nobs) * nexper * nhyp rows. Each row corresponds to an realization of an estimator, assumed to be an approximation to an asymptotically normal estimator with root-n rate (based on n observations). The simulations here are based on the normal approximations, and consists of the following columns:

  • nobs: Number of observations (affecting the standard deviation). Values are from the given value in the corresponding parameter nobs.

  • exper: Serial number of the experiment in the current nobs value.

  • case: Identifier of the true case of the hypothesis. In each experiment the hypotheses are distributed according to config.

  • g and b: The true parameters. Their values depends on the parameters in the config, and on the current nobs value: γ_n = gaddend + gfactor * nobs^gexp; β_n = baddend + bfactor * nobs^bexp.

  • gestim and bestim: estimators for γ_n and β_n, distributed independently from Normal distribution with mean γ_n and β_n respectively, and with standard deviation equals 1/√ n.

  • gpval and bpval: Corresponding p-values, under the null hypotheses γ = 0 and β = 0, respectively.

Simulate data for mediation hypotheses


yotamleibovici/twostageshrink documentation built on Sept. 15, 2022, 7:30 p.m.