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

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

[复制链接]
发表于 2012-9-28 20:37:49 | 显示全部楼层 |阅读模式
SPcaGrid(rrcovHD)
SPcaGrid()所属R语言包:rrcovHD

                                        Sparse Robust Principal Components based on Projection Pursuit (PP): GRID search Algorithm
                                         稀疏强大的主成分投影寻踪(PP):网格搜索算法的基础上

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

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

Computes an approximation of the PP-estimators for sparse and robust PCA using the grid search algorithm in the plane.
PP估计在飞机上使用网格搜索算法的稀疏和强大的PCA的近似计算。


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


    SPcaGrid(x, ...)
    ## Default S3 method:
SPcaGrid(x, k = 0, kmax = ncol(x), method = c ("mad", "sd", "qn"),
    lambda = 1, scale=FALSE, na.action = na.fail, trace=FALSE, ...)
    ## S3 method for class 'formula'
SPcaGrid(formula, data = NULL, subset, na.action, ...)



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

参数: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.
一个可选的数据框(或相似:model.frame),其中包含公式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 default is na.omit.
一个函数,它表示当数据包含NA的,应该发生什么。默认设置是由na.action的options,是na.fail,如果是没有设置的。默认的na.omit。


参数:...
arguments passed to or from other methods.
传递的参数或其他方法。


参数:x
a numeric matrix (or data frame) which provides the data for the principal components analysis.
一个数字矩阵(或数据框),它提供的数据,主成分分析。


参数:k
number of principal components to compute. If k is missing,  or k = 0, the algorithm itself will determine the number of  components by finding such k that l_k/l_1 >= 10.E-3 and  Σ_{j=1}^k l_j/Σ_{j=1}^r l_j >= 0.8.  It is preferable to investigate the scree plot in order to choose the number  of components and then run again. Default is k=0.  
主成分的数目来计算。如果k失踪,或k = 0,算法本身决定的元件数量由找到这样的k,l_k/l_1 >= 10.E-3和Σ_{j=1}^k l_j/Σ_{j=1}^r l_j >= 0.8。这是最好的卵石在选择组件的数量,然后再次运行图进行调查。默认是k=0。


参数:kmax
maximal number of principal components to compute. Default is kmax=10. If k is provided, kmax  does not need to be specified, unless k is larger than 10.
最大的主成分个数来计算。默认是kmax=10。如果k提供,kmax不需要被指定,除非k是大于10。


参数:method
the scale estimator used to detect the direction with the  largest variance. Possible values are "sd", "mad" and  "qn", the  latter can be called "Qn" too. "mad" is the  default value.
的比例的估计使用与最大方差的方向进行检测。可能的值有"sd","mad"和"qn",后者可以被称为"Qn"太。 "mad"是默认值。


参数:lambda
the sparseness constraint's strength(sPCAgrid only). A single value for all components, or a vector of length k with  different values for each component can be specified. See opt.TPO for the choice of this argument.  



参数:scale
a value indicating whether and how the variables should be  scaled. If scale = FALSE (default) or scale = NULL no scaling is  performed (a vector of 1s is returned in the scale slot).  If scale = TRUE the data are scaled to have unit variance. Alternatively it can  be a function like sd or mad or a vector of length equal  the number of columns of x. The value is passed to the underlying function and the result returned is stored in the scale slot.  Default is scale = FALSE
一个值,该值指示是否以及如何变量应该进行调整。如果scale = FALSE(默认)或scale = NULL不结垢(的向量1 scale插槽中返回的)。如果scale = TRUE的数据缩放到单位方差。另外,它可以是类似的函数sd或mad或向量的长度等于数列的x。该值被传递到底层函数,返回的结果存储在scale插槽。默认是scale = FALSE


参数:trace
whether to print intermediate results. Default is trace = FALSE
是否要打印的中间结果。默认是trace = FALSE


Details

详细信息----------Details----------

SPcaGrid, serving as a constructor for objects of class SPcaGrid-class  is a generic function with "formula" and "default" methods. For details see  sPCAgrid and the relevant references.
SPcaGrid,作为一个构造函数的类的对象SPcaGrid-class是一个通用的功能与“公式”和“默认”的方法。有关详细信息,请参阅sPCAgrid和相关文献。


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

An S4 object of class SPcaGrid-class which is a subclass of PcaGrid-class which in turn is a subclass of the  virtual class PcaRobust-class.
S4对象的类SPcaGrid-class这是PcaGrid-class这又是一个子类的虚拟类PcaRobust-class的一个子类。


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


Valentin Todorov <a href="mailto:valentin.todorov@chello.at">valentin.todorov@chello.at</a>




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

Algorithms for Projection-Pursuit Robust Principal Component Analysis, Chemometrics and Intelligent Laboratory Systems, Vol. 87, pp. 218-225.
Robust Sparse Principal Component Analysis Based on Projection-Pursuit,  To appear.

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



data(bus)
bus <- as.matrix(bus)

## calculate MADN for each variable[#计算每个变量的MADN]
xmad <- apply(bus, 2, mad)
cat("\nMin, Max of MADN: ", min(xmad), max(xmad), "\n")

## calculate MADN for each variable[#计算每个变量的MADN]
xqn <- apply(bus, 2, qn)
cat("\nMin, Max of Qn: ", min(xqn), max(xqn), "\n")


## MADN vary between 0 (for variable 9) and 34. Therefore exclude[#MADN 0(可变9)和34之间变化。因此排除]
##  variable 9 and divide the remaining variables by their MADNs.[#变量和分裂他们的MADNs其余变量。]
bus1 <- bus[, -c(9)]
p <- ncol(bus1)

madbus <- apply(bus1, 2, mad)
bus2 <- sweep(bus1, 2, madbus, "/", check.margin = FALSE)

xsd <- apply(bus1, 2, sd)
bus.sd <- sweep(bus1, 2, xsd, "/", check.margin = FALSE)

xqn <- apply(bus1, 2, Qn)
bus.qn <- sweep(bus1, 2, xqn, "/", check.margin = FALSE)

spc <- SPcaGrid(bus2, lambda=0, method="sd", k=p, kmax=p)
rspc <- SPcaGrid(bus2, lambda=0, method="qn", k=p, kmax=p)
summary(spc)
summary(rspc)
screeplot(spc, type="line", main="Classical PCA", sub="PC", cex.main=2)
screeplot(rspc, type="line", main="Robust PCA", sub="PC", cex.main=2)

##  find lambda[#找到的lambda]

K <- 4
lambda.sd <- 1.64
## Not run: [#不运行:]
    to.sd <- .tradeoff(bus2, k=K, lambda.max=2.5, lambda.n=100, method="sd")
    plot(to.sd, type="b", xlab="lambda", ylab="Explained Variance (percent)")
    abline(v=lambda.sd, lty="dotted")

## End(Not run)[#(不执行)]

spc.sd.p <- SPcaGrid(bus2, lambda=lambda.sd, method="sd", k=p)
.CPEV(spc.sd.p, k=K)
spc.sd <- SPcaGrid(bus2, lambda=lambda.sd, method="sd", k=K)
getLoadings(spc.sd)[,1:K]
plot(spc.sd)

lambda.qn <- 2.06
## Not run: [#不运行:]
    to.qn <- .tradeoff(bus2, k=K, lambda.max=2.5, lambda.n=100, method="qn")
    plot(to.qn, type="b", xlab="lambda", ylab="Explained Variance (percent)")
    abline(v=lambda.qn, lty="dotted")

## End(Not run)[#(不执行)]

spc.qn.p <- SPcaGrid(bus2, lambda=lambda.qn, method="qn", k=p)
.CPEV(spc.qn.p, k=K)
spc.qn <- SPcaGrid(bus2, lambda=lambda.qn, method="qn", k=K)
getLoadings(spc.qn)[,1:K]
plot(spc.qn)

## DD-plots[#DD图]
##[#]
## Not run:[#不运行:]
usr <- par(mfrow=c(2,2))
plot(SPcaGrid(bus2, lambda=0, method="sd", k=4), id.n.sd=0, main="Standard PCA")
plot(SPcaGrid(bus2, lambda=0, method="qn", k=4), id.n.sd=0, ylim=c(0,20))

plot(SPcaGrid(bus2, lambda=1.64, method="sd", k=4), id.n.sd=0, main="Stdandard sparse PCA")
plot(SPcaGrid(bus2, lambda=3.07, method="qn", k=4), id.n.sd=0, main="Robust sparse PCA")

par(usr)
## End (Not run)[#(不执行)]


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 19:45 , Processed in 0.021178 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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