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

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

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

                                        Function for fitting univariate Bayesian spatial regression models
                                         函数的拟合单变量贝叶斯空间回归模型

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

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

The function spLM fits Gaussian univariate Bayesian spatial regression models. Given a set of knots, spLM will also fit a predictive process model (see references below).
的功能spLM符合高斯单变量的贝叶斯空间回归模型。给定一组的结,spLM也符合预测过程模型(请参阅下面的参考资料)。


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


spLM(formula, data = parent.frame(), coords, knots,
      starting, sp.tuning, priors, cov.model,
      modified.pp = TRUE, n.samples, sub.samples,
      verbose=TRUE, n.report=100, ...)



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

参数:formula
a symbolic description of the regression model to be fit. See example below.  
一个象征性的回归模型的描述是合适的。见下面的例子。


参数:data
an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which spLM is called.   
一个可选的数据框包含在模型中的变量。如果没有找到,数据,变量environment(formula),通常是spLM被称为环境。


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


参数:knots
either a m x 2 matrix of the predictive process knot coordinates in R^2 (e.g., easting and northing) or a vector of length two or three with the first and second elements recording the number of columns and rows in the desired knot grid. The third, optional, element sets the offset of the outermost knots from the extent of the coords extent.   
m x 2矩阵的预测过程结坐标在R^2(例如,东向和北向)或长度的向量的记录的数目的列和行,在该第一和第二元件中的两个或三个与所需的结栅格。可选的第三个,元素设置从coords程度的程度的最外节的偏移量。


参数:starting
a list with each tag corresponding to a parameter name. Valid list tags are beta, sigma.sq, tau.sq, phi, and nu.  The value portion of each of each tag is the parameter's starting value.  
与每个标记对应的参数名称的列表。有效的列表标签是beta,sigma.sq,tau.sq,phi,nu。部的每个的每个标记的值是参数的初始值。


参数:sp.tuning
a list with each tag corresponding to a parameter name. Valid list tags are sigma.sq, tau.sq, phi, and nu. The value portion of each of each tag defines the variance of the Metropolis normal proposal distribution.
与每个标记对应的参数名称的列表。有效的列表标签是sigma.sq,tau.sq,phi,nu。每个标签的值部分的定义都会正常的提议分布的方差。


参数:modified.pp
a logical value indicating if the modified predictive process should be used (see references below for details). Note, if a predictive process model is not used (i.e., knots is not specified) then this argument is ignored.  
一逻辑值,如果修改后的预测过程中应使用(有关详细信息,请参阅下面的参考资料)。请注意,如果预测过程模型是不使用(即,knots没有指定),那么这个参数将被忽略。


参数:priors
a list with each tag corresponding to a parameter name. Valid list tags are sigma.sq.ig, tau.sq.ig, phi.unif, and nu.unif (Beta priors are assumed flat). Variance parameters, simga.sq and tau.sq, are assumed to follow an inverse-Gamma distribution, whereas the spatial decay phi and smoothness nu parameters are assumed to follow Uniform distributions. The hyperparameters of the inverse-Gamma are passed as a vector of length two, with the first and second elements corresponding to the shape and scale, respectively. The hyperparameters of the Uniform are also passed as a vector of length two with the first and second elements corresponding to the lower and upper support, respectively.  
与每个标记对应的参数名称的列表。有效的列表标签sigma.sq.ig,tau.sq.ig,phi.unif和nu.unif(Beta先验假设持平)。方差参数,simga.sq和tau.sq,分别假设为逆Gamma分布,而在空间衰减phi和平滑nu参数的假设为均匀分布。的超反伽马传递作为一个向量的长度为2,第一和第二元件与对应的形状和规模,分别。也通过分别与第一和第二元件的下部和上部的支持对应的长度为2的向量,均匀的超。


参数: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"。有关详细信息,请参见下文。


参数:n.samples
the number of MCMC iterations.  
MCMC中的迭代数。


参数:sub.samples
a vector of length 3 that specifies start, end, and thin, respectively, of the MCMC samples. The default is c(1, n.samples, 1) (i.e., all samples).  
一个向量的长度为3,指定起点,终点,又瘦,分别MCMC样本。默认值是c(1, n.samples, 1)(即,所有样品)。


参数:verbose
if TRUE, model specification and progress of the sampler is printed to the screen. Otherwise, nothing is printed to the screen.   
如果TRUE,型号规格和进步的取样打印到屏幕上。否则,一切都被打印到屏幕上。


参数:n.report
the interval to report Metropolis acceptance and MCMC progress.   
报告的时间间隔都会接受和MCMC进步。


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


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

An object of class spLM, which is a list with the following tags:
类的一个对象spLM,这是一个与下面的标签列表:


参数:coords
the n x 2 matrix specified by coords.   
n x 2的矩阵指定coords。


参数:knot.coords
the m x 2 matrix as specified by knots.   
m x 2矩阵指定的knots。


参数:p.samples
a coda object of posterior samples for the defined parameters.  
一个coda对象定义的参数后样品。


参数:acceptance
the Metropolis sampling acceptance rate.  
Metropolis抽样验收合格率。


参数:sp.effects
a matrix that holds samples from the posterior distribution of the spatial random effects. The rows of this matrix correspond to the n point observations and the columns are the posterior samples.  
一个矩阵保存样本的空间随机效应的后验分布。这个矩阵的行对应的n点的观测和列后的样品。

The return object might include additional data used for subsequent prediction and/or model fit evaluation.
返回的对象可能包括额外的数据,用于以后的预测和/或模型拟合的评价。


(作者)----------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>




参考文献----------References----------


Hierarchical spatial modeling of additive and dominance genetic variance for large spatial trial datasets. Biometrics. DOI: 10.1111/j.1541-0420.2008.01115.x
large datasets. Computational Statistics and Data Analysis, DOI: 10.1016/j.csda.2008.09.008   


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

spGGT, spMvLM
spGGT,spMvLM


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


## Not run: [#不运行:]
data(rf.n200.dat)

Y <- rf.n200.dat$Y
coords <- as.matrix(rf.n200.dat[,c("x.coords","y.coords")])
w <- rf.n200.dat$w

##############################[#############################]
##Simple spatial regression[#简单的空间回归]
##############################[#############################]
m.1 <- spLM(Y~1, coords=coords,
             starting=list("phi"=0.6,"sigma.sq"=1, "tau.sq"=1),
             sp.tuning=list("phi"=0.01, "sigma.sq"=0.05, "tau.sq"=0.05),
             priors=list("phi.Unif"=c(0.3, 3), "sigma.sq.IG"=c(2, 1),
               "tau.sq.IG"=c(2, 1)),
             cov.model="exponential",
             n.samples=1000, verbose=TRUE, n.report=100)

print(summary(m.1$p.samples))
plot(m.1$p.samples)

##Requires MBA package to[#需要MBA包]
##make surfaces[#使表面]
library(MBA)
par(mfrow=c(1,2))
obs.surf <-
  mba.surf(cbind(coords, Y), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(obs.surf, xaxs = "r", yaxs = "r", main="Observed response")
points(coords)
contour(obs.surf, add=T)

w.hat <- rowMeans(m.1$sp.effects)
w.surf <-
  mba.surf(cbind(coords, w.hat), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(w.surf, xaxs = "r", yaxs = "r", main="Estimated random effects")
points(coords)
points(m.1$knot.coords, pch=19, cex=1)
contour(w.surf, add=T)

##############################[#############################]
##Predictive process[#预测过程]
##############################[#############################]
##Use some more observations[#使用一些更多的观测。]
data(rf.n500.dat)

Y <- rf.n500.dat$Y
coords <- as.matrix(rf.n500.dat[,c("x.coords","y.coords")])
w <- rf.n500.dat$w

m.2 <- spLM(Y~1, coords=coords, knots=c(6,6,0),
             starting=list("phi"=0.6,"sigma.sq"=1, "tau.sq"=1),
             sp.tuning=list("phi"=0.01, "sigma.sq"=0.01, "tau.sq"=0.01),
             priors=list("phi.Unif"=c(0.3, 3), "sigma.sq.IG"=c(2, 1),
               "tau.sq.IG"=c(2, 1)),
             cov.model="exponential",
             modified.pp=FALSE, n.samples=2000, verbose=TRUE, n.report=100)

print(summary(m.2$p.samples))
plot(m.2$p.samples)

##Requires MBA package to[#需要MBA包]
##make surfaces[#使表面]
library(MBA)
par(mfrow=c(1,2))
obs.surf <-
  mba.surf(cbind(coords, w), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(obs.surf, xaxs = "r", yaxs = "r", main="Observed response")
points(coords)
contour(obs.surf, add=T)

w.hat <- rowMeans(m.2$sp.effects)
w.surf <-
  mba.surf(cbind(coords, w.hat), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(w.surf, xaxs = "r", yaxs = "r", main="Estimated random effects")
contour(w.surf, add=T)
points(coords, pch=1, cex=1)
points(m.2$knot.coords, pch=19, cex=1)
legend(1.5,2.5, legend=c("Obs.", "Knots"), pch=c(1,19), bg="white")

##############################[#############################]
##Modified predictive process[#改进的预测过程]
##############################[#############################]
m.3 <- spLM(Y~1, coords=coords, knots=c(6,6,0),
             starting=list("phi"=0.6,"sigma.sq"=1, "tau.sq"=1),
             sp.tuning=list("phi"=0.01, "sigma.sq"=0.01, "tau.sq"=0.01),
             priors=list("phi.Unif"=c(0.3, 3), "sigma.sq.IG"=c(2, 1),
               "tau.sq.IG"=c(2, 1)),
             cov.model="exponential",
             n.samples=2000, verbose=TRUE, n.report=100)

print(summary(m.3$p.samples))
plot(m.3$p.samples)

##Requires MBA package to[#需要MBA包]
##make surfaces[#使表面]
library(MBA)
par(mfrow=c(1,2))
obs.surf <-
  mba.surf(cbind(coords, w), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(obs.surf, xaxs = "r", yaxs = "r", main="Observed response")
points(coords)
contour(obs.surf, add=T)

w.hat <- rowMeans(m.3$sp.effects)
w.surf <-
  mba.surf(cbind(coords, w.hat), no.X=100, no.Y=100, extend=TRUE)$xyz.est
image(w.surf, xaxs = "r", yaxs = "r", main="Estimated random effects")
contour(w.surf, add=T)
points(coords, pch=1, cex=1)
points(m.3$knot.coords, pch=19, cex=1)
legend(1.5,2.5, legend=c("Obs.", "Knots"), pch=c(1,19), bg="white")



## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 07:25 , Processed in 0.022107 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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