predict.gstat(gstat)
predict.gstat()所属R语言包:gstat
Multivariable Geostatistical Prediction and Simulation
多变量地质统计预测和模拟
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function provides the following prediction methods: simple, ordinary, and universal kriging, simple, ordinary, and universal cokriging, point- or block-kriging, and conditional simulation equivalents
该功能提供了以下的预测方法:简单,普通,和通用克里格法,协同克里格法简单,普通,和通用,点或块克里格的,条件模拟等值
用法----------Usage----------
## S3 method for class 'gstat'
predict(object, newdata, block = numeric(0), nsim = 0,
indicators = FALSE, BLUE = FALSE, debug.level = 1, mask,
na.action = na.pass, sps.args = list(n = 500, type = "regular",
offset = c(.5, .5)), ...)
参数----------Arguments----------
参数:object
object of class gstat, see gstat and krige
对象的类gstat,gstat和克里格
参数:newdata
data frame with prediction/simulation locations; should contain columns with the independent variables (if present) and the coordinates with names as defined in locations
数据框预测/模拟位置;应包含列的名字自变量(如果有的话)的坐标中定义的locations
参数:block
block size; a vector with 1, 2 or 3 values containing the size of a rectangular in x-, y- and z-dimension respectively (0 if not set), or a data frame with 1, 2 or 3 columns, containing the points that discretize the block in the x-, y- and z-dimension to define irregular blocks relative to (0,0) or (0,0,0)—see also the details section below. By default, predictions or simulations refer to the support of the data values.
块的大小;用1,2或3中的x,y和z维度分别为(0,如果未设定),或列1,2或3的数据框,包含含有一个矩形的大小的值的矢量离散的块中的点的x-,γ-和z-维度以定义不规则的块相对于(0,0)或(0,0,0) - 也见下面的细节部分。缺省情况下,预测或模拟参考的数据值的支持。
参数:nsim
integer; if set to a non-zero value, conditional simulation is used instead of kriging interpolation. For this, sequential Gaussian or indicator simulation is used (depending on the value of indicators), following a single random path through the data.
整数,如果设置为非零值,条件模拟使用,而不是克里金插值。对于这一点,用于序贯高斯或指示器模拟(取决于indicators)的值之后,通过数据的一个单一的随机的路径。
参数:indicators
logical; only relevant if nsim is non-zero; if TRUE, use indicator simulation, else use Gaussian simulation
逻辑,只有当nsim是非零;如果为TRUE,指示模拟,否则使用高斯模拟
参数:BLUE
logical; if TRUE return the BLUE trend estimates only, if FALSE return the BLUP predictions (kriging)
逻辑,如果返回true蓝色的趋势估计,如果为FALSE返回,BLUP预测(克里格法)
参数:debug.level
integer; set gstat internal debug level, see below for useful values. If set to -1 (or any negative value), a progress counter is printed
的整数; gstat内部的调试级别,请参阅下面的有用的值。如果设置为-1(或负值),打印进度计数器
参数:mask
not supported anymore – use na.action; logical or numerical vector; pattern with valid values in newdata (marked as TRUE, non-zero, or non-NA); if mask is specified, the returned data frame will have the same number and order of rows in newdata, and masked rows will be filled with NA's.
不支持了 - 使用na.action;逻辑或数值向量;有效值newdata图案(标记为TRUE,则非零,或非-NA);如果指定掩模,所返回的数据框将具有相同数量newdata,蒙面行的行会和秩序充满了不适用的。
参数:na.action
function determining what should be done with missing values in 'newdata'. The default is to predict 'NA'. Missing values in coordinates and predictors are both dealt with.
函数确定“newdata”遗漏值应该做些什么。默认值是预测“NA”。失踪的坐标和的预测值处理。
参数:sps.args
when newdata is of class SpatialPolygons or SpatialPolygonsDataFrame this argument list gets passed to spsample in package sp to control the discretizing of polygons
时newdata类SpatialPolygons或SpatialPolygonsDataFrame此参数列表被传递给spsample包sp控制的离散化的多边形
参数:...
ignored (but necessary for the S3 generic/method consistency)
忽略(但必要的S3通用/方法的一致性)
Details
详细信息----------Details----------
When a non-stationary (i.e., non-constant) mean is used, both for simulation and prediction purposes the variogram model defined should be that of the residual process, not that of the raw observations.
当一个非固定的(即非恒定)的平均值,模拟和预测的目的定义的变差函数模型的残余过程,不是那么的原始观测。
For irregular block kriging, coordinates should discretize the area relative to (0), (0,0) or (0,0,0); the coordinates in newdata should give the centroids around which the block should be located. So, suppose the block is discretized by points (3,3) (3,5) (5,5) and (5,3), we should pass point (4,4) in newdata and pass points (-1,-1) (-1,1) (1,1) (1,-1) to the block argument. Although passing the uncentered block and (0,0) as newdata may work for global neighbourhoods, neighbourhood selection is always done relative to the centroid values in newdata.
对于不规则块状克里金,坐标应离散的区域相对于为(0),(0,0)或(0,0,0)中的坐标newdata应该给周围应该位于该块的重心。因此,假设该块被离散的点(3,3)(3,5)(5,5)和(5,3),我们应该通过点(4,4)在newdata和通过点(-1, - 1)(-1,1)(1,1)(1,-1)的块参数。虽然通过非中心块和(0,0)newdata全球社区,居委会的选择总是相对于质心在newdata值。
If newdata is of class SpatialPolygons or SpatialPolygonsDataFrame (see package sp), then the block average for each of the polygons or polygon sets is calculated, using spsample to discretize the polygon(s). sps.args controls the parameters used for spsample. The "location" with respect to which neighbourhood selection is done is for each polygon the SpatialPolygons polygon label point; if you use local neighbourhoods you should check out where these points are—this may be well outside the ring itself.
如果newdata类SpatialPolygons或SpatialPolygonsDataFrame(见包SP),然后为每块平均的多边形或多边形集计算,使用spsample离散的多边形(S) 。 sps.args控制参数用于spsample。在“位置”,附近的选择是每个多边形的SpatialPolygons的多边形的标注点;如果你使用当地的社区,你应该检查出这些点,这可能是戒指本身之外。
The algorithm used by gstat for simulation random fields is the sequential simulation algorithm. This algorithm scales well to large or very large fields (e.g., more than $10^6$ nodes). Its power lies in using only data and simulated values in a local neighbourhood to approximate the conditional distribution at that location, see nmax in krige and gstat. The larger nmax, the better the approximation, the smaller nmax, the faster the simulation process. For selecting the nearest nmax data or previously simulated points, gstat uses a bucket PR quadtree neighbourhood search algorithm; see the reference below.
使用的算法模拟随机领域gstat是连续的模拟算法。该算法能很好地进行扩展或大或非常大的领域(例如,超过$ 10 ^ 6 $节点)。它的力量在于在当地居委会的条件分布在该位置,只用数据和模拟值,请参阅:nmax的克里格和gstat的。较大的nmax,更好的近似,规模较小的nmax,模拟过程的速度就越快。选择最近的nmax数据或以前模拟点,gstat使用了一个桶PR四叉树邻域搜索算法,请参阅以下参考。
For sequential Gaussian or indicator simulations, a random path through the simulation locations is taken, which is usually done for sequential simulations. The reason for this is that the local approximation of the conditional distribution, using only the nmax neareast observed (or simulated) values may cause spurious correlations when a regular path would be followed. Following a single path through the locations, gstat reuses the expensive results (neighbourhood selection and solution to the kriging equations) for each of the subsequent simulations when multiple realisations are requested. You may expect a considerable speed gain in simulating 1000 fields in a single call to predict.gstat, compared to 1000 calls, each for simulating a single field.
对于顺序高斯或指示器模拟,通过模拟位置被一个随机的路径,这通常是用于顺序模拟。这样做的原因是,当地的条件概率分布的近似,仅使用nmaxneareast观察(或模拟)的值可能导致杂散相关性时,将遵循为常规路径。通过单一路径的位置,gstat重用的的昂贵结果(街道克里格方程的选择和解决方案)要求多个实现时,随后的模拟。您可能希望一个相当大的的速度增益在模拟1000领域的一个调用predict.gstat,较1000个检测,每个模拟单场。
The random number generator used for generating simulations is the native random number generator of the environment (R, S); fixing randomness by setting the random number seed with set.seed() works.
用于生成模拟随机数发生器是原生的随机数发生器的环境(R,S);定影用set.seed()工程通过设置随机数种子的随机性。
When mean coefficient are not supplied, they are generated as well from their conditional distribution (assuming multivariate normal, using the generalized least squares BLUE estimate and its estimation covariance); for a reference to the algorithm used see Abrahamsen and Benth, Math. Geol. 33(6), page 742 and leave out all constraints.
平均系数不提供,他们会产生,以及从他们的条件分布(假设多元正态分布,采用广义最小二乘BLUE估计,其估计方差)为参考Abrahamsen和广藿香,数学所使用的算法。地质论评。 33(6),第742页,并留下了所有的约束。
Memory requirements for sequential simulation: let n be the product of the number of variables, the number of simulation locations, and the number of simulations required in a single call. the gstat C function gstat_predict requires a table of size n * 12 bytes to pass the simulations back to R, before it can free n * 4 bytes. Hopefully, R does not have to duplicate the remaining n * 8 bytes when the coordinates are added as columns, and when the resulting matrix is coerced to a data.frame.
序贯仿真的内存要求:让n是变量的数目的乘积,模拟位置,并在一个单一的呼叫所需要的数量的模拟数。 gstat C函数gstat_predict需要一个表的大小,N * 12个字节,通过模拟返回R的,它可以释放N * 4字节。希望,R不复制在余下的n * 8个字节时,坐标被作为列添加,当所得到的矩阵被强制为一个data.frame。
Useful values for debug.level: 0: suppres any output except warning and error messages; 1: normal output (default): short data report, program action and mode, program progress in %, total execution time; 2: print the value of all global variables, all files read and written, and include source file name and line number in error messages; 4: print OLS and WLS fit diagnostics; 8: print all data after reading them; 16: print the neighbourhood selection for each prediction location; 32: print (generalised) covariance matrices, design matrices, solutions, kriging weights, etc.; 64: print variogram fit diagnostics (number of iterations and variogram model in each iteration step) and order relation violations (indicator kriging values before and after order relation correction); 512: print block (or area) discretization data for each prediction location. To combine settings, sum their respective values. Negative values for debug.level are equal to positive, but cause the progress counter to work.
有用的值debug.level:0:抑以外的任何输出警告和错误消息; 1:正常输出(默认):短数据报告,计划行动和模式,项目进度(%)总执行时间2:打印所有的全局变量的值,所有的文件读取和写入,包括在错误消息中的源文件名和行号,4:打印OLS和WLS适合诊断; 8:阅读后打印所有数据; 16:为每个打印附近选择打印(广义)的协方差矩阵,设计矩阵,解决方案,克立格权重等; 64:打印变差函数拟合诊断(在每一个迭代步数的迭代及变异模式)和的违反顺序关系(指示克里格值,然后预测的位置; 32:后顺序关系校正); 512:打印块(或区)的离散化的数据,为每个预测位置。要结合设置,总结它们各自的值。 debug.level的负值等于正,但会导致工作进度计数器。
For data with longitude/latitude coordinates (checked by is.projected), gstat uses great circle distances in km to compute spatial distances. The user should make sure that the semivariogram model used is positive definite on a sphere.
数据与经度/纬度坐标(检查is.projected),gstat使用大圆距离以公里计算空间距离。用户应确保所使用的半变异函数模型是在一个球体上的正定。
值----------Value----------
a data frame containing the coordinates of newdata, and columns of prediction and prediction variance (in case of kriging) or the columns of the conditional Gaussian or indicator simulations
一个数据框含有newdata,并预测和预测方差的列(在克里金法的情况下),或条件高斯或指示器模拟的列的坐标
(作者)----------Author(s)----------
Edzer Pebesma
参考文献----------References----------
Computers \& Geosciences, 30: 683-691.
http://www.cs.umd.edu/~brabec/quadtree/index.html
参见----------See Also----------
gstat, krige
gstat,克里格
实例----------Examples----------
# generate 5 conditional simulations[产生5个条件模拟]
data(meuse)
coordinates(meuse) = ~x+y
v <- variogram(log(zinc)~1, meuse)
m <- fit.variogram(v, vgm(1, "Sph", 300, 1))
plot(v, model = m)
set.seed(131)
data(meuse.grid)
gridded(meuse.grid) = ~x+y
sim <- krige(formula = log(zinc)~1, meuse, meuse.grid, model = m,
nmax = 15, beta = 5.9, nsim = 5)
# show all 5 simulation[显示所有5个模拟]
spplot(sim)
# calculate generalised least squares residuals w.r.t. constant trend:[计算广义最小二乘法残差WRT不变的趋势:]
g <- gstat(NULL, "log.zinc", log(zinc)~1, meuse, model = m)
blue0 <- predict(g, newdata = meuse, BLUE = TRUE)
blue0$blue.res <- log(meuse$zinc) - blue0$log.zinc.pred
bubble(blue0, zcol = "blue.res", main = "GLS residuals w.r.t. constant")
# calculate generalised least squares residuals w.r.t. linear trend:[计算广义最小二乘法残差WRT线性趋势:]
m <- fit.variogram(variogram(log(zinc)~sqrt(dist.m), meuse),
vgm(1, "Sph", 300, 1))
g <- gstat(NULL, "log.zinc", log(zinc)~sqrt(dist.m), meuse, model = m)
blue1 <- predict(g, meuse, BLUE = TRUE)
blue1$blue.res <- log(meuse$zinc) - blue1$log.zinc.pred
bubble(blue1, zcol = "blue.res",
main = "GLS residuals w.r.t. linear trend")
# unconditional simulation on a 100 x 100 grid[无条件地模拟100×100格]
xy <- expand.grid(1:100, 1:100)
names(xy) <- c("x","y")
g.dummy <- gstat(formula = z~1, locations = ~x+y, dummy = TRUE, beta = 0,
model = vgm(1,"Exp",15), nmax = 20)
yy <- predict(g.dummy, newdata = xy, nsim = 4)
# show one realisation:[显示一个实现:]
gridded(yy) = ~x+y
spplot(yy[1])
# show all four:[显示所有四种:]
spplot(yy)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|