找回密码
 注册
查看: 4243|回复: 0

R语言 qgraph包 qgraph()函数中文帮助文档(中英文对照)

  [复制链接]
发表于 2012-9-24 21:31:08 | 显示全部楼层 |阅读模式
qgraph(qgraph)
qgraph()所属R语言包:qgraph

                                        qgraph
                                         qgraph

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

This is the main function of qgraph. It is typically used to visualize the relationship between several variables as a network. This function can be used to create various types of networks based on a number of input options. Please see the details section for more detail.
这是的主要功能qgraph。它通常是用于可视化的几个变量之间的关系作为一个网络。此功能可以用于创建基于输入选项上的数量的不同类型的网络。请参阅更详细的细节部分。


用法----------Usage----------


qgraph( input, ... )



参数----------Arguments----------

参数:input
Can be either a weights matrix or an edgelist. Can also be an object of class "sem" (sem), "mod" (sem), "lavaan" (lavaan), "principal" (psych), "loadings" (stats), "factanal" (stats), "graphNEL" (Rgraphviz) or "pcAlgo" (pcalg)
可以是一个权重矩阵或EdgeList都。也可以是一个对象类“扫描电镜(SEM),”国防部“(SEM),”lavaan“(lavaan),”校长“(心理),”负荷“(统计),”factanal的“ (STATS),“graphNEL”(Rgraphviz)或“pcAlgo”(pcalg)


参数:...
Any additional arguments described below. Also a list with class "qgraph" can be added that contains any of these arguments (this is returned invisibly by the function)
任何额外的参数说明如下。还可以添加一个列表,类“qgraph”,其中包含这些参数(这是返回的功能无形)


Details

详细信息----------Details----------

The qgraph function has a lot of arguments. Mostly the default values of these work well. Because of the amount of arguments the usage of the qgraph function has been reduced by using the ... method for clarity. This does mean that arguments need to be specified by using their exact name. For instance, to specify color="red" you can not use col="red".
qgraph功能有很多的参数。大多数情况下,这些工作的默认值。由于参数的量已经减少了使用的qgraph函数使用...为清楚起见,方法。这并不意味着需要指定的参数通过使用他们的确切名称。例如,指定颜色=“红色”,你可以不使用COL =“红色”。

Below is a complete list of all the arguments that can be used in qgraph and a detailed guide on how the function can be used.
下面是一个完整的列表,可用于在qgraph和一个详细的指南如何可以使用该函数的所有参数。


值----------Value----------

qgraph returns (invisibly) a 'qgraph' object that contains all the arguments used, with the exeption of the 'layout' argument which is set to the final layout used in the graph. This can then be sent to a new qgraph function to use the same arguments in the new plot.
qgraph收益(不可见),包含所有使用的参数的exeption的“布局”参数被设置为最后的布局图中的“qgraph对象。这可以被发送到一个新的qgraph功能使用相同的参数,在新的图。

One of the values returned is 'layout.orig', the original (not rescaled) layout, which needs to be used when using constraint layouts.
返回的值是“layout.orig,原来不重新调整布局,需要使用时要使用的约束布局。


重要的附加参数----------Important additional arguments----------




layout This argument controls the layout of the graph. "circular" gives a circular layout, "groups" gives a layout in which each group is put in a circle and "spring" gives a force embedded layout. It also can be a matrix with a row for each node and x and y coordinates in the first and second column respectively. Defaults to "circular" in weighted graphs without a groups list, "groups" in weighted graphs with a groups list, and "spring" in unweighted graphs.
布局参数控制图的布局。 “通知”给出了一个圆形的布局,“组”给出了一个布局,其中每个组都放了一圈,“春天里”给力嵌入式布局。它也可以是一个矩阵,其中每个节点对应的一行,且x和y坐标分别在第一和第二列。默认为“通知”加权图无组列表,加权图的组列表中的“组”,和“春天”在非加权图。




groups An object that indicates which nodes belong together. Can be a list in which each element is a vector of integers identifying the numbers of the nodes that belong together, or a factor.
组对象,指示哪些节点属于一起。可以是一个列表,其中每个元素是一个向量识别的节点属于一起的,或一个因素的数目的整数。




minimum Edges with absolute weights under this value are omitted. Defaults to 0 for graphs with less than 50 nodes or 0.1 for larger graphs.
绝对权重的最低边缘,根据这个值被忽略了。默认为0,小于50个节点或0.1更大的图形与图表。




maximum qgraph regards the highest of the maximum or highest absolute edge weight as the highest weight to scale the edge widths too. To compare several graphs, set this argument to a higher value than any edge weight in the graphs (typically 1 for correlations).
最大qgraph方面的最大或最高的绝对边的权重最高的权重缩放边缘宽度。比较几种图表,将该参数设置为较高的值在图中边的权重比任何(通常为1的相关性)。




cut In weighted graphs, this argument can be used to cut the scaling of edges in width and color saturation. Edges with absolute weights over this value will have the strongest color intensity and become wider the stronger they are, and edges with absolute weights under this value will have the smallest width and become vaguer the weaker the weight. If this is set to NULL, no cutoff is used and all edges vary in width and color. Defaults to NULL for graphs with less then 50 nodes and 0.3 to larger graphs.
切在加权图,这种说法,可以用来切割边缘的宽度和色彩饱和度的缩放比例。绝对重量超过这个值的边缘颜色强度最强,并成为更广泛的他们,绝对体重低于该值的边缘,将有最小宽度,并成为虚化较弱的重量。如果设置为NULL,没有截止,所有的边的宽度和颜色变化。小于50个节点和0.3较大的图形与图表的默认设置为NULL。




details Logical indicating if minimum, maximum and cutoff score should be printed under the graph. Defaults to FALSE.
细节逻辑指示是否应印在图表中最小,最大和截止得分。默认为false。


输出参数----------Output arguments----------




filetype A character containing the file type to save the output in. "R" and "x11" outputs in a new R window ("x11" is prefered for Rstudio), "pdf" creates a pdf file. "svg" creates a svg file (requires RSVGTipsDevice). "tex" creates LaTeX code for the graph (requires tikzDevice). 'jpg', 'tiff' and 'png' can also be used. If this is given any other string (e.g. filetype="") no device is opened. Defaults to 'R' if the current device is the NULL-device or no new device if there already is an open device.
文件格式包含的文件类型。“R”和“X11”的一个新的R输出窗口(“X11”是首选为Rstudio),将输出保存到一个字符,“PDF”创建PDF文件。 “SVG”创建一个SVG文件需要RSVGTipsDevice的。 “TEX”创建LaTeX代码的图形(需要tikzDevice)。 jpg文件,tiff的和png文件也可以被使用。如果这是其他任何字符串(例如,文件格式=“”)没有设备被打开。默认为R如果当前设备是NULL设备或没有新的设备,如果已经有一个开放的设备。




filename Name of the file without extension
文件名不带扩展名的文件名称




width Width of the plot, in inches
的图,以英寸为单位的宽度宽




height Height of the plot, in inches
高度的图的高度,以英寸为单位




standAlone Logical. If filetype="tex" this argument can be used to choose between making the output a standalone LaTeX file or only the codes to include the graph.
独立的逻辑。如果文件=“TEX”这种说法,可以被用来输出一个独立的的LaTeX文件或代码,包括图形之间进行选择。


图形参数----------Graphical arguments----------




color A vector with a color for each element in the groups list, or a color for each node. Defaults to "white" without groups list and rainbow(length(groups)) with a groups list.
颜色的向量组列表中的每个元素的颜色,或颜色为每个节点。默认组列表和组列表的彩虹(长度(集团))的“白色”没有。




legend Logical value indicating if a legend should be plotted. Defaults to TRUE if a groups object is supplied
传说中的逻辑值,该值指示是否应绘制一个传奇。如果一组对象提供缺省值是TRUE




legend.cex Scalar of the legend. defaults to 1
legend.cex标量的传奇。默认为1




GLratio Relative size of the graph compared to the layout. Defaults to 2.5
GLratio相比的相对大小的图形的布局。默认为2.5




vsize A value indicating the size of the nodes. Can also be a vector of length 2 (nodes are scaled to degree) or a size for each node. Defaults to: max((-1/72)*(nNodes)+5.35,1)
VSIZE值表示的节点的大小。也可以是一个矢量的长度为2(节点缩放度)或为每个节点的尺寸。默认为:MAX((-1/72)*(nNodes)+5.35,1)




esize Size of the largest edge (or what it would be if there was an edge with weight maximum). Defaults to: max((-1/72)*(nNodes)+5.35,1)
ESIZE最大的边缘(或会是什么感觉,如果有一个边缘与重量最大)的大小。默认为:MAX((-1/72)*(nNodes)+5.35,1)




labels If FALSE, no labels are plotted. If TRUE, order in weights matrix is used as labels. This can also be a vector with a label for each node. Defaults for graphs with less than 20 nodes to a 3 character abbreviation of the columnames and rownames if these are identical or else to TRUE. If a label contains an asterisk (e.g. "x1*") then the asterisk will be omitted and the label will be printed in symbol font (use this for Greek letters)
如果为FALSE的标签,没有标签被绘制。如果是TRUE,以便在权重矩阵作为标签。这也可以是与为每个节点一个标签的向量。图的默认值小于20个节点,3个字符缩写的columnames和行名,如果这些是相同的,否则为TRUE。如果标签中包含一个星号(如“×*”),则星号将被省略,将被印在标签符号字体(使用希腊字母)




edge.labels If FALSE, no edge labels are plotted. If TRUE, numerical edge weights are printed on the edges. This can also be a vector with a label for each edge. Defaults to FALSE. If a label contains an asterisk (e.g. "y1*") then the asterisk will be omitted and the label will be printed in symbol font (use this for Greek letters)
edge.labels如果为FALSE,没有边缘绘制标签。如果是TRUE,数值边的权重打印的边缘。这也可以是一个向量,其每个边缘的标签。默认为false。如果标签中包含一个星号(例如“Y1”),然后星号会被忽略的标签将被印在符号字体(使用希腊字母)




edge.label.cex Either a single number or a number per edge used as a scalar of the edge label size. Defaults to 1.
edge.label.cex无论是单一的数或每边一个数字用于对边标签大小作为一个标量。默认为1。




bg If this is TRUE, a background is plotted in which node colors cast a light of that color on a black background. Can also be a character containing the color of the background Defaults to FALSE
bg如果这是真的,背景绘制节点的颜色在黑色背景上投下的光,色。也可以是一个字符的背景色默认值FALSE




bgcontrol The higher this is, the less light each node gives if bg=TRUE. Defaults to 6.
bgcontrol此值越高,光线就越少,每个节点提供,如果BG = TRUE。默认为6。




bgres square root of the number of pixels used in bg=TRUE, defaults to 100.
bgres用于血糖= TRUE,默认为100的像素的数量的平方根。




transparency In weighted graphs: logical indicating if the edges should fade to white (FALSE) or become more transparent (TRUE; use this only if you use a background). In directed graphs this is a value between 0 and 1 indicating the level of transparancy.
透明度在加权图:逻辑边缘应褪色成白色(FALSE)或变得更加透明(TRUE;使用,如果你使用的背景)。在有向图中,这是一个介于0和1之间的值,表示透明度水平。




lcolor Character containing the color of the labels, defaults to "black"
lcolor字符的标签,默认的颜色为“黑色”




diag Should the diagonal also be plotted as edges? defaults to FALSE. Can also be "col" to plot diagonal values as vertex colors.
诊断的对角线也被绘制成边缘?默认为false。也可以是“中国网络”绘制顶点颜色的对角线值。




loop If diag=T, this can be used to scale the size of the loop. defaults to 1.
如果diag = T循环,这可以被用于缩放的大小的循环。默认为1。




lty Line type, see 'par'
LTY线路类型,请参阅“看齐”




pty See 'par'
PTY“看齐”




borders Logical indicating if borders should be plotted, defaults to TRUE.
边界的逻辑是否应绘制边界,默认为true。




shape A character containing the shape of the nodes. "circle", "square", "triangle" and "diamond" are supported. Can also be a vector with a shape for each node. Defaults to "circle".
A型性格的形状节点。 “圆”,“广场”,“三角”和“钻石”的支持。与为每个节点的形状,也可以是一个矢量。默认为“圆”。




label.scale Logical indicating if labels should be scaled to fit the node. Defaults to TRUE.
label.scale逻辑表示,如果标签应进行调整以适合的节点。默认为true。




gray Logical, set to TRUE to plot the graph in grayscale colors
灰色的逻辑,设置为TRUE来绘制图形的灰度颜色




tooltips A vector with tooltips for each node, only used when filetype='svg' or filetype='tex'
工具提示为每个节点的工具提示,只用一个向量,其文件格式=SVG或文件格式=TEX




vTrans Transparency of the nodes, must be an integer between 0 and 255, 255 indicating no transparancy. Defaults to 255
节点的VTRANS的透明度,必须是一个整数介于0和255,255表示没有transparancy。默认为255




overlay Logical, should a Venn-diagram like overlay be plotted? If TRUE then for each group a x% confidence region is plotted for the X and Y position, using ellipse
覆盖的逻辑,应该被绘制维恩图像覆盖吗?如果是TRUE,则各组斧头%置信区间绘制的X和Y位置,使用ellipse




overlaySize Specifies the size of the overlay ellipses. Corresponds to the confidence level (default is 0.5)
overlaySize指定叠加椭圆的大小。对应的置信水平(默认值是0.5)




rotation A vector that can be used to rotate the circles created with the circular layout. Must contain the rotation in radian for each group of nodes. Defaults to zero for each group.
旋转的向量,可用于旋转的圆与圆形布局创建。必须包含的每组节点的旋转弧度。各组默认为0。




layout.par A list of arguments passed to qgraph.layout.fruchtermanreingold when layout="spring"
layout.par的参数列表传递给qgraph.layout.fruchtermanreingold布局=“春天”




layout.control A scalar on the size of the circles created with the circular layout.
layout.control创建的圆的大小与圆形的布局上的标量。




aspect Should the original aspect ratio be maintained if rescale = TRUE? Defaults to FALSE. Set this to TRUE to keep the aspect ratio of the original layout (e.g. result from layout="spring"). Currently this only works correctly if the plotting area is square. This can be forced withh exporting the graph using 'height', 'width' and 'filetype' arguments.
如果重新调整= TRUE方面应该保持原始的宽高比?默认为false。设置为TRUE,以保持高宽比原来的布局(例如,从布局=“春天里”)。目前,这只是正常工作,如果是方形的绘图区。这可以强制withh导出的图形使用“高度”,“宽度”和“文件类型”参数。


对于有向图的其他参数----------Additional arguments for directed graphs----------




directed Logical indicating if edges are directed or not. Can be TRUE or FALSE to indicate if all edges are directed, a logical vector (when using edgelists) or a logical matrix (when using weights matrix)
边缘定向或不定向逻辑。可以为TRUE或FALSE表示,如果所有边缘都指向一个的逻辑向量(当使用edgelists)或逻辑矩阵(使用权重矩阵)




curve A value indicating how strongly edges should be curved. Defaults to 0 (no curve) for each edge except for edges in directional graphs between nodes that have two edges in between them. CURVING LINES DRASTICALLY INCREASES FILE SIZE!
曲线A值,表示强烈的边缘应弯曲。默认为0(没有曲线)除了定向图具有在它们之间的两个边缘节点之间的边缘的每个边缘。曲线上极大地增加文件的大小!




arrows A logical indicating if arrows should be drawn, or a number indicating how much arrows should be drawn on each edge. If this is TRUE, a simple arrow is plotted, if this is a number, arrows are put in the middle of the edges.
箭头A的逻辑指示箭头应绘制,或一个数字,表示每个边缘上绘制的箭头应如何。如果这是TRUE时,一个简单的箭头绘制,如果这是一个数字,箭头被放置在边缘的中间。




asize Scalar of the length of arrow heads, in inches. Defaults to 0.15.
asize箭头头部的长度,以英寸为单位的标量。默认值为0.15。




open Logical indicating if open (TRUE) or closed (FALSE) arrowheads should be drawn.
打开逻辑表示开(TRUE)或关闭(FALSE)箭头应制定。




bidirectional If this is TRUE, Then directional edges between nodes that have two edges between them are not curved. Defaults to FALSE. Can also be a logical vector (when using edgelists) or a logical matrix (when using weights matrix)
双向的,如果这是真的,然后定向,它们之间有两个边缘节点之间的边缘没有弯曲。默认为false。也可以是一个的逻辑向量(当使用edgelists)或一个逻辑矩阵(当使用权重矩阵)


参数图形的基础上显着性值----------Arguments for graphs based on significance values----------




mode This argument defines the mode used for coloring the edges. The default, "strength" assumes each edge weight indicates the strength of connection centered around  and makes positive edges green and negative edges red. If this is set to "sig" then the edge weights are assumed to be significance values and colored accordingly. This can also include negative values, which will be interpreted as p-values based on negative statitstics.
模式这个参数定义模式用于着色的边缘。默认情况下,“实力”假定每个边的权重表示围绕的连接强度,使正面边缘红色绿色上升沿和下降沿。如果设置为“信号”,然后边的权重都被假定为显着性值和彩色。这还可以包括负值,这将被解释为基于负statitstics的p-值。




alpha A vector of max 4 elements indicating the alpha level cutoffs. Defaults to c(0.0001,0.001,0.01,0.05)
字母表示α水平临界值最多4个元素的矢量。默认为C(0.0001,0.001,0.01,0.05)




OmitInsig Logical indicating if edge weights with a p-value over the highest alpha level should be omitted. Defaults to FALSE, can be used with any mode
OmitInsig逻辑边权重的P-α水平最高的价值超过应该被忽略。默认为false,可以使用任何模式




sigScale The function used to scale the edges if mode="sig". Defaults to $function(x)0.8*(1-x)^(log(0.4/0.8,1-0.05))$
sigScale使用的功能扩展的边缘,如果mode =“信号”。默认为$函数(x)0.8 *(1-x)^(log(0.4/0.8 ,1-0 .05))




bonf Logical indicating if a bonferonni correction should be applied if mode="sig". If so p-values are multiplied by the number of edges
bonf逻辑表明,如果一个bonferonni修正应适用模式=“信号”。如果是这样的边的数目的p值被乘以


相关矩阵的附加选项----------Additional options for Correlation Matrices----------




graph Type of graph to be made, for use with a correlation matrix as input. "association" will plot the matrix as is, "concentration" will first compute partial correlations between each pair of nodes (controlled for all other variables) and "factorial" will create a graph based on an exploratory factor analysis. Finally "sig" will transform all correlations in p-values (using the fdrtool package; Korbinian Strimmer, 2009) and force mode="sig". "sig2" will do the same but show p-values based on negative statistics in shades of orange
作出图类型的图形,用于与作为输入的相关矩阵。 “协会”将绘制的矩阵,“集中”将首先计算每一对节点(控制其他变量)和“因子”探索性因素分析的基础上创建一个图形部分之间的相互关系。最后,“SIG”将改变所有相关的p-值(使用fdrtool包,Korbinian Strimmer,2009年)和力模式“信号”。 “SIG2”将尽相同,但在色调的橙色的负面统计数字显示p值,


参数绘制分数的节点上----------Arguments for plotting scores on nodes----------




scores This argument can be used to plot scores of an individual on the test. Should be a vector with the scores for each item. Currently this can only be integer values (e.g.\ LIKERT scales).
分数该参数可用于对测试成绩的个人图。应该是一个向量,其每个项目的得分。目前,这只能是整数的值(例如,\李克特量表)。




scores.range Vector of length two indicating the range of the scores, if scores is assigned.
scores.range向量的长度为2,表示的分数的范围内,如果被分配分数。


手动定义图表的参数----------Arguments for manually defining graphs----------




mode The mode argument (see section on significance graph arguments) can also be used to make the weights matrix correspond directly to the width of the edges (as in lwd of plot()). To do this, set mode to "direct".
模式的模式参数(见部分的意义图参数)也可以被用来使权重矩阵的直接对应的宽度的边缘(如在LWD样地())。要做到这一点,将模式设置为“直接”。




edge.color This argument can be used to overwrite the colors. Can be either a single value to make all edges the same color, a matrix with a color for each edge (when using a weights matrix) or a vector with a color for each edge (when using an edgelist)
edge.color该参数可用于覆盖的颜色。使用EdgeList,在该列表中时,可以是一个单一的值,以使所有的边缘相同的颜色,以矩阵的每个边缘的颜色(当使用权重矩阵)或向量与一种颜色的每个边缘()


附加参数----------Additional arguments----------




weighted Logical that can be used to force either a weighted graph (TRUE) or an unweighted graph(FALSE).
加权的逻辑可以用来强制一个加权图(TRUE)或一个未加权的图(FALSE)。




nNodes The number of nodes, only needs to be specified if the first argument is an edge-list and some nodes have no edges
nNodes节点的数目,只需要指定如果第一个参数是一个边列表和一些节点没有边缘




DoNotPlot Runs qgraph but does not plot. Useful for saving the output (i.e. layout) without plotting
DoNotPlot运行qgraph,但不绘制。没有绘制可用于保存输出(即布局)




plot Logical. Should a new plot be made? Defaults to TRUE. Set to FALSE to add the graph to the existing plot.
绘制逻辑。一个新的图呢?默认为true。如果设置为FALSE,现有的图添加图形。




rescale Logical. Defines if the layout should be rescaled to fit the -1 to 1 x and y area. Defaults to TRUE. Can best be used in combination with plot=FALSE.
的重新调整逻辑。定义是否应重新调整布局,以适应-1到1 x和y。默认为true。可以最好地组合使用与地积= FALSE。




layoutScale A vector with a scalar for respectivally the x and y coordinates of the layout (which default plotting area is from -1 to 1 on both x and y axis). Setting this to e.g. c(2,2) would make the plot twice as big. Use this in combination with 'layoutOffset' and 'plot' arguments to define the graph placement on an existing plot.
layoutScale为respectivally的x和y坐标的布局(默认绘图区域是从-1到1的x和y轴)与一个标量的向量。将其设置为例如C(2,2)将积的两倍大。使用此结合“layoutOffset和图参数来定义图形放置在现有的图。




layoutOffset A vector with the offset to the x and  coordinates of the center of the graph (defaults to (0,0)). Use this in combination with 'layoutScale' and 'plot' arguments to define the graph placement on an existing plot.
layoutOffset的向量与偏移量的曲线图的中心(默认为(0,0))的x和坐标。使用此结合“layoutScale和图参数来定义图形放置在现有的图。


使用qgraph来绘制图形----------Using qgraph to plot graphs----------

The first argument of qgraph(), 'input', is the input. This can be a number of objects but is mainly either a weights matrix or an edgelist. Here we will assume a graph is made of n nodes connected by m edges. qgraph is mainly aimed at visualizing (statistical) relationships between variables as weighted edges. In these edge weights a zero indicates no connection and negative values are comparable in strength to positive values. Many (standardized) statistics follow these rules, the most important example being correlations. In the special case where all edge weights are either 0 or 1 the weights matrix is interpreted as an adjacency matrix and an unweighted graph is made.
qgraph()的第一个参数,“输入”,是输入。这可以是一个对象的数目,但主要是一个权重矩阵或EdgeList,在该列表中。在这里,我们将假设由m条边连接的n个节点的曲线制成的。 qgraph主要是针对在可视化变量的加权边缘(统计)之间的关系。在这些边的权重为0,代表没有连接和负值相媲美的强度为正值。许多(标准)的统计遵循这些规则,最重要的例子的相关性。在特殊情况下,所有边的权重为0或1的权重矩阵被解释为邻接矩阵和非加权图。

a weights matrix is a square n by n matrix in which each row and column represents a node. The element at row i and column j indicates the connection from node i to node j. If the weights matrix is symmetrical an undirected graph is made and if the matrix is asymmetrical a directed graph is made (note that due to floating point errors seemingly symmetrical matrices may actually be asymmetrical). These matrices occur naturally in statistics or can easily be obtained through matrix algebra, the most important example being correlation matrices.
一个权重矩阵是一个正方形的n×n矩阵,其中每一行和每一列代表一个节点。在i行j列的元素表示从节点i到节点j的连接。如果权重矩阵是对称的无向图,如果一个有向图的矩阵是不对称的(请注意,由于浮点错误,看似对称矩阵实际上可能是不对称的)。这些矩阵中自然产生的统计数据或通过矩阵代数,相关矩阵的最重要的例子是,可以容易地得到。

An edgelist can also be used. This is a m by 2 matrix (not a list!) in which each row indicates an edge. The first column indicates the number of the start of the edge and the second column indicates the number of the end of the edge. The number of each node is a unique integer between 1 and n. The total number of nodes will be estimated by taking the highest value of the edgelist. If this is incorrect (there are nodes with no edges beyond the ones already specified) the 'nNodes' argument can be used. If an integer between 1 and n is missing in the edgelist it is assumed to be a node with no edges. To create a weighted graph edge weights can be added as a third column in the edgelist. By default using an edgelist creates a directed graph, but this can be set with the 'directed' argument.
EdgeList,在该列表中也可以被使用。这是上午2矩阵(不是列表中的每一行表示一个边缘!)。第一列表示的数目的边缘的开始和第二列表示的端部的边缘的数目。每个节点的数目是1和n之间的一个整数。节点的总数通过服用的EdgeList,在该列表中的最高值,将被估计。如果这是不正确的(有没有已经指定以外的边缘节点)“nNodes”参数可以使用。如果1和n之间的整数,在EdgeList,在该列表中缺少它被假定为是一个节点没有边缘。要创建一个加权图边的权重,可以增加一条,作为第三EdgeList都在列。默认情况下,使用EdgeList都创建一个有向图,但可以设置导向的说法。


解释图表----------Interpreting graphs----------

In weighted graphs green edges indicate positive weights and red edges indicate negative weights. The color saturation and the width of the edges corresponds to the absolute weight and scale relative to the strongest weight in the graph. It is possible to set this strongest edge by using the 'maximum' argument. When 'maximum' is set to a value above any absolute weight in the graph that value is considered the strongest edge (this must be done to compare different graphs; a good value for correlations is 1). Edges with an absolute value under the 'minimum' argument are omitted (useful to keep filesizes from inflating in very large  graphs).
赋权图中的绿色边缘正权红边表示负的权重。色彩饱和度和边缘的宽度对应于相对于在图中最强的重量的绝对重量和规模。通过使用“最高”的说法,它可以设置这个强烈的边缘。当设置为“最高”任何绝对权重值高于该值被认为是最强烈的边缘(图中的这必须做比较不同的图形,一个很好的价值相关性为1)。边缘的绝对值根据“最低”的说法被省略(有用的,保持的filesizes从膨胀非常大图)。

In larger graphs the above edge settings can become hard to interpret. With the 'cut' argument a cutoff value can be set which splits scaling of color and width. This makes the graphs much easier to interpret as you can see important edges and general trends in the same picture. Edges with absolute weights under the cutoff score will have the smallest width and become more colorful as they approach the cutoff score, and edges with absolute weights over the cutoff score will be full red or green and become wider the stronger they are.
在较大的图形边缘设置可能会很难解释。随着“腰斩”的说法分割缩放,颜色和宽度,可以设置一个临界值。这使图表更容易理解,你可以看到重要的在同一画面的边缘和一般趋势。截止得分的绝对权重下边缘将有最小的宽度,因为他们的做法,截止得分,截止得分的绝对重量超过全是红色或绿色的边缘,成为更广泛的他们,变得更加丰富多彩。


指定的布局----------Specifying the layout----------

The placement of the nodes (i.e. the layout) is specified with the 'layout' argument. It can be manually specified by entering a matrix for this argument. The matrix must have a row for each node and two columns indicating its X and Y coordinate respectively. qgraph plots the nodes on a (-1:1)(-1:1) plane, and the given coordinates will be rescaled to fit this plane unless 'rescale' is FALSE (not recommended).  Another option to manually specify the layout is by entering a matrix with more then two columns. This matrix must then consist of zeroes and a number (the order in the weights matrix) for each node indicating it's place. For example:
节点的位置(即布局)指定的“布局”的说法。它可以手动指定,进入这一论点的矩阵。矩阵的每个节点必须有一排两列,表明其X和Y坐标分别。 qgraph(-1:1)(-1:1)面图的节点上,给定的坐标将被重新调整,以适应这架飞机,除非“重新调整是假的(不推荐)。手动指定布局的另一种选择是进入了一个矩阵,然后两列。这个矩阵组成的0和1的每个节点表明它的位置的一个数(权重矩阵的顺序)。例如:

0 0 2 0 0
0 0 2 0 0

1 0 3 0 4
1 0 3 0 4

will place node 2 at the top in the center, node 1 at the bottom left corner, node 3 at the bottom in the center and node 4 at the bottom right corner. It is recommended however that one of the integrated layouts is used. 'layout' can be given a character as argument to accomplish that. layout="circular" will simply place all nodes in a circle if the groups argument is not used and in separate circles per group if the groups argument is used (see next section).
将放置在顶部的中心在左下角右下角底部的中心和节点4,节点3,节点1节点2。然而,建议使用的综合布局之一。 “布局”,可以得到一个字符作为参数来实现这一目标。布局=“通知”将只是把一个圆圈中的所有节点,如果组参数没有被使用,如果在不同的圈子每组各组参数(见下一节)。

The circular layout is convenient to see how well the data conforms to a model, but to show how the data clusters another layout is more appropriate. By specifying layout="spring" the Fruchterman-reingold algorithm (Fruchterman & Reingold, 1991), which has been ported from the SNA package (Butts, 2010), can be used to create a force-directed layout. In principle, what this function does is that each node (connected and unconnected) repulse each other, and connected nodes also attract each other. Then after a number of iterations (500 by default) in which the maximum displacement of each node becomes smaller a layout is achieved in which the distance between nodes correspond very well to the absolute edge weight between those nodes.
圆形的布局是方便的看到数据符合的模型,但显示的数据聚类的布局是比较合适的。通过指定布局“春天里”的FRUCHTERMAN莱因戈尔德的算法(FRUCHTERMAN莱因戈尔德,1991),已移植由的SNA包(巴茨,2010年),可用于创建一个力的布局。原则上,这个功能是相互排斥的每个节点(连接和未连接),以及连接的节点也相互吸引。然后经过迭代次数(缺省是500)来实现的,其中的每个节点的最大位移变小的布局中,节点之间的距离非常好对应的绝对这些节点之间的边的权重。

A solution to use this function for weighted graphs has been taken from the igraph package (Csardi G & Nepusz T, 2006) in which the same function was ported from the SNA package. New in qgraph are the option to include constraints on the nodes by fixing a coordinate for nodes or reducing the maximum allowed displacement per node. This can be done with the 'layout.par' argument. For more information see qgraph.layout.fruchtermanreingold.
已经从一个解决方案,使用此功能的加权图的igraph包(Csardi T,G&Nepusz 2006年)相同的功能被移植的SNA包。新在qgraph的该选项以包括在节点上的约束,通过固定的坐标的节点或减少每个节点的最大允许位移。这是可以做到的“layout.par”的说法。有关详细信息,请参阅qgraph.layout.fruchtermanreingold。

By default, 'layout' is set to "spring" for unweighted and directed graphs and "circular" otherwise.
默认情况下,“布局”设置为加权,有向图的“春天”和“通知”,否则。


指定的测量模式----------Specifying a measurement model----------

A measurement model can be specified with the 'groups' argument. This must be a list in which each element is a vector containing the numbers of nodes that belong together (numbers are taken from the order in the weights matrix). All numbers must be included. If a groups list is specified the "groups" layout can be used to place these nodes together, the nodes in each group will be given a color, and a legend can be plotted (by setting 'legend' to TRUE). The colors will be taken from the 'color' argument, or be generated with the rainbow function.
可以指定一个测量模型与“群体”的说法。这必须是一个列表,其中的每个元素是一个向量,包含数字的节点上属于(数字从订单中的权重矩阵)。所有的数字必须包括在内。如果指定了一组“列表中的”组“布局,可以用来放置这些节点,每个组中的节点将一种颜色,可以绘制一个传说(”传奇“设置为TRUE)。颜色会从“色”的说法,或产生rainbow功能。


产量----------Output----------

By default qgraph will plot the graph in a new R window. However the graphs are optimized to be plotted in a PDF file. To easily create a pdf file set the 'filetype' argument to "pdf". 'filename' can be used to specify the filename and folder to output in. 'height' and 'width' can be used to specify the height and width of the image in inches. By default a new R window is opened if the current device is the NULL-device, otherwise the current device is used (note that when doing this 'width' and 'height' still optimize the image for those widths and heights, even though the output screen size isn't affected, this is especially important for directed graphs!).
默认情况下,qgraph将在一个新的R窗口中绘制的图形。然而,优化的图形被绘制在一个PDF文件中。要轻松地创建PDF文件的“文件类型”参数设置为“PDF”。 文件名可以用于以指定的文件名和文件夹,以输出英寸“高度”和“宽度”可以被用来指定以英寸为单位的图像的高度和宽度。默认情况下,一个新的R窗口打开,如果当前设备是NULL设备,否则当前的设备使用(请注意,这样做时,“宽度”和“高度”这些宽度和高度优化的图像,即使输出屏幕的尺寸则不会受到影响,这是特别重要的有向图!)。

Furthermore filetype can also be set to numerous other values. Alternatively any output device in R can be used by simply opening the device before calling qgraph and closing it with dev.off() after calling qgraph.
此外,文件类型也可以设置众多的其他值。另外,R中的任何输出装置可用于通过简单地打开之前调用qgraph和关闭它后调用qgraph用dev.off()的移动设备。

The graphs can also be outputted in an SVG file using the RSVGTipsDevice package (Plate, 2009). An SVG image can be opened in most browsers (firefox and chrome are recommended), and can be used to display tooltips. Each node can be given a tooltip with the 'tooltips' argument. The function qgraph.svg can be used to make a battery of svg pictures with hyperlinks to each other, working like a navigation menu.
输出的图表也可以使用RSVGTipsDevice包(图版,2009)中的SVG文件。打开SVG图像可以在大多数浏览器(建议使用Firefox和Chrome),可以用来显示工具提示。每个节点都可以给出一个工具提示“工具提示”的说法。的功能qgraph.svg可以被用来制造电池的SVG图片的超链接彼此,像一个导航菜单。

IMPORTANT NOTE: RSVGTipsDevice is a 32-bit only package, so SVG functionality is not available in 64bit versions of R.
重要注意事项:RSVGTipsDevice是一个32位的唯一的包,所以SVG功能是不可用的,在64位版本的R.

Finally, the filetype 'tex' can be used. This uses the tikzDevice package to create a LaTeX file that can then be compiled in your LaTeX compiler to create a pdf file. The main benefit of this over plotting directly in a pdf file is that tooltips can be added which can be viewed in several PDF document readers (Adobe Reader is recommended for the best result).
最后,可以使用的文件格式TEX。这使用的tikzDevice的包来创建一个LaTeX文件,然后可以在LaTeX编译器编译,以创建一个PDF文件。这在PDF文件中直接绘图的主要好处是可以添加到工具提示中可以查看PDF文件阅读器(建议使用Adobe Reader是最好的结果)。


手动指定颜色和宽度----------Manual specification of color and width----------

In qgraph the widths and colors of each edge can also be manually controlled. To directly specify the width of each edge set the 'mode” argument to "direct". This will then use the absolute edge weights as the width of each edge (negative values can still be used to make red edges). To manually set the color of each edge, set the 'edge.color' argument to a matrix with colors for each edge (when using a weights matrix) or a vector with a color for each edge (when using an edgelist).
在qgraph的每一个边缘的宽度和颜色也可以手动控制。直接指定的宽度每边设置“模式”的说法,“导演”。然后,这将使用的每一个边缘的宽度(负值仍然可以使用,使红色的边)的绝对值的边的权重。要手动设置每个边缘的颜色,设置“edge.color”的参数为一个矩阵,每个边缘的颜色(当使用一个权重矩阵)或矢量的颜色每条边(时使用EdgeList都)。


其他信息----------Additional information----------

By default, edges will be straight between two nodes unless there are two edges between two nodes. To overwrite this the 'bidirectional' argument can be set to TRUE, which will turn two edges between two nodes into one bidirectional edge. 'bidirectional' can alsobe a vector with TRUE or FALSE for each edge.
缺省情况下,边将两个节点之间是直链的,除非有两个节点之间的两个边缘。要覆盖“双向”参数可以设置为TRUE,这将打开两个边两个节点之间的一个双向边缘。 “双向”alsobe TRUE或FALSE的每条边的一个向量。

To specify the strength of the curve the argument 'curve' can be used (but only in directional graphs). 'curve' must be given a numerical value that represent an offset from the middle of the straight edge through where the curved edge must be drawn. 0 indicates no curve, and any other value  indicates a curve of that strength. A value of 0.3 is recommended for nice curves. This can be either one number or a vector with the curve of each edge.
要指定强度的曲线“曲线”的说法,可以使用(但只在定向图表)。 “曲线”,必须给予的数值的值,该值代表从直边的中间的偏移通过在弯曲边缘必须得出。 0表示没有曲线,和任何其他值表示该强度的曲线。建议值0.3漂亮的曲线。这可以是一个数字或一个矢量的每一个边缘的曲线。

Nodes and edges can be given labels with the 'labels' and the 'edge.labels' arguments. 'labels' can be set to FALSE to omit labels, TRUE (default) to set labels equal to the node number (order in the weights matrix) or it can be a vector with the label for each node. Edge labels can also be set to FALSE to be omitted (default). If 'edge.labels' is TRUE then the weight of each label is printed. Finally, 'edge.labels' can also be a vector with the label for each edge. If a label (both for edges and nodes) contain an asterisk then the asterisk is omitted and that label is printed in the symbol font (useful to print Greek letters).
节点和边,可以给出与“标签”和edge.labels论据的标签。 “标签”可以设置为FALSE省略标签,TRUE(默认)设置标签的节点数量相等的权重矩阵的顺序,也可以是一个向量,其每个节点的标签。边缘标签还可以被忽略(默认)设置为FALSE。如果edge.labels为真,那么的重量,每一个标签被打印出来。最后,edge.labels也可以是一个向量,其每个边缘的标签。如果一个标签(边和节点)包含一个星号,星号被省略的符号字体,标签印刷(打印希腊字母)。

A final two things to try: the 'scores' argument can be given a vector with the scores of a person on each variable, which will then be shown using colors of the nodes, And the 'bg' argument can be used to change the background of the graph to another color, or use bg=TRUE for a special background (do set transparency=TRUE when using  background colors other then white).
最后的两件事情尝试:“分数”的说法可以得到一个向量的分数,然后将其显示色彩的节点,每个变量,一个人的“BG”的说法,可以用来改变背景图的另一种颜色,或使用bg = TRUE一个特殊的背景(不透明度= TRUE时使用的背景颜色白)。


调试----------Debugging----------

If this function crashes for any reason with the filetype argument specified, run:
如果此功能崩溃以任何理由指定的文件类型的参数,运行以下命令:

dev.off()
dev.off()

To shut down the output device!
要关闭输出设备!


(作者)----------Author(s)----------



Sacha Epskamp (qgraph@sachaepskamp.com)




参考文献----------References----------

Waldorp, Verena D. Schmittmann, Denny Borsboom (2012). qgraph: Network Visualizations of Relationships in Psychometric Data. Journal of Statistical Software, 48(4), 1-18. URL http://www.jstatsoft.org/v48/i04/.






参见----------See Also----------

qgraph qgraph.animate qgraph.efa qgraph.pca qgraph.loadings qgraph.sem qgraph.lavaan qgraph.cfa qgraph.svg qgraph.panel
qgraphqgraph.animateqgraph.efaqgraph.pcaqgraph.loadingsqgraph.semqgraph.lavaanqgraph.cfaqgraph.svgqgraph.panel


实例----------Examples----------


### BIG 5 DATASET ###[##BIG 5的DATASET###]
# Load big5 dataset:[加载BIG5数据集:]
data(big5)
data(big5groups)

# Correlations:[相关性:]
Q <- qgraph(cor(big5),minimum=0.25,cut=0.4,vsize=2,groups=big5groups,legend=TRUE,borders=FALSE)
title("Big 5 correlations",line=2.5)

# Same graph with spring layout:[同带弹簧的布局图:]
Q <- qgraph(Q,layout="spring")
title("Big 5 correlations",line=2.5)

# Same graph with Venn diagram overlay:[同图与维恩图覆盖:]
qgraph(Q,overlay=TRUE)
title("Big 5 correlations",line=2.5)

# Significance graph (circular):[意义图形(圆形):]
qgraph(Q,graph="sig",layout="circular")
title("Big 5 correlations (p-values)",line=2.5)

# Significance graph:[意义图:]
qgraph(Q,graph="sig")
title("Big 5 correlations (p-values)",line=2.5)

# Significance graph (distinguishing positive and negative statistics):[意义图(区分正面和负面的统计数据):]
qgraph(Q,graph="sig2")
title("Big 5 correlations (p-values)",line=2.5)

# Grayscale graphs:[灰度图形:]
qgraph(Q,gray=TRUE,layout="circular")
title("Big 5 correlations",line=2.5)

qgraph(Q,graph="sig",gray=TRUE)
title("Big 5 correlations (p-values)",line=2.5)

# Correlations graph with scores of random subject:[关联图随机主题评分:]
qgraph(cor(big5),minimum=0.25,cut=0.4,vsize=2,groups=big5groups,legend=TRUE,borders=FALSE,scores=as.integer(big5[sample(1:500,1),]),scores.range=c(1,5))
title("Test scores of random subject",line=2.5)

# EFA:[全民教育:]
big5efa <- factanal(big5,factors=5,rotation="promax",scores="regression")
qgraph(big5efa,groups=big5groups,layout="circle",rotation="promax",minimum=0.2,cut=0.4,vsize=c(1,15),borders=FALSE,asize=0.07,esize=4,vTrans=200,filetype="R",width=7,height=7)
title("Big 5 EFA",line=2.5)

# PCA:[PCA:]
library("psych")
big5pca <- principal(cor(big5),5,rotate="promax")
qgraph(big5pca,groups=big5groups,layout="circle",rotation="promax",minimum=0.2,cut=0.4,vsize=c(1,15),borders=FALSE,asize=0.07,esize=4,vTrans=200)
title("Big 5 PCA",line=2.5)

#### UNWEIGHTED DIRECTED GRAPHS ###[###未加权的有向图###]
set.seed(1)
adj=matrix(sample(0:1,10^2,TRUE,prob=c(0.8,0.2)),nrow=10,ncol=10)
qgraph(adj)
title("Unweighted and directed graphs",line=2.5)

# Save plot to nonsquare pdf file:[图非方pdf文件:]
## Not run: [#不运行:]
qgraph(adj,filetype='pdf',height=5,width=10)

## End(Not run)[#(不执行)]

#### EXAMPLES FOR EDGES UNDER DIFFERENT ARGUMENTS ###[###示例的边根据不同的参数###]
# Create edgelist:[创建EdgeList,在该列表:]
dat.3 <- matrix(c(1:15*2-1,1:15*2),,2)
dat.3 <- cbind(dat.3,round(seq(-0.7,0.7,length=15),1))

# Create grid layout:[创建网格布局:]
L.3 <- matrix(1:30,nrow=2)

# Different esize:[不同ESIZE:]
qgraph(dat.3,layout=L.3,directed=FALSE,edge.labels=TRUE,esize=14)

# Different esize, strongest edges omitted (note how 0.4 edge is now [不同的ESIZE,最强的边缘省略(现在是0.4边缘]
# just as wide as 0.7 edge in previous graph):[一样宽0.7在以前的图形的边缘):]
qgraph(dat.3[-c(1:3,13:15),],layout=L.3,nNodes=30,directed=FALSE,
        edge.labels=TRUE,esize=14)

# Different esize, with maximum:[不同ESIZE,最大:]
qgraph(dat.3,layout=L.3,directed=FALSE,edge.labels=TRUE,esize=14,maximum=1)
title("maximum=1",line=2.5)

qgraph(dat.3[-c(1:3,13:15),],layout=L.3,nNodes=30,directed=FALSE,edge.labels=TRUE,
        esize=14,maximum=1)
title("maximum=1",line=2.5)

# Different minimum[不同的最低]
qgraph(dat.3,layout=L.3,directed=FALSE,edge.labels=TRUE,esize=14,minimum=0.1)
title("minimum=0.1",line=2.5)

# With cutoff score:[带切断评分:]
qgraph(dat.3,layout=L.3,directed=FALSE,edge.labels=TRUE,esize=14,cut=0.4)
title("cut=0.4",line=2.5)

# With details:[搭配细节:]
qgraph(dat.3,layout=L.3,directed=FALSE,edge.labels=TRUE,esize=14,minimum=0.1,maximum=1,
        cut=0.4,details=TRUE)
title("details=TRUE",line=2.5)

# Trivial example of manually specifying edge color and widths:[手动指定边缘的颜色和宽度的小例子:]
E <- as.matrix(data.frame(from=rep(1:3,each=3),to=rep(1:3,3),width=1:9))
qgraph(E,mode="direct",edge.color=rainbow(9))

### STRUCTURAL EQUATION MODELLING ###[#####结构方程建模]
## Not run: [#不运行:]
library('sem')

### This example is taken from the examples of the sem function. [##此示例取自的扫描电镜功能的实施例。]
### Only names were changed to better suit the path diagram.[##只有名字被更改,以更好地适应路径图。]

# ----------------------- Thurstone data ---------------------------------------[-----------------------瑟斯顿数据------------------------- --------------]
#  Second-order confirmatory factor analysis, from the SAS manual for PROC CALIS[二阶验证性因素分析,从SAS PROC CALIS手册]

R.thur <- readMoments(diag=FALSE, names=c('Sen','Voc',
        'SC','FL','4LW','Suf',
        'LS','Ped', 'LG'))
    .828                                             
    .776   .779                                       
    .439   .493    .46                                 
    .432   .464    .425   .674                           
    .447   .489    .443   .59    .541                    
    .447   .432    .401   .381    .402   .288              
    .541   .537    .534   .35    .367   .32   .555        
    .38   .358    .359   .424    .446   .325   .598   .452  
            
model.thur <- specifyModel()
    F1 -> Sen,               *l11, NA
    F1 -> Voc,               *l21, NA
    F1 -> SC,                *l31, NA
    F2 -> FL,                *l41, NA
    F2 -> 4LW,               *l52, NA
    F2 -> Suf,               *l62, NA
    F3 -> LS,                *l73, NA
    F3 -> Ped,               *l83, NA
    F3 -> LG,                *l93, NA
    F4 -> F1,                *g1,  NA
    F4 -> F2,                *g2,  NA
    F4 -> F3,                *g3,  NA
    Sen <-> Sen,             q*1,   NA
    Voc<-> Voc,              q*2,   NA
    SC <-> SC,               q*3,   NA
    FL <-> FL,               q*4,   NA
    4LW <-> 4LW,             q*5,   NA
    Suf<-> Suf,              q*6,   NA
    LS <-> LS,               q*7,   NA
    Ped<-> Ped,              q*8,   NA
    LG <-> LG,               q*9,   NA
    F1 <-> F1,               NA,     1
    F2 <-> F2,               NA,     1
    F3 <-> F3,               NA,     1
    F4 <-> F4,               NA,     1

## End(Not run)[#(不执行)]



# Path diagram of the model:[该模型的路径图:]
qgraph(model.thur)
qgraph(model.thur,layout="tree",manifest=c('Sen','Voc','SC','FL','4LW','Suf','LS','Ped','LG'))

# Estimate and plot parameters:[估计和绘图参数:]
sem.thur <- sem(model.thur, R.thur, 213)
qgraph(sem.thur,layout="tree",curve=0.4)

## Not run: [#不运行:]
### pcalg support ###[#####pcalg支持]
# Example from pcalg vignette:[例如,从pcalg的小插曲:]
library("pcalg")
data(gmI)
suffStat <- list(C = cor(gmI$x), n = nrow(gmI$x))
pc.fit <- pc(suffStat, indepTest=gaussCItest,
p = ncol(gmI$x), alpha = 0.01)

qgraph(pc.fit)

## End(Not run)[#(不执行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-4-18 10:42 , Processed in 0.027932 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表