VisCov(VisCov)
VisCov()所属R语言包:VisCov
Visualizing of distributions of covariance matrices
可视化的协方差矩阵的分布
译者:生物统计家园网 机器人LoveR
描述----------Description----------
To generate samples from a specific distribution of covariance matrices, draw the four-layered graphs and return the sampled matrices and the related information on the distribution.
要生成样品从一个特定的分布的协方差矩阵,得出的四层的图表和返回采样矩阵和分布上的相关信息。
用法----------Usage----------
VisCov(distribution = "Inverse Wishart", param = list(prob = 0.5, dim = 4, nu = 5,
scaleCov = diag(1,4)), title = distribution, Nsamples = 1000, Ncontours = 100,
logSD = TRUE, histogram.Variance = TRUE, histogram.Correlation = TRUE,
histogram.Effective.Variance = TRUE, histogram.Effective.Dependence = TRUE,
extreme.regio = "Effective Dependence", title.logical = TRUE)
参数----------Arguments----------
参数:distribution
a distribution to be plotted among:
要绘制之间的分配:
参数:
"Inverse Wishart", "Scaled Inverse Wishart", "Scaled Inverse Wishart for correlation", "Scaled with uniform on correlation", "Wishart", and "User defined distribution"
“反威沙特”,“调整反威沙特”,“的缩放反威沙特相关”,“相关性与均匀缩放”,“威沙特”,和“用户定义的分布”
参数:title.logical
a logical value indicating whether a title should be given to the graph
一逻辑值,指示是否应给予一个标题的图形
参数:title
title of the graph
图形的标题
参数:Nsamples
the number of samples for all plots except the contour plot
以外的所有图的等高线图的样本数
参数:Ncontours
the number of samples for the contour plot
的等高线图的样本数
参数:logSD
a logical value indicating whether the natural logarithm of the standard deviation is plotted
一个逻辑值,该值指示是否绘制的自然对数的标准偏差
参数:histogram.Variance
a logical value indicating whether the univariate graph of the (log) standard deviation is a histogram (TRUE) or a density (FALSE)
一个逻辑值,该值指示单变量曲线图(对数)标准偏差是否是一个直方图(TRUE)或密度(FALSE)
参数:histogram.Correlation
a logical value indicating whether the univariate graph of the correlation is a histogram (TRUE) or a density curve (FALSE)
一个逻辑值,该值指示是否单因素的相关性的图,是一个直方图(TRUE)或密度曲线(FALSE)
参数:histogram.Effective.Variance
a logical value indicating whether the univariate graph of the effective variance is a histogram (TRUE) or a density curve (FALSE)
一个逻辑值,该值指示是否有效方差的单变量曲线图是一个直方图(TRUE)或密度曲线(FALSE)
参数:histogram.Effective.Dependence
a logical value indicating whether the univariate graph of the effective dependence is a histogram (TRUE) or a density curve (FALSE)
一逻辑值,指示是否单因素的有效依赖图的直方图(TRUE)或密度曲线(FALSE)
参数:extreme.regio
indicates whether the coloring of extreme samples (in red and blue) is based on the "Effective Dependence" or "Effective Variance". If neither of them is specified, there is no coloring.
指示是否极端样本的着色(红色和蓝色)的基础上的“有效的依赖性”或“有效方差”。如果两者都没有指定,是无着色。
参数:param
a list of parameters consisting of the following objects: mat, a list of covariance matrices; applicable only when distribution = "User defined distribution"; prob, mass concentration in the equiprobability contour plot; dim, dimension of matrices; nu, degrees of freedom for the inverse Wishart or Wishart distributions; scaleCov, scale matrix for the inverse Wishart or Wishart distributions; mu0 and s0 are the mean and the standard deviation for the folded normal distribution, applicable when distribution is "Scaled Inverse Wishart", "Scaled Inverse Wishart for correlation" or "Scaled with uniform on correlation"
只有当分布参数的列表包括以下对象:mat,协方差矩阵的列表;适用=“用户定义分布”,“prob,质量浓度等概率等高线图,”<所述>,维矩阵,“dim,逆威沙特或威沙特分布的自由度; nu,规模矩阵的逆威沙特或威沙特分布,scaleCov和<X >的均值和标准差为倍数正态分布,适用于mu0是“调整反威沙特”,“的缩放反威沙特的相关性”或“缩放与统一的相关性”
Details
详细信息----------Details----------
VisCov generates samples from a specific distribution of covariance matrices (or user defined distribution), draws the four-layered graphs and returns the sampled matrices and the related information on the distribution. For more detail, see Tokuda et al. in the following references.
VisCov生成样品从一个特定的分布的协方差矩阵(或用户定义的分布),投篮四层的图表和返回的采样矩阵和分布上的相关信息。欲知更多详情,请参阅德田等。在下列参考文献。
参考文献----------References----------
实例----------Examples----------
###### Figures in the paper (Tokuda, Goodrich, Van Mechelen, Gelman, and Tuerlinckx)[#####图中的文件(德田,古德里奇,凡梅赫伦,吉尔曼,以及Tuerlinckx)]
## Figure 1[#图1]
distribution = "Inverse Wishart"
dim = 4
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData = VisCov(distribution, param, title.logical = FALSE)
## Figure 2[#图2]
distribution = "Inverse Wishart"
dim = 4
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
distribution = "Inverse Wishart"
dim = 4
param = list(prob = 0.5, dim = dim, nu = dim+50, scaleCov = diag(1,dim))
CovPlotData2 = VisCov(distribution, param, title.logical = FALSE)
selected.condition = c("scatter1", "scatter4", "contour", "Effective.Dependence")
panelSelectMultiple(selected.condition, list(CovPlotData1, CovPlotData2))
## Figure 3[#图3]
## Not run: [#不运行:]
distribution = "Inverse Wishart"
dim = 4
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
dim = 100
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData2 = VisCov(distribution, param, title.logical = FALSE)
selected.condition = c("Effective.Dependence")
panelSelectMultiple(selected.condition, list(CovPlotData1, CovPlotData2))
## End(Not run)[#(不执行)]
## Figure 4[#图4]
distribution = "Scaled Inverse Wishart for correlation"
dim = 4
param = list(mu0 = 0, s0 = 1, prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
param = list(mu0 = 0, s0 = 1,prob = 0.5, dim = dim, nu = dim+50, scaleCov = diag(1,dim))
CovPlotData2 = VisCov(distribution, param, title.logical = FALSE)
selected.condition = c("scatter1", "scatter2", "scatter4", "contour")
panelSelectMultiple(selected.condition, list(CovPlotData1, CovPlotData2))
## Figure 5[图5]
## Not run: [#不运行:]
distribution = "Scaled with uniform on correlation"
dim = 4
param = list(mu0 = 0, s0 = 1, prob = 0.5, dim = dim)
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
dim = 50
param = list(mu0 = 0, s0 = 1, prob = 0.5, dim = dim)
CovPlotData2 = VisCov(distribution, param,title.logical = FALSE)
selected.condition = c("scatter2", "scatter4", "contour","Effective.Dependence.submatrix")
panelSelectMultiple(selected.condition, list(CovPlotData1, CovPlotData2))
## End(Not run)[#(不执行)]
## Figure 6[#图6]
distribution = "Scaled Inverse Wishart"
dim = 4
param = list(mu0 = 0, s0 = 1, prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
param = list(mu0 = 0, s0 = 1,prob = 0.5, dim = dim, nu = dim+50, scaleCov = diag(1,dim))
CovPlotData2 = VisCov(distribution, param, title.logical = FALSE)
selected.condition = c("scatter2", "scatter4", "contour","Effective.Dependence")
panelSelectMultiple(selected.condition, list(CovPlotData1,CovPlotData2))
## Figure 7[图7]
## Not run: [#不运行:]
distribution = "Wishart"
dim = 4
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData1 = VisCov(distribution, param, title.logical = FALSE)
dim = 50
param = list(prob = 0.5, dim = dim, nu = dim+1, scaleCov = diag(1,dim))
CovPlotData2 = VisCov(distribution, param,title.logical = FALSE)
selected.condition = c("scatter2", "scatter4", "contour","Effective.Dependence")
panelSelectMultiple(selected.condition, list(CovPlotData1,CovPlotData2))
## End(Not run)[#(不执行)]
## Figure 8[图8]
## Not run: [#不运行:]
distribution = "User defined distribution"
param = list()
mat = list()
# Generation of covariance matrices[协方差矩阵的生成]
for (i in 1:1000){
index = 0
dim = 50
while (index == 0){
W = matrix(rnorm(dim*dim,0,1),nrow = dim)
svdW= svd(W)
Rho = svdW$u%*%t(svdW$v)
D = diag(rbeta(dim,0.5,5))
Sigma = diag(rnorm(dim,0,1))
Sigma = abs(Sigma)
S = Sigma%*%Rho%*%D%*%t(Rho)%*%Sigma
# Checking positive definiteness[检查正定性]
eigenv = eigen(S)$values
if (all(eigenv > 0)) index = 1
if (index ==0){print("zero")}
}
mat[[i]] = S
}
param = list(prob = 0.5, mat = mat)
CovPlotData = VisCov(distribution, param , title.logical = FALSE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|