cluster_programming.hlp
来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 383 行 · 第 1/2 页
HLP
383 行
{smcl}
{* 06apr2005}{...}
{cmd:help cluster programming}
{hline}
{title:Title}
{p2colset 5 43 45 2}{...}
{p2col :{hi:[MV] cluster programming utilities} {hline 2}}Cluster-analysis
programming utilities{p_end}
{p2colreset}{...}
{title:Syntax}
INCLUDE help cluster_programming_syntax.ihlp
{title:Description}
{p 4 4 2}
The {bind:{cmd:cluster query}}, {bind:{cmd:cluster set}},
{bind:{cmd:cluster delete}}, {bind:{cmd:cluster parsedistance}}, and
{bind:{cmd:cluster measures}} commands provide tools for programmers to add
their own cluster-analysis subroutines to Stata's {cmd:cluster} command; see
{helpb cluster}. These commands make it possible for the new command to
take advantage of Stata's cluster management facilities.
{p 4 4 2}
{cmd:cluster query} provides a way to obtain the various attributes of a
cluster analysis in Stata. If {it:clname} is omitted, {cmd:cluster query}
returns in {hi:r(names)} a list of the names of all currently defined cluster
analyses. If {it:clname} is provided, then the various attributes of the
specified cluster analyses are returned in {hi:r()}. These attributes include
the type, method, (dis)similarity used, created variable names, notes, and
any other information attached to the cluster analysis.
{p 4 4 2}
{cmd:cluster set} allows you to set the various attributes that define a
cluster analysis in Stata. This includes giving a name to your cluster
results and adding that name to the master list of currently defined cluster
results. With {cmd:cluster set}, you can provide information on the type,
method, and (dis)similarity measure of your cluster-analysis results. You can
associate variables and Stata characteristics (see {helpb char}) with your
cluster analysis. {cmd:cluster set} also allows you to add notes and other
specified fields to your cluster analysis result. These items become part
of the dataset and are saved with the data.
{p 4 4 2}
{cmd:cluster delete} allows you to delete attributes from a cluster
analysis in Stata. This command is the inverse of {bind:{cmd:cluster set}}.
{p 4 4 2}
{cmd:cluster parsedistance} takes the similarity or dissimilarity
{it:measure} name and checks it against the list of those provided within
Stata, taking account of allowed minimal abbreviations and aliases. Aliases
are resolved (for instance, {cmd:Euclidean} is changed into the equivalent
{cmd:L2}).
{p 4 4 2}
{cmd:cluster measures} computes the similarity or dissimilarity {it:measure}
between the observations listed in the {cmd:compare()} option and the
observations included based on the {cmd:if} and {cmd:in} conditions and places
the results in the variables specified by the {cmd:generate()} option. See
{helpb matrix dissimilarity} for the {cmd:matrix dissimilarity} command
that places (dis)similarities in a matrix.
{p 4 4 2}
Stata also provides a method for programmers to extend the {cmd:cluster}
command by providing subcommands. This is discussed in the {hi:Remarks}
section below.
{title:Options for {cmd:cluster set}}
{phang}
{cmd:addname} adds {it:clname} to the master list of currently defined
cluster analyses. When {it:clname} is not specified the {cmd:addname} option
is mandatory, and in this case, {bind:{cmd:cluster set}} automatically finds a
cluster name that is not currently in use and uses this as the cluster name.
{bind:{cmd:cluster set}} returns the name of the cluster in {hi:r(name)}. If
{cmd:addname} is not specified, the {it:clname} must have been
added to the master list previously (for instance, through a previous call to
{bind:{cmd:cluster set}}).
{phang}
{cmd:type(}{it:type}{cmd:)} sets the cluster type for {it:clname}.
{cmd:type(hierarchical)} indicates that the cluster analysis
is some kind of hierarchical-style clustering, and {cmd:type(partition)}
indicates that it is a partition-style of clustering. You are not
restricted to these types. For instance, you might program some
kind of fuzzy partition-clustering analysis, so you, in that case, use
{cmd:type(fuzzy)}.
{phang}
{cmd:method(}{it:method}{cmd:)} sets the name of the clustering method
for the cluster analysis. For instance, Stata uses {cmd:method(kmeans)} to
indicate a kmeans cluster analysis, and uses {cmd:method(single)} to indicate
single-linkage cluster analysis. You are not restricted to the names
currently employed within Stata.
{phang}
{cmd:dissimilarity(}{it:measure}{cmd:)} and
{cmd:similarity(}{it:measure}{cmd:)} set the name of the dissimilarity or
similarity measure used for the cluster analysis. For example, Stata uses
{cmd:dissimilarity(L2)} to indicate the L2 or Euclidean distance. You are not
restricted to the names currently employed within Stata. See
{it:{help measure_option}} for discussion of the
(dis)similarity measures provided by Stata. See {helpb parse_dissim}
for a programmer's command for parsing (dis)similarity names.
{phang}
{cmd:var(}{it:tag varname}{cmd:)} sets a marker called {it:tag} in the
cluster analysis that points to the variable {it:varname}. For instance,
Stata uses {bind:{cmd:var(group} {it:varname}{cmd:)}} to set a grouping
variable from a kmeans cluster analysis. With single-linkage clustering,
Stata uses {bind:{cmd:var(id} {it:idvarname}{cmd:)}},
{bind:{cmd:var(order} {it:ordervarname}{cmd:)}}, and
{bind:{cmd:var(height} {it:hgtvarname}{cmd:)}} to set the id, order, and
height variables that define the cluster-analysis result. You are not
restricted to the names currently employed within Stata. Up to ten
{cmd:var()} options may be specified with a single {bind:{cmd:cluster set}}
command.
{phang}
{cmd:char(}{it:tag charname}{cmd:)} sets a marker called {it:tag} in
the cluster analysis that points to the Stata characteristic named
{it:charname}; see {helpb char}. This can be either an {hi:_dta[]} dataset
characteristic or a variable characteristic. Up to ten {cmd:char()} options
may be specified with a single {bind:{cmd:cluster set}} command.
{phang}
{cmd:other(}{it:tag text}{cmd:)} sets a marker called {it:tag} in
the cluster analysis with {it:text} attached to the {it:tag} marker. Stata
uses {bind:{cmd:other(k} {it:#}{cmd:)}} to indicate that {hi:k} (the number
of groups) was {it:#} in a kmeans cluster analysis. You are not restricted
to the names currently employed within Stata. Up to ten {cmd:other()}
options may be specified with a single {bind:{cmd:cluster set}} command.
{phang}
{cmd:note(}{it:text}{cmd:)} adds a note to the {it:clname} cluster
analysis. The {bind:{cmd:cluster notes}} command (see
{helpb cluster notes})
is the command for users to add, delete, or view cluster notes. The
{bind:{cmd:cluster notes}} command uses the {cmd:note()} option of
{bind:{cmd:cluster set}} to actually add a note to a cluster analysis.
Up to ten {cmd:note()} options may be specified with a single
{bind:{cmd:cluster set}} command.
{title:Options for {cmd:cluster delete}}
{phang}
{cmd:zap} deletes everything possible for cluster analysis {it:clname}.
It is the same as specifying the {cmd:delname}, {cmd:type}, {cmd:method},
{cmd:dissimilarity}, {cmd:similarity}, {cmd:allnotes}, {cmd:allcharzap},
{cmd:allothers}, and {cmd:allvarzap} options.
{phang}
{cmd:delname} removes {it:clname} from the master list of current
cluster analyses. This option does not touch the various pieces
that make up the cluster analysis. To remove them, use the other options of
{bind:{cmd:cluster delete}}.
{phang}
{cmd:type} deletes the cluster type entry from {it:clname}.
{phang}
{cmd:method} deletes the cluster method entry from {it:clname}.
{phang}
{cmd:dissimilarity} and {cmd:similarity} delete the dissimilarity and
similarity entries, respectively, from {it:clname}.
{phang}
{cmd:notes(}{it:numlist}{cmd:)} deletes the specified numbered notes
from {it:clname}. The numbering corresponds to the returned results from the
{bind:{cmd:cluster query} {it:clname}} command. The
{bind:{cmd:cluster notes drop}} command (see {helpb cluster notes}) is the
command for users to drop a cluster note. It, in turn, calls
{bind:{cmd:cluster delete}} using the {cmd:notes()} option to drop the notes.
{phang}
{cmd:allnotes} removes all notes from the {it:clname} cluster analysis.
{phang}
{cmd:var(}{it:tag}{cmd:)} removes from {it:clname} the entry labeled
{it:tag} that points to a variable. This option does not delete the variable.
{phang}
{cmd:allvars} removes all the entries pointing to variables for
{it:clname}. This option does not delete the corresponding variables.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?