predict.seqModel(robustHD)
predict.seqModel()所属R语言包:robustHD
Predict from a sequence of regression models
从回归模型的序列预测
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Make predictions from a sequence of regression models such as submodels along a robust least angle regression sequence.
从一个序列的回归模型,如沿一个强大的至少角回归序列的子模型进行预测。
用法----------Usage----------
## S3 method for class 'seqModel'
predict(object, newdata, s, ...)
参数----------Arguments----------
参数:object
the model fit from which to make predictions.
模型拟合,以便作出预测。
参数:newdata
new data for the predictors. If the model fit was computed with the formula method, this should be a data frame from which to extract the predictor variables. Otherwise this should be a matrix containing the same variables as the predictor matrix used to fit the model (including a column of ones to account for the intercept).
新的预测数据。如果模型拟合,计算公式法,这应该是一个数据框,从中提取的预测变量。否则,这应该是一个矩阵包含相同的变量的预测矩阵,用来拟合模型(包括一列的,用于拦截)。
参数:s
an integer vector giving the steps of the submodels for which to make predictions (the default is to use the optimal submodel).
整数向量,子模型来进行预测(默认是使用的最佳子模型)的步骤。
参数:...
additional arguments to be passed down to the respective method of coef.
额外的参数传递到各自的方法coef。
Details
详细信息----------Details----------
For predict.seqModel, the newdata argument defaults to the matrix of predictors used to fit the model such that the fitted values are computed.
对于predict.seqModel,newdata的参数默认的矩阵,用来拟合模型的拟合值计算的预测。
值----------Value----------
If only one submodel is requested, a numeric vector containing the corresponding predicted values.
如果只有一个子模型被请求时,包含相应的一个数值向量的预测值。
If multiple submodels are requested, a numeric matrix in which each column contains the predicted values from the corresponding submodel.
如果多个子模型被请求时,一个数字矩阵,其中的每一列包含从相应的子模型的预测值。
(作者)----------Author(s)----------
Andreas Alfons
参见----------See Also----------
predict, rlars
predict,rlars
实例----------Examples----------
## generate data[#生成数据]
# example is not high-dimensional to keep computation time low[例如不高维的计算时间保持低]
set.seed(1234) # for reproducibility[可重复性]
n <- 100 # number of observations[的观测数]
p <- 25 # number of variables[的变量数目]
beta <- rep.int(c(1, 0), c(5, p-5)) # coefficients[系数]
sigma <- 0.5 # controls signal-to-noise ratio[控制的信号 - 噪声比]
epsilon <- 0.1 # contamination level[污染水平]
x <- replicate(p, rnorm(n)) # predictor matrix[预测矩阵]
e <- rnorm(n) # error terms[误差项]
i <- 1:ceiling(epsilon*n) # observations to be contaminated[受到污染的意见]
e[i] <- e[i] + 5 # vertical outliers[垂直离群]
y <- c(x %*% beta + sigma * e) # response[响应]
x[i,] <- x[i,] + 5 # bad leverage points[坏的平衡点]
## fit robust LARS model[配合强大的LARS模型]
fit <- rlars(x, y)
## compute fitted values via predict method[#通过预测方法计算拟合值]
predict(fit)
predict(fit, s = 1:5)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|