Description Usage Arguments Details Value Author(s) References See Also Examples
Fits dummy coefficients of ordinally scaled independent variables with a group lasso penalty on differences of adjacent dummy coefficients.
1 2 3 4 5 6 
x 
the matrix of ordinal predictors, with each column corresponding to one predictor and containing numeric values from {1,2,...}; for each covariate, category 1 is taken as reference category with zero dummy coefficient. 
y 
the response vector. 
u 
a matrix (or 
z 
a matrix (or 
offset 
vector of offset values. 
lambda 
vector of penalty parameters (in decreasing order). Optimization starts with the first component. See details below. 
nu 
additional tuning parameter to control the strength of the penalty
imposed on dummy coefficients corresponding to 
zeta 
additional tuning parameter to control the strength of the penalty
imposed on coefficients corresponding to 
model 
the model which is to be fitted. Possible choices are "linear" (default), "logit" or "poisson". See details below. 
penscale 
rescaling function to adjust the value of the penalty parameter to the degrees of freedom of the parameter group. See the references below. 
scalex, scaleu, scalez 
logical. Should (split/dummycoded) design
matrices corresponding to 
nonpenx, nonpenu, nonpenz 
vectors of indices indicating columns of

intercept 
logical. Should a (nonpenalized) intercept be included in the model? Default is TRUE. 
eps 
a (small) constant to be added to the columnwise standard deviations when scaling design matrices, to control the effect of very small stds. See details below. 
... 
additional arguments. 
The method assumes that categorical covariates (contained in x
and
u
) take values 1,2,...,max, where max denotes the (columnwise) highest
level observed in the data. If any level between 1 and max is not observed,
a corresponding (dummy) coefficient is fitted anyway. If any level > max is
not observed but possible in principle, and a corresponding coefficient is to
be fitted, the easiest way is to add a corresponding row to x
(and
u
,z
) with corresponding y
value being NA
.
In order to adjust the strength of penalty that is imposed on nominal or
metric covariates, nu
, resp. zeta
can be chosen. The penalty
parameter used for nominal variables (contained in u
) is
lambda*nu
, for metric predictors (contained in z
) it is
lambda*zeta
.
If a linear regression model is fitted, response vector y
may contain
any numeric values; if a logit model is fitted, y
has to be 0/1 coded;
if a poisson model is fitted, y
has to contain count data.
If scalex
, scaleu
or scalez
are TRUE
, design
matrices constructed from x
, u
, resp. z
are scaled to have
unit variance over columns. In the case of x
, the design matrix is
splitcoded, in the case of u
, it is dummycoded, and in case of
z
, it is just z
. If a certain x
 or u
 category,
however, is observed only a few times, variances may become very small and
scaling has enormous effects on the result and may cause numerical problems.
Hence a small constant eps
can be added to each standard deviation
when used for scaling.
An ordPen
object, which is a list containing:
fitted 
the matrix of fitted response values of the training data.
Columns correspond to different 
coefficients 
the matrix of fitted coefficients with respect to dummycoded (ordinal or nominal) categorical input variables (including the reference category) as well as metric predictors. Columns correspond to different lambda values. 
model 
the type of the fitted model: "linear", "logit", or "poisson". 
lambda 
the used lambda values. 
xlevels 
a vector giving the number of levels of the ordinal predictors. 
ulevels 
a vector giving the number of levels of the nominal predictors. 
zcovars 
the number of metric covariates. 
Jan Gertheiss
Gertheiss, J., S. Hogger, C. Oberhauser and G. Tutz (2011). Selection of ordinally scaled independent variables with applications to international classification of functioning core sets. Journal of the Royal Statistical Society C (Applied Statistics), 60, 377395.
Meier, L., S. van de Geer and P. Buehlmann (2008). The group lasso for logistic regression. Journal of the Royal Statistical Society B, 70, 5371.
Yuan, M. and Y. Lin (2006). Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society B, 68, 4967.
plot.ordPen
, predict.ordPen
,
ICFCoreSetCWP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  # smoothing and selection of ordinal covariates using a random dataset
set.seed(123)
# generate (ordinal) predictors
x1 < sample(1:8,100,replace=TRUE)
x2 < sample(1:6,100,replace=TRUE)
x3 < sample(1:7,100,replace=TRUE)
# the response
y < 1 + log(x1) + sin(3*(x21)/pi) + rnorm(100)
# x matrix
x < cbind(x1,x2,x3)
# lambda values
lambda < c(1000,500,200,100,50,30,20,10,1)
# smoothing and selection
o2 < ordSelect(x = x, y = y, lambda = lambda)
# results
round(o2$coef,digits=3)
plot(o2)
# If for a certain plot the xaxis should be annotated in a different way,
# this can (for example) be done as follows:
plot(o2, whichx = 1, xlim = c(0,9), xaxt = "n")
axis(side = 1, at = c(1,8), labels = c("no agreement","total agreement"))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.