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

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

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

                                         Computes Conditional Expectation for Unobserved Locations
                                         计算条件期望的未观测到的位置

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

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

Compute the conditional expectations (i.e. predictions) at the unobserved space-time locations.
计算条件期望(即预测),未观测到的空间位置。


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


cond.expectation(x, mesa.data.model, mesa.data = NA, Nmax = 1000,
    only.pars = FALSE, compute.beta = FALSE, no.nugget = FALSE,
    only.obs = FALSE, pred.var = TRUE, pred.covar = FALSE,
    combine.data = FALSE, type = "p")



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

参数:x
Model parameters for which to compute the conditional expectation.  
计算模型参数的条件期望。


参数:mesa.data.model
Data structure holding observations and information regarding where to compute predictions. Predictions are computed conditional on the observations in mesa.data.model. See further mesa.data.model.  
数据结构持有的观测和计算预测的信息。预测计算条件的意见mesa.data.model。另见mesa.data.model。


参数:mesa.data
Data structure holding additional locations, geographic covariates, and spatio-temporal covariates, smooth temporal trends, and optionally additional observations. See further mesa.data.  
其他位置,GEO协变量和的时空协变量,平滑的变化趋势,以及可选的额外观测的数据结构。另见mesa.data。


参数:Nmax
Limits the size of matrices constructed when computing expectations. Use a smaller value if memory becomes a problem.  
矩阵计算的期望时,构造的大小限制。使用一个较小的值,如果内存成为一个问题。


参数:only.pars
Compute only the regression parameters (using GLS) along with the related variance.  only.pars=TRUE is incompatible with type="f"  
只计算回归参数(使用的GLS)连同相关的方差。 only.pars=TRUE是不符合type="f"的


参数:compute.beta
Compute the latent beta-fields at all locations in mesa.data.model and/or mesa.data.  
计算潜在的β-字段,在所有位置mesa.data.model和/或mesa.data。


参数:no.nugget
Set the nugget for the residual nu field to zero when computing the conditional expectations. Makes no difference at unobserved locations but implies smoothing at locations with observations.  
设置金块计算条件期望为零时的剩余NU领域。在未观察到的位置,但没什么区别,意味着平滑的观测地点。


参数:only.obs
Compute predictions at only the observations specified in mesa.data. Used to limit computations when doing  cross-validation.  This requires that mesa.data!=NA and that mesa.data$obs$obs exist.  only.obs = TRUE is incompatible with combine.data =       TRUE and <br> pred.covar = TRUE.  
计算预测在指定的mesa.data的意见。做交叉验证时,用于限制计算。这要求mesa.data!=NA mesa.data$obs$obs和存在。 only.obs = TRUE是不符合combine.data =       TRUE和<br>pred.covar = TRUE。


参数:pred.var
If TRUE, compute point-wise variances for the predictions.  
如果TRUE,逐点计算的预测的差异。


参数:pred.covar
If TRUE, compute covariance matrices for the predicted time series at each location.  pred.covar = TRUE implies pred.var = TRUE and sets Nmax equal to the number of timepoints.  pred.covar = TRUE is incompatible with only.obs       = TRUE.  
如果TRUE,计算协方差矩阵在每个位置的时间序列预测。 pred.covar = TRUE意味着pred.var = TRUE和集Nmax等于时间点数目。 pred.covar = TRUE是不兼容与only.obs       = TRUE。


参数:combine.data
If TRUE will combine locations and covariates from mesa.data.model and mesa.data, but will use temporal trends from mesa.data.model. Predictions are still conditional on only observations in mesa.data.model. See further combineMesaData.  combine.data = TRUE is incompatible with only.obs = TRUE  
如果TRUE将结合mesa.data.model和mesa.data,地点和协变量,从mesa.data.model但是会使用的时间趋势。预测仍然只观测条件mesa.data.model。另见combineMesaData。 combine.data = TRUE是不符合only.obs = TRUE的


参数: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)。


Details

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

Predictions are computed for the space-time locations in mesa.data.model and/or <br> mesa.data, conditional on the observations in mesa.data.model and parameters given in x.
预测计算中的时空位置“mesa.data.model和/或参考mesa.data,mesa.data.modelx和参数的观测条件。

Depending on the the model requested in type the parameters specified in x can be either the log-covariances or regression parameters and log-covariances parameters.
根据模型所要求的typex指定的参数可以的log - 协方差或回归参数和log协方差参数。

If type="f" the user has the freedom to specify all model parameters &ndash; including the regression coefficients &ndash; rather than just the log-covariance parameters. However, if type="f" and only log-covariance parameters are given then the regression parameters are inferred using generalised least squares (GLS). If type!="f" the regression parameters are always computed using GLS (any input is ignored). The GLS can be obtained through cond.expectation(x, mesa.data.model, only.pars = TRUE,     type="p").
如果type="f"用户的自由,而不是仅仅的log - 协方差参数指定所有模型的参数 - 包括回归系数 - 。但是,如果type="f",只有log - 协方差参数回归参数推断使用广义最小二乘法(GLS)。如果type!="f"回归参数计算的GLS(任何输入将被忽略)。可以通过GLS cond.expectation(x, mesa.data.model, only.pars = TRUE,     type="p")。

The space-time locations at which to compute predictions are specified through <br> mesa.data.model and mesa.data. If mesa.data=NA predictions will be computed at all space-time locations given in mesa.data.model. If mesa.data!=NA three options exist:
在哪些计算预测的空间 - 时间位置中指定通过<br>文章mesa.data.model和mesa.data。如果mesa.data=NA预测将被计算在mesa.data.model在所有的时空位置。如果mesa.data!=NA三个选项存在:

If combine.data=FALSE predictions will be given at only the space-time locations in mesa.data. If mesa.data does not have a smooth temporal trend, the trend in <br> mesa.data.model will be used (with a warning). Predictions are still computed conditional on the observations in mesa.data.model and any observations in mesa.data are ignored.
如果combine.data=FALSE预测在给定的空间位置在mesa.data。如果mesa.data不有一个平稳的时间趋势,这种趋势在参考mesa.data.model将被用于(警告)。预测仍然计算在mesa.data.model条件的意见和任何意见mesa.data将被忽略。

If combine.data=FALSE and only.obs=TRUE predictions are computed as in (1) <br> above, but only at space-time locations given in mesa.data$obs. This is primarily used to limit the number of computations needed when doing cross-validation.
如果combine.data=FALSE和only.obs=TRUE如在(1)<br>物理化学学报上述预测计算,但仅在空间 - 时间位置中给出mesa.data$obs。这主要是用来限制数的计算时,需要做交叉验证。

If combine.data=TRUE locations and covariates from both mesa.data.model and mesa.data are combined using combineMesaData. The smooth temporal trends are taken from mesa.data.model with trends in mesa.data being ignored. I.e. predictions are computed conditional on only the observations in mesa.data.model, at locations given in both mesa.data.model and mesa.data and at only the times specified in mesa.data.model$trend.
如果combine.data=TRUE位置和协变量的两个mesa.data.model和mesa.data相结合使用combineMesaData。平滑的变化趋势是从mesa.data.model与趋势mesa.data被忽略。即预测计算条件上只的意见,mesa.data.model,位置在两个mesa.data.model和mesa.data和在指定的时间在mesa.data.model$trend。

In addition to computing the conditional expectation at a number of space-time locations the function also computes predictions based on only the regression part of the model as well as the latent beta-fields (the latter only if compute.beta=TRUE).
另外计算的条件期望在一些空间位置的功能也可以计算预测的基础上回归模型的一部分,以及潜在的β-字段(后者只有compute.beta=TRUE“)。

<STRONG>NOTE:</STRONG> When computing the latent beta-fields, some matrix multiplications occur in a different order. this can lead to differences on the order of 1e-13 in some conditional expectations and variances.
<STRONG>注:</ STRONG>在计算潜在的测试领域,以不同的顺序出现一些矩阵乘法。这可能会导致不同的顺序1e-13在一些有条件的期望和方差。

Predictions variances can also be computed. If pred.var=TRUE point-wise variances for the predictions (and the latent beta-fields) are computed. If instead pred.covar=TRUE the full covariance matrices for each predicted time series is computed (as well as full covariance matrices for the latent beta-fields); this implies that the covariances between temporal predictions at the same location are calculated but not, due to memory restrictions, any covariances between locations.
期预测方差也可以被计算出来。如果pred.var=TRUE逐点计算的预测的差异(和潜在的β-字段)。相反,如果pred.covar=TRUE每个预测的时间序列的大的协方差矩阵的计算(以及大的协方差矩阵的潜β-字段),这意味着在同一位置的时间预测之间的协方差计算,但不由于内存的限制,任何位置之间的协方差。


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

The function returns a list containing:
该函数返回一个列表,其中包含:


参数:pars
A list with regression parameters and related variances. The variances are set to zero if type="f" and the input x contains the regression parameters.  pars contain gamma.E and alpha.E which are regression coefficients for the spatio-temporal model and land-use covaraiates respectively. The associated variances are found in gamma.V and alpha.V, with the cross-covariance between gamma and alpha in gamma.alpha.C  
回归参数列表和相关的差异。设置为0,如果type="f"和输入x回归参数的差异。 pars包含gamma.E和alpha.E这是回归系数的时空模型和土地使用covaraiates的分别。相关的变异被发现在gamma.V和alpha.V,与gamma和alphagamma.alpha.C之间的互协方差


参数:EX.beta.mu
A (number of locations) - by - (number of smooth trends) matrix with mean value component of the latent beta-fields (i.e. covariates * alpha).  NULL if compute.beta=FALSE.  
A(位置) - 由 - 矩阵数的顺利发展趋势与潜在的β-字段(即协变量*α)的平均值组成部分。 NULL如果compute.beta=FALSE。


参数:EX.beta
A (number of locations) - by - (number of smooth trends) matrix with predictions of the latent beta-fields.   NULL if compute.beta=FALSE.  
A(的位置) - 由 - 矩阵数的顺利发展趋势与预测的潜在β-字段。 NULL如果compute.beta=FALSE。


参数:VX.beta
A (number of locations) - by - (number of smooth trends) matrix or a (number of locations) - by - (number of locations) - by - (number of smooth trends) 3D-array containing the prediction (co)variances for the beta-fields.  NULL if compute.beta=FALSE or pred.var=FALSE, a matrix if <br> pred.covar=FALSE, and a 3D-array if pred.covar=TRUE.  
A(的位置) - 用 - (数字的平滑趋势)矩阵或一个数(位置) - 由 - (位置) - 由 - (数字的平滑趋势)三维数组,其中包含的预测(CO)的差异β-场。 NULL如果compute.beta=FALSE或pred.var=FALSE,如果参考pred.covar=FALSE,和一个3D阵列矩阵如果pred.covar=TRUE。


参数:EX.mu
A (number of timepoints) - by - (number of locations) matrix with predictions based on only the regression parameters, geographic covariates, and temporal trends. I.e. only the deterministic part of the spatio-temporal model. Predictions are computed at the space-time locations defined by mesa.data.model and/or mesa.data.  If only.obs=TRUE this is a vector with predictions at the space-time locations of the observations in mesa.data$obs.  
A(数的时间点) - 由 - (位置)矩阵的基础上回归参数,GEO协变量和时间趋势的预测。即只有确定性部分的时空的模型。预测计算的时空位置定义的mesa.data.model和/或mesa.data。如果only.obs=TRUE这是一个向量与预测在空间 - 时间位置中的观测mesa.data$obs。


参数:EX.mu.beta
Predictions based on the latent-beta fields, but not on the residual nu field; i.e. the predictions in EX.mu with kriging for the geographic covariates.  Same size as EX.mu above; NULL if compute.beta=FALSE.  
预测的潜在-β的基础上,而不是在的残留NU领域;即预测在EX.mu的GEO协变量克立格法。大小相同EX.mu以上; NULL如果compute.beta=FALSE。


参数:EX
Full predictions at the space-time locations defined by mesa.data.model and/or mesa.data.  Same size as EX.mu above.  
全部预测的时空位置定义的mesa.data.model和/或mesa.data。相同大小的EX.mu以上。


参数:VX
Pointwise prediction variances for all locations in EX above. <br> NULL if pred.var=FALSE.  
逐点预测EX以上所有位置的差异。参考NULL如果pred.var=FALSE。


参数:VX.full
A list with (number of locations) elements, each element is a (number of timepoints) - by - (number of timepoints) temporal covariance matrix for the predicted timeseries at that location. NULL if pred.covar=FALSE.  
列表(位置数)元素,每个元素是a(数目的时间点) - 由 - (数的时间点)的时间的协方差矩阵的预测的时间序列在该位置。 NULL如果pred.covar=FALSE。


参数:I
A vector with the locations of the observations in mesa.data.model or mesa.data. To extract predictions at these observations locations use EX[I]. NULL if only.obs=TRUE.  
一个向量的意见mesa.data.model或mesa.data的位置。在这些意见中提取的预测位置使用EX[I]。 NULL如果only.obs=TRUE。


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



Johan Lindstr枚m




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

For optimization functions see loglike,  loglike.var.names, create.data.model, <br> fit.mesa.model, and run.MCMC.
优化功能loglike,loglike.var.names,create.data.model,参考fit.mesa.model,run.MCMC。

For prediction see also fit.mesa.model, and  plotCV for plotting prediction results.
预测fit.mesa.model和plotCV绘制的预测结果。

combineMesaData is used to combine mesa.data and mesa.data.model structures.
combineMesaData是用来结合mesa.data和mesa.data.model结构。


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


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

##extract estimated parameters[#提取参数估计值。]
x <- mesa.data.res$par.est$res.best$par

##find regression parameters using GLS[#使用GLS回归参数]
x.reg <- cond.expectation(x, mesa.data.model, only.pars = TRUE)
str(x.reg)

## Not run: [#不运行:]
##compute predictions at all locations, including beta-fields[#计算预测在所有地点,包括β-字段]
EX <- cond.expectation(x, mesa.data.model, compute.beta=TRUE)
##compute predictions at only observations locations[#计算预测,在只观察位置]
EX.obs <- cond.expectation(x, mesa.data.model, mesa.data=mesa.data,
                           only.obs=TRUE, compute.beta=FALSE)

## End(Not run)[#(不执行)]
##Let's load precomputed results instead.[#我们,加载预先计算的结果,而不是。]
EX <- mesa.data.res$EX
EX.obs <- mesa.data.res$EX.obs

##Compare the predictions at all locations and only obs[#比较,只有在所有地点的预测OBS]
dim(EX$EX)
dim(EX.obs$EX)

##estimate beta from the observations for reference[估计测试的意见,以供参考]
##create data matrix[#创建数据矩阵。]
D <- create.data.matrix(mesa.data)
beta <- matrix(NA,dim(D)[2], dim(mesa.data$trend)[2])
##extact the temporal trends[#extact的时间趋势。]
F <- mesa.data$trend
##drop the date column[#删除日期列]
F$date <- NULL
##estimate the beta-coeficients at each location[#在每个位置估计的β-coeficients]
for(i in 1:dim(D)[2])
  beta[i,] <- summary(lm(D[,i] ~ as.matrix(F)))$coefficients[,1]

##Study the results[#研究的结果。]
##Start by comparing beta fields[#开始通过比较测试领域]
par(mfcol=c(1,1), mar=c(4.5,4.5,2,.5), pty="s")
plot(x=beta[,1], y=EX$EX.beta[,1], main="Temporal Intercept",
     xlab="Empirical estimate", ylab="Spatio-Temporal Model")
abline(0,1,col="grey")

##plot predictions and observations for 4 locations[#图4个地点的预测和观测]
par(mfrow=c(4,1),mar=c(2.5,2.5,2,.5))
plotPrediction(EX,  1, mesa.data.model)
plotPrediction(EX, 10, mesa.data.model)
plotPrediction(EX, 17, mesa.data.model)
plotPrediction(EX, 22, mesa.data.model)

##compare the only obs predictions with what we can extract from EX[#比较只开放式保税仓的预测,我们可以提取EX]
par(mfcol=c(1,1), mar=c(4.5,4.5,2,.5), pty="s")
plot(EX$EX[EX$I], EX.obs$EX)

##minor (1e-14) numerical differences in the results[未成年人(1E-14)的数值不同的结果]
print(range(EX$EX[EX$I]-EX.obs$EX))

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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