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

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

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

                                        Principal Components Analysis
                                         主成分分析

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

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

Perform a principal components analysis on a matrix or data frame and return a pcomp object.
矩阵或数据框进行主成分分析,并返回一个pcomp对象。


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


pcomp(x, ...)
## S3 method for class 'formula'[类formula的方法]
pcomp(formula, data = NULL, subset, na.action,
    method = c("svd", "eigen"), ...)
## Default S3 method:[默认方法]
pcomp(x, method = c("svd", "eigen"), scores = TRUE,
    center = TRUE, scale = TRUE, tol = NULL, covmat = NULL,
        subset = rep(TRUE, nrow(as.matrix(x))), ...)

## S3 method for class 'pcomp'
print(x, ...)
## S3 method for class 'pcomp'
summary(object, loadings = TRUE, cutoff = 0.1, ...)
## S3 method for class 'summary.pcomp'
print(x, digits = 3, loadings = x$print.loadings,
    cutoff = x$cutoff, ...)

## S3 method for class 'pcomp'
plot(x, which = c("screeplot", "loadings", "correlations", "scores"),
    choices = 1L:2L, col = par("col"), bar.col = "gray", circle.col = "gray",
    ar.length = 0.1, pos = NULL, labels = NULL, cex = par("cex"),
    main = paste(deparse(substitute(x)), which, sep = " - "), xlab, ylab, ...)
## S3 method for class 'pcomp'
screeplot(x, npcs = min(10, length(x$sdev)), type = c("barplot", "lines"),
    col = "cornsilk", main = deparse(substitute(x)), ...)
## S3 method for class 'pcomp'
points(x, choices = 1L:2L, type = "p", pch = par("pch"),
    col = par("col"), bg = par("bg"), cex = par("cex"), ...)
## S3 method for class 'pcomp'
lines(x, choices = 1L:2L, groups, type = c("p", "e"),
    col = par("col"), border = par("fg"), level = 0.9, ...)
## S3 method for class 'pcomp'
text(x, choices = 1L:2L, labels = NULL, col = par("col"),
    cex = par("cex"), pos = NULL, ...)
## S3 method for class 'pcomp'
biplot(x, choices = 1L:2L, scale = 1, pc.biplot = FALSE, ...)

## S3 method for class 'pcomp'
pairs(x, choices = 1L:3L, type = c("loadings", "correlations"),
    col = par("col"), circle.col = "gray", ar.col = par("col"), ar.length = 0.05,
    pos = NULL, ar.cex = par("cex"), cex = par("cex"), ...)

## S3 method for class 'pcomp'
predict(object, newdata, dim = length(object$sdev), ...)
## S3 method for class 'pcomp'
correlation(x, newvars, dim = length(x$sdev), ...)
scores(x, ...)
## S3 method for class 'pcomp'
scores(x, labels = NULL, dim = length(x$sdev), ...)



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

参数:x
a matrix or data frame with numeric data.
矩阵或数字数据的数据框。


参数: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
either "svd" (the function uses prcomp), or "eigen" (the function uses princomp), or an abbreviation.
是"svd"(该函数使用prcomp),或"eigen"(该函数使用princomp),或简称。


参数:...
arguments passed to or from other methods. If x is a formula one might specify scale, tol or covmat.
传递的参数或其他方法。如果x是一个公式可以指定scale,tol或covmat。


参数:scores
a logical value indicating whether the score on each principal component should be calculated.
一个逻辑值,该值指示是否应计算各主成分得分。


参数:center
a logical value indicating whether the variables should be shifted to be zero centered. Alternately, a vector of length equal the number of columns of x can be supplied. The value is passed to scale. Note that this argument is ignored for method = "eigen" and the dataset is always centered in this case.
一个逻辑值,该值指示变量是否应该被转移至零为中心的。或者,一个向量的长度等于x的数目的列可以供给。该值传递给scale。请注意,此参数将被忽略method = "eigen"和数据集在这种情况下,始终围绕。


参数:scale
a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. The default is TRUE, which in general, is advisable. Alternatively, a vector of length equal the number of columns of x can be supplied. The value is passed to scale.
一个逻辑值,该值指示变量是否应扩展到单位方差分析发生之前。默认的是TRUE,这在一般情况下,是可取的。可替换地,一个向量的长度等于x的数目的列可以供给。该值传递给scale。


参数:tol
only when method = "svd". A value indicating the magnitude below which components should be omitted. (Components are omitted if their standard deviations are less than or equal to tol times the standard deviation of the first component.) With the default null setting, no components are omitted. Other settings for tol could be tol = 0 or tol = sqrt(.Machine$double.eps), which would omit essentially constant components.
只有当method = "svd"。值,低于该组件的大小应该被忽略。 (组件被省略,如果它们的标准偏差小于或等于tol倍的标准偏差的第一成分。)使用默认的空值,没有部件被省略。其他设置为TOL可能是tol = 0或tol = sqrt(.Machine$double.eps),省略基本上是恒定的组件。


参数:covmat
a covariance matrix, or a covariance list as returned by cov.wt (and cov.mve or cov.mcd from package MASS). If supplied, this is used rather than the covariance matrix of x.
返回的cov.wt(cov.mve或cov.mcd包MASS)的协方差矩阵或协方差列表。如果提供,这是使用而不是协方差矩阵x。


参数:object
a 'pcomp' object.
一个PCOMP对象。


参数:loadings
do we also summarize the loadings?
我们还介绍了负荷?


参数:cutoff
the cutoff value below which loadings are replaced by white spaces in the table. That way, larger values are easier to spot and to read in large tables.
由表中的空格被替换的截止值,低于该载荷。这样一来,值越大更容易被发现和阅读大表。


参数:digits
the number of digits to print.
要打印的数字的数量。


参数:which
the graph to plot.
要绘制的图形。


参数:choices
which principal axes to plot. For 2D graphs, specify two integers.
主要轴绘制。对于2D图形,指定两个整数。


参数:col
the color to use in graphs.
在图表中使用的颜色。


参数:bar.col
the color of bars in the screeplot.
的颜色的screeplot条形。


参数:circle.col
the color for the circle in the loadings or correlations plots.
负荷或相关图中的圆圈的颜色。


参数:ar.length
the length of the arrows in the loadings and correlations plots.
长度的负荷和相关图中的箭头。


参数:pos
the position of text relative to arrows in loadings and correlations plots.
文本的位置,相对于负荷和相关图中的箭头。


参数:labels
the labels to write. If NULL default values are computed.
标签写。如果NULL的默认值计算。


参数:cex
the factor of expansion for text (labels) in the graphs.
的因素扩展的文本(标签)在图中。


参数:main
the title of the graph.
标题的图表。


参数:xlab
the label of X-axis.
X轴标签。


参数:ylab
the label of Y-axis.
Y-轴的标签。


参数:pch
type of symbol to use.
类型的符号使用。


参数:bg
background color for symbols.
背景颜色符号。


参数:groups
a grouping factor.
一组因素。


参数:border
the color of the border.
边框的颜色。


参数:level
the probability level to use to draw the ellipse.
用来绘制椭圆的概率水平。


参数:pc.biplot
do we create a Gabriel's biplot (see biplot() documentation)?
我们创建了一个加布里埃尔的双标图(参见biplot()文件)?


参数:npcs
the number of principal components to represent in the screeplot.
的主成分个数代表在screeplot。


参数:type
the type of screeplot ("barplot" or "lines") or pairs plot ("loadings" or "correlations").
类型的screeplot("barplot"或"lines")或双图("loadings"或"correlations")。


参数:ar.col
color of arrows.
颜色的箭头。


参数:ar.cex
expansion factor for terxt on arrows.
膨胀系数terxt的箭头。


参数:newdata
new individuals with observations for the same variables as those used for making the PCA. You can then plot these additional individuals in the scores graph.
用于使PCA的那些相同的变量与观测的新的个体。然后,您可以绘制这些额外的个人的分数图。


参数:newvars
new variables with observations for same individuals as those used for making the PCA. Correlation with PCs is calculated. You can then plot these additional variables in the correlation graph.
新的变量的PCA用于同一个人的观察。与PC相关的计算方法。然后,您可以绘制相关图中这些额外的变量。


参数:dim
The number of principal components to keep.
保留的主成分个数。


Details

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

pcomp() is a generic function with "formula" and "default" methods. It is essentially a wrapper around prcomp() and princomp() to provide a coherent interface and object for both methods.
pcomp()"formula"和"default"方法是一个泛型函数。它本质上是一个包装周围prcomp()和princomp()提供一个一致的界面和对象这两种方法。

A 'pcomp' object is created. It inherits from 'pca' (as in labdsv package, but not compatible with the 'pca' object of package ade4!) and of 'princomp'.
APCOMP“对象被创建。它继承从pca的(如labdsv包,但不兼容与pca的对象软件包ADE4!),和“主成分法。

For more information on calculation done, refer to prcomp for method = "svd" or princomp for method = "eigen".
完成计算的更多信息,请参阅prcompmethod = "svd"或princompmethod = "eigen"。


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

A c("pcomp", "pca", "princomp") object containing list components: <table summary="R valueblock"> <tr valign="top"><td>comp_i</td> <td> Description of comp_i.</td></tr> </table> TODO: complete this (also speak about the various methods)!
Ac("pcomp", "pca", "princomp")对象,其中包含列表组件:<table summary="R valueblock"> <tr valign="top"> <TD>comp_i </ TD> <TD>的描述,comp_i。“</ TD > </ TR> </ TABLE> TODO:完成(也讲的各种方法)!


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

The signs of the columns of the loadings and scores are arbitrary, and so may differ between different programs for PCA, and even between different builds of R.
列的负荷和成绩的迹象是任意的,所以PCA不同的程序之间可能会有所不同,甚至不同的版本之间的R.


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



Philippe Grosjean &lt;phgrosjean@sciviews.org&gt;, but the core code is indeed in
package stats.




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

vectorplot, prcomp, princomp,
vectorplot,prcomp,princomp,


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


## We will analyze mtcars without the Mercedes data (rows 8:14)[#我们将分析mtcars,没有奔驰的数据(行八时十四)]
data(mtcars)
cars.pca <- pcomp(~mpg+cyl+disp+hp+drat+wt+qsec, data = mtcars, subset = -(8:14))
cars.pca
summary(cars.pca)
screeplot(cars.pca)

## Loadings are extracted and plotted like this[#荷载这样的提取和绘制]
(cars.ldg <- loadings(cars.pca))
plot(cars.pca, which = "loadings") # Equivalent to vectorplot(cars.ldg)[相当于vectorplot(cars.ldg)]

## Similarly, correlations of variables with PCs are extracted and plotted[#同样,与PC的变量的相关性被提取出来并绘制]
(cars.cor <- correlation(cars.pca))
plot(cars.pca, which = "correlations") # Equivalent to vectorplot(cars.cor)[相当于vectorplot(cars.cor)]
## One can add supplementary variables on this graph[在这个图表上,可以添加补充变量]
lines(correlation(cars.pca,
    newvars = mtcars[-(8:14), c("vs", "am", "gear", "carb")]))

## Plot the scores[#图的分数]
plot(cars.pca, which = "scores", cex = 0.8) # Similar to plot(scores(x)[, 1:2])[相似图(得分(X)[1:2])]
## Add supplementary individuals to this plot (labels), use also points() or lines()[添加补充个人图(标签),还可以使用点()或线()]
text(predict(cars.pca, newdata = mtcars[8:14, ]), col = "gray", cex = 0.8)

## More scores plot[#更多的得分图]
## TODO...[#TODO ...]

## Pairs plot for 3 PCs[对图3台电脑]
iris.pca <- pcomp(iris[, -5])
pairs(iris.pca, col = (2:4)[iris$Species])

## rgl plot for 3 PCs[#3台电脑的RGL图]
## TODO...[#TODO ...]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-29 20:52 , Processed in 0.021500 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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