Learn R Programming

logitchoice (version 0.9.4)

coef.logitchoice: Return estimated coefficients from fitted logitchoice object.

Description

Returns the model coefficients for each lambda.

Usage

"coef"(object, lambdaIndex = NULL, ...)

Arguments

object
Fitted "logitchoice" model object.
lambdaIndex
Index of lambda value at which to extract coefficients. If NULL, return the coefficients for all values of lambda in the path.
...
Not used.

Value

Details

Returns the actual main effect and interaction coefficients. These satisfy the sum constraints in the original linear interaction model.

See Also

predict.logitchoice, logitchoice

Examples

Run this code
  groupSizes = sample(6:18, 100, replace=TRUE)
  numGroups = length(groupSizes)
  n = sum(groupSizes)
  p = 10
  X = matrix(rnorm(n*p), nrow=n)
  X = scale(X)
  Y = rep(0, n)
  Y[cumsum(groupSizes)] = 1
  grouping = rep(1:numGroups, groupSizes)
  fit = logitchoice(X, Y, grouping)
max(abs(fit$betahat - coef(fit)))

Run the code above in your browser using DataLab