Learn R Programming

gvcm.cat (version 1.8)

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

  • Xthe model matrix
  • Termsthe according terms.object
  • mthe model frame
  • inteither 0, indicating that the intercept is varying, or 1 indicating that the intercept is constant
  • formulasorted version of the given formula, index vectors will refer to this formula
  • a matrixvalue 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 factoruthe entry equals the number ofu'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 covariatesp(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 covariatesgrouped(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 covariatessp
  • index7: indicates penalized covariatesSCAD. 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 covariateselastic. 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