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

R语言 spBayes包 covInvLogDet()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 14:23:01 | 显示全部楼层 |阅读模式
covInvLogDet(spBayes)
covInvLogDet()所属R语言包:spBayes

                                        Utility function for constructing predictive process covariance matrices
                                         效用函数的构造预测过程的协方差矩阵

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

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

Utility function for constructing predictive process covariance matrices
效用函数的构造预测过程的协方差矩阵


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


   covInvLogDet(coords, knots, cov.model, sigma.sq,
                  tau.sq, theta, modified.pp=TRUE, SWM=TRUE, ...)



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

参数:coords
a n x 2 matrix of the observation coordinates in R^2 (e.g., easting and northing).  
一个n x 2R^2(例如,东向和北向)的观察坐标矩阵。


参数:knots
a m x 2 matrix of knot coordinates.  
m x 2结坐标矩阵。


参数:sigma.sq
partial sill value.   
偏基台值。


参数:tau.sq
nugget value.  
金块价值。


参数:theta
if cov.model is matern then theta is a vector of the spatial decay and smoothness parameters; otherwise, theta is the spatial decay.   
如果cov.model是materntheta是一个矢量的空间衰减和平滑参数,否则,theta是空间衰减。


参数:modified.pp
a logical value indicating if the modified predictive process should be used.  
如果修改后的预测过程中应使用一个逻辑值,该值指示。


参数:cov.model
a quoted key word that specifies the covariance function used to model the spatial dependence structure among the observations.  Supported covariance model key words are: "exponential", "matern", "spherical", and "gaussian".  See below for details.   
一个带引号的关键字,指定的协方差函数用于模拟空间之间的依赖结构的观察。支持的协方差模型的关键词是:"exponential","matern","spherical"和"gaussian"。有关详细信息,请参见下文。


参数:SWM
a logical value indicating if the Sherman-Woodbury-Morrison equation should be used for computing the inverse (this is ignored if modified.pp is FALSE).   
这是一个逻辑值,表示如果“谢尔曼伍德伯里 - 莫里森公式可以计算反(忽略,如果modified.pp是FALSE)。


参数:...
currently no additional arguments.   
目前没有任何额外的参数。


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

Returns the covariance matrix, log-determinant, and inverse.
返回的协方差矩阵,数行列式和逆。


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



Andrew O. Finley <a href="mailto:finleya@msu.edu">finleya@msu.edu</a>, <br>
Sudipto Banerjee <a href="mailto:baner009@umn.edu">baner009@umn.edu</a>




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



set.seed(1)

n <- 100
coords <- cbind(runif(n),runif(n))

m <- 50
knots <- cbind(runif(m), runif(m))

theta <- c(6, 2)
sigma.sq <- 1
tau.sq <- 1
tol <- 1.0e-5

##[#]
##non bias-adjusted predictive process[#非偏置调整后的预测过程]
##[#]
c1 <- covInvLogDet(coords=coords, knots=knots, cov.model="exponential",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=FALSE, SWM=FALSE)

if(max(abs(chol2inv(chol(c1$C)) - c1$C.inv)) > tol) stop("test-1 failed")
if(max(abs(2*sum(log(diag(chol(c1$C)))) - c1$log.det)) > tol)
stop("test-1 failed")


c2 <- covInvLogDet(coords=coords, knots=knots, cov.model="matern",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=FALSE, SWM=FALSE)

if(max(abs(chol2inv(chol(c2$C)) - c2$C.inv)) > tol) stop("test-2 failed")
if(max(abs(2*sum(log(diag(chol(c2$C)))) - c2$log.det)) > tol)
stop("test-2 failed")

##[#]
##bias-adjusted predictive process[偏置调整后的预测过程]
##[#]
c3 <- covInvLogDet(coords=coords, knots=knots, cov.model="exponential",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=TRUE, SWM=FALSE)

if(max(abs(chol2inv(chol(c3$C)) - c3$C.inv)) > tol) stop("test-3 failed")
if(max(abs(2*sum(log(diag(chol(c3$C)))) - c3$log.det)) > tol)
stop("test-3 failed")


c4 <- covInvLogDet(coords=coords, knots=knots, cov.model="matern",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=TRUE, SWM=FALSE)

if(max(abs(chol2inv(chol(c4$C)) - c4$C.inv)) > tol) stop("test-4 failed")
if(max(abs(2*sum(log(diag(chol(c4$C)))) - c4$log.det)) > tol)
stop("test-4 failed")

##[#]
##non bias-adjusted predictive process using SWM[#非偏置调整后的预测过程中使用SWM]
##[#]
c5 <- covInvLogDet(coords=coords, knots=knots, cov.model="exponential",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=FALSE, SWM=TRUE)

if(max(abs(chol2inv(chol(c5$C)) - c5$C.inv)) > tol) stop("test-5 failed")
if(max(abs(2*sum(log(diag(chol(c5$C)))) - c5$log.det)) > tol)
stop("test-5 failed")

c6 <- covInvLogDet(coords=coords, knots=knots, cov.model="matern",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=FALSE, SWM=TRUE)

if(max(abs(chol2inv(chol(c6$C)) - c6$C.inv)) > tol) stop("test-6 failed")
if(max(abs(2*sum(log(diag(chol(c6$C)))) - c6$log.det)) > tol)
stop("test-6 failed")

##[#]
##Check SWM[#检查SWM]
##[#]
##c.str &lt;- sigma.sq*exp(-theta[1]*iDist(knots))[#c.str:< -  sigma.sq * EXP(-θ[1] * iDist(节))]
##ct &lt;- sigma.sq*exp(-theta[1]*iDist(coords,knots))[#CT:< -  sigma.sq * exp(-θ[1] * iDist(坐标,绳结))]
##C.inv.swm &lt;- diag(1/tau.sq,n)-diag(1/tau.sq,n)/%*/%ct/%*/%[#C.inv.swm < - 诊断(1/tau.sq,N)的诊断(1/tau.sq,N)/%* /%的CT /%* /%]
##  chol2inv(chol(c.str+t(ct)/%*/%diag(1/tau.sq,n)/%*/%ct))/%*/%[#chol2inv(哲(c.str + T(CT)/%* /%诊断(1/tau.sq,N)/%* /%克拉))/%* /%]
##  t(ct)/%*/%diag(1/tau.sq,n)[#T(CT)/%* /%的诊断(1/tau.sq,&#327;)]
##if(max(abs(C.inv.swm - c5$C.inv)) &gt; tol) stop("test-5a failed")[#(最大(ABS(C.inv.swm  -  C5 $ C.inv))> TOL)停止(“-5A测试失败”)]

##[#]
##bias-adjusted predictive process using SWM[偏置调整后的预测过程中使用SWM]
##[#]
c7 <- covInvLogDet(coords=coords, knots=knots, cov.model="exponential",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=TRUE, SWM=TRUE)

if(max(abs(chol2inv(chol(c7$C)) - c7$C.inv)) > tol) stop("test-7 failed")
if(max(abs(2*sum(log(diag(chol(c7$C)))) - c7$log.det)) > tol)
stop("test-7 failed")

c8 <- covInvLogDet(coords=coords, knots=knots, cov.model="matern",
                   sigma.sq=sigma.sq, tau.sq=tau.sq, theta=theta,
                   modified.pp=TRUE, SWM=TRUE)

if(max(abs(chol2inv(chol(c8$C)) - c8$C.inv)) > tol) stop("test-8 failed")
if(max(abs(2*sum(log(diag(chol(c8$C)))) - c8$log.det)) > tol)
stop("test-8 failed")


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 02:16 , Processed in 0.024763 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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