ctrl_GPCMlasso: Control function for GPCMlasso

View source: R/ctrl_GPCMlasso.R

ctrl_GPCMlassoR Documentation

Control function for GPCMlasso

Description

Control parameters for penalty terms and for tuning the fitting algorithm.

Usage

ctrl_GPCMlasso(
  log.lambda = TRUE,
  lambda = NULL,
  l.lambda = 50,
  lambda.min = 0.1,
  adaptive = TRUE,
  weight.penalties = TRUE,
  ada.lambda = 1e-04,
  ada.power = 1,
  Q = 15,
  lambda2 = 1e-04,
  cvalue = 1e-05,
  trace = TRUE,
  folds = 10,
  cores = 25,
  null_thresh = 0.01,
  gradtol = 1e-06,
  steptol = 1e-06,
  iterlim = 500,
  precision = 3,
  all.dummies = FALSE
)

Arguments

log.lambda

Should the grid of tuning parameters be created on a log scale?

lambda

Optional argument to specify a vector of tuning parameters. If lambda = NULL, a vector of length l.lambda is created automatically.

l.lambda

Specifies the length of the grid of tuning parameters.

lambda.min

Minimal value used if the grid of tuning parameters is created automatically.

adaptive

Should adaptive lasso be used? Default is TRUE.

weight.penalties

Should penalties be weightes accoreding to the number of penalty term and the number of parameters corresponding to one pair between item and covariate. Only relevant if both DSF = TRUE and the number of response categories differs across items (because only then these values can differ).

ada.lambda

Size of tuning parameter for Ridge-regularized estimation of parameters used for adaptive weights.

ada.power

By default, 1st power of absolute values of Ridge-regularized estimates are used. Could be changed to squared values by ada-power = 2.

Q

Number of nodes to be used in Gauss-Hermite quadrature.

lambda2

Tuning parameter for ridge penalty on all coefficients except sigma/slope parameters. Should be small, only used to stabilize results.

cvalue

Internal parameter for the quadratic approximation of the L1 penalty. Should be sufficiently small. For details see cat_control.

trace

Should the trace of the progress (current tuning parameter) be printed?

folds

Number of folds for cross-validation. Only relevant if cv = TRUE in GPCMlasso.

cores

Number of cores to be used parallel when fitting the model.

null_thresh

Threshold which is used to distinguih between values equal and unequal to zero.

gradtol

Parameter to tune optimization accuracy, for details see nlm.

steptol

Parameter to tune optimization accuracy, for details see nlm.

iterlim

Parameter to tune optimization accuracy, for details see nlm.

precision

Number of decimal places used to round coefficient estimates.

all.dummies

Should (in case of factors with more than 2 categories) the dummy variables for all categories be included in the design matrix? If all.dummies = TRUE, the dependence on the reference category is eliminated for multi-categorical covariates.

Author(s)

Gunther Schauberger
gunther.schauberger@tum.de

References

Schauberger, Gunther and Mair, Patrick (2019): A Regularization Approach for the Detection of Differential Item Functioning in Generalized Partial Credit Models, Behavior Research Methods, https://link.springer.com/article/10.3758/s13428-019-01224-2

Examples

data(tenseness_small)

## formula for simple model without covariates
form.0 <- as.formula(paste("cbind(",paste(colnames(tenseness_small)[1:5],collapse=","),")~0"))

######
## fit simple RSM where loglikelihood and score function are evaluated parallel on 2 cores
rsm.0 <- GPCMlasso(form.0, tenseness_small, model = "RSM", 
control= ctrl_GPCMlasso(cores=2))
rsm.0

## Not run: 
## formula for model with covariates (and DIF detection)
form <- as.formula(paste("cbind(",paste(colnames(tenseness_small)[1:5],collapse=","),")~."))

######
## fit GPCM model with 10 different tuning parameters
gpcm <- GPCMlasso(form, tenseness_small, model = "GPCM", 
                  control = ctrl_GPCMlasso(l.lambda = 10))
gpcm
plot(gpcm)
pred.gpcm <- predict(gpcm)
trait.gpcm <- trait.posterior(gpcm)

######
## fit RSM, detect differential step functioning (DSF)
rsm.DSF <- GPCMlasso(form, tenseness_small, model = "RSM", DSF = TRUE, 
                     control = ctrl_GPCMlasso(l.lambda = 10))
rsm.DSF
plot(rsm.DSF)

## create binary data set
tenseness_small_binary <- tenseness_small
tenseness_small_binary[,1:5][tenseness_small[,1:5]>1] <- 2

######
## fit and cross-validate Rasch model
set.seed(1860)
rm.cv <- GPCMlasso(form, tenseness_small_binary, model = "RM", cv = TRUE, 
                   control = ctrl_GPCMlasso(l.lambda = 10))
rm.cv
plot(rm.cv)

## End(Not run)

GPCMlasso documentation built on May 3, 2022, 5:05 p.m.