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

R语言 SpatioTemporal包 fit.mesa.model()函数中文帮助文档(中英文对照)

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

                                         Estimation of the Spatio-Temporal Model
                                         估计的时空模型

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

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

Estimates parameters of the spatio-temporal model using maximum-likelihood, profile maximum likelihood or restricted maximum  likelihood (REML). The function uses the L-BFGS-B method in  optim to maximise loglike.
估计参数的时空模型,采用最大似然,型材最大的可能性或限制最大似然法(REML)。该功能采用L-BFGS-B方法在optim最大限度地loglike。


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


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



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

参数:x
Vector or matrix of starting point(s) for the optimisation. A vector will be treated as a single starting point. If x is a matrix the optimisation will be run using each column as a separate starting point. If x 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). See details below.  
优化开始点(s)的向量或矩阵。一个向量将被视为一个单一的出发点。如果x是一个矩阵的优化运行使用的每一列作为一个单独的出发点。如果x是一个整数,那么将创建多个出发点,为一组的值的常量向量的每一个起点,作为seq(-5, 5,       length.out=par.init)。见details下面。


参数: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 use. Valid options are "f", "p", and "r", for full, profile or restricted maximum likelihood (REML).  
一个单字符表示的对数似然使用的类型。有效的选项为“F”,“P”和“R”,个人资料或约束最大似然(REML)。


参数:h, diff.type
Step length and type of finite difference to use when computing gradients. <br> See loglike.grad and gen.gradient for details.  
步骤,有限差分计算梯度时要使用的长度和类型。 <br>查看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. See value below.  
如果type!="f"计算麻袋(不确定性)的回归和log - 协方差参数,不仅为log - 协方差参数。见value下面。


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


Details

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

The function estimates parameters for the spatio-temporal model using the full likelihood formulation, profile likelihood, or restricted maximum likelihood (REML). In principal full likelihood and profile likelihood should give the same results, corresponding to the maximum likelihood estimate, with the full likelihood approach being slower.
该函数估计参数的时空模型,使用的可能性完整的配方,型材的可能性,或限制最大似然法(REML)。在主要的可能性和个人资料的可能性,应该得到相同的结果,对应的最大似然估计,似然法的要慢。

The starting point(s) for the optimisation can either contain both regression parameters and log-covariances parameters for a total of loglike.dim(mesa.data.model)$nparam parameters or only contain the log-covariances covariances parameters <br> i.e. loglike.dim(mesa.data.model)$nparam.cov parameters. <br> If regression parameters are given but not needed (type!="f") they are dropped; if they are needed but not given they are inferred through a generalised least squares (GLS) computation, obtained by calling cond.expectation(x, mesa.data.model, only.pars=TRUE).
共loglike.dim(mesa.data.model)$nparam参数优化的出发点(s)为可以同时包含回归参数和log协方差参数,或只包含log协方差协方差参数参考即loglike.dim(mesa.data.model)$nparam.cov参数。 <br>如果回归参数,但没有必要(type!="f"),他们都将被丢弃,如果他们是必要的,但没有给他们推断通过一个广义最小二乘法(GLS)计算,通过调用cond.expectation(x, mesa.data.model, only.pars=TRUE)获得。

If x is a single integer then that many starting points will be created as vectors with the constant values for the log-covariance parameters being in the sequence seq(-5, 5, length.out=x); if needed the corresponding regression parameters are computed using GLS.
x如果是一个整数,那么将被创建为向量的log - 协方差参数序列中的常量值,许多出发点seq(-5, 5, length.out=x);如果需要相应的回归参数计算GLS 。

The estimation uses the L-BFGS-B method in optim to maximise loglike. Gradient calculations are done by loglike.grad; when specifying the type of finite differences to use note that central differences (diff.type=0) will <STRONG>drastically</STRONG> increase estimation time, often with <STRONG>little or no</STRONG> benefit to the optimisation.
估计使用的L-BFGS-Boptim的方法,以最大限度地提高loglike。梯度计算是由loglike.grad;指定类型的有限差分时使用注意中央的差异(diff.type=0)将<STRONG>显着</ STRONG>增加估计时间,经常与<STRONG>小的没有</ STRONG>有利于优化。

If multiple starting points are used this function returns all optimisation results, along with an indication of the best result. The best result is determined by first evaluating which of the optimisations have converged. Convergence is determined by checking that the output from optim has convergence==0 and that the hessian is negative definite, <br> i.e. all(eigen(hessian)$value < -1e-10). <br> Among the converged optimisations the one with the highest log-likelihood value is then selected as the best result.
如果有多个出发点都是用这个函数将返回所有优化的结果,最好的结果表明。最好的结果是由第一次评估的优化,融合。收敛是由检查的输出optim有convergence==0和hessian是负定的,<BR>即all(eigen(hessian)$value < -1e-10)。 <BR>在融合的优化,一个具有最高的对数似然值,然后选择最好的结果。

If none of the optimisations have converged the result with the highest log-likelihood value is selected as the best result.
如果没有的优化,融合的结果具有最高的对数似然值被选为最好的结果。


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

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


参数:res.best
A list containing the best optimisation result; elements are described below. Selection of the best result is described in details above.  
含有最佳的优化结果;元素列表描述如下。最好的结果是选择在details上述描述。


参数:res.all
A list with all the optimisations results, each element contains (almost) the same information as res.best, e.g. res.all[[i]] contains optimisation results for the i:th starting point.  
所有的优化结果列表,每个元素包含(几乎)相同的信息res.best,例如res.all[[i]]包含第i个出发点的优化结果。


参数:message
A text string with information regarding best value and number of converged optimisations.  
与信息方面的最佳融合优化,价值和数量的文本字符串。

Most of the elements in res.best (and in res.all[[i]]) are obtained from optim. The following is a brief description:
中的元素res.best(在res.all[[i]])获得optim。以下是简要说明:




par The best set of parameters found.
面值找到最好的一组参数。




value Log-likelihood value corresponding to par.
值的对数似然值对应的par。




counts The number of calls to loglike and
的调用次数计数loglike和




convergence 0 indicates successful convergence, see
收敛0表示成功融合,




message Additional information returned by optim.
返回optim的消息的更多信息。




hessian A symmetric matrix giving the finite difference
麻对称矩阵提供的有限差分




conv A logical variable indicating convergence; TRUE if convergence==0 and hessian is negative definite, see details above.
换一个逻辑变量,表示收敛; TRUE如果convergence==0和hessian是负定的,看到details以上。




par.init The initial parameters used for this optimisation.
par.init使用这种优化的初始参数。




par.all All parameters (both regression and log-covariance). Identical to par if type="f", otherwise computed as <br> cond.expectation(par, mesa.data.model, only.pars=TRUE).
par.all的所有参数(回归和log协方差)。相同的par如果type="f",否则计算<BR> cond.expectation(par, mesa.data.model, only.pars=TRUE)。




hessian.all The hessian for all parameters (both regression and log-covariance). Identical to <br> hessian if type="f".
hessian.all麻的所有参数(回归和log协方差)。相同<BR> hessian如果type="f"。

<STRONG>NOTE:</STRONG> Due to computational considerations hessian.all is computed only for <br> res.best.
<STRONG>注意:</ STRONG>由于计算考虑hessian.all只计算为<BR>res.best。


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



Johan Lindstr枚m




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

Uses the L-BFGS-B method in optim to maximise the log-likelihood given by loglike (with gradients from loglike.grad.
使用optim最大化对数似然梯度loglike(loglike.gradL-BFGS-B方法。

Expected names for x are given by loglike.var.names.
预期的名称x的loglike.var.names。

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

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


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


##load a model object[#加载一个模型对象]
data(mesa.data.model)

##examine the model[#检查模型]
printMesaDataNbrObs(mesa.data.model)

##covariates[#协变量]
mesa.data.model$LUR.list
mesa.data.model$ST.Ind

##Important dimensions of the model[#重要的模型尺寸]
dim <- loglike.dim(mesa.data.model)
print(dim)

##Set up initial parameter values for optimization[#设定初始参数值的优化]
x.init <- cbind(rep(2,dim$nparam.cov),
                c(rep(c(1,-3),dim$m+1),-3))
##and add names to the initial values[#添加名称为初始值]
rownames(x.init) <- loglike.var.names(mesa.data.model,
                                      all=FALSE)
print(x.init)

## Not run: [#不运行:]
##estimate parameters[#参数估计]
##This may take a while...[#这可能需要一段时间...]
par.est <- fit.mesa.model(x.init, mesa.data.model, type="p",
      hessian.all=TRUE, control=list(trace=3,maxit=1000))

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

##Optimisation status message[#优化状态消息]
par.est$message

##compare the estimated parameters for the two starting points[#比较参数估计值的两个出发点]
cbind(par.est$res.all[[1]]$par.all,
      par.est$res.all[[2]]$par.all)
##and values of the likelihood[#和值的可能性]
cbind(par.est$res.all[[1]]$value,
      par.est$res.all[[2]]$value)

##extract the estimated parameters[#提取参数的估计。]
x <- par.est$res.best$par.all

##and approximate uncertainties from the hessian[#和近似的不确定性,从麻]
x.sd <- sqrt(diag(-solve(par.est$res.best$hessian.all)))
names(x.sd) <- names(x)

##plot the estimated parameters with uncertainties[#图的估计参数的不确定性]
par(mfrow=c(1,1),mar=c(13.5,2.5,.5,.5))
plot(x, ylim=range(c(x-1.96*x.sd,x+1.96*x.sd)),
     xlab="", xaxt="n")
points(x-1.96*x.sd, pch=3)
points(x+1.96*x.sd, pch=3)
axis(1,1:length(x),names(x),las=2)

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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