mle(spam)
mle()所属R语言包:spam
Maximum likelihood estimates
最大似然估计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Maximum likelihood estimates of a simple spatial model
最大似然估计的一个简单的空间模型
用法----------Usage----------
neg2loglikelihood.spam(y, X, distmat, Covariance,
beta, theta, Rstruct = NULL, ...)
neg2loglikelihood(y, X, distmat, Covariance,
beta, theta, ...)
mle.spam(y, X, distmat, Covariance,
beta0, theta0,
thetalower, thetaupper, optim.control=NULL,
Rstruct = NULL, hessian = FALSE,...)
mle(y, X, distmat, Covariance,
beta0, theta0,
thetalower, thetaupper, optim.control=NULL,
hessian = FALSE, ...)
mle.nomean.spam(y, distmat, Covariance,
theta0,
thetalower, thetaupper, optim.control=NULL,
Rstruct = NULL, hessian = FALSE, ...)
mle.nomean(y, distmat, Covariance,
theta0,
thetalower, thetaupper, optim.control=NULL,
hessian = FALSE, ...)
参数----------Arguments----------
参数:y
data vector of length n.
数据长度为n的向量。
参数:X
the design matrix of dimension n x p.
n维设计矩阵X P。
参数:distmat
a distance matrix. Usually the result of a call to nearest.dist.
距离矩阵。一般的,调用nearest.dist。结果
参数:Covariance
function defining the covariance. See example.
函数定义的协方差。请参阅示例。
参数:beta
parameters of the trend (fixed effects).
参数趋势(固定资产)。
参数:theta
parameters of the covariance structure.
参数的协方差结构。
参数:Rstruct
the Cholesky structure of the covariance matrix.
的协方差矩阵的的乔列斯基结构的。
参数:beta0,theta0
inital values.
>初始值。
参数:thetalower,thetaupper
lower and upper bounds of the parameter theta.
的上限和下限的参数theta。
参数:optim.control
arguments passed to optim.
参数传递到optim。
参数:hessian
Logical. Should a numerically differentiated Hessian matrix be returned?
逻辑。如果一个数字分化Hessian矩阵回来了吗?
参数:...
additional arguments passed to chol.
额外的参数传递给chol。
Details
详细信息----------Details----------
We provide functions to calculate the negative-2-log-likelihood and maximum likelihood estimates for the model
我们所提供的功能来计算负对数似然估计和最大似然估计的模型
y ~ N_n( X beta, Sigma(h;theta) )
Y~N_N(X测试版,适马(Hθ))
in the case of a sparse or ordinary covariance matrices.
在稀疏或普通的协方差矩阵的情况下。
In the case of the *.spam versions, the covariance function has to return a spam object. In the other case, the methods are correctly overloaded and work either way, slightly slower than the *.spam counterparts though.
以*.spam版本的情况下,协方差函数返回一个spam对象。在其他情况下,正确的方法是重载,无论哪种方式工作,速度稍慢比*.spam同行,但。
When working on the sphere, the distance matrix has to be transformed by
当工作在球体上,距离矩阵也必须改变
h -> R / 2 sin(h/2)
H - > R / 2罪(H / 2)
where R is the radius of the sphere.
其中,R为半径的球体。
The covariance function requires that the first argument is the distance matrix and the second the parameters. One can image cases in which the covariance function does not take the entire distance matrix but only some partial information thereof. (An example is the use of a kronecker type covariance structure.) In case of a sparse covariance construction where the argument Rstruct is not given, the first parameter element needs to be the range parameter. (This results from the fact, that a sparse structure is constructed that is independent of the parameter values to exploit the fast Choleski decomposition.)
协方差函数的第一个参数是距离矩阵和第二个参数。我们可以在图像的情况下,协方差函数不拿整个的距离矩阵,但只有一些局部的信息。 (一个例子是使用的一个的克罗内克类型的协方差结构。)的第一个参数元素在参数Rstruct没有给出一个稀疏的协方差结构的情况下,需要的范围参数。 (实际上,这将导致从一个稀疏结构的构造,是独立的参数值,利用快速Choleski分解。)
In the zero-mean case, the neg2loglikelihood is calculated by setting the parameters X or beta to zero.
在零均值的情况下,neg2loglikelihood设置的参数X或beta零计算。
值----------Value----------
The negative-2-loglikelihood or the output from the function optim.
负2-loglikelihood或从函数optim的输出。
(作者)----------Author(s)----------
Reinhard Furrer
参见----------See Also----------
chol
chol
实例----------Examples----------
# True parameter values:[真正的参数值:]
truebeta <- c(1,2,.2) # beta = (intercept, linear in x, linear in y)[β=(拦截在x,直线,直线在y)]
truetheta <- c(.5,2,.02) # theta = (range, sill, nugget)[θ=(范围,窗台,金块)]
# Auxiliary covariance function, parameterized by[辅助协方差函数,参数化]
# theta = (range, sill, nugget)[θ=(范围,窗台,金块)]
spherical <- function(distmat, theta, eps = 1e-06) {
Sigma <- distmat
d <- Sigma@entries/theta[1]
Sigma@entries <- ifelse(d < eps,
theta[3]+ theta[2],
ifelse(d < 1, theta[2]*(1 - 1.5*d + 0.5*d^3), 0))
return( Sigma)
}
# We now define a grid, distance matrix, and a sample:[现在,我们定义一个网格,距离矩阵,以及一个示例:]
x <- seq(0,1,l=5)
locs <- expand.grid( x, x)
X <- as.matrix( cbind(1,locs)) # design matrix[设计矩阵]
Covariance <- 'spherical' # covariance function[协方差函数]
distmat <- nearest.dist( locs, upper=NULL) # distance matrix[距离矩阵]
Sigma <- spherical( distmat, truetheta) # true covariance matrix[真正的协方差矩阵]
set.seed(15)
y <- c(rmvnorm.spam(1,X %*% truebeta,Sigma)) # construct sample[构建示例]
# Here is the negative 2 log likelihood:[这里是2负对数似然:]
neg2loglikelihood.spam( y, X, distmat, Covariance,
truebeta, truetheta)
# We pass now to the mle:[现在,我们通过极大似然估计:]
res <- mle.spam(y, X, distmat, Covariance,
truebeta, truetheta,thetalower=c(0,0,0),thetaupper=c(1,Inf,Inf))
# Similar parameter estimates here, of course:[类似的参数估计这里,当然:]
mle.nomean.spam(y-X%*%res$par[1:3], distmat, Covariance,
truetheta, thetalower=c(0,0,0), thetaupper=c(1,Inf,Inf))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|