gvcm.cat (version 1.9)

index: Functions to Build Design Matrices and Indices for Function gvcm.cat()

Description

design() builds design matrices for function gvcm.cat; index() computes indices with information about the terms of the formula.

Usage

design(formula, data)
index(dsgn, data = data, formula = formula)

Arguments

formula
an object of class "formula"; see gvcm.cat
data
a data frame; see gvcm.cat
dsgn
value of function design()

Value

X
the model matrix
Terms
the according terms.object
m
the model frame
int
either 0, indicating that the intercept is varying, or 1 indicating that the intercept is constant
formula
sorted version of the given formula, index vectors will refer to this formula
a matrix
value of function index

Details

Function index returns a matrix with one indicator vector per row. The columns refer to the elements of the formula (same order). The indicator/indices are:
  • index1 : gives the number of coefficients belonging to each term in the formula. An entry is 1 if the according term is metric, it equals the number of the coded variable's categories, if the variable is a factor. If a continuous variable is modified by a factor u the entry equals the number of u's categories
  • index2 : indicates varying coefficients. An entry is 0 if the according coefficient is not varying, it is -1 if the according coefficient is nominal, 1 if it is ordinal
  • index2b: conforms to indicator $b_j$ in Oelker et. al. 2012
  • index3 : indicates penalized covariates p(u). An entry is 0 if the according covariate is not penalized, it is -1 if the according covariate is nominal, 1 if it is ordinal or metric
  • index4 : indicates penalized covariates grouped(u). An entry is 0 if the according covariate is not penalized, it is -1 if the according covariate is nominal, 1 if it is ordinal or metric
  • index5 : experimental
  • index6 : indicates penalized covariates sp
  • index7 : indicates penalized covariates SCAD. An entry is 0 if the according covariate is not penalized, it is -1 if the according covariate is nominal, 1 if it is ordinal or metric
  • index8 : indicates penalized covariates elastic. An entry is 0 if the according covariate is not penalized, it is -1 if the according covariate is nominal, 1 if it is ordinal or metric
  • index9 : experimental

References

Oelker, M.-R., J. Gertheiss and G. Tutz (2012). Regularization and model melection with categorial predictors and effect modifiers in generalized linear models. Department of Statistics at the University of Munich: Technical Report 122.

See Also

Functions pest, abc

Examples

Run this code
## example for function simulation()
covariates <- list(x1=list("unif", c(0,2)),
                  x2=list("unif", c(0,2)),
                  x3=list("unif", c(0,2)),
                  u=list("multinom",c(0.3,0.4,0.3), "nominal")
                  )
true.f <- y ~ 1 + v(x1,u) + x2
true.coefs <- c(0.2,  0.3,.7,.7, -.5)
data <- simulation(400, covariates, NULL, true.f, true.coefs , binomial(), seed=456)
## example for function index()
f <- y ~ v(1,u) + v(x1,u) + v(x2,u)
dsgn <- design(f, data)
index(dsgn, data)

Run the code above in your browser using DataLab