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

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

[复制链接]
发表于 2012-9-30 13:03:53 | 显示全部楼层 |阅读模式
estimateCV(SpatioTemporal)
estimateCV()所属R语言包:SpatioTemporal

                                         Cross-Validated Estimation and Prediction
                                         交叉验证的估计和预测

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

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

Functions that perform cross-validated parameter estimation and prediction for the spatio-temporal model.
进行交叉验证的时空模型的参数估计和预测的功能。


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


estimateCV(par.init = 3, mesa.data.model, Ind.cv, type = "p",
           h = 0.001, diff.type = 1, lower = -15, upper = 15,
           hessian.all = FALSE, control =
           list(trace = 3, maxit = 1000))

predictCV(par, mesa.data.model, Ind.cv, type = "p",express=FALSE, Nmax = 1000,
          silent = TRUE)



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

参数:par.init
Vector or matrix of starting point(s) for the parameter estimation. See further fit.mesa.model.  
向量或矩阵的起点(S)的参数估计。另见fit.mesa.model。


参数:par
Vector or matrix of parameters. Cross-validated predictions are carried out using these parameter values. If par is a vector then the same parameter values will be used for all cross-validation sets. If par is a matrix the parameters in par[,i] will be used for the predictions of the cross-validation set given by Ind.cv[,i].  
向量或矩阵的参数。使用这些参数值进行交叉验证的预测。如果par是一个向量,然后使用相同的参数值将所有交叉验证集。设置的给定par如果par[,i]是一个矩阵中的参数Ind.cv[,i]将用于交叉验证的预测。


参数:mesa.data.model
Data structure holding observations, and information regarding the observation locations. See create.data.model and mesa.data.model.  
数据结构保持的观察,和有关的观察位置。见create.data.model和mesa.data.model。


参数:Ind.cv
Ind.cv defines the cross-validation scheme. Either a (number or observations) - by - (groups) logical matrix or an integer valued vector with length equal to (number or observations). See further createCV.  
Ind.cv定义交叉验证计划的。 (数或观察) - 由 - (组)的逻辑矩阵或一个整数值的向量,其长度等于(号码或意见)。另见createCV。


参数:type
A single character indicating the type of log-likelihood to use. Valid options are "f", "p", and "r", for full, profile or restricted maximum likelihood (REML).  
一个单字符表示的对数似然使用的类型。有效的选项为“F”,“P”和“R”,个人资料或约束最大似然(REML)。


参数:express
logical: should an “express” version of predictions be returned as a single data frame, without variances?  For more datails see under “Value” (defaults to FALSE).   
逻辑:“快速”版本的预测,作为一个单一的数据框返回,没有差异?对于更多的datails看到“价值”(默认为FALSE)。


参数:h, diff.type
Step length and type of finite difference to use when computing gradients. See loglike.grad and gen.gradient for details.  
步骤,有限差分计算梯度时要使用的长度和类型。 loglike.grad和gen.gradient的详细信息。


参数:lower, upper
Bounds on the variables, see optim.  
变量的界限,optim。


参数:hessian.all
If type!="f" computes hessian (and uncertainties) for both regression and log-covariance parameters, not only for log-covariance parameters. <br> See fit.mesa.model for details.  
如果type!="f"计算麻袋(不确定性)的回归和log - 协方差参数,不仅为log - 协方差参数。参考见fit.mesa.model的详细信息。


参数:control
A list of control parameters for the optimisation. See optim for details.  
列表控制参数的优化。见optim的详细信息。


参数:Nmax
Limits the size of matrices constructed when computing the expectations. See cond.expectation.  
矩阵计算的期望时,构造的大小限制。见cond.expectation。


参数:silent
If FALSE outputs brief progress information. If TRUE no output.  
如果FALSE输出简短的进度信息。如果TRUE不输出。


Details

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

For estimateCV the inital parameters for the optimisation can be given as a vector of single starting point, as a matrix of multiple starting point, or as a single value. If par.init is a single integer then multiple starting points will be created as a set of constant vectors with the values of each starting point taken as seq(-5, 5, length.out=par.init).
对于estimateCV>初始参数的优化可被指定为单起点的向量,作为一个矩阵的多个起点,或作为一个单一的值。如果par.init是一个整数,那么将创建多个出发点,为一组的值的常量向量的每一个起点,作为seq(-5, 5, length.out=par.init)。

For predictCV the parameters used to compute predictions for the left out observations can be either a single vector or a matrix with dim(par)[2]=dim(Ind.cv)[2] (or <br> dim(par)[2]=max(Ind.cv)). For a single vector the same parameter values will be  used for all cross-validation predictions, for a matrix the parameters in par[,i] will be used for the predictions of the cross-validation set given by Ind.cv[,i] (or Ind.cv==i). A suitable matrix is provided in the output from estimateCV.
predictCV左向外观察的预测来计算的参数可以是一个向量或矩阵dim(par)[2]=dim(Ind.cv)[2](或参考dim(par)[2]=max(Ind.cv))。对于一个向量相同的参数值将被用于所有交叉验证的预测,集par[,i](或矩阵中的参数Ind.cv[,i]将用于交叉验证的预测Ind.cv==i“)。一个合适的矩阵设置在输出从estimateCV。

The cross-validation groups are given by Ind.cv. Ind.cv should be either a (number of observations) - by - (groups) logical matrix or an integer valued vector with length equal to (number of observations). If a matrix then each column defines a cross-validation set with the TRUE values marking the observations to be left out. If a vector then 1:s denote observations to be dropped in the first cross-validation set, 2:s observations to be dropped in the second set, etc. Observations marked by values <=0 are never dropped. See createCV for details.
交叉验证组的Ind.cv。 Ind.cv应该是一个数(观察) - 由 - (组)的逻辑矩阵或向量的长度等于一个整数值(若干意见)。如果一个矩阵的每一列定义交叉验证TRUE值标记的意见被冷落。如果一个向量,然后1:S表示观测到被丢弃在第一个交叉验证设置,2:在第二盘被丢弃的观察,等观察标记的值<=0的永不掉线。见createCV的详细信息。


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

estimateCV returns a list containing:
estimateCV返回一个列表,其中包含:


参数:par
A (number of parameters) - by - (number of groups) matrix containing the estimated parameters for each cross-validation group. This can be used as par-input to predictCV.  
A(数参数) - 由 - 基质中含有参数的估计,每个交叉验证组(组数)。这可以被用来作为par-输入到predictCV的。


参数:res.all
A list with (number of groups) elements. Each element is the best estimation result for that cross-validation group, <br> e.g. fit.mesa.model(...)$res.best.  
与(组数)元素列表。每一个元素是最好的估计结果,交叉验证,例如参考fit.mesa.model(...)$res.best。

If &ldquo;express&rdquo;=FALSE (default), predictCV returns a list containing:
如果“明示”=FALSE(默认),predictCV返回一个列表,其中包含:


参数:pred.obs
A data.frame with the observations, predictions and prediction variances. The elements in this data.frame are in the same order as those in <br> mesa.data.model$obs.  NULL if any observation occurs in more than one cross-validation set, <br> e.g. max(rowSums(Ind.cv))!=1.  
数据框的观测,预报和预测的差异。此数据框中的元素是在<br>文章mesa.data.model$obs中的那些相同的顺序。 NULL如果发生在一个以上的交叉验证组的任何意见,参考,例如max(rowSums(Ind.cv))!=1。


参数:pred.by.cv
A list with (number of groups) elements. Each element contains a data.frame with the observations, predictions and prediction variances for that <br> cross-validation group. The elements in each data.frame are in the same order as those in mesa.data.model$obs.  NULL if no observation occurs in more than one cross-validation set, <br> e.g. max(rowSums(Ind.cv))==1.  
与(组数)元素列表。每个元素包含一个数据框,下载交叉验证组的观测,预报和预测的差异。每个数据框中的元素是在那些在mesa.data.model$obs的相同的顺序的。 NULL如果没有观察到发生在一个以上的交叉验证集,参考如max(rowSums(Ind.cv))==1。


参数:pred.all
A list with (number of groups) elements. Each element contains a (number of time points) - by - (number of locations in that group) - by - (3) 3D-array. The arrays contain observations, predictions and prediction variances for the locations in each each cross-validation group.  
与(组数)元素列表。每个元素包含a(数目的时间点) - 按 - (该组中的位置数) -   - (3)三维阵列。该阵列包含的观测,预报和预测差异的位置在每个交叉验证组。

If &ldquo;express&rdquo;=TRUE, predictCV returns a data frame with information pertaining only to  observations predicted during the CV cycle (i.e., observations left out and predicted upon at least once). That data frame has vectors:
如果“明示”=TRUE,predictCV返回一个数据框的信息只涉及在CV周期(即,观察,预测后至少一次)预测的意见。该数据框的向量:


参数:ID
The location ID, as it appears in the &ldquo;location&rdquo; component of &ldquo;mesa.data.model&rdquo;
位置ID,因为它出现在“位置”组成部分“mesa.data.model”


参数:date
The observation's date
观察的日期


参数:raw
The actual observation as it appears in the &ldquo;obs&rdquo; component of &ldquo;mesa.data.model&rdquo;
实际的观察,因为它出现在“OBS”组件“mesa.data.model”


参数:lur
The prediction (on the model scale) without any spatial smoothing: see &ldquo;EX.mu&rdquo; under cond.expectation
预测的模型规模没有任何空间平滑:“EX.mu”在cond.expectation


参数:krig
The prediction (on the model scale) of the full model including spatial smoothing: see &ldquo;EX&rdquo; under cond.expectation
在模型上规模的完整的模型,包括空间平滑预测:见“EX”在cond.expectation


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



Johan Lindstr枚m (<code>predictCV</code> &ldquo;express&rdquo; option by Assaf Oron)




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

See createCV for creating CV-schemes.
见createCV CV计划。

The functions use fit.mesa.model for estimation and cond.expectation for prediction.
该函数使用fit.mesa.model估计和cond.expectation预测。

For computing CV statistics, see also compute.ltaCV,  predictNaive, and for further illustration see plotCV, CVresiduals.qqnorm,  and summaryStatsCV.
对于计算CV统计,也compute.ltaCV,predictNaive,并为进一步的说明,请参阅plotCV,CVresiduals.qqnorm和summaryStatsCV。


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


##Load data[#加载数据]
data(mesa.data.model)
data(mesa.data.res)

##create the CV structure defining 10 different CV-groups[#创建CV结构定义10种不同的CV组]
Ind.cv <- createCV(mesa.data.model, groups=10, min.dist=.1)

## Not run: [#不运行:]
##estimate different parameters for each CV-group[#估计每个CV组不同的参数]
dimm <- loglike.dim(mesa.data.model)
x.init <- as.matrix(cbind(rep(2,dimm$nparam.cov),c(rep(c(1,-3),dimm$m+1),-3)))
##This may take a while...[#这可能需要一段时间...]
par.est.cv <- estimateCV(par.est$res.best$par,
      mesa.data.model, Ind.cv)

## End(Not run)[#(不执行)]
##Get the pre-computed results instead.[#获取预先计算的结果,而不是。]
par.est.cv <- mesa.data.res$par.est.cv

##let's examine estimation of the results[#让我们来看看估计的结果]
names(par.est.cv)
##estimated parameters for each CV-group[#估计参数为每个CV组]
par.est.cv$par

##Convergence of the optimisation for each group[#各组的优化收敛]
sapply(par.est.cv$res.all,function(x) x$conv)

##boxplot of the different estimates from the CV[#箱线图的不同估计,从CV]
par(mfrow=c(1,1), mar=c(7,2.5,2,.5), las=2)
boxplot(t(par.est.cv$par))

## Not run: [#不运行:]
##Do cross-validated predictions using the newly [#交叉验证的预测,使用新]
##This may take a while...[#这可能需要一段时间...]
pred.cv <- predictCV(par.est.cv$par, mesa.data.model,
                     Ind.cv, silent = FALSE)

## End(Not run)[#(不执行)]
##Get the pre-computed results instead.[#获取预先计算的结果,而不是。]
pred.cv <- mesa.data.res$pred.cv
##examine the results[#检查的结果。]
names(pred.cv)

##Alternatively, one can use the ``express'' option which should be faster and returns a compact dataset:[另外,我们可以使用#快速选项应该是速度更快,并返回一个紧凑的数据集:]
pred0.cv <- predictCV(par.est.cv$par, mesa.data.model,Ind.cv, silent = FALSE,express=TRUE)
#Instead of a list, a single data frame is returned:[取而代之的是,一个单一的数据框,则返回:]
head(pred0.cv)



##compute CV-statistics[#计算CV-统计量。]
pred.cv.stats <- summaryStatsCV(pred.cv, lta=TRUE, trans=0)
pred.cv.stats$Stats

##Plot observations with CV-predictions and prediction intervals[号地观测CV预测和预测区间]
par(mfcol=c(4,1),mar=c(2.5,2.5,2,.5))
plotCV(pred.cv,  1, mesa.data.model)
plotCV(pred.cv, 10, mesa.data.model)
plotCV(pred.cv, 17, mesa.data.model)
plotCV(pred.cv, 22, mesa.data.model)

##Residual QQ-plots[#的残余QQ图]
par(mfrow=c(1,2),mar=c(3,2,1,1),pty="s")
##Raw Residual QQ-plot[原始残余QQ图]
CVresiduals.qqnorm(pred.cv.stats$res)
##Normalized Residual QQ-plot[#归一化残差QQ积]
CVresiduals.qqnorm(pred.cv.stats$res.norm, norm=TRUE)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-11 05:54 , Processed in 0.021920 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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