qpCov(qpgraph)
qpCov()所属R语言包:qpgraph
Calculation of the sample covariance matrix
计算样本协方差矩阵
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Calculates the sample covariance matrix, just as the function cov() but returning a dspMatrix-class object which efficiently stores such a dense symmetric matrix.
计算样本协方差矩阵,一样的功能cov()但返回一个dspMatrix-class对象,有效地保存如此密集的对称矩阵。
用法----------Usage----------
qpCov(X, corrected=TRUE)
参数----------Arguments----------
参数:X
data set from where to calculate the sample covariance matrix. As the cov() function, it assumes the columns correspond to random variables and the rows to multivariate observations.
从那里来计算样本协方差矩阵的数据集。 cov()功能,它假定列对应的随机变量和行多元意见。
参数:corrected
flag set to TRUE when calculating the sample covariance matrix (default; and set to FALSE when calculating the uncorrected sum of squares and deviations.
标志设置TRUE当计算样本协方差矩阵(默认情况下设置为FALSE当裸总和计算平方和偏差。
Details
详情----------Details----------
This function makes the same calculation as the cov function but returns a sample covariance matrix stored in the space-efficient class dspMatrix-class and, moreover, allows one for calculating the uncorrected sum of squares and deviations which equals (n-1) * cov().
此功能使cov功能相同的计算,而是返回一个样本协方差矩阵存储空间高效的类dspMatrix-class“,而且,允许一个计算平方和偏差的裸总和等于 (n-1) * cov()。
值----------Value----------
A sample covariance matrix stored as a dspMatrix-class object. See the Matrix package for full details on this object class.
样本协方差矩阵存储dspMatrix-class对象。这个对象类的全部细节,请参阅Matrix包。
作者(S)----------Author(s)----------
R. Castelo
参见----------See Also----------
qpPCC
qpPCC
举例----------Examples----------
require(graph)
require(mvtnorm)
nVar <- 50 ## number of variables[#变量]
nObs <- 10 ## number of observations to simulate[#号观测到模拟]
set.seed(123)
g <- randomEGraph(as.character(1:nVar), p=0.15)
Sigma <- qpG2Sigma(g, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
S <- qpCov(X)
## estimate Pearson correlation coefficients by scaling the sample covariance matrix[#通过扩大样本协方差矩阵估计Pearson相关系数]
R <- cov2cor(as(S, "matrix"))
## get the corresponding boolean adjacency matrix[#得到相应的布尔邻接矩阵]
A <- as(g, "matrix") == 1
## Pearson correlation coefficients of the present edges[目前的边缘#皮尔逊相关系数]
summary(abs(R[upper.tri(R) & A]))
## Pearson correlation coefficients of the missing edges[#皮尔森相关系数失踪边缘]
summary(abs(R[upper.tri(R) & !A]))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|