Learn R Programming

textir (version 1.1)

mnlm: Estimation for high-dimensional Multinomial Logistic Regression

Description

MAP estimation of Multinomial logistic regression models.

Usage

mnlm(counts, covars, normalize=FALSE, lambda=NULL, start=NULL,
                  tol=0.1, tmax=1000, delta=1, dmin=0, verb=TRUE)

Arguments

counts
A matrix of multinomial response counts in ncol(counts) categories for nrow(counts) individuals/observations.
covars
A matrix of ncol(covars) covariate values for each of the nrow(counts) observations. This does not include the intercept, which is ALWAYS added in the design matrix.
normalize
Whether or not to normalize the covariate matrix to have mean zero and variance one.
lambda
Either a single fixed value, or a vector of length 3 giving initial lambda followed by gamma prior shape and rate parameters (e.g., c(init=sqrt(2), shape=2, rate=2) ). Here, lambda (>0) is a joint scale parameter for the Laplace pri
start
An initial guess for the full ncol(counts) by ncol(covars)+1 matrix of regression coefficients. The first row (usually set to zero) corresponds to our "null" category and is not updated during the model fit. Under
tol
Optimization convergence tolerance for the improvement on the un-normalized negative log posterior over a single full parameter sweep.
tmax
The maximum number of optimization iterations.
delta
An initial step size for the least upper bound approximation to parameter information; implies a starting trust region of 2*delta.
dmin
Minimum trust region delta.
verb
Level of print-statement output. TRUE prints some initial info and updates every iteration.

Value

  • An mnlm object list with entries
  • coefRegression coefficient estimates, including the intercept column
  • LThe unnormalized negative log posterior at each iteration.
  • niterThe number of iterations
  • Xsimple_triplet_matrix form of the counts input matrix
  • VCovariate matrix (including the intercept)
  • covarMeanIf normalize=TRUE, the original covariate means. Otherwise empty.
  • covarSDIf normalize=TRUE, the original covariate standard deviations. Otherwise empty.
  • maplamAn indicator for whether the regularization penalty was estimated.
  • lamparParameters (init, shape, rate) for the regularization penalty.
  • lambdaThe path of lambda estimates.
  • deltaThe trust region deltas upon convergence.
  • tol,tmaxConvergence parameters, unchanged from input.
  • startThe initial coefficient estimates.

Details

Finds the posterior mode for multinomial logistic regression parameters using cyclic coordinate descent. This is designed to be useful for inverse regression analysis of sentiment in text, where the multinomial response is quite large, but should be generally useful for any large-scale multinomial logistic regression. We allow for joint estimation of regression coefficients and a Laplace regularization penalty. Full details are available in Taddy (2011).

References

Taddy (2011), Inverse Regression for Analysis of Sentiment in Text. http://arxiv.org/abs/1012.2098

See Also

congress109, we8there, plot.mnlm, pls

Examples

Run this code
## See congress109 and we8there for data examples

n <- 1000
size <- 10

v <- rnorm(n)
covars <- cbind(v)

p1 <- (1+exp(-(1 + v*2)))^{-1} 
p2 <- (1+exp(-(1 - v*2)))^{-1}
y1 <- rbinom(n, size=size, prob=p1)
y2 <- rbinom(n, size=size, prob=p2)

# binomial
counts <- cbind(size-y1, y1)
print(mnlm(counts, covars)$coef)

# 3 category multinomial
counts <- cbind(2*size-y1-y2,y1,y2)
print(mnlm(counts, covars)$coef)

Run the code above in your browser using DataLab