Learn R Programming

BTLLasso (version 0.1-2)

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

coefs
Matrix containing all (original) coefficients, one row per tuning parameter, one column per coefficient.
coefs.repar
Matrix containing all reparameterized (for symmetric side constraint) coefficients, one row per tuning parameter, one column per coefficient.
logLik
Vector of log-likelihoods, one per tuning parameter.
design
Design matrix, NULL if return.design=FALSE in BTLLasso.ctrl
Y
Y matrix
q
q=K-1, K is the number of different categories in Y
acoefs
Matrix containing penalties, for internal use.
response
Vector containing 0-1 coded response.
n
Number of persons/subjects
I
Number of paired comparisons
m
Number of objects
p
Number of covariates
X
X matrix
n.theta
Number of estimated threshold parameters
lambda
Vector of tuning parameters
labels
Labels of objects, only correct if Y specified correctly by "1 vs 2","1 vs 3",...
epsilon
Threshold 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
## Not run: 
# # 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)
# ## End(Not run)

Run the code above in your browser using DataLab