run.MCMC(SpatioTemporal)
run.MCMC()所属R语言包:SpatioTemporal
MCMC Inference of Parameters in the Spatio-Temporal Model.
MCMC推断的时空模型中的参数。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Estimates parameters and parameter uncertainties for the spatio-temporal model using a Metropolis-Hastings based Markov Chain Monte Carlo (MCMC) algorithm.
使用一个大都市黑斯廷斯基于马尔可夫链蒙特卡罗(MCMC)算法的时空模型估计的参数和参数的不确定性。
用法----------Usage----------
run.MCMC(x, mesa.data.model, type = "f", N = 1000,
Hessian.prop = NA, Sigma.prop = NA, silent = TRUE)
参数----------Arguments----------
参数:x
Point at which to start the MCMC. Could be either only log-covariance parameters or regression and log-covariance parameters. If regression parameters are given but not needed they are dropped, if they are needed but not given they are inferred by calling <br> cond.expectation(x, mesa.data.model, only.pars=TRUE).
在开始MCMC点。可能是要么只log - 协方差参数或回归和log - 协方差参数。如果回归参数,但不需要他们被丢弃,如果他们需要,但没有给他们推断通过调用<BR> cond.expectation(x, mesa.data.model, only.pars=TRUE)。
参数:mesa.data.model
Data structure holding observations, and information regarding which <br> geographic and spatio-temporal covariates to use when fitting the model. <br> See create.data.model and mesa.data.model.
数据结构观察,和有关参考地域和时空的协变量拟合模型时使用的。参考见create.data.model和mesa.data.model。
参数:type
A single character indicating the type of log-likelihood to compute. Valid options are "f" or "r", for full, or restricted maximum likelihood (REML). Since profile is not a proper likelihood type="p" will revert (with a warning) to using the full log-likelihood. Computation of the full log-likelihood needs both regression and log-covariance parameters while REML only needs the log-covariance parameters.
一个单一的字符,指示对数似然计算的类型。有效的选项是“f”或“R”,充分,或限制最大似然法(REML)。由于配置文件是不恰当的可能性type="p"将恢复使用对数似然(警告)。完整的对数似然计算需要回归和log协方差的参数,而,REML只需要的log - 协方差参数。
参数:N
Number of MCMC iterations to run.
数MCMC迭代运行。
参数:Hessian.prop
Hessian (information) matrix for the log-likelihood, can be used to create a proposal matrix for the MCMC.
Hessian矩阵(信息)的矩阵,对数似然,可用于建立一个建议的MCMC矩阵。
参数:Sigma.prop
Proposal matrix for the MCMC.
建议矩阵的MCMC。
参数:silent
If FALSE outputs status information and brief progress information every 100:th iteration. If TRUE no output.
如果FALSE输出状态信息和简短的进度信息每100次迭代。如果TRUE不输出。
Details
详细信息----------Details----------
The function runs uses a Metropolis-Hastings algorithm (Hastings, 1970) to sample from the parameters of the spatio-temporal model, assuming flat priors for all the parameters (flat on the log-scale for the covariance parameters).
在运行该函数的所有参数的先验假设平(平log上规模的协方差参数)采用了大都市的黑斯廷斯算法(黑斯廷斯,1970年)的时空模型的参数进行采样,。
At each iteration of the MCMC new parameters are proposed using a random-walk with a proposal covariance matrix. The proposal matrix is determined as:
在每次迭代中的MCMC新的参数提出一个建议,协方差矩阵的随机行走。的建议矩阵被确定为:
1 If Sigma.prop is given then this is used.
1如果Sigma.prop这是使用。
2 If Sigma.prop=NA then we follow Roberts et.al. (1997) and compute <br> c <- 2.38*2.38/dim(Hessian.prop)[1]<br> Sigma.prop <- -c*solve(Hessian.prop).
2如果Sigma.prop=NA然后我们按照罗伯茨等人(1997年),并计算参考c <- 2.38*2.38/dim(Hessian.prop)[1]参考Sigma.prop <- -c*solve(Hessian.prop)。
3 If both Sigma.prop=NA and Hessian.prop=NA then the hessian is computed as <br> Hessian.prop <- loglike.hessian(x, mesa.data.model, type) <br> and Sigma.prop is computed according to point 2.
3如果两个Sigma.prop=NA和Hessian.prop=NA然后计算Hessian是作为参考Hessian.prop <- loglike.hessian(x, mesa.data.model, type)<br>和Sigma.prop根据第2点的计算。
The resulting proposal matrix is checked to ensure that it is positive definite before proceeding, <br> all(eigen(Sigma.prop)$value > 1e-10).
由此形成的提案的矩阵的检查,以确保这是正定的,然后再继续,<BR> all(eigen(Sigma.prop)$value > 1e-10)。
值----------Value----------
Returns a list containing:
返回一个列表,其中包含:
参数:par
A N - by - (number of parameters) matrix with the MCMC paths of the estimated parameters.
AN - BY - 矩阵(参数)的参数的估计与MCMC路径。
参数:log.like
A vector of length N with the log-likelihood values at each iteration.
的向量的长度N在每次迭代时的对数似然值。
参数:acceptance
A vector of length N with the acceptance probability of the MCMC proposal at each iteration. Can be used to study the overall acceptance rate.
一个向量的长度N MCMC建议在每次迭代的接受概率。可用于研究的总体合格率为。
参数:chol.prop
Choleskey factor of the proposal matrix.
choleskey因子的建议矩阵。
(作者)----------Author(s)----------
Johan Lindstr枚m
参考文献----------References----------
and their applications, Biometrika, 57, 97–109.
optimal scaling of random walk Metropolis algorithms, Annals of Probability, 7, 110–120.
参见----------See Also----------
See fit.mesa.model for ML-parameter estimation, both functions use log-likelihood given by loglike.
见fit.mesa.modelML参数估计,这两个函数使用对数似然的loglike。
Expected names for x are given by loglike.var.names.
预期的名称x的loglike.var.names。
For further optimization functions see loglike, loglike.var.names, <br> create.data.model, and cond.expectation.
为进一步优化功能看loglike,loglike.var.names,参考create.data.model,cond.expectation。
实例----------Examples----------
##load data[#加载数据]
data(mesa.data.model)
data(mesa.data.res)
##Extract parameters,[#提取参数,]
par <- mesa.data.res$par.est$res.best$par.all
##... and the Hessian.[#...和Hessian。]
H <- mesa.data.res$par.est$res.best$hessian.all
## Not run: [#不运行:]
##run the MCMC, this may take a while...[#运行MCMC,这可能需要一段时间...]
MCMC.res <- run.MCMC(par, mesa.data.model, N = 5000,
Hessian.prop = H, silent = FALSE)
## End(Not run)[#(不执行)]
##Get the precomputed results instead.[#获取预先计算的结果,而不是。]
MCMC.res <- mesa.data.res$MCMC.res
##components of the MCMC results[#组件的MCMC结果]
names(MCMC.res)
##The acceptance probability (alpha) for each step [#接受的概率(α)的每一步]
##in the Metropolis-Hastings algorithm.[#中的Metropolis-Hastings算法。]
summary(MCMC.res$acceptance)
##The MCMC-estimated parameters[#MCMC估计的参数]
summary(MCMC.res$par)
##MCMC tracks for four of the parameters[#MCMC四个轨道的参数]
par(mfrow=c(4,1),mar=c(2,2,2.5,.5))
for(i in c(4,9,13,15)){
plot(MCMC.res$par[,i], ylab="", xlab="", type="l",
main=colnames(MCMC.res$par)[i])
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|