📄 nlogit.hlp
字号:
{smcl}
{* *! version 1.0.0 16jun2005}{...}
{cmd:help nlogit}, {cmd:help nlogitgen},{right:dialogs: {bf:{dialog nlogit}} {bf:{dialog nlogitgen}} {bf:{dialog nlogittree}}}
{cmd:help nlogittree}{right:also see: {help nlogit postestimation}{space 8}}
{hline}
{title:Title}
{p2colset 5 19 21 2}{...}
{p2col :{hi:[R] nlogit} {hline 2}}Nested logit regression{p_end}
{p2colreset}{...}
{title:Syntax}
{phang}
Nested logit regression
{p 8 15 2}
{cmd:nlogit} {it:{help nlogit##description:depvar}} {cmd:(}{it:{help nlogit##description:altsetvarB}} {cmd:=}
{it:{help nlogit##description:indepvarsB}}{cmd:)} [{it:...} {cmd:(}{it:altsetvar2} {cmd:=}
{it:indepvars2}{cmd:)} {cmd:(}{it:altsetvar1} {cmd:=}
{it:indepvars1}{cmd:)}] {ifin} {weight}
{cmd:,} {opt gr:oup(varname)} [{it:{help nlogit##options:options}}]
{phang}
Create variable based on specification of branches
{p 8 18 2}
{cmd:nlogitgen} {newvar} {cmd:=} {varname}
{cmd:(}{it:{help nlogit##branchlist:branchlist}}{cmd:)} [{cmd:,} {opt nolo:g}]
{phang}
Display tree structure
{p 8 19 2}
{cmd:nlogittree} {varlist} [{cmd:,} {opt nolab:el}]
{synoptset 28 tabbed}{...}
{marker options}{...}
{synopthdr}
{synoptline}
{syntab :Model}
{p2coldent :* {opth gr:oup(varname)}}group ID variable{p_end}
{synopt :{opt ivc:onstraints(string)}}apply specified linear constraints of the inclusive-value parameters{p_end}
{synopt :{cmdab:const:raints(}{it:{help estimation options##constraints():constraints}}{cmd:)}}apply specified linear constraints{p_end}
{syntab :SE/Robust}
{synopt :{opth vce(vcetype)}}{it:vcetype} may be {opt oim} or {opt opg}{p_end}
{synopt :{opt r:obust}}synonym for {cmd:vce(robust)}{p_end}
{syntab :Reporting}
{synopt :{opt l:evel(#)}}set confidence level; default is {cmd:level(95)}{p_end}
{synopt :{opt notr:ee}}suppress display of tree-structure output{p_end}
{synopt :{opt nolab:el}}suppress value labels in tree-structure output{p_end}
{synopt :{opt clo:git}}report clogit estimates{p_end}
{syntab :Max options}
{synopt :{it:{help nlogit##maximize_options:maximize_options}}}control the maximization process; seldom used{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}* {opt group(varname)} is required.{p_end}
{p 4 6 2}{cmd:bootstrap}, {cmd:by}, {cmd:jackknife}, {cmd:rolling},
{cmd:statsby}, and {cmd:xi} are allowed; see {help prefix}.{p_end}
{p 4 6 2}{cmd:fweight}s and {cmd:iweight}s are allowed but
are interpreted to apply to groups as a whole and not to individual
observations; see {help weight}.{p_end}
{p 4 6 2}See {help nlogit postestimation} for features available after estimation.
{phang}{marker description}
where
{p 12 23 2}{it:depvar} {space 3} is a dichotomous variable coded as 0 for
unselected alternatives and 1 for the selected alternative.{p_end}
{p 12 23 2}{it:altsetvarB} is a categorical variable that identifies the
bottom, or final, set of all alternatives.{p_end}
{p 12 23 2}{it:indepvarsB} are the attributes of the bottom-level
alternatives (absolute or perceived) and possibly interactions of individual
attributes with the bottom-level alternatives.{p_end}
{p 12 23 2}{it:altsetvar2} is a categorical variable that identifies the
second-level set of alternatives{hline 2}these must be mutually exclusive groups of the third-level alternatives.{p_end}
{p 12 23 2}{it:indepvars2} are the attributes of the second-level
alternatives (absolute or perceived) and possibly interactions of individual
attributes with the second-level alternatives.{p_end}
{p 12 23 2}{it:altsetvar1} is a categorical variable that identifies the
top- or first-level set of alternatives{hline 2}these alternatives must be mutually exclusive groups of the second-level alternatives.{p_end}
{p 12 23 2}{it:indepvars1} are the attributes of the first-level
alternatives{hline 2}either of an alternative alone (absolute) or as the
alternative is perceived by the chooser (perceived){hline 2}and possibly
interactions of individual attributes with the first-level alternatives.
{phang}{marker branchlist}
where {it:branchlist} is{p_end}
{p 12 12 2}{it:branch}{cmd:,} {it:branch} [{cmd:,} {it:branch ...}]
{phang}
{it:branch} is{p_end}
{p 12 12 2}[{it:label}{cmd::}] {it:outcome} [{cmd:|} {it:outcome}
[{cmd:|} {it:outcome ...}] ]
{phang}
and {it:outcome} is either a numerical value of the variable specified as
{it:varname} or the value label associated with that numerical value. For
instance,
{p 12 16 2}{cmd}. nlogitgen type = restaurant({bind:fast: 1 | 2,}
{bind:family: 3 | 4 | 5,} {bind:fancy: 6 | 7)}{txt}
{title:Description}
{pstd}
{cmd:nlogit} fits a nested logit model using full maximum likelihood.
The model may contain one or more levels. For a single-level model,
{cmd:nlogit} fits the same model as {helpb clogit}.
{pstd}
{cmd:nlogitgen} generates a new categorical variable based on the
specification of the branches. For instance,
{phang2}{cmd}. nlogitgen type = restaurant({bind:fast: 1 | 2,}
{bind:family: 3 | 4 | 5,} {bind:fancy: 6 | 7)}{txt}
{pstd}
is equivalent to
{phang2}{cmd:. gen type = 1 if restaurant == 1 | restaurant == 2}{p_end}
{phang2}{cmd:. replace type = 2 if restaurant == 3 | restaurant == 4 | restaurant== 5}{p_end}
{phang2}{cmd:. replace type = 3 if restaurant == 6 | restaurant == 7}{p_end}
{phang2}{cmd:. label define lb_type 1 fast 2 family 3 fancy}{p_end}
{phang2}{cmd:. label value type lb_type}{p_end}
{pstd}
{cmd:nlogittree} displays the tree structure based on the {varlist}.
Note that the bottom level should be specified first. For instance,
{phang2}{cmd:. nlogittree restaurant type}
{title:Options}
{dlgtab:Model}
{phang}
{opth group(varname)} is required; it specifies the identifier variable for the
groups.
{phang}
{opt ivconstraints(string)} specifies the linear constraints of the inclusive-value
parameters. You can constrain inclusive-value parameters to be equal to
each other, equal to fixed values, etc. Inclusive-value parameters are
referred to by the corresponding level labels; for instance,
{cmd:ivconstraints(fast = family)} or {cmd:ivconstraints(fast=1)}.
{phang}
{opt constraints(constraints)}; see {help estimation options}.
{dlgtab:SE/Robust}
{phang}
{opt vce(vcetype)}; see {it:{help vce_option}}.
{phang}
{opt robust}; see {help estimation options}. This option is not allowed when
the model contains more than three levels.
{dlgtab:Reporting}
{phang}
{opt level(#)}; see {help estimation options}.
{phang}
{opt notree} specifies that the tree structure of the nested logit
model not be displayed.
{phang}
{opt nolabel} causes the numeric codes rather than the label values to
be displayed in the tree structure of the nested logit model.
{phang}
{opt clogit} specifies that the initial values obtained from
{opt clogit} be displayed.
{marker maximize_options}{...}
{dlgtab:Max options}
{phang}
{it:maximize_options}: {opt dif:ficult}, {opt tech:nique(algorithm_spec)},
{opt iter:ate(#)}, [{cmdab:no:}]{opt lo:g}, {opt tr:ace},
{opt grad:ient}, {opt showstep}, {opt shownr:tolerance},
{opt hess:ian}, {opt tol:erance(#)}, {opt ltol:erance(#)},
{opt gtol:erance(#)}, {opt nrtol:erance(#)}, {opt nonrtol:erance}, control the
maximization process; see {help maximize}. These options are seldom used.
{title:Saved results}
{pstd}
In addition to what is documented in the manual, {cmd:nlogit} also saves in
{hi:e()}:
{synoptset 15 tabbed}{...}
{syntab:Scalars}
{synopt:{hi:e(alt_min)}}minimum number of alternatives per group{p_end}
{synopt:{hi:e(alt_max)}}maximum number of alternatives per group{p_end}
{synopt:{hi:e(alt_avg)}}average number of alternatives per group{p_end}
{title:Examples}
{pstd}
Generate a new categorical variable named "{hi:type}" that identifies the
first-level set of alternatives based on the variable named "{hi:restaurant}".
{phang2}{cmd:. nlogitgen type = restaurant(fast: Freebirds | MamasPizza, family: CafeEccell | LosNortenos | WingsNmore, fancy: Christophers | MadCows)}
{pstd}
The tree structure implied by these two variables can be examined using
{cmd:nlogittree}.
{phang2}{cmd:. nlogittree restaurant type}
{pstd}
Fit the nested logit model.
{phang2}{cmd:. nlogit chosen (restaurant = cost rating distance) (type = incFast incFancy kidFast kidFancy), group(family_id)}
{phang2}{cmd:. nlogit chosen (restaurant = cost rating distance) (type = incFast incFancy kidFast kidFancy), group(family_id) ivc(fast=1, family=1, fancy=1)}
{title:Also see}
{psee}
Manual: {bf:[R] nlogit}
{psee}
Online: {help nlogit postestimation};{break}
{helpb clogit}, {helpb constraint},
{helpb mlogit}, {helpb ologit}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -