代码拉取完成,页面将自动刷新
{smcl}
{* *! version 1.0.1 3sept2014 author: Thomas Grund}{...}
{marker topic}
{helpb nw_topical##manipulation:[NW-2.5] Manipulation}
{title:Title}
{p2colset 9 19 22 2}{...}
{p2col :nw2project {hline 2} Make one-mode projection}
{p2colreset}{...}
{title:Syntax}
{p 8 17 2}
{cmdab: nw2project}
[{it:{help netname}}]
[{cmd:,}
{opth name(newnetname)}
{opt level}({it:{help nw2fromedge##project_level:project_level}})
{opt stat}({it:{help nw2fromedge##project_stat:project_stat}})
]
{synoptset 30 tabbed}{...}
{synopthdr}
{synoptline}
{synopt:{opth name(newnetname)}}name of the new network projection{p_end}
{synopt:{opt level}({it:{help nw2fromedge##project_level:project_level}})}make one-mode projection to either level {bf:1} or level {bf:2} {p_end}
{synopt:{opt stat}({it:{help nw2fromedge##project_stat:project_stat}})}logic for dealing with tie values in one-mode projection{p_end}
{p2colreset}{...}
{title:Description}
{pstd}
{cmd:nw2project} makes a one-mode projection of a two-mode network. See also {help nw2fromedge} and {help nw2set}.
{pstd}
A two-mode network consists of two sets of units (e. g. people and events) and relations connect the two sets, e. g. participation
of people in social events. Some examples are:
{pmore}
- Membership in institutions - people, institutions, is a member, e.g. directors and commissioners on the boards of corporations.
{pmore}
- Voting for suggestions - polititians, suggestions, votes for.
{pmore}
- Citation network, where first set consists of authors,
the second set consists of articles/papers,
connection is a relation author cites a paper.
{pmore}
- Co-autorship networks - authors, papers, is a (co)author.
A corresponding graph is called bipartite graph – lines
connect only vertices from one to vertices from another set –
inside sets there are no connections.
{marker edgelist}{...}
{pstd}
An edgelist is a set of two (or three in the case of a valued network) variables representing
relations. Nodes are identified by entries in the cells. For example, the data
{com}. use "http://nwcommands.org/data/institutions.dta", clear
{com}. list _all
{txt}
{c TLC}{hline 10}{c -}{hline 11}{c -}{hline 7}{c TRC}
{c |} {res} person institu~n years {txt}{c |}
{c LT}{hline 10}{c -}{hline 11}{c -}{hline 7}{c RT}
1. {c |} {res} Thomas Oxford 5 {txt}{c |}
2. {c |} {res} Peter Oxford 7 {txt}{c |}
3. {c |} {res} Tim Oxford 4 {txt}{c |}
4. {c |} {res} Peter LiU 1 {txt}{c |}
5. {c |} {res} Tim LiU 1 {txt}{c |}
{c LT}{hline 10}{c -}{hline 11}{c -}{hline 7}{c RT}
6. {c |} {res} Thomas LiU 1 {txt}{c |}
7. {c |} {res}Mathilde UdeM 5 {txt}{c |}
8. {c |} {res} Thomas UdeM 1 {txt}{c |}
9. {c |} {res} Michael ETH 3 {txt}{c |}
10. {c |} {res} Michael Groningen 5 {txt}{c |}
{c LT}{hline 10}{c -}{hline 11}{c -}{hline 7}{c RT}
11. {c |} {res} Thomas ETH 1 {txt}{c |}
{c BLC}{hline 10}{c -}{hline 11}{c -}{hline 7}{c BRC}
{pstd}
stores information about the affiliation of individual researchers.
{pstd}
The following command declares such data as two-mode network data:
{cmd:. nw2fromedge person institution, name(mynet)}
{pstd}
Essentially, this does exactly the same as {help nwfromedge}, but also generates a variable {it:_modeid}, which has the value 1 for persons (Peter, Tim,
Thomas, Michael, Mathilde) and value 2 for institutions (LiU, UdeM, Oxford, ETH, Groningen).
{pstd}
For example, one can plot this two-mode network and color the two levels differently:
{cmd:. nwplot mynet, color(_modeid)}
{marker project_stat}{...}
{marker project_level}{...}
{title:One-mode projection}
{pstd}
Sometimes one wants to collapse a two-mode network to a one-mode network. This is called a one-mode projection. Such a projection is a simplification of the network to nodes
of one level only. For example, in our example one can either collapse to the level of persons or to the level of institutions. The level to which one wants to collapse is
specified in option {bf:level()}.
{pstd}
For example, this makes a one-mode projection on level 1 (persons):
{cmd: nw2project mynet, level(1)}
{pstd}
It generates a network with five unique actors (Peter, Tim, Thomas, Michael and Mathilde). By default, a one-mode projection
on one level generates ties between nodes (on this level) when they have at least one network neighbor on the
other level in common. In our case, projecting to the level of persons creates ties between persons when they share
at least one institution. By default, such a one-mode projection is a valued network, where the
tie values indicate how many institutions individuals share. To illustrate this,
let us consider the relationship between Peter and Thomas. In this example, they share
two institutions: Oxford and LiU.
{pmore}
Thomas - LiU
{pmore}
Peter - LiU
{pmore}
Thomas - Oxford
{pmore}
Peter - Oxford
{pstd}
A one-mode projection to the level of persons generates a tie between Thomas and Peter with value 2, because
they share two institutions. A one-mode projection to the level of institutions would generate a tie
with value 2 between the institutions Oxford and LiU, because they share two persons (Peter and Thomas).
{pstd}
When ties in the original network are valued there are several ways how the value of projected ties is generated. Option {opt stat()} can
be one of the following: {bf:min, max, minmax, sum, mean}. To illustrate what each one of them calculates tie values for
the projection, let us consider the relationship between Peter and Thomas. They share two institutions: Oxford and LiU.
{pmore}
Thomas - LiU - 1 year
{pmore}
Peter - LiU - 1 year
{pmore}
Thomas - Oxford - 5 years
{pmore}
Peter - Oxford - 7 years
{pstd}
The option {bf:stat(min)} takes the overall minimum from all these ties and generates the projection:
{pmore}
Peter - Thomas - 1 year
{pstd}
The option {bf:stat(max)} takes the overall maximum from all these ties and generates the projection:
{pmore}
Peter - Thomas - 7 years
{pstd}
The option {bf:stat(sum)} takes the sum over all these ties and generates the projection:
{pmore}
Peter - Thomas - 14 years
{pstd}
The option {bf:stat(mean)} takes the sum over all these ties and generates the projection:
{pmore}
Peter - Thomas - 3.5 years
{pstd}
The option {bf:stat(minmax)} takes for each institution Peter and Thomas share the minimum (Oxford = 5, LiU = 1) and
and takes the maximum out of these scores as tie value. Substantially, this corresponds to the
longest time that Peter and Thomas were at the same institution. This is the default option.
{pmore}
Peter - Thomas - 5 years
{pstd}
In contrast, the next command generates a one-mode projection on level 2 (institutions).
{cmd: nw2project mynet, project(2)}
{title:Also see}
{help nw2fromedge}, {help nw2set}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。