Learn R Programming

BTLLasso (version 0.1-1)

BTLLasso: Function to perform BTLLasso

Description

Performs BTLLasso, a method to model heterogeneity in paired comparison data. Subject-specific covariates are allowd to have an influence on the attractivity/strength of the objects. An L1 penalty on the pairwise differences between the object-specific parameters allows for both clustering of object with regard to covariates and elimination of irrelevant covariates.

Usage

BTLLasso(Y, X, lambda, control = BTLLasso.ctrl(), trace = TRUE)

Arguments

Y
Matrix containing paired comparisons, ordered or binary. For K categories, the colmuns have to be ordered as follows: 1 vs 2, 1 vs 3, ..., 1 vs K, 2 vs 3, 2 vs 4, ..., 2 vs K, ..., K-1 vs K. One row represents one subject.
X
Matrix containing all subject-specific covariates. One row represents one subject, one column represents one covariate. Has to be standardized.
lambda
Vector of tuning parameters.
control
Function for control arguments, mostly for internal use. See also BTLLasso.ctrl.
trace
Should the trace of the BTLLasso algorithm be printed?

Value

  • coefsMatrix containing all (original) coefficients, one row per tuning parameter, one column per coefficient.
  • coefs.reparMatrix containing all reparameterized (for symmetric side constraint) coefficients, one row per tuning parameter, one column per coefficient.
  • logLikVector of log-likelihoods, one per tuning parameter.
  • designDesign matrix, NULL if return.design=FALSE in BTLLasso.ctrl
  • YY matrix
  • qq=K-1, K is the number of different categories in Y
  • acoefsMatrix containing penalties, for internal use.
  • responseVector containing 0-1 coded response.
  • nNumber of persons/subjects
  • INumber of paired comparisons
  • mNumber of objects
  • pNumber of covariates
  • XX matrix
  • n.thetaNumber of estimated threshold parameters
  • lambdaVector of tuning parameters
  • labelsLabels of objects, only correct if Y specified correctly by "1 vs 2","1 vs 3",...
  • epsilonThreshold value for convergence of the algorithm, specified in BTLLasso.ctrl

Details

Y matrix needs a special format. Column names need to be in the style "1 vs 2","1 vs 3",... If so, object labels "1", "2", ... are extracted from the column names.

References

Schauberger, Gunther and Tutz, Gerhard (2015): Modelling Heterogeneity in Paired Comparison Data - an L1 Penalty Approach with an Application to Party Preference Data, Department of Statistics, LMU Munich, Technical Report 183

See Also

cv.BTLLasso, boot.BTLLasso, singlepaths, paths

Examples

Run this code
# load data set
data(GLESsmall)

# define response and covariate matrix
X <- scale(GLESsmall[, 11:14])
Y <- as.matrix(GLESsmall[, 1:10])

# vector of subtitles, containing the coding of the single covariates
subs <- c("(in years)","female (1); male (0)",
"East Germany (1); West Germany (0)","(very) good (1); else (0)")

# vector of tuning parameters
lambda <- exp(seq(log(31),log(1),length=50))-1

# compute BTLLasso model
m <- BTLLasso(Y = Y, X = X, lambda = lambda)

op <- par(no.readonly = TRUE) 
par(mar=c(5,4,4,8))

# plot covariate paths
paths(m)

# plot parameter paths
singlepaths(m, subs = subs)

par(op)

Run the code above in your browser using DataLab