iam(VGAM)
iam()所属R语言包:VGAM
Index from Array to Matrix
从阵列到矩阵索引
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Maps the elements of an array containing symmetric positive-definite matrices to a matrix with sufficient columns to hold them (called matrix-band format.)
图数组中的元素包含对称正定矩阵的矩阵与持有足够的列(称为矩阵带格式。)
用法----------Usage----------
iam(j, k, M, hbw = M, both = FALSE, diag = TRUE)
参数----------Arguments----------
参数:j
An integer from the set {1:M} giving the row number of an element.
一个整数,从集合{1:M}给一个元素的行号。
参数:k
An integer from the set {1:M} giving the column number of an element.
从集合{1:M}给一个元素的列数中的一个整数。
参数:M
The number of linear/additive predictors. This is the dimension of each positive-definite symmetric matrix.
线性/添加剂预测因子的数目。这是每个正定对称矩阵的维数。
参数:hbw
Defunct.
曾经存在过的。
参数:both
Logical. Return both the row and column indices? See below for more details.
逻辑。返回的行和列?请参阅下面的更多细节。
参数:diag
Logical. Return the indices for the diagonal elements? If FALSE then only the strictly upper triangular part of the matrix elements are used.
逻辑。返回指数的对角线元素吗?如果FALSE然后只有严格上三角矩阵元素的一部分使用。
Details
详细信息----------Details----------
Suppose we have n symmetric positive-definite square matrices, each M by M, and these are stored in an array of dimension c(n,M,M). Then these can be more compactly represented by a matrix of dimension c(n,K) where K is an integer between M and M*(M+1)/2 inclusive. The mapping between these two representations is given by this function. It firstly enumerates by the diagonal elements, followed by the band immediately above the diagonal, then the band above that one, etc. The last element is (1,M). This function performs the mapping from elements (j,k) of symmetric positive-definite square matrices to the columns of another matrix representing such. This is called the matrix-band format and is used by the VGAM package.
假设我们有n对称正定方阵,每个M,由M,而这些被存储在array的尺寸c(n,M,M)。这些都可以更紧凑的matrix的尺寸c(n,K)其中K是M和M*(M+1)/2包容性之间的一个整数。这两种表示形式之间的映射是通过此功能。它首先列举由对角元素,其次由紧接上面的对角线的频带,那么,一个以上的频带等的最后一个元素是(1,M)。这个函数执行的映射元素(j,k)另一个矩阵的列代表这样的对称正定方阵。这就是所谓的矩阵带格式使用VGAM的软件包。
值----------Value----------
This function has a dual purpose depending on the value of both. If both=FALSE then the column number corresponding to the j-k element of the matrix is returned. If both = TRUE then j and k are ignored and a list with the following components are returned.
这个函数有一个取决于both的值上的双重目的。如果both=FALSE然后的列数对应的j - k矩阵元素被返回。如果both = TRUE然后j和k被忽略,并且返回了以下组件的列表。
参数:row.index
The row indices of the upper triangular part of the matrix (This may or may not include the diagonal elements, depending on the argument diagonal).
行指数,其中矩阵的上三角部分(这可能会或可能不包括在对角线上的元素,取决于该参数diagonal)。
参数:col.index
The column indices of the upper triangular part of the matrix (This may or may not include the diagonal elements, depending on the argument diagonal).
列指数,其中矩阵的上三角部分(这可能会或可能不包括在对角线上的元素,取决于该参数diagonal)。
注意----------Note----------
This function is used in the weight slot of many VGAM family functions (see vglmff-class), especially those whose M is determined by the data, e.g., dirichlet, multinomial.
此功能用于在weight许多VGAM家庭功能的插槽(见vglmff-class),尤其是那些M确定的数据,例如,dirichlet的,multinomial。
(作者)----------Author(s)----------
T. W. Yee
参考文献----------References----------
some additional information.
参见----------See Also----------
vglmff-class.
vglmff-class。
实例----------Examples----------
iam(1, 2, M = 3) # The 4th column represents element (1,2) of a 3x3 matrix[第四列表示一个3x3矩阵的元素(1,2)的]
iam(NULL, NULL, M = 3, both = TRUE) # Return the row and column indices[返回的行和列]
dirichlet()@weight
M = 4
temp1 = iam(NA, NA, M = M, both = TRUE)
mat1 = matrix(NA, M, M)
mat1[cbind(temp1$row, temp1$col)] = 1:length(temp1$row)
mat1 # More commonly used[较常用的]
temp2 = iam(NA, NA, M = M, both = TRUE, diag = FALSE)
mat2 = matrix(NA, M, M)
mat2[cbind(temp2$row, temp2$col)] = 1:length(temp2$row)
mat2 # Rarely used[很少使用]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|