loglike.grad(SpatioTemporal)
loglike.grad()所属R语言包:SpatioTemporal
Compute Gradient and Hessian for the Log-likelihood
对数似然计算梯度和Hessian
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes finite difference gradients and hessians for the log-likelihood functions loglike and loglike.naive.
计算有限差分梯度和黑森对数似然函数loglike和loglike.naive。
用法----------Usage----------
loglike.grad(x, mesa.data.model, type = "p", h = 0.001,
diff.type = 0)
loglike.naive.grad(x, mesa.data.model, type = "p", h = 0.001,
diff.type = 0)
loglike.hessian(x, mesa.data.model, type = "p", h = 0.001)
loglike.naive.hessian(x, mesa.data.model, type = "p", h = 0.001)
参数----------Arguments----------
参数:x
Point at which to compute the gradient or hessian. See loglike.
在计算梯度或麻点。见loglike。
参数:mesa.data.model
Data structure holding observations, and information regarding which <br> geographic and spatio-temporal covariates to use when fitting the model. See <br> create.data.model and mesa.data.model.
数据结构观察,和有关参考地域和时空的协变量拟合模型时使用的。见<BR>create.data.model和mesa.data.model。
参数:type
A single character indicating the type of log-likelihood to compute. Valid options are "f", "p", and "r", for full, profile or restricted maximum likelihood (REML). Computation of the full log-likelihood requires both regression and log-covariance parameters. Profile and REML require only log-covariance parameters.
一个单一的字符,指示对数似然计算的类型。有效的选项为“F”,“P”和“R”,个人资料或约束最大似然(REML)。完整的对数似然计算需要回归和log - 协方差参数。个人和REML只需要log - 协方差参数。
参数:h, diff.type
Step length and type of finite difference to use when computing gradients; positive values of diff.type gives forward differences, 0 gives central differences, and negative values gives backward differences. See gen.gradient for details.
步长和类型的有限差分计算梯度时使用的,正面的价值观diff.type提供了前进的差异,0给中央的差异,而负值给人很大差距。见gen.gradient的详细信息。
Details
详细信息----------Details----------
Uses gen.gradient and gen.hessian to compute finite difference derivatives of the log-likelihood function in loglike and loglike.naive.
使用gen.gradient和gen.hessianloglike和loglike.naive的对数似然函数的计算有限差分衍生工具。
Used by the model fitting function fit.mesa.model and provided for users who want to implement their own model fitting.
所使用的模型拟合函数fit.mesa.model,并提供给用户谁想要实现自己的模型拟合。
值----------Value----------
Returns the gradient (as a vector) or hessian matrix for the loglike and loglike.naive functions.
返回梯度(矢量)或Hessian矩阵为loglike和loglike.naive的功能。
警告----------Warning----------
loglike.naive.grad and loglike.naive.hessian may take <STRONG>very</STRONG> long time to run, use with extreme care.
loglike.naive.grad和loglike.naive.hessian可能需要<STRONG>的非常</ STRONG>长的时间来运行,使用时请特别小心。
(作者)----------Author(s)----------
Johan Lindstr枚m
参见----------See Also----------
Computes gradients and hessians for the log-likelihood function loglike.
计算梯度和黑森对数似然函数loglike。
Expected names for x are given by loglike.var.names.
预期的名称x的loglike.var.names。
Used by the estimation functions fit.mesa.model and run.MCMC.
使用估计功能fit.mesa.model和run.MCMC。
For general computation of gradient and hessian see gen.gradient and gen.hessian.
对于通用计算的梯度和Hessiangen.gradient和gen.hessian。
For further log-likelihood computations see loglike, loglike.dim, and <br> loglike.var.names.
对于进一步的对数似然计算loglike,loglike.dim,和<br>loglike.var.names。
实例----------Examples----------
## Not run: [#不运行:]
##load the data[#加载的数据。]
data(mesa.data.model)
##Compute dimensions for the data structure[#计算尺寸的数据结构]
dim <- loglike.dim(mesa.data.model)
##Let's create random vectors of values[#让我们创建随机向量的值]
x <- runif(dim$nparam.cov)
x.all <- runif(dim$nparam)
##Compute the gradients[#计算的梯度。]
Gf <- loglike.grad(x.all, mesa.data.model, "f")
Gp <- loglike.grad(x, mesa.data.model, "p")
Gr <- loglike.grad(x, mesa.data.model, "r")
##And the Hessian, this may take some time...[#和Hessian,这可能需要一些时间...]
Hf <- loglike.hessian(x.all, mesa.data.model, "f")
Hp <- loglike.hessian(x, mesa.data.model, "p")
Hr <- loglike.hessian(x, mesa.data.model, "r")
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|