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

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

[复制链接]
发表于 2012-9-29 22:56:21 | 显示全部楼层 |阅读模式
correlation(SciViews)
correlation()所属R语言包:SciViews

                                        Correlation matrices
                                         相关矩阵

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

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

Compute the correlation matrix between two variables, or more (between all columns of a matrix or data frame).
计算两个变量,或多个(所有列的矩阵或数据框之间)之间的相关矩阵。


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


correlation(x, ...)
## S3 method for class 'formula'[类formula的方法]
correlation(formula, data = NULL, subset, na.action, ...)
## Default S3 method:[默认方法]
correlation(x, y = NULL, use = "everything",
    method = c("pearson", "kendall", "spearman"), ...)

is.correlation(x)
as.correlation(x)

## S3 method for class 'correlation'
print(x, digits = 3, cutoff = 0, ...)
## S3 method for class 'correlation'
summary(object, cutpoints = c(0.3, 0.6, 0.8, 0.9, 0.95),
    symbols = c(" ", ".", ",", "+", "*", "B"), ...)
## S3 method for class 'summary.correlation'
print(x, ...)
## S3 method for class 'correlation'
plot(x, y = NULL, outline = TRUE,
    cutpoints = c(0.3, 0.6, 0.8, 0.9, 0.95), palette = rwb.colors, col = NULL,
    numbers = TRUE, digits = 2, type = c("full", "lower", "upper"),
    diag = (type == "full"), cex.lab = par("cex.lab"), cex = 0.75 * par("cex"),
    ...)



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

参数:x
a numeric vector, matrix or data frame (or any object for is.correlation(), or as.correlation()).
一个数值向量,矩阵或数据框(或任何对象is.correlation()或as.correlation()“)。


参数:formula
a formula with no response variable, referring only to numeric variables.
没有响应变量的公式,只给数值变量。


参数:data
an optional data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).
一个可选的数据框(或相似:model.frame),其中包含公式formula中的变量。默认情况下,变量从environment(formula)。


参数:subset
an optional vector used to select rows (observations) of the data matrix x.
的可选的向量选择行(观察)的数据矩阵x。


参数:na.action
a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The 'factory-fresh' default is na.omit.
一个函数,它表示当数据包含NA的,应该发生什么。默认设置是由na.action的options,是na.fail,如果是没有设置的。的工厂新鲜的“默认是na.omit。


参数:method
a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman", can be abbreviated.
一个字符串,表示哪个相关系数是要计算。 "pearson"(默认),"kendall"或"spearman",可以缩写。


参数:y
NULL (default), or a vector, matrix or data frame with compatible dimensions to x for correlation(). The default is equivalent to x = y, but more efficient. For plot.correlation(), if a second 'correlation' object is provided in y, then a visual comparison of two correlation matrices is performed (not implemented yet)!
NULL(默认),或一个向量,矩阵或数据框兼容的尺寸x的correlation()。 x = y,但更有效的默认值是相等的。对于plot.correlation(),如果第二个相关性的对象是提供y,然后比较两个相关矩阵的可视化(尚未实现)!


参数:use
an optional character string giving a method for computing correlations in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".
一个可选的字符的字符串,给出了一个计算方法存在的遗漏值的相关性。这必须是(缩写)的字符串之一"everything","all.obs","complete.obs","na.or.complete"或"pairwise.complete.obs"。


参数:digits
digits to print after the decimal separator.
打印后的小数点分隔符的数字。


参数:cutoff
correlation coefficients lower than this (in absolute value) are suppressed.
低于此的相关系数(绝对值)被抑制。


参数:object
a 'correlation' object.
“相关性”的对象。


参数:cutpoints
the cut points to use for categories. Specify only positive values (absolute value of correlation coefficients are summarized, or negative equivalents are automatically computed for the graph. Do not include 0 or 1 in the cutpoints).
的切点使用的类别。仅指定正值(相关系数的绝对值进行了总结,或否定形式的图形自动计算,不包括在分割点的0或1)。


参数:symbols
the symbols to use to summarize the correlation matrix.
符号使用以总结相关矩阵。


参数:outline
do we draw the outline of the ellipse?
我们勾勒出的椭圆形吗?


参数:palette
a function that can produce a palette of colors.
一个函数,可以产生颜色的调色板。


参数:col
color of the ellipse. If NULL (default), the colors will be computed using cutpoints and palette.
椭圆的颜色。如果NULL(默认),颜色将计算使用cutpoints和palette。


参数:numbers
do we print correlation values in the center of the ellipses?
我们打印的相关值,在中心的椭圆形?


参数:type
do we plot a complete matrix, or only lower or upper triangle?
我们绘制一个完整的矩阵,或只有下限或上限的三角吗?


参数:diag
do we plot items on the diagonal? They have always a correlation of one.
我们画出对角线上的项目吗?他们总有一个相关的一个。


参数:cex.lab
the expansion factor for labels.
标签的膨胀系数。


参数:cex
the expansion factor for text.
文本的膨胀系数。


参数:...
further arguments passed to functions.
进一步的参数传递给函数。


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

correlation() and as.correlation() create a 'correlation' object, while is.correlation() tests for it.
correlation()和as.correlation()创建一个相关性的对象,而is.correlation()测试。

There are print() and summary() methods for the 'correlation' object that differ in the symbolic encoding of the correlations in summary(), using symnum, which makes large correlation matrices more readable.
有print()和summary()方法“相关性”的对象,不同的符号编码的相关性summary(),使用symnum,这使得大相关矩阵更具可读性。

The method plot returns nothing, but it draws ellipses on a graph that represent the correlation matrix visually. This is essentially the plotcorr() function from package ellipse, with slightly different default arguments and with default cutpoints equivalent to those used in the summary method.
的方法plot返回任何内容,但它代表的相关矩阵的可视化图形上绘制椭圆。这实际上是plotcorr()功能包椭圆形,略有不同的默认参数和默认cutpoints在summary方法所使用的。


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



Philippe Grosjean <phgrosjean@sciviews.org>, wrapping code in package ellipse,
function <code>plotcorr()</code> for the <code>plot.correlation()</code> method.




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

cov, cov2cor, cov.wt, symnum, plotcorr and look also at
cov,cov2cor,cov.wt,symnum,plotcorr和看也有


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


## This is a simple correlation coefficient[#这是一个简单的相关系数。]
cor(rnorm(10), runif(10))
## but this is a 'correlation' object containing a correlation matrix[#但是这是一个相关的对象,它包含一个相关矩阵]
correlation(rnorm(10), runif(10))

## 'correlation' objects allow better inspection of the correlation matrices[#相关性的对象,以便更好地检查的相关性矩阵]
## than the output of default R cor() function[#比的输出默认&#341;COR()函数]
(longley.cor <- correlation(longley))
summary(longley.cor) # Synthetic view of the correlation matrix[的相关矩阵综合视图]
plot(longley.cor)    # Graphical representation[图形表示]

## Use of the formula interface[#使用的公式接口]
(mtcars.cor <- correlation(~ mpg + cyl + disp + hp, data = mtcars,
    method = "spearman", na.action = "na.omit"))

mtcars.cor2 <- correlation(mtcars, method = "spearman")
print(mtcars.cor2, cutoff = 0.6)
summary(mtcars.cor2)
plot(mtcars.cor2, type = "lower")

mtcars.cor2["mpg", "cyl"] # Extract one correlation from the correlation matrix[从相关系数矩阵中提取一个相关]
## TODO: a plot comparing two correlation matrices[#TODO:比较两个相关矩阵的图]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-29 20:41 , Processed in 0.026846 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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