predict(mixOmics)
predict()所属R语言包:mixOmics
Predict Method for PLS, sPLS, PLS-DA or sPLS-DA
PLS,SPLS,PLS-DA或SPLS-DA的预测方法
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Predicted values based on PLS, sparse PLS, PLS-DA or sparse PLS-DA models. New responses and variates are predicted using a fitted model and a new matrix of observations.
的基础上的PLS,稀疏的PLS,PLS-DA或稀疏的PLS-DA模型的预测值。新的反应和变元,预计使用拟合模型和一个新的矩阵观测。
用法----------Usage----------
## S3 method for class 'pls'
predict(object, newdata, ...)
## S3 method for class 'spls'
predict(object, newdata, ...)
## S3 method for class 'plsda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
## S3 method for class 'splsda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
参数----------Arguments----------
参数:object
object of class inheriting from "pls", "spls", "plsda" or "splsda".
继承的类的对象从"pls","spls","plsda"或"splsda"。
参数:newdata
data matrix in which to look for for explanatory variables to be used for prediction.
在其中寻找用于说明要用于预测的变量的数据矩阵。
参数:method
method to be applied for plsda or splsda to predict the class of new data, should be a subset of "centroids.dist", "mahalanobis.dist" or "max.dist" (see Details). Defaults to "all".
plsda或splsda来预测新的数据之类的,应该是一个子集"centroids.dist","mahalanobis.dist"或"max.dist"(详细申请方法) 。默认为"all"的。
参数:...
not used currently.
目前没有使用。
Details
详细信息----------Details----------
predict produces predicted values, obtained by evaluating the PLS, sparse PLS, PLSDA or sparse PLSDA model returned by pls, spls, plsda or splsda in the frame newdata. Variates for newdata are also returned.
predict产生的预测值,评估PLS,稀疏的PLS,PLSDA或稀疏PLSDA模型返回的pls,spls,plsda或splsda在框架newdata。分布随机newdata也回来了。
Different class prediction methods are proposed for plsda or splsda: "max.dist" is the naive method to predict the class. It is based on the predicted matrix (object$predict) which can be seen as a probability matrix to assign each test data to a class. The class with the largest class value is the predicted class. "centroids.dist" allocates the individual x to the class of Y minimizing dist(\code{x-variate}, G_l), where G_l, l = 1,...,L are the centroids of the classes calculated on the X-variates of the model. "mahalanobis.dist" allocates the individual x to the class of Y as in "centroids.dist" but by using the Mahalanobis metric in the calculation of the distance.
不同类的预测方法提出了plsda或splsda:"max.dist"是天真的类的方法来预测。它是基于预测矩阵(object$predict)可以被看作是一个概率矩阵分配一个类的每一个测试数据。最大的一类值的预测类的类。 "centroids.dist"分配个人x之类的Y最小化dist(\code{x-variate}, G_l),其中G_l,l = 1,...,L类的质心计算的X变异的模式。 "mahalanobis.dist"分配个别的x类Y作为"centroids.dist"但通过的距离的计算中使用的马氏度量。
值----------Value----------
predict produces a list with the following components:
predict产生一个列表,以下组件:
参数:predict
a three dimensional array of predicted response values. The dimensions correspond to the observations, the response variables and the model dimension, respectively.
一个三维阵列的预测响应值。尺寸的意见,响应变量和模型尺寸,分别对应于。
参数:variates
matrix of predicted variates.
矩阵预测的变元。
参数:B.hat
matrix of regression coefficients (without the intercept).
回归系数矩阵(不拦截)。
参数:class
vector or matrix of predicted class by using 1,...,ncomp (sparse)PLS-DA components.
使用1,...,“ncomp(稀疏)PLS-DA组件的向量或矩阵的预测类。
参数:centroid
matrix of coordinates for centroids.
矩阵的质心的坐标。
(作者)----------Author(s)----------
S茅bastien D茅jean, Ignacio Gonz谩lez, Kim-Anh L锚 Cao and Pierre Monget
参考文献----------References----------
参见----------See Also----------
pls, spls, plsda, splsda and http://www.math.univ-toulouse.fr/~biostat/mixOmics/ for more details.
pls,spls,plsda,splsda和http://www.math.univ-toulouse.fr/~抗生素的/ mixOmics /更多详细信息。
实例----------Examples----------
data(linnerud)
X <- linnerud$exercise
Y <- linnerud$physiological
linn.pls <- pls(X, Y, ncomp = 2, mode = "classic")
indiv1 <- c(200, 40, 60)
indiv2 <- c(190, 45, 45)
newdata <- rbind(indiv1, indiv2)
colnames(newdata) <- colnames(X)
newdata
pred <- predict(linn.pls, newdata)
plotIndiv(linn.pls, comp = 1:2, rep.space = "X-variate")
points(pred$variates[, 1], pred$variates[, 2], pch = 19, cex = 1.2)
text(pred$variates[, 1], pred$variates[, 2],
c("new ind.1", "new ind.2"), pos = 3)
## First example with plsda[#第一个例子plsda]
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- as.factor(liver.toxicity$treatment[, 4])
## if training is perfomed on 4/5th of the original data[#如果训练perfomed的4/5th的原始数据]
samp <- sample(1:5, nrow(X), replace = TRUE)
test <- which(samp == 1) # testing on the first fold[测试的第一倍]
train <- setdiff(1:nrow(X), test)
plsda.train <- plsda(X[train, ], Y[train], ncomp = 2)
test.predict <- predict(plsda.train, X[test, ], method = "max.dist")
Prediction <- levels(Y)[test.predict$class$max.dist[, 2]]
cbind(Y = as.character(Y[test]), Prediction)
## Second example with splsda[#第二个例子splsda]
splsda.train <- splsda(X[train, ], Y[train], ncomp = 2, keepX = c(30, 30))
test.predict <- predict(splsda.train, X[test, ], method = "max.dist")
Prediction <- levels(Y)[test.predict$class$max.dist[, 2]]
cbind(Y = as.character(Y[test]), Prediction)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|