View source: R/predict_gpt_fit.R
predict.gpt_fit | R Documentation |
Computes expected category/branch probabilities and the corresponding conditional means and quantiles/densities for the continuous latent distributions.
## S3 method for class 'gpt_fit'
predict(
object,
cat = TRUE,
dens = FALSE,
group,
dim = 1,
quantiles = c(0.1, 0.3, 0.5, 0.7, 0.9),
prec = 500,
...
)
object |
GPT model fitted by |
cat |
if |
dens |
if |
group |
select group by an index, e.g., |
dim |
only for multivariate continuous data: dimension for prediction |
quantiles |
which quantiles to predict |
prec |
number of evaluations of the GPT density to compute conditional means/quantiles for the latent distributions |
... |
ignored |
## Not run:
# generate data
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 <- gpt_fit(x=gen$x, y=gen$y, latent="exgauss", file=file,
restrictions=list("do=dn", "lambda_do=lambda_dn",
"lambda_go=lambda_gn"))
# Predictions for MPT categories:
predict(fit)
# Predictions for latent MPT branches:
p <- predict(fit, cat=FALSE, dens=TRUE)
yy <- as.numeric(colnames(p[,-(1:5)]))
plot(yy, p[1,-(1:5)], main="2HTM", type="l")
lines(yy, p[3,-(1:5)], col=2)
legend("topright", col=1:2, lty=1, c("Detect","Guess"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.