rowCors(scrime)
rowCors()所属R语言包:scrime
Rowwise Correlation with a Vector
一个向量的相关性Rowwise
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes Pearson's correlation coefficient of a vector with each row of a matrix.
计算的Pearson相关系数的向量与矩阵的每一行。
用法----------Usage----------
rowCors(X, y, trendStat = FALSE, use.n = NULL)
参数----------Arguments----------
参数:X
a numeric matrix in which each row represents a variable and each column an observation.
一个数字的矩阵中的每一行代表一个变量和每一列的观察。
参数:y
a numeric vector of length ncol(X).
一个数字矢量的长度ncol(X)。
参数:trendStat
instead of the correlation coefficients should the values of the statistic for a test of linear trend based on this coefficient be returned? If TRUE, then it is assumed that all variables in X and the variable represented by y are ordinal, and the values in X and y represent scores for the different levels.
而不是相关系数的统计量的值,根据这个系数的线性趋势测试应该返回?如果TRUE,那么就假设所有变量在X和所表示的变量y是序数,和值在X和y代表分数的不同级别。
参数:use.n
should the squared values of the correlation coefficient be multiplied by ncol(X)? Ignored if trendStat = FALSE. If FALSE, the squared values are multiplied by ncol(X) - 1. By default, the squared values are multiplied by ncol(X) if y shows two levels, leading to the Cochran-Armitage test of trend. Otherwise, they are multiplied by ncol(X) - 1.
应的相关系数的平方值乘以ncol(X)?如果忽略trendStat = FALSE。如果FALSE,平方值乘以ncol(X) - 1。默认情况下,平方值乘以ncol(X)如果y显示了两层,科克伦 - 阿米蒂奇测试的趋势。否则,它们乘以ncol(X) - 1。
值----------Value----------
A vector containing the rowwise values of Pearson's correlation coefficient (if trendStat = FALSE or the rowwise values of the trend statistics (if trendStat = TRUE.
如果一个向量包含的rowwise的Pearson相关系数的值(trendStat = FALSE或在rowwise的趋势统计值(如果trendStat = TRUE。
(作者)----------Author(s)----------
Holger Schwender, <a href="mailto:holger.schwender@udo.edu">holger.schwender@udo.edu</a>
参考文献----------References----------
Agresti, A.\ (2002). Categorical Data Analysis. Wiley, Hoboken, NJ. 2nd Edition.
参见----------See Also----------
rowTrendStats, rowCATTs, rowMsquares
rowTrendStats,rowCATTs,rowMsquares
实例----------Examples----------
# Generate a random matrix containing 10 continuous variables[生成一个随机矩阵,包含10个连续变量]
# and a vector representing a continuous variable.[和一个向量,表示一个连续变量。]
mat <- matrix(runif(200, 0, 20), 10)
y <- sample(runif(20, 0, 20))
# The correlations between y and each of row of mat are[y和每行的垫之间的相关性]
# computed by[计算方法]
rowCors(mat, y)
# Generate a random binary vector and a matrix consisting[产生一个随机的二进制向量和矩阵组成]
# of 10 ordinal variables with levels 0, 1, 2, where these [10有序变量与级别0,1,2,这些]
# values can be interpreted as scores for the differ [的值可以被解释为不同的分数]
# categories.[类别。]
mat <- matrix(sample(0:2, 500, TRUE), 10)
y <- sample(0:1, 50, TRUE)
# The values of the Cochran-Armitage trend statistic are[Cochran-Armitage趋势统计的值是]
# computed by[计算方法]
rowCors(mat, y, trendStat = TRUE)
# If the values of the general test of linear trend described[如果描述的值的一般测试的线性趋势]
# on page 87 of Agresti (2002) should be computed, then call[阿格雷斯蒂(2002年)第87页计算,然后调用]
rowCors(mat, y, trendStat = TRUE, use.n = FALSE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|