gpt_fit | R Documentation |
Fit GPT Model
gpt_fit(
x,
y,
data,
file,
latent,
group = NULL,
restrictions = NULL,
baseline = FALSE,
starting.values = NULL,
eta.lower = NULL,
eta.upper = NULL,
n.fit = c(3, 1),
maxit = c(300, 1000),
EM.tol = 0.01,
cpu = NULL,
print = FALSE
)
x |
vector of observed discrete observations (e.g., choices) or name of variable in |
y |
vector or matrix of observed continuous variable(s) (e.g., response times, confidence,...) or name of variable in |
data |
data frame containing the variables as named in |
file |
a character vector specifying the path to the model file |
latent |
type of latent continuous distribution (one of |
group |
vector with the number of observations as in |
restrictions |
list with parameter restrictions (e.g., |
baseline |
whether to fit baseline models that assume a saturated MPT structure and (a) separate continuous distributions per category ( |
starting.values |
starting values for theta and eta (used only in first EM run). Note that sensible starting values are guessed by default. |
eta.lower |
lower bound vector or scalar for eta parameters (assigned by name; or in alphabetical order). It is sufficient to constrain a subset of eta parameters selectively using a named vector. |
eta.upper |
upper bound vector or scalar for eta parameters |
n.fit |
number of EM and optim fitting runs (if any |
maxit |
maximum number of EM and optim iterations, respectively |
EM.tol |
tolerance for EM algorithm |
cpu |
number of cores used to fit individual data (default: number of cores minus one). Alternatively: a cluster spawned by |
print |
whether to print current status |
The following paramaters are used to specify the latent distributions (will be assigned in this order to the parameters listed in the model file as last argument in each row/branch):
"normal"
:mean (mu) and SD (sigma)
"exgauss"
(sum of normal and independent exponential):mean and SD of normal (mu, sigma); mean of exponential (tau)
"gamma"
:shape (k), scale (theta), shift
"weibull"
:shape (k), scale (lambda), shift
"lognormal"
:mean and SD (of normal distribution before taking log), shift
"wald"
(= inverse normal):mean (mu), shape (lambda), shift
"exwald"
(= sum of inverse normal and independent exponential):mean, shape, shift
"beta"
:shape1 (alpha) and shape2 (beta), see dbeta
"vonmises"
:mu (mean), kappa (concentration) of von Mises distribution for circular data.
## Not run:
n <- c(targets=75, lures=75) # number of items
theta <- c(do=.6,dn=.4, g=.5) # MPT parameters
eta <- c(mu=400, sig=50, lambda_do=300,
lambda_go=500, lambda_gn=500,
lambda_dn=300) # exGaussian parameters
file <- paste0(path.package("gpt"), "/models/2htm_exgauss.txt")
gen <- gpt_gen(n=n, theta=theta, eta=eta, latent="exgauss", file=file)
fit <- gpt_fit(x=gen$x, y=gen$y, latent="exgauss", file=file,
restrictions=list("do=dn", "lambda_do=lambda_dn",
"lambda_go=lambda_gn"))
fit
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.