mnl.spec(f, data, choices = NULL, base.choice = 1,
varying = NULL, sep = ".")reshape function), i.e. there is one record for each individual and alternatichoices.data that are alternative-specific.mnl.spec containing the following elements:choices.variable.used. It contains names of variables in its alternative-specific form.varying vector that are used in the specification.choices vector computed from the data.f is of the form response ~ x1 + x2 | y1 + y2. Coefficients for variables in the first part of the formula (i.e. before '|'), here x1 and x2, are forced to be the same for all alternatives. Variables in the second part of the formula (i.e. after '|'), here y1 and y2, have different coefficients for different alternatives. Either part of the formula can be omitted. Alternative specific constants (asc) are included automatically. To exclude asc, use -1 in the first part. The equation of the base alternative is always set to 0.summary.mnl.specdata(heating)
spec <- mnl.spec(depvar ~ ic + oc + income, heating, varying=3:12, sep='')
summary(spec)
spec <- mnl.spec(depvar ~ oc-1 | ic, heating, varying=3:12, sep='')
summary(spec)Run the code above in your browser using DataLab