View source: R/gen_data_sample.R
gpt_gen_sample | R Documentation |
Allows to simulate parameter heterogeneity. Note that truncated normal distributions are used to ensure that parameters within the specified bounds.
gpt_gen_sample(
S,
n,
theta,
eta,
theta_sd = 0,
eta_sd = 0,
file,
latent,
restrictions = NULL,
cpu
)
S |
sample size (number of participants) |
n |
vector of the length of number of trees with n per tree |
theta |
vector of true MPT parameter values (consider also restricted parameters!). Values will be appropriatly reordered if a named vector ist given (otherwise, check order!). |
eta |
vector of true continuous parameters. Values will be appropriatly reordered if a named vector ist given (otherwise, check order!). |
theta_sd |
vector giving the standard deviation of normally distributed MPT parameters across participants (default: homogeneity) |
eta_sd |
vector giving the standard deviation of normally distributed continuous parameters across participants (default: homogeneity) |
file |
a character vector specifying the path to the model file |
latent |
type of latent continuous distribution (one of |
restrictions |
list with parameter restrictions (e.g., |
cpu |
number of cores used for data generation (default: number of cores minus one). alternatively, a parallel cluster initialized by 'cl <- parallel::makeCluster(4)' |
gpt_gen
###### 2-High-Threshold Model (with fixed guessing) ######
## Not run:
n <- c(targets=20, lures=20) # number of items
theta <- c(do=.6,dn=.4, g=.5) # MPT parameters
eta <- c(mu=400, sig=50, lambda_do=200,
lambda_go=600, lambda_gn=400,
lambda_dn=300) # exGaussian parameters
file <- paste0(path.package("gpt"), "/models/2htm_exgauss.txt")
gen <- gpt_gen_sample(S=3, n=n, theta=theta, eta=eta,
theta_sd=.1, eta_sd=10,
file =file, latent="exgauss")
sapply(gen, head, 3)
# check mean of latent continuous distributions:
by(gen$data$y, gen$data$state, mean)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.