代码拉取完成,页面将自动刷新
{smcl}
{* *! version 1.0.0 3sept2014}{...}
{marker topic}
{helpb nw_topical##manipulation:[NW-2.5] Manipulation}
{title:Title}
{p2colset 9 22 22 2}{...}
{p2col :nwreplacemat {hline 2} Replace network with Stata or Mata matrix}
{p2colreset}{...}
{title:Syntax}
{p 8 17 2}
{cmdab: nwreplacemat}
[{it:{help netname}}]
{cmd:,}
{opt newmat}({it:matname})
[{opt nosync}]
{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{synopt:{opt newmat}({it:matname})}name of a Stata or Mata matrix{p_end}
{synopt:{opt nosync}}do not sync Stata variables; by default Stata variables are synced (see {help nwsync}){p_end}
{title:Description}
{pstd}
{cmd:nwreplacemat} changes a network by replacing the adjacency matrix of the network with an existing Mata matrix.
{pstd}
The command checks if the Stata/Mata matrix {it:matname} has the correct dimensions.
{pstd}
By default, the command also checks if the new adjacency matrix is symmetric and if yes, it alters the
meta-information of the network (directed => undirected). In case, one still wants to assign
a perfectly symmetric matrix to a directed network, one can use:
{pmore}
{cmd:nwname} [{it:{help netname}}]{cmd:, directed(true)}
{pstd}
to overwrite the automatic setting afterwards.
{title:Examples}
{pstd}
This example generates a ring lattice first ({it:mynet}), but then replaces the adjacency matrix of this
network with a new Mata matrix {bf:J(5,5,99)}.
{com}. nwring 5, k(1), name(mynet)
{com}. mata: net = J(5,5,99)
{com}. nwreplacemat mynet, newmat(net)
{com}. nwsummarize mynet, matonly
1 2 3 4 5
{c TLC}{hline 25}{c TRC}
1 {c |} {res}0 {txt} {c |}
2 {c |} {res}99 0 {txt} {c |}
3 {c |} {res}99 99 0 {txt} {c |}
4 {c |} {res}99 99 99 0 {txt} {c |}
5 {c |} {res}99 99 99 99 0{txt} {c |}
{c BLC}{hline 25}{c BRC}
{title:See also}
{help nwreplace}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。