diagDA(sfsmisc)
diagDA()所属R语言包:sfsmisc
Diagonal Discriminant Analysis
对角线判别分析
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function implements a simple Gaussian maximum likelihood discriminant rule, for diagonal class covariance matrices.
此功能实现了一个简单的高斯最大似然判别规则,协方差矩阵为对角类。
用法----------Usage----------
dDA(x, cll, pool = TRUE)
## S3 method for class 'dDA'
predict(object, newdata, pool = object$pool, ...)
## S3 method for class 'dDA'
print(x, ...)
diagDA(ls, cll, ts, pool = TRUE)
参数----------Arguments----------
参数:x,ls
learning set data matrix, with rows corresponding to cases (e.g., mRNA samples) and columns to predictor variables (e.g., genes).
学习集数据矩阵,行对应的情况下(例如,mRNA样品)和列预测变量(例如,基因)。
参数:cll
class labels for learning set, must be consecutive integers.
学习组类的标签,必须是连续的整数。
参数:object
object of class dDA.
对象类dDA。
参数:ts, newdata
test set (prediction) data matrix, with rows corresponding to cases and columns to predictor variables.
测试集(预测)的数据矩阵的行对应的情况和列预测变量。
参数:pool
logical flag. If true (by default), the covariance matrices are assumed to be constant across classes and the discriminant rule is linear in the data. Otherwise (pool= FALSE), the covariance matrices may vary across classes and the discriminant rule is quadratic in the data.
逻辑标志。如果为true(默认情况下),协方差矩阵被认为是恒定的类,并判别是线性的数据。否则(pool= FALSE),协方差矩阵可能会有所不同跨类的判别规则是二次的数据的。
参数:...
further arguments passed to and from methods.
进一步传递的参数和方法。
值----------Value----------
dDA() returns an object of class dDA for which there are print and predict methods. The latter returns the same as diagDA():
dDA()返回一个类的对象dDA有print和predict方法。后者作为diagDA()返回相同的:
diagDA() returns an integer vector of class predictions for the test set.
diagDA()返回一个整数向量类,测试组的预测。
(作者)----------Author(s)----------
Sandrine Dudoit, <a href="mailto:sandrine@stat.berkeley.edu">sandrine@stat.berkeley.edu</a> and<br>
Jane Fridlyand, <a href="mailto:janef@stat.berkeley.edu">janef@stat.berkeley.edu</a> originally wrote
<code>stat.diag.da()</code> in CRAN package <span class="pkg">sma</span> which was modified
for speedup by Martin Maechler <a href="mailto:maechler@R-project.org">maechler@R-project.org</a>
who also introduced <code>dDA</code> etc.
参考文献----------References----------
Comparison of Discrimination Methods for the Classification of Tumors Using Gene Expression Data. (Statistics, UC Berkeley, June 2000, Tech Report \#576)
参见----------See Also----------
lda and qda from the MASS package.
lda和qdaMASS包。
实例----------Examples----------
## two artificial examples by Andreas Greutert:[两个人工由Andreas Greutert的例子:]
d1 <- data.frame(x = c(1, 5, 5, 5, 10, 25, 25, 25, 25, 29),
y = c(4, 1, 2, 4, 4, 4, 6:8, 7))
n.plot(d1)
library(cluster)
(cl1P <- pam(d1,k=4)$cluster) # 4 surprising clusters[4惊人的聚类]
with(d1, points(x+0.5, y, col = cl1P, pch =cl1P))
i1 <- c(1,3,5,6)
tr1 <- d1[-i1,]
cl1. <- c(1,2,1,2,1,3)
cl1 <- c(2,2,1,1,1,3)
plot(tr1, cex=2, col = cl1, pch = 20+cl1)
(dd.<- diagDA(tr1, cl1., ts = d1[ i1,]))# ok[行]
(dd <- diagDA(tr1, cl1 , ts = d1[ i1,]))# ok, too![好了,太!]
points(d1[ i1,], pch = 10, cex=3, col = dd)
## use new fit + predict instead :[#使用新飞度+预测,而不是:]
(r1 <- dDA(tr1, cl1))
(r1.<- dDA(tr1, cl1.))
stopifnot(dd == predict(r1, new = d1[ i1,]),
dd.== predict(r1., new = d1[ i1,]))
plot(tr1, cex=2, col = cl1, bg = cl1, pch = 20+cl1,
xlim=c(1,30), ylim= c(0,10))
xy <- cbind(x= runif(500, min=1,max=30), y = runif(500, min=0, max=10))
points(xy, cex= 0.5, col = predict(r1, new = xy))
abline(v=c( mean(c(5,25)), mean(c(25,29))))
## example where one variable xj has Var(xj) = 0:[#例如,其中一个变量XJ无功(XJ)= 0:]
x4 <- matrix(c(2:4,7, 6,8,5,6, 7,2,3,1, 7,7,7,7), ncol=4)
y <- c(2,2, 1,1)
m4.1 <- dDA(x4, y, pool = FALSE)
m4.2 <- dDA(x4, y, pool = TRUE)
xx <- matrix(c(3,7,5,7), ncol=4)
predict(m4.1, xx)## gave integer(0) previously[#给以前整数(0)]
predict(m4.2, xx)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|