summaryStatsCV(SpatioTemporal)
summaryStatsCV()所属R语言包:SpatioTemporal
Computes Summary Statistics for Cross-validation
计算汇总统计数据进行交叉验证
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes summary statistics for cross validation. Statistics that are computed include RMSE, R2, and coverage of CI:s; both for all observations and stratified by date.
计算汇总统计数据进行交叉验证。统计计算包括CI:S RMSE,R2,和覆盖范围的所有意见和分层日期。
用法----------Usage----------
summaryStatsCV(predCV, pred.naive = NULL, lta = FALSE,
by.date = FALSE, p = 0.95, trans = NULL)
参数----------Arguments----------
参数:predCV
Result of a cross-validation. Should be the output from predictCV.
交叉验证的结果。应该是输出predictCV。
参数:pred.naive
Result of naive prediction, this is used to compute modified R2 values. Should be the output from predictNaive.
天真的预测结果,这是用来计算修改后的R2值。应该是输出predictNaive。
参数:lta
Compute cross-validation statistics for the long term averages at each site. If trans!=NULL the transformation will be applied before computation of the averages, see compute.ltaCV for details.
计算交叉验证的术语平均每个站点的统计数据。如果trans!=NULL的转型将被应用在计算平均值之前,请参阅compute.ltaCV的详细信息。
参数:by.date
Compute individual cross-validation statistics for each time-point. May lead to the computation of very many statistics.
为每个时间点计算个别交叉验证的统计数字。可能会导致很多的统计数据计算。
参数:p
Approximate coverage of the computed confidence bands. The confidence bands are used when computing the coverage of the cross-validated predictions.
近似计算的置信区间的覆盖面。置信带的覆盖范围的交叉验证的预测计算时使用。
参数:trans
Transform observations and predictions before computing statistics. Different values for trans give different transforms:
转换前计算统计数据的观测和预测。不同的值trans给不同的转换:
NULLGives no transformation
NULL没有给出转换
0Takes the exponent of data, essentially assuming that data was originally log-transformed.
0注意到的指数数据,基本上假设数据最初登录变换。
non-zero values Raises the data to that power, assuming an original <br> root-transform, e.g. trans=2 gives the long term averages as <br> mean(obs^2) and mean(pred^2).
非零值引发该功率的数据,假设原始的<br>文章根变换,例如trans=2术语平均<BR>mean(obs^2)和mean(pred^2)。
值----------Value----------
Returns a list containing:
返回一个列表,其中包含:
参数:Stats
A data.frame where the columns contain RMSE, R2 and coverage of the width p confidence intervall(s). At a minimum this is computed for all observations. If pred.naive!=NULL four additional rows are added to Stats. These rows contain adjusted R2 that compare cross-validated predictions to predictions computed using predictNaive. The adjusted R2 are computed as (1 - MSE_cv/MSE_naive). For this to make sense the locations used for the naive predictions should not be among the locations that cross-validated predictions are computed for. If lta=TRUE one additional rows containing RMSE and R2 for the long term average predictions given by compute.ltaCV is added to Stats. If by.date=TRUE one additional rows containing RMSE, R2 and coverage is added to Stats for each unique observation date.
数据框列中包含RMSE,R2和覆盖范围的宽度p的信心intervall(S)。至少,这是计算的所有观测值。如果pred.naive!=NULL四个额外的行添加到Stats。这些行包含调整R2,比较交叉验证的预测,预测计算使用predictNaive,。调整后的R2的计算作为(1 - MSE_cv / MSE_naive)。这使天真的预言意义上的位置不应该是交叉验证的预测计算之间的位置。如果lta=TRUE一个额外的列的术语平均预测的RMSE和R2compute.ltaCV到Stats。如果by.date=TRUE RMSE,R2和覆盖范围包含一个额外的行添加到Stats为每一个独特的观察日。
参数:res, res.norm
Residuals and normalised residuals from the cross-validated predictions. Two (nbr of observations) - by (1) vectors with residuals for the observations in mesa.data.model$obs. The residuals are computed as: <br> res <- (predCV$pred.obs[,"obs"] -<br> predCV$pred.obs[,"pred"]) <br> res.norm <- res / sqrt(predCV$pred.obs[,"pred.var"]) <br> Here the normalised residuals are divided by the prediction standard deviation.
残差和标准化的残差交叉验证的预测。两个观测(NBR) - (1)向量的残差的意见mesa.data.model$obs。残差计算如下:参考res <- (predCV$pred.obs[,"obs"] -参考predCV$pred.obs[,"pred"])参考res.norm <- res / sqrt(predCV$pred.obs[,"pred.var"])参考这里的归一化残差标准差除以预测。
参数:lta
A data.frame with predicted and observed long term averages at each site, or NULL if lta=FALSE. If given this is the output from:<br> compute.ltaCV(predCV, trans) <br> See compute.ltaCV
预测和观察到的数据框与术语平均每个站点,或NULL如果lta=FALSE。如果给定的输出是:参考compute.ltaCV(predCV, trans)参考,请参阅compute.ltaCV
参数:p
Approximate coverage of the computed confidence bands, same as p in the input.
近似计算的置信区间,p在输入相同的覆盖范围。
(作者)----------Author(s)----------
Johan Lindstr枚m
参见----------See Also----------
See createCV and estimateCV for cross-validation set-up and estimation.
createCV和estimateCV交叉验证设置和估计。
For computing CV statistics, see also predictNaive and compute.ltaCV; for further illustration see plotCV and CVresiduals.qqnorm.
对于计算CV统计,predictNaive和compute.ltaCV;为进一步说明,请参阅plotCV和CVresiduals.qqnorm。
实例----------Examples----------
##load data[#加载数据]
data(mesa.data.model)
data(mesa.data.res)
##Extract pre-computed cross-validated predictions[#提取预先计算的交叉验证预测]
pred.cv <- mesa.data.res$pred.cv
##Naive predictions based on AQS sites only[#天真的预测基于AQS网站的唯一]
pred.N <- predictNaive(mesa.data.model, type="AQS")
##compute summary statistics[#计算汇总统计数据。]
stat.CV <- summaryStatsCV(pred.cv, pred.naive=pred.N,
lta=TRUE, by.date=TRUE)
##study the summary statistics (for observations and long term average)[#研究的汇总统计数据(观测及术语平均)]
stat.CV$Stats[1:2,]
##adjusted R2 values, these are slightly strange since we[#R2值调整,这是有些奇怪,因为我们]
##(in this case) are basing the naive predictions on [(在这种情况下)的基础天真的预测]
##things left out of the cross-validation.[#离开了交叉验证。]
stat.CV$Stats[(dim(stat.CV$Stats)[1]-3):dim(stat.CV$Stats)[1],]
##plot the RMSE for each date as a function of date[#为每个日期作为日期的函数绘制的RMSE]
plot(as.Date(rownames(stat.CV$Stats[3 dim(stat.CV$Stats)[1]-4),])),
stat.CV$Stats[3 dim(stat.CV$Stats)[1]-4),"RMSE"],
xlab="Date",ylab="RMSE")
##add over all RMSE as reference[#添加的所有RMSE作为参考]
abline(h=stat.CV$Stats["obs","RMSE"])
##Some plots for the residuals[#部分图的残差]
par(mfrow=c(2,2), mar=c(4.5,4.5,3,.5))
## residuals against observations[#反对的观察残差]
plot(mesa.data.model$obs$obs, stat.CV$res,
ylab="Residuals", xlab="Observations")
## Norm-plot for the residuals[#规范的残差图]
CVresiduals.qqnorm(stat.CV$res)
## Norm-plot and normalised residuals, these should be N(0,1).[#规范的图和标准化的残差,这些应该是N(0,1)。]
CVresiduals.qqnorm(stat.CV$res.norm, norm=TRUE)
## normalised residuals against the first temporal trend[#标准化残差对第一时间趋势]
CVresiduals.scatter(stat.CV$res.norm, mesa.data.model$F[,2],
xlab="First temporal trend")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|