Description Usage Arguments Details Value Author(s) References Examples
multinomMLE
estimates the coefficients of the multinomial
regression model for grouped count data by maximum likelihood, then
computes a moment estimator for overdispersion and reports standard
errors for the coefficients that take overdispersion into account.
This function is not meant to be called directly by the user. It is
called by multinomRob
, which constructs the various arguments.
1 2 | multinomMLE(Y, Ypos, Xarray, xvec, jacstack, itmax=100, xvar.labels,
choice.labels, MLEonly=FALSE, print.level=0)
|
Y |
Matrix (observations by alternatives) of outcome counts.
Values must be nonnegative. Missing data ( |
Ypos |
Matrix indicating which elements of Y are counts to be analyzed (TRUE) and which are values to be skipped (FALSE). This allows the set of outcome alternatives to vary over observations. |
Xarray |
Array of regressors. dim(Xarray) = c(observations, parameters, alternatives). |
xvec |
Matrix (parameters by alternatives) that represents the model structure. It has a 1 for an estimated parameter, an integer greater than 1 for an estimated parameter constrained equal to another estimated parameter (all parameters constrained to be equal to one another have the same integer value in xvec) and a 0 otherwize. |
jacstack |
Array of regressors used to facilitate computing the gradient and the hessian matrix. dim(jacstack) = c(observations, unique parameters, alternatives). |
itmax |
The maximum number of iterations to be done in the Gauss-Newton optimization. |
xvar.labels |
Vector of labels for observations. |
choice.labels |
Vector of labels for outcome alternatives. |
MLEonly |
If |
print.level |
Specify 0 for minimal printing (error messages only) or 3 to print details about the MLE computations. |
Following the generalized linear models approach, the coefficient parameters in an overdispersed multinomial regression model may be estimated using the likelihood for a standard multinomial regression model. A moment estimator may be used for the dispersion parameter, given the coefficient estimates, with little efficiency loss.
multinomMLE returns a list containing the following objects. The returned objects are:
coefficients |
The maximum likelihood coefficient estimates in matrix format. The value 0 is used in the matrix to fill in for values that do not correspond to a regressor. |
coeffvec |
A vector containing the maximum likelihood coefficient estimates. |
dispersion |
Moment estimate of the dispersion: mean sum of squared orthogonalized residuals (adjusted for degrees of freedom lost to estimated coefficients). |
se |
The MLE coefficient estimate standard errors derived from the asymptotic covariance estimated using the Hessian matrix (observed information). |
se.opg |
The MLE coefficient estimate standard errors derived from the asymptotic
covariance estimated using the outer product of the gradient (expected
information) divided by the moment estimate of the dispersion.
Not provided if |
se.hes |
The MLE coefficient estimate standard errors derived from the asymptotic
covariance estimated using the Hessian matrix (observed
information). Same as |
se.sw |
The MLE coefficient estimate standard errors derived from the asymptotic
covariance estimated using the estimated asymptotic
sandwich covariance estimate. Not provided if |
se.vec |
|
se.opg.vec |
|
se.hes.vec |
|
se.sw.vec |
|
A |
The outer product of the gradient (expected information) divided by the moment estimate of the dispersion. |
B |
The inverse of the hessian matrix (observed formation). |
covmat |
Sandwich estimate of the asymptotic covariance of the maximum likelihood coefficient estimates. |
iters |
Number of Gauss-Newton iterations. |
error |
Exit error code. |
GNlist |
List reporting final results of the Gauss-Newton optimization. Elements:
|
sigma2 |
Moment estimate of the dispersion: mean sum of squared orthogonalized residuals (adjusted for degrees of freedom lost to estimated coefficients). |
Y |
The same |
Ypos |
The same |
fitted.prob |
The matrix of predicted probabilities for each category for each observation based on the coefficient estimates. |
jacstack |
The same |
Walter R. Mebane, Jr., University of Michigan,
wmebane@umich.edu, http://www-personal.umich.edu/~wmebane
Jasjeet S. Sekhon, UC Berkeley, sekhon@berkeley.edu, http://sekhon.berkeley.edu/
Walter R. Mebane, Jr. and Jasjeet Singh Sekhon. 2004. “Robust Estimation and Outlier Detection for Overdispersed Multinomial Models of Count Data.” American Journal of Political Science 48 (April): 391–410. http://sekhon.berkeley.edu/multinom.pdf
For additional documentation please visit http://sekhon.berkeley.edu/robust/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # make some multinomial data
x1 <- rnorm(50);
x2 <- rnorm(50);
p1 <- exp(x1)/(1+exp(x1)+exp(x2));
p2 <- exp(x2)/(1+exp(x1)+exp(x2));
p3 <- 1 - (p1 + p2);
y <- matrix(0, 50, 3);
for (i in 1:50) {
y[i,] <- rmultinomial(1000, c(p1[i], p2[i], p3[i]));
}
# perturb the first 5 observations
y[1:5,c(1,2,3)] <- y[1:5,c(3,1,2)];
y1 <- y[,1];
y2 <- y[,2];
y3 <- y[,3];
# put data into a dataframe
dtf <- data.frame(x1, x2, y1, y2, y3);
#Do MLE estimation. The following model is NOT identified if we
#try to estimate the overdispersed MNL.
dtf <- data.frame(y1=c(1,1),y2=c(2,1),y3=c(1,2),x=c(0,1))
summary(multinomRob(list(y1 ~ 0, y2 ~ x, y3 ~ x), data=dtf, MLEonly=TRUE))
|
Loading required package: rgenoud
## rgenoud (Version 5.8-2.0, Build Date: 2018-04-03)
## See http://sekhon.berkeley.edu/rgenoud for additional documentation.
## Please cite software as:
## Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
## ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
## Journal of Statistical Software, 42(11): 1-26.
##
Loading required package: MASS
Loading required package: mvtnorm
##
## multinomRob (Version 1.8-6.1, Build Date: 2013/02/15)
## See http://sekhon.berkeley.edu/robust for additional documentation.
## Please cite as: Walter R. Mebane, Jr. and Jasjeet S. Sekhon. "Robust Estimation
## and Outlier Detection for Overdispersed Multinomial Models of Count Data".
## American Journal of Political Science, 48 (April): 391-410. 2004.
##
Choice 1 : y1 Estimates and SE:
Est SE.Sand t.val.Sand
NA 0 0 NaN
NA 0 0 NaN
Choice 2 : y2 Estimates and SE:
Est SE.Sand t.val.Sand
(Intercept) 0.693 1.22 0.566
x -0.693 1.87 -0.371
Choice 3 : y3 Estimates and SE:
Est SE.Sand t.val.Sand
(Intercept) 2.60e-16 1.41 1.84e-16
x 6.93e-01 1.87 3.71e-01
Residual Deviance: 16.63553
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.