Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: glm
See also: glmbilo genmultlo

Macro: glmmultlo
Description: glmmultlo fits a multinomial/conditional logit model where the response Y is multinomial distributed. This means, P( Y = j | Xa , Xi) is proportional to exp( Xa * ba + Xi * bi[j] ). Here, Xi denotes that part of the explanatory variables which merely depends on the individuals and Xa covers variables which may vary with the alternatives j. Either part, Xa or Xi, can be omitted.

Link:
Usage: myfit = glmmultlo(x,y{,opt})
Input:
x n x r matrix, the predictor variables. Individual-specific variables form single columns of x. Alternative-specific variables must be evaluated for each alternative and are to be stored in blocks of m subsequent columns. The optional parameters opt.indiv and opt.alter define which columns belong to which group. Without these optional parameters, all columns of x are interpreted as individual-specific.
y n x 1 vector or n x m matrix. If y is vector (numeric or string), the different realizations are considered to be the alternatives. If y is matrix, it should contain 0/1 dummies, with 1 in the j-th column indicating that alternative j (in 1 ... m) has been chosen.
opt optional, a list with optional input. The macro "glmopt" can be used to set up this parameter. The order of the list elements is not important. Parameters which are not given are replaced by defaults (see below).
opt.shf integer, if exists and =1, some output is produced which indicates how the iteration is going on.
opt.miter integer, maximal number of iterations. The default is 10.
opt.cnv scalar, convergence criterion. The default is 0.0001.
opt.indiv indices of columns of x (=variables) which are individual-specific, i.e. which are constant over alternatives. If neither opt.indiv and opt.alter are given, the model is estimated as if opt.indiv=1:r. Otherwise, the default is empty.
opt.alter indices of columns of x (=variables) which are alternative-specific, i.e. which vary over the alternatives (and eventually individuals). x[,opt.alter] should have a multiple of m columns, i.e. contain subsequent realizations for each of the alternatives. The default is empty.
Output:
myfit list with the components b, bv, and stat:
b.indiv p x m vector, estimated coefficients corresponding to individual-specific variables. The first column is zero.
b.alter q x 1 vector, estimated coefficients corresponding to alternative-specific variables.
bv.indiv (p*m) x (p*m) matrix, estimated covariance for b.indiv, matrix of p x p blocks.
bv.alter q x q matrix, estimated covariance for b.alter.
bv.mixed (p*m) x q matrix, estimated mixed covariances between b.alter and b.indiv, vector of p x q blocks.
mu n x m vector, estimated response mu=P(y=j) corresponding to alternatives 1 ... m of y.
stat list with the following statistics:
stat.serror standard errors, list containing components indiv and/or alter, respectively.
stat.tvalues t-values, list containing components indiv and/or alter, respectively.
stat.pvalues p-values, list containing components indiv and/or alter, respectively.
stat.deviance deviance,
stat.loglik log-likelihood,
stat.r2 (pseudo) R^2.
stat.adr2 adjusted (pseudo) R^2.
stat.it scalar, number of iterations needed
stat.ret scalar, return code: 0 o.k., 1 maximal number of iterations reached, -1 missing values have been encountered.

Example:
library("glm") 
n = 100
b = list((0|0)~(1|2)~(-1|0)~(1|1),2)
m = cols(b{1})
id=diag(matrix(m))
x=normal(n,2)~kron(id,matrix(n/m))
{y,mu}  = genmultlo(x,b) 
;
opt=glmopt("indiv",1:2,"alter",3:6)
ml = glmmultlo(x,y,opt)
ml.b
ml.stat
Result:
Multinomial logit data are generated. The first
two columns of the design 'x' correspond to 
individual-specific influences, the other four
columns are alternative-specific.
Then, a multinomial logit fit is computed. 
The optional parameter 'opt' comprises the 
information how to split the design.
'ml.b' gives the coefficients, 'ml.stat' some
statistics of the fit.

Library: glm
See also: glmbilo genmultlo

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Author: Marlene Mueller, 970523
(C) MD*TECH Method and Data Technologies, 28.6.1999