predict.GPCMlasso: Predict function for GPCMlasso

View source: R/predict.GPCMlasso.R

predict.GPCMlassoR Documentation

Predict function for GPCMlasso

Description

Predict category probabilities or linear predictors from a fitted GPCMlasso model.

Usage

## S3 method for class 'GPCMlasso'
predict(
  object,
  coefs = NULL,
  newdata = NULL,
  theta = NULL,
  type = c("link", "response"),
  trait.cores = 1,
  ...
)

Arguments

object

GPCMlasso object.

coefs

Optional vector of coefficients, can be filled with a specific row from object$coefficients. If not specified, coefs are chosen to be the BIC-optimal coefficients or, if cross-validation was performed, the optimal coefficients according to cross-validation.

newdata

Optional data frame containing the covariates used for prediction. The right-hand side of object$formula is evaluated on newdata. The resulting columns must match the covariate columns used in the fitted model.

theta

Optional vector of trait values used for prediction. Required when newdata is supplied.

type

"link" returns the linear predictor.

"response" returns predicted category probabilities.

trait.cores

Number of cores used for computing posterior trait estimates within prediction on the original data. The default is 1, which avoids the overhead of starting parallel workers for small prediction tasks.

...

Further predict arguments.

Details

Predictions are based on a selected coefficient vector. If no coefficient vector is supplied, the cross-validation optimal coefficient vector is used when cross-validation was performed; otherwise, the BIC-optimal coefficient vector is used.

For predictions on the original data, posterior trait estimates are obtained from trait.posterior(). For predictions on newdata, trait values must be supplied via the argument theta, because posterior trait estimation for new persons requires response data and is not inferred automatically from covariates alone.

Results are lists of vectors with length equal to the number of response categories in case of probabilities (type = "response") or the number of adjacent-category logits in case of linear predictors (type = "link").

Author(s)

Gunther Schauberger
gunther@stat.uni-muenchen.de

See Also

GPCMlasso


GPCMlasso documentation built on Sept. 8, 2026, 5:08 p.m.