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

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

[复制链接]
发表于 2012-9-29 23:03:29 | 显示全部楼层 |阅读模式
rowChisqStats(scrime)
rowChisqStats()所属R语言包:scrime

                                        Rowwise Pearson's ChiSquare Statistic
                                         Rowwise Pearson的卡方统计

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

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

Computes for each row of a matrix the value of Pearson's ChiSquare statistic for testing if the corresponding categorical variable is associated with a (categorical) response, or determines for each pair of rows of a matrix the value of Pearson's ChiSquare statistic for testing if the two corresponding variables are independent.
计算每行一个矩阵的值Pearson的卡方统计量,如果在相应的分类变量的相关联的一个(分类)响应进行测试,或确定为各一对的矩阵行Pearson的卡方统计量的值进行测试,如果两个相应的变量都是独立的。


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


rowChisqStats(data, cl, compPval = TRUE, asMatrix = TRUE)



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

参数:data
a numeric matrix consisting of the integers between 1 and n.cat, where n.cat is the maximum number of levels the categorical variables can take. Each row of data must correspond to a variable, each row to an observation. Missing values and different numbers of levels a variable might take are allowed.
一个数字矩阵之间的整数n.cat,其中n.cat是分类变量可以采取的最大数量的水平。 data的每一行对应一个变量,每行观察。缺失值和水平变量可能采取的不同的检测号码,是允许的。


参数:cl
a numeric vector of length ncol(data) containing the class labels for the observations represented by the columns of data. The class labels must be coded by the integers between 1 and n.cl, where n.cl is the number of classes. If missing, the value of the statistic for Pearson's ChiSquare-test of independence will be computed for each pair of rows of data. Otherwise, the value of Pearson's ChiSquare-statistic for testing if the distribution of the variable differs between the groups specified by cl will be determined for each row of data.
一个数值向量的长度ncol(data)包含类标签的列data代表的意见。类标签必须被编码之间的整数n.cl,其中n.cl的班级数目。如果缺少,Pearson的ChiSquare-测试的独立的统计量的值将被计算为每对行data。否则,将确定的每一行ChiSquare,Pearson的cl的统计测试的变量的分布不同群体之间的指定data,。


参数:compPval
should also the p-value (based on the approximation to a  ChiSquare-distribution) be computed?
也应的p-值(基于近似ChiSquare分布)来计算?


参数:asMatrix
should the pairwise test scores be returned as matrix? Ignored if cl is specified. If TRUE, a matrix with m rows and columns is returned that contains the values of Pearson's ChiSquare-statistic in its lower triangle, where m is the number of variables. If FALSE, a vector of length m * (m - 1) / 2 is returned, where the value for testing the ith and jth variable is given by the j + m * (i - 1) - i * (i - 1) / 2 element of this vector.
成对的考试成绩应返回的矩阵?如果忽略cl指定。 TRUE如果,m行和列的矩阵返回一个包含Pearson的ChiSquare-统计量的值在其下方的三角形,其中m是变量的数目。如果FALSE,一个向量的长度m * (m - 1) / 2返回,i测试个的价值在哪里j个变量j + m * (i - 1) - i * (i - 1) / 2元素的这个向量。


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

If compPval = FALSE, a vector (or matrix if cl is not specified and as.matrix = TRUE) composed of the values of Pearson's ChiSquare-statistic. Otherwise, a list consisting of <table summary="R valueblock"> <tr valign="top"><td>stats</td> <td> a vector (or matrix) containing the values of Pearson's ChiSquare-statistic.</td></tr> <tr valign="top"><td>df</td> <td> a vector (or matrix) comprising the degrees of freedom of the asymptotic ChiSquare-distribution.</td></tr> <tr valign="top"><td>rawp</td> <td> a vector (or matrix) containing the (unadjusted) p-values.</td></tr>  </table>
如果compPval = FALSE,一个向量(或矩阵如果cl没有被指定,as.matrix = TRUE)由Pearson的ChiSquare-统计量的值。否则,列表中的<table summary="R valueblock"> <tr valign="top"> <TD> stats</ TD> <td>一个向量(或矩阵)的值Pearson的ChiSquare-统计量。</ TD> </ TR> <tr valign="top"> <TD>df </ TD> <td>一个向量(或矩阵),它包括的自由度的渐近ChiSquare分配。</ TD> </ TR> <tr valign="top"> <TD> rawp</ TD> <td>一个向量(或矩阵)(未经调整)的p值</ TD> </ TR> </ TABLE>


注意----------Note----------

Contrary to chisq.test, currently no continuity correction is done  for 2 x 2 tables.
相反,chisq.test,目前没有连续性校正2 x 2的表格。


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


Holger Schwender, <a href="mailto:holger.schwender@udo.edu">holger.schwender@udo.edu</a>



参考文献----------References----------

Schwender, H.\ (2007). A Note on the Simultaneous Computation of Thousands of  Pearson's <code>ChiSquare</code>-Statistics. Technical Report, SFB 475, Deparment of Statistics, University of Dortmund.

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

computeContCells, computeContClass
computeContCells,computeContClass


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


# Generate an example data set consisting of 5 rows (variables)[生成的示例数据集,包括5行(变量)]
# and 200 columns (observations) by randomly drawing integers [列和200列(观察)随机抽取整数]
# between 1 and 3.[在1和3之间。]

mat <- matrix(sample(3, 1000, TRUE), 5)
rownames(mat) <- paste("SNP", 1:5, sep = "")

# For each pair of rows of mat, test if they are independent.[对于每对行垫子,测试,如果它们是独立的。]

r1 <- rowChisqStats(mat)

# The values of Pearson's ChiSquare statistic as matrix.[Pearson的卡方统计值矩阵。]

r1$stats

# And the corresponding (unadjusted) p-values.[相应的(未经调整)的p值。]

r1$rawp

# Obtain only the values of the test statistic as vector[仅获得的检验统计量的值,作为矢量]

rowChisqStats(mat, compPval = FALSE, asMatrix =FALSE)


# Generate an example data set consisting of 10 rows (variables)[生成的示例数据集由10行(变量)]
# and 200 columns (observations) by randomly drawing integers [列和200列(观察)随机抽取整数]
# between 1 and 3, and a vector of class labels of length 200[在1和3之间,和一个向量的长度为200的类标记]
# indicating that the first 100 observation belong to class 1[表明第100观察属于1类]
# and the other 100 to class 2. [和其他100至2级。]

mat2 <- matrix(sample(3, 2000, TRUE), 10)
cl <- rep(1:2, e = 100)

# For each row of mat2, test if they are associated with cl.[对于每一行MAT2,测试是当它们存在与与cl。]

r2 <- rowChisqStats(mat2, cl)
r2$stats

# And the results are identical to the one of chisq.test[和结果之一chisq.test相同的]
pv <- stat <- numeric(10)
for(i in 1:10){
    tmp <- chisq.test(mat2[i,], cl)
    pv[i] <- tmp$p.value
    stat[i] <- tmp$stat
}

all.equal(r2$stats, stat)
all.equal(r2$rawp, pv)



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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-29 22:43 , Processed in 0.022031 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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