Home

Package `gstat`

image

Contents

1. 47 spplot vcov 48 transect dat jura 17 tull 48 tull136 tu11 48 TULLNREG tu11 48 validation dat jura 17 variogram 3 6 15 35 36 39 50 57 variogram default 3 variogramLine 36 44 54 57 vgm 3 6 11 20 23 25 35 36 44 53 55 59 vgm panel xyplot 58 walker 59 wind 60 xyz2img 16 xyz2img image 15
2. 874 04 ordinary kriging x lt krige log zinc 1 meuse meuse grid model m spplot x varl pred main ordinary kriging predictions spplot x varl var main ordinary kriging variance simple kriging x lt krige log zinc 1 meuse meuse grid model m beta 5 9 residual variogram m lt vgm 4 Sph 954 06 universal block kriging x lt krige log zinc x y meuse meuse grid model m block c 40 40 spplot x varl pred main universal kriging predictions krige0 using user defined covariance function and multiple responses in y exponential variogram with range 500 defined as covariance function v function x y exp spDists coordinates x coordinates y 500 krige two variables in a single pass using 1 covariance model y cbind meuseszinc meuseScopper meuseSlead meuseScadmium x lt krige0 zinc 1 meuse meuse grid v y y meuse grid zinc x 1 spplot meuse grid zinc main zinc meuse grid copper x 2 spplot meuse grid copper main copper krige cv co kriging cross validation n fold or leave one out Description Cross validation functions for simple ordinary or universal point co kriging kriging in a local neighbourhood Usage gstat cv object nfold remove al FALSE verbose FALSE all residuals FALSE krige cv formula locations krige cv locations formula locations data mod
3. O Dubois J P Webster R 1994 Geostatistical analysis of soil contamination in the Swiss Jura Environmental Pollution 86 315 327 Webster R Atteia O Dubois J P 1994 Coregionalization of trace metals in the soil in the Swiss Jura European Journal of Soil Science 45 205 218 Examples data Jura summary prediction dat summary validation dat summary transect dat summary juragrid dat the commands to create the spatial objects require sp jura pred prediction dat jura val validation dat jura grid juragrid dat jura predSLanduse factor prediction dat Landuse labels levels juragrid datSLanduse jura pred Rock factor prediction dat Rock labels levels juragrid datSRock jura valSLanduse factor validation dat Landuse labels levels juragrid dat Landuse jura valSRock factor validation dat Rock labels levels juragrid dat Rock coordinates jura pred Xloc Yloc coordinates jura val Xloc Yloc coordinates jura grid Xloc Yloc gridded jura grid TRUE krige 19 krige Simple Ordinary or Universal global or local Point or Block Krig ing or simulation Description Function for simple ordinary or universal kriging sometimes called external drift kriging kriging in a local neighbourhood point kriging or kriging of block mean values rectangular or irregular blocks and conditional Gaussian or indicator simulation equivalents for all kri
4. R A McDonnell 1998 Principles of Geographical Information Systems Oxford University Press http www gstat org See Also meuse alt Examples data meuse all summary meuse all meuse alt Meuse river altitude data set Description This data set gives a point set with altitudes digitized from the 1 10 000 topographical map of the Netherlands Usage data meuse alt Format This data frame contains the following columns x a numeric vector x coordinate m in RDM Dutch topographical map coordinates y a numeric vector y coordinate m in RDM Dutch topographical map coordinates alt altitude in m above NAP Dutch zero for sea level References http www gstat org See Also meuse all 30 ncp grid Examples data meuse alt library lattice xyplot y x meuse alt aspect iso ncp grid Grid for the NCP the Dutch part of the North Sea Description Gridded data for the NCP the Dutch part of the North Sea for a 5 km x 5 km grid stored as data frame Usage data ncp grid Format This data frame contains the following columns x x coordinate UTM31 y y coordinate UTM31 depth sea water depth m coast distance to coast m area identifier for administrative sub areas Author s Dutch National Institute for Coastal and Marine Management RIKZ data compiled for R by Edzer Pebesma See Also fulmar Examples data ncp grid summary ncp grid ossfim 31 o
5. and 11 SSErr a numerical attribute with the weighted sum of squared errors of the fitted model See Notes below Note If fitting the range s is part of the job of this function the results may well depend on the starting values given in argument model This is nothing new but generally true for non linear regression problems This function uses the internal gstat C code which interates over a a direct least squares fit of the partial sills and b an iterated search using gradients for the optimal range value s until convergence of after a combined step a and b is reached If for a direct i e not a cross variogram a sill parameter partial sill or nugget becomes negative fit variogram is called again with this parameter set to zero and with a FALSE flag to further fit this sill This implies that once at the search space boundary a sill value does not never away from it On singular model fits If your variogram turns out to be a flat horizontal or sloping line then fitting a three parameter model such as the exponential or spherical with nugget is a bit heavy there s an infinite number of possible combinations of sill and range both very large to fit to a sloping line In this case the returned singular model may still be useful just try and plot it Gstat converges when the parameter values stabilize and this may not be the case Another case of singular model fits happens when a model that reaches the
6. by 1 the integer division of np by the BigInt attribute of the returned object the second point by 1 the remainder of that division as data frame variogramCloud returns no np field but does the decoding into left for variogramCloud data id row number of one of the data pair right for variogramCloud data id row number of the other data in the pair In the past gstat returned an object of class variogram however this resulted in confusions for users of the package geoR the geoR variog function also returns objects of class variogram incompatible to those returned by this function That s why I changed the class name Note variogram line is DEPRECATED it is and was never meant as a variogram method but works automatically as such by the R dispatch system Use variogramLine instead Author s Edzer Pebesma References Cressie N A C 1993 Statistics for Spatial Data Wiley http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers amp Geo sciences 30 683 691 See Also print gstat Variogram plot gstatVariogram plot variogramCloud for variogram models vgm to fit a variogram model to a sample variogram fit variogram variogramLine Examples data meuse no trend coordinates meuse x y variogram log zinc 1 meuse residual variogram w r t a linear trend variogram log zinc x y meuse directional variogram variogram log zinc x y
7. ignored but necessary for the S3 generic method consistency Details When a non stationary i e non constant mean is used both for simulation and prediction pur poses the variogram model defined should be that of the residual process not that of the raw obser vations 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 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 sosample to discretize the polygon s sps args controls the parameters used for spsample The loca tion 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 The algorithm used by gstat for simulation random fields is the sequential simulation algorithm This algorithm scales wel
8. meuse alpha c 0 45 90 135 GLS residual variogram v variogram log zinc x y meuse v fit fit variogram v vgm 1 Sph 700 1 Vet dt set list gls 1 v g gstat NULL log zinc log zinc x y meuse model v fit set set variogram g if require rgdal proj4string meuse CRS init epsg 28992 meuse 11 spTransform meuse CRS proj longlat variogram of unprojected data using great circle distances returning km as units variogram log zinc 1 meuse 11 variogramLine Semivariance Values For a Given Variogram Model Description Generates a semivariance values given a variogram model Usage variogramLine object maxdist n 200 min 1 0e 6 x maxdist dir c 1 0 0 covariance FALSE dist_vector debug level 0 Arguments object variogram model for which we want semivariance function values maxdist maximum distance for which we want semivariance values n number of points min minimum distance a value slightly larger than zero is usually used to avoid the discontinuity at distance zero if a nugget component is present dir direction vector unit length vector pointing the direction in x East West y North South and z Up Down vem 55 covariance logical if TRUE return covariance values otherwise return semivariance values ignored dist vector numeric vector or matrix with distance values debug level gstat internal debug level Value
9. 1 the dependent variable should be NOT transformed locations object of class Spat ial with observations newdata Spatial object with prediction simulation locations the coordinates should have names as defined in locations model variogram model of the TRANSFORMED dependent variable see vgm or fit variogram nmax for local kriging the number of nearest observations that should be used for a kriging prediction or simulation where nearest is defined in terms of the space of the spatial locations By default all observations are used nmin for local kriging if the number of nearest observations within distance maxdi st is less than nmin a missing value will be generated see maxdist 26 krigeTg maxdist for local kriging only observations within a distance of maxdi st from the pre diction location are used for prediction or simulation if combined with nmax both criteria apply block does not function correctly afaik nsim does not function correctly afaik 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 lambda value for the Box Cox transform debug level debug level passed to predict gstat use 1 to see progress in percentage and 0 to suppress all printed information other arguments that will be passed to gstat Details Function kr igeTg uses transGaussian kriging as explained in http w
10. 19 idw locations krige 19 idw spatial krige 19 idw0 krige 19 image 15 image data frame 16 27 image default 16 jura 17 64 juragrid dat jura 17 krige 13 19 24 26 27 32 40 42 krige formula formula method krige 19 krige formula NULL method krige 19 krige formula Spatial method krige 19 krige methods krige 19 krige cv 22 krige cv formula formula method krige cv 22 krige cv formula Spatial method krige cv 22 krige cv locations krige cv 22 krige cv spatial krige cv 22 krige locations krige 19 krige spatial krige 19 krige0 krige 19 krigeST krige 19 krigeTg 25 locator 39 Ipoints 58 map to lev 27 meuse all 28 29 meuse alt 29 29 ncp grid 9 30 34 ossfim 31 oxford 32 panel pointPairs vgm panel xyplot 58 pcb 34 plot gstatVariogram 35 39 53 55 59 plot pointPairs 37 39 plot variogramCloud 37 38 38 53 plot variogramMap plot gstatVariogram 35 predict gstat 10 13 19 24 26 27 40 4 prediction dat jura 17 print gstat gstat 11 print gstatVariogram 53 print gstatVariogram variogram 50 INDEX print variogramCloud variogram 50 print variogramModel vgm 55 show vgms 43 57 sic grid sic2004 45 sic pred sic2004 45 sic test sic2004 45 sic train sic2004 45 sic val sic2004 45 sic2004 45 sic97 47 sic full sic97 47 sic_obs sic97
11. This requires package sp Alternatively a map can be passed of class SpatialDataFrameGrid see sp docs logical if TRUE a message will be printed to say that this function is depre cated Function variogram line will be deprecated in favour of the identi cal variogramLine NULL or object of class gstat may be used to pass settable parameters and or variograms see example logical if FALSE data are assumed to be unprojected meaning decimal longi tude latitude For projected data Euclidian distances are computed for unpro jected great circle distances km In variogram formula or variogram gstat for data deriving from class Spatial projection is detected automatically using is projected test feature not working yet variogram 53 Value If map is TRUE or a map is passed a grid map is returned containing the cross variogram map s See package sp In other cases an object of class gstatVariogram with the following fields np the number of point pairs for this estimate in case of a variogramCloud see below dist the average distance of all point pairs considered for this estimate gamma the actual sample variogram estimate dir hor the horizontal direction dir ver the vertical direction id the combined id pair If cloud is TRUE an object of class variogramCloud with the field np encoding the numbers of the point pair that contributed to a variogram cloud estimate as follows The first point is found
12. copies the data objects into the gstat object so this may become a large object I would like to copy only the name of the data frame but could not get this to work Any help is appreciated Subsetting see examples is done using the id s of the variables or using numeric subsets Sub setted gstat objects only contain cross variograms if i the original gstat object contained them and ii the order of the subset indexes increases numerically or given the order they have in the gstat object The merge item may seem obscure Still for colocated cokriging it is needed See texts by Goovaerts Wackernagel Chiles and Delfiner or look for standardised ordinary kriging in the 1992 Deutsch and Journel or Isaaks and Srivastava In these cases two variables share a common mean parameter Gstat generalises this case any two variables may share any of the regression coef ficients allowing for instance analysis of covariance models when variograms were left out see e g R Christensen s Plane answers book on linear models The tests directory of the package contains examples in file merge R There is also demo pcb which merges slopes across years but with year dependent intercept Author s Edzer Pebesma References http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers amp Geosciences 30 683 691 for kriging with known varying measurement errors weights see e g
13. plot pointPairs identify locator Examples data meuse coordinates meuse x y plot variogram log zinc 1 meuse cloud TRUE commands that require interaction x lt variogram log zinc 1 loc xty data meuse cloud TRUE plot plot x identify TRUE meuse plot plot x digitize TRUE meuse 40 predict gstat predict gstat Multivariable Geostatistical Prediction and Simulation 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 equiv alents for each of the kriging methods Usage predict gstat 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 sss Arguments object object of class gst at see gstat and krige 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 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 re
14. present in package fields as coalash Author s unknown R version prepared by Edzer Pebesma data obtained from http www stat uiowa edu dzimmer spatialstats Dale Zimmerman s course page References N A C Cressie 1993 Statistics for Spatial Data Wiley Gomez M and Hazen K 1970 Evaluating sulfur and ash distribution in coal seems by statistical response surface regression analysis U S Bureau of Mines Report RI 7377 see also fields manual http www image ucar edu GSP Software Fields fields manual coalashEX Krig shtml Examples data coalash summary coalash fit lmc Fit a Linear Model of Coregionalization to a Multivariable Sample Variogram Description Fit a Linear Model of Coregionalization to a Multivariable Sample Variogram in case of a single variogram model i e no nugget this is equivalent to Intrinsic Correlation Usage fit lmc v g model fit ranges FALSE fit lmc fit ranges correct diagonal 1 0 Arguments v multivariable sample variogram output of variogram g gstat object output of gstat model variogram model output of vgm if supplied this value is used as initial value fit ranges fit lmc for each fit logical determines whether the range coefficients excluding that of the nugget component should be fitted or logical vector determines for each range pa rameter of the variogram model whether it should be fitted or fixed logical
15. summary walker exh wind Ireland wind data 1961 1978 Description Daily average wind speeds for 1961 1978 at 12 synoptic meteorological stations in the Republic of Ireland Haslett and raftery 1989 Wind speeds are in knots 1 knot 0 5418 m s at each of the stations in the order given in Fig 4 of Haslett and Raftery 1989 see below Usage data wind Format data frame wind contains the following columns year year minus 1900 month month number of the year day day RPT average wind speed in knots at station RPT VAL average wind speed in knots at station VAL ROS average wind speed in knots at station ROS KIL average wind speed in knots at station KIL SHA average wind speed in knots at station SHA BIR average wind speed in knots at station BIR DUB average wind speed in knots at station DUB CLA average wind speed in knots at station CLA MUL average wind speed in knots at station MUL CLO average wind speed in knots at station CLO BEL average wind speed in knots at station BEL wind 61 MAL average wind speed in knots at station MAL data frame wind loc contains the following columns Station Station name Code Station code Latitude Latitude in DMS see examples below Longitude Longitude in DMS see examples below MeanWind mean wind for each station metres per second Note This data set comes with the following message Be aware that the dataset is 532494 bytes long thats over half a Megabyte Plea
16. they return numeric vectors or matrices in case of multiple dependent with pre dicted values only in case computeVar is TRUE a list with elements pred and var is returned containing predictions and co variances depending on argument ful lCovariance Methods formula formula locations formula locations specifies which coordinates in data re fer to spatial coordinates formula formula locations Spatial Object locations knows about its own spatial loca tions formula formula locations NULL used in case of unconditional simulations newdata needs to be of class Spatial Note Daniel G Krige is a South African scientist who was a mining engineer when he first used gen eralised least squares prediction with spatial covariances in the 50 s George Matheron coined the term kriging in the 60 s for the action of doing this although very similar approaches had been taken in the field of meteorology Beside being Krige s name I consider krige to be to kriging what predict is to prediction Author s Edzer Pebesma References N A C Cressie 1993 Statistics for Spatial Data Wiley http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers amp Geo sciences 30 683 691 22 krige cv See Also gstat predict gstat Examples data meuse coordinates meuse xty data meuse grid gridded meuse grid x y m x vgm 59 Sph
17. values e g c zn cd further only supplying arguments g and model It is advisable not to use expressions such as log zinc as identi fiers as this may lead to complications later on formula formula that defines the dependent variable as a linear model of independent variables suppose the dependent variable has name z for ordinary and simple kriging use the formula z 1 for simple kriging also define beta see below for universal kriging suppose z is linearly dependent on x and y use the for mula z x y locations formula with only independent variables that define the spatial data locations coordinates e g x y if data has a coordinates method to extract its coordinates this argument can be ignored see package sp for classes for point or grid data data data frame contains the dependent variable independent variables and loca tions model variogram model for this id defined by a call to vgm see argument id to see how cross variograms are entered beta only for simple kriging and simulation based on simple kriging vector with the trend coefficients including intercept if no independent variables are defined the model only contains an intercept and this should be the simple kriging mean nmax for local kriging the number of nearest observations that should be used for a kriging prediction or simulation where nearest is defined in terms of the space of the spatial locations 12 nmin maxdist dum
18. vv vgm model Tab covtable variogramLine vgm l Sph 1 1 n le4 min 0 covariance TRUE 58 vgm panel xyplot vgm panel xyplot panel functions for most of the variogram plots through lattice Description Variogram plots contain symbols and lines more control over them can be gained by writing your own panel functions or extending the ones described here see examples Usage vgm panel xyplot x y subscripts type p pch plot symbolSpch col col line plot line col col symbol plot symbol col lty plot line lty cex plot symbolScex ids lwd plot line lwd model model direction direction labels shift shift mode mode panel pointPairs x y type p pch plot symbolSpch col col line plot line col col symbol plot symbol col lty plot lineSlty cex plot symbolScex lwd plot lineSlwd pairs pairs line pch line pch Arguments x x coordinates of points in this panel y y coordinates of points in this panel subscripts subscripts of points in this panel type plot type 1 for connected lines pch plotting symbol col symbol and line color if set col line line color col symbol symbol color Ity line type for variogram model cex symbol size ids gstat model ids lwd line width model variogram model direction direction vector c dir horizontal dir ver labels labels to plot next to points shift amount to sh
19. xty fig 1 if require mapdata map worldHires xlim c 11 5 4 ylim c 51 55 5 62 wind plot wind loc add TRUE pch 16 text coordinates wind loc pos 1 label wind loc Station windStime ISOdate wind year 1900 wind month windSday time series of e g Dublin data plot DUB time wind type 1 ylab windspeed knots main Dublin fig 2 wind wind windSmonth 2 amp wind day 29 windSjday as numeric format windStime 5j windsqrt sqrt 0 5148 x wind 4 15 Jday 1 366 daymeans apply sapply split windsqrt mean windsgrt windSjday mean 2 mean plot daymeans Jday lines lowess daymeans Jday f 0 1 subtract the trend meanwind lowess daymeans Jday f 0 1 Sy windsjday velocity apply windsqrt 2 function x x meanwind match order of columns in wind to Code in wind loc pts coordinates wind loc match names wind 4 15 wind locSCode fig 3 but not really yet dists spDists pts longlat TRU El corv cor velocity sel as vector dists 0 plot as vector corv sel as vector dists sel xlim c 0 500 ylim c 4 1 xlab distance km ylab correlation plots all points twice ignores zero distance now really get fig 3 ros rownames corv ROS dists nr dists ros ros corv nr corv ros ros sel as vector dists nr 0 plot as vector corv nr se
20. Delhomme J P Krig ing in the hydrosciences Advances in Water Resources 1 5 251 266 1978 see also the section Kriging with known measurement errors in the gstat user s manual http www gstat org See Also predict gstat krige Examples data meuse let s do some manual fitting of two direct variograms and a cross variogram g lt gstat id In zinc formula log zinc 1 locations X y data meuse g lt gstat g id 1ln lead formula log lead 1 locations xty 14 hscat data meuse examine variograms and cross variogram plot variogram g enter direct variograms g lt gstat g id 1ln zinc model vgm 55 Sph 900 05 g lt gstat g id In lead model vgm 55 Sph 900 05 enter cross variogram g lt gstat g id c ln zinc In lead model vgm 47 Sph 900 03 examine fit plot variogram g model g model main models fitted by eye see also demo cokriging for a more efficient approach gain nG g MIn lead g c TIn zinc 1ln lead g 1 g 2 Inverse distance interpolation with inverse distance power set to 5 kriging variants need a variogram model to be specified data meuse data meuse grid meuse gstat lt gstat id zinc formula zinc 1 locations x y data meuse nmax 7 set list idp 5 meuse gstat z lt predict meuse gstat meuse grid library lattice for levelplot levelplot zinc
21. Package gstat May 16 2011 Version 0 9 81 Date 2011 05 16 Title geostatistical modelling prediction and simulation Author Edzer Pebesma lt edzer pebesma uni muenster de gt and others Maintainer Edzer Pebesma lt edzer pebesma uni muenster de gt Description variogram modelling simple ordinary and universal point or block co kriging sequential Gaussian or indicator co simulation variogram and variogram map plotting utility functions Depends R gt 2 10 methods sp gt 0 9 72 Imports lattice Suggests rgdal gt 0 5 2 fields mapdata lattice spacetime maptools License GPL URL http www gstat org http 52north org geostatistics Repository CRAN Date Publication 2011 05 16 19 31 29 R topics documented COMAS Ne Bo A a EPA ee ea EE EO EE 2 TEMO oo e a OL EER D ee A Ee e e 3 fit Varo STAM Ae ER E Wan dll AE a Ge 4 fit vartogram gl e EEN eee e EN ewe 6 fit variogram reml s sos s sosoca ee A RA EEN a 7 fulmar ag Woh Os eS EES BRUL DEE amp EHS HAS tre BH Ee HO be 9 BELOON s us coe BR poe ER be ee Ge be BREER PEG WA Ed WER fs 10 gestat a de ed ehh Se SAS AREAS EME SG RSS EES EM 24 ee ee 11 DSCAGA Kanan eam ae e GR ot EE 14 2 coalash EE 15 QUAL aa acest ee wh SG RN ae he Re os Baye Ga Age eee Ga ee 17 Enge ey eo els GA NG ae ee PLA ees ot EE OT N Se be 19 A cheb EN fet hee NAN bebe EE EE wa bbw A 22 a Seo N SR OSES NAL OE EE ER UR OE KS 25 map dtodlev e pa na eH GE Sos RR GE Ed Ore SE
22. RS SESS NG RE ER Bb NG 21 meusesall ER BR EE RR DE BOER bead be be bee eS eos Ra RR NG 28 meusealt 253 G en ph o EEE S Bee eS 4583 BESS 29 DCP ONG ii bg hs Sa we os Rip Sh EA ee ea A e a Be el 30 OSSHD ic Gas ee KAP eta Ewa PP ee eae haa 31 Oxford ota a a a a ENE HE we BBL a ca 32 POD ovio a EGE be a GA eae OA eed dbo LA ee ees 34 plot gstatVariogram 39 plot pomtPaws o s oro a GS AE E ARRE 8 3T plot variogramCloud teg 644 5464 02 DBA Ds gs DILA PAN te BNG CYA Wg 38 predict gstat is KI Dm pa ea ar GS KP NAG a eb gee ME E 40 SHOW VEMS Had on bk PAG AT BA RAE GREER EE EE EES 43 SIC2004 RR EE EE eA EER EE ER OE SE EO EE e 45 SR ie abe OR BM ee EA EEE AREER SD SEE De Oe EE 47 SDpIOEVEOV cis Ba a AS AA 48 Wh hk ea Re PAL ORE a E EN eee ee bd eA eee 48 VAMOPTADD ie 8 a SR a BAK A a a PEAK OE EE Dake N 50 ac 54 A EN 55 Vem panel xyplot maa pw Din ee pe ed PG PA N RR a RR A 58 Walkets 3 2255 Gend pi AG ede SHES BA Ee AN S 59 Wind s apap oe Ree Slee aoe GR ere E A EE 60 Index 63 coalash Coal ash samples from a mine in Pennsylvania Description Data obtained from Gomez and Hazen 1970 Tables 19 and 20 on coal ash for the Robena Mine Property in Greene County Pennsylvania Usage data coalash Format This data frame contains the following columns X a numeric vector x coordinate reference unknown y anumeric vector x coordinate reference unknown coalash the target variable fit lImc Note data are also
23. S2063 Station name S2064 Station name S2065 Station name S2066 Station name S2067 Station name S2070 Station name S2071 Station name S2072 Station name S2128 Station name S5319 Station name S5320 Station name S5321 Station name S5322 Station name S5323 Station name 50 variogram Note This data set was obtained on May 6 2008 from http www ifas jku at e5361 index_ ger html The author of the book that uses it is found at http www ifas jku at e2571 e2604 index_ger html References Werner G Miiller Collecting Spatial Data 3rd edition Springer Verlag Heidelberg 2007 Examples data tull TULLNREG read csv TULLNREG csv I modified tulln36des csv such that the first line only contained x y resulting in row names that reflect the station ID as in tull36 read csv tulln36des csv Chlorid92 was read amp converted by Chlorid92 read csv Chlorid92 csv Chlorid92 Datum as POSIXct strptime Chlorid92 Datum Sd m Sy summary tul136 summary TULLNREG summary Chlorid92 stack join data to x y Date Chloride form cl st stack Chlorid92 1 names cl st c Chloride Station cl stSDate rep Chlorid92 Datum length names Chlorid92 1 cl stSx tull36 match cl st Station row names tull36 x cl stSy tull36 match cl st Station row names tul136 y library lattice xyplot Chloride Date Station cl st xyplot y x Date cl st asp
24. UI By object of class gstatVariogram obtained from the function variogram possibly containing directional or cross variograms in case of a single variogram a variogram model as obtained from vgm or fit variogram to be drawn as a line in the variogram plot in case of a set of variograms and cross variograms a list with variogram models numeric vector of length 2 limits of the y axis numeric vector of length 2 limits of the x axis x axis label y axis label panel function r logical if TRUE directional variograms are plotted in different panels if FALSE directional variograms are plotted in the same graph using color colored lines and symbols to distinguish them logical or numeric if TRUE plot number of point pairs next to each plotted semivariance symbol if FALSE these are omitted If numeric TRUE is assumed and the value is passed as the relative distance to be used between symbols and numeric text values default 0 03 optional argument that will be passed to xyplot in case of the plotting of var iograms and cross variograms use the value list relation if y axes need to share scales same plot numbers 36 ids group id skip layout np threshold Value plot gstat Variogram ids of the data variables and variable pairs logical control for directional multivariate variograms if TRUE panels di vide direction and colors indicate variables ids if FALSE panels divi
25. a data frame of dimension n x 2 with columns distance and gamma semivariances or covari ances or in case dist vector is a matrix a conforming matrix with semivariance covariance values is returned Note variogramL ine is used to generate data for plotting a variogram model Author s Edzer Pebesma See Also plot gstatVariogram Examples variogramLine vgm 5 Exp 10 5 10 10 anisotropic variogram plotted in E W direction variogramLine vgm l Sph 10 anis c 0 0 5 10 10 anisotropic variogram plotted in N S direction variogramLine vgm 1 Sph 10 anis c 0 0 5 10 10 dir c 0 1 0 variogramLine vgm l Sph 10 anis c 0 0 5 dir c 0 1 0 dist vector variogramLine vgm 1 Sph 10 anis c 0 0 5 dir c 0 1 0 dist vector 0 5 c 0 0 5 0 75 vgm Generate or Add to Variogram Model Description Generates a variogram model or adds to an existing model print variogramModel prints the essence of a variogram model Usage vgm psill model range nugget add to anis kappa 0 5 covtable S3 method for class variogramModel print x sss as vgm variomodel mi 56 vgm Arguments psill partial sill of the variogram model component model model type e g Exp Sph Gau Mat Calling vgm without a model argument returns a data frame with available models range range of the variogram model component in case of anisotropy major range ka
26. al a vector of directions in x y direction in z in positive degrees up from the x y plane optional a vector of directions horizontal tolerance angle in degrees vertical tolerance angle in degrees logical if TRUE use Cressie s robust variogram estimate if FALSE use the classical method of moments variogram estimate include a pair of data points y s_1 y s_2 taken at locations s_1 and s_2 for sample variogram calculation only when llx s_1 x s_2 ll lt dX with and x s_i the vector with regressors at location s_i and II II the 2 norm This allows pooled estimation of within strata variograms use a factor variable as regressor and dX 0 5 or variograms of near replicates in a linear model ad dressing point pairs having similar values for regressors variables numerical vector with distance interval boundaries values should be strictly increasing logical if TRUE calculate the semivariogram cloud vector with trend coefficients in case they are known By default trend coeffi cients are estimated from the data integer set gstat internal debug level logical if FALSE no cross variograms are calculated when object is of class gstat and has more than one variable object of class variogram or variogramCloud to be printed grid parameters if data are gridded not to be called directly this is filled auto matically logical if TRUE and cutoff and width are given a variogram map is re turned
27. alis during the Aug Sept 1998 and 1999 flights on the Netherlands part of the North Sea NCP Usage data fulmar Format This data frame contains the following columns year year of measurement 1998 or 1999 x x coordinate in UTM31 y y coordinate in UTM31 depth sea water depth in m coast distance to coast in m fulmar observed density number of birds per square km Author s Dutch National Institute for Coastal and Marine Management RIKZ http www rikz nl See Also ncp grid E J Pebesma R N M Duin P A Burrough 2005 Mapping Sea Bird Densities over the North Sea Spatially Aggregated Estimates and Temporal Changes Environmetrics 16 6 p 573 587 Examples data fulmar summary fulmar 10 get contr get contr Calculate contrasts from multivariable predictions Description Given multivariable predictions and prediction co variances calculate contrasts and their co variance Usage get contr data gstat object X ids names gstat object data Arguments data data frame output of predict gstat gstat object object of class gst at used to extract ids may be missing if ids is used X contrast vector or matrix the number of variables in gstat object should equal the number of elements in X if X is a vector or the number of rows in X if X is a matrix ids character vector with selection of id names present in data Details From data we can extract the n x 1 vector w
28. ariogram Description Fit ranges and or sills from a simple or nested variogram model to a sample variogram Usage fit variogram object model fit sills TRUE fit ranges TRUE fit method 7 debug level 1 warn if neg FALSE fit variogram 5 Arguments object sample variogram output of variogram model variogram model output of vgm fit sills logical determines whether the partial sill coefficients including nugget vari ance should be fitted or logical vector determines for each partial sill param eter whether it should be fitted or fixed fit ranges logical determines whether the range coefficients excluding that of the nugget component should be fitted or logical vector determines for each range pa rameter whether it should be fitted or fixed fit method fitting method used by gstat The default method uses weights N_h h 2 with N_h the number of point pairs and h the distance This criterion is not supported by theory but by practice For other values of fit method see table 4 2 in the gstat manual debug level integer set gstat internal debug level warn if neg logical if TRUE a warning is issued whenever a sill value of a direct variogram becomes negative Value returns a fitted variogram model of class variogramModel This is a data frame has two attributes i singular a logical attribute that indicates whether the non linear fit converged or ended in a singularity
29. ates calculated for each day Hence we ended up having 11 data sets Prior information sic train 10 data sets of 200 points that are identical for what concerns the loca tions of the monitoring stations have been prepared These locations have been randomly selected see Figure 1 These data sets differ only by their Z values since each set corresponds to 1 day of measurement made during the last 14 months No information will be provided on the date of measurement These 10 data sets 10 days of measurements can be used as prior information to tune the parameters of the mapping algorithms No other information will be provided about these sets Participants are free of course to gather more information about the variable in the literature and so on The 200 monitoring stations above were randomly taken from a larger set of 1008 stations The remaining 808 monitoring stations have a topology given in sic pred Participants to SIC2004 will have to estimate the values of the variable taken at these 808 locations The SIC2004 data sic val variable dayx The exercise consists in using 200 measurements made on a 11th day THE data of the exercise to estimate the values observed at the remaining 808 loca tions hence the question marks as symbols in the maps shown in Figure 3 These measurements will be provided only during two weeks 15th of September until 1st of October 2004 on a web page restricted to the participants The true values observ
30. c 30 0 5 The first parameter 30 refers to the main axis direction it is the angle for the principal direction of continuity measured in degrees clockwise from positive Y i e North The second parameter 0 5 is the anisotropy ratio the ratio of the minor range to the major range a value between 0 and 1 So in our example if the range in the major direction North East is 100 the range in the minor direction South East is 0 5 x 100 50 In three dimensions five values should be given in the form anis c p q r s t Now p is the angle for the principal direction of continuity measured in degrees clockwise from Y in direction of X q is the dip angle for the principal direction of continuity measured in positive degrees up from horizontal r is the third rotation angle to rotate the two minor directions around the principal direction defined by p and q A positive angle acts counter clockwise while looking in the principal direction Anisotropy ratios s and t are the ratios between the major range and each of the two minor ranges The anisotropy code was taken from GSLIB Note that in vem 57 http www gslib com sec_gb html itis reported that this code has a bug Quoting from this site The third angle in all GSLIB programs operates in the opposite direction than specified in the GSLIB book Explanation The books says pp27 the angle is measured clockwise when looking toward the origin from the postive pri
31. cal if FALSE initial parameter are taken from model if TRUE initial val ues of model are ignored and taken from variogram cloud nugget mean y 2 sill mean y 2 range median h0 4 with y the semivariance cloud value and hO the distances fit variogram reml 7 cutoff maximum distance up to which point pairs are taken into consideration plot logical if TRUE a plot is returned with variogram cloud and fitted model else the fitted model is returned Value an object of class variogramModel see fit variogram if plot is TRUE a plot is returned instead Note Inspired by the code of Mihael Drinovac which was again inspired by code from Ernst Glatzer author of package vardiag Author s Edzer Pebesma References Mueller W G 1999 Least squares fitting from the variogram cloud Statistics amp Probability Letters 43 93 98 Mueller W G 2007 Collecting Spatial Data Springer Heidelberg See Also fit variogram Examples data meuse coordinates meuse x y fit variogram gls log zinc 1 meuse 1 40 vgm 1 Sph 900 1 fit variogram reml REML Fit Direct Variogram Partial Sills to Data Description Fit Variogram Sills to Data using REML only for direct variograms not for cross variograms Usage fit variogram reml formula locations data model debug level 1 set degr 8 fit variogram reml Arguments formula formula defining the response vector an
32. cally draws a legend and therefore I now prefer levelplot over image Plotting points on a levelplots is probably done with providing a panel function and using lpoints for S Plus only it is hard if not impossible to get exactly right cell shapes e g square for a square grid without altering the size of the plotting region but this function tries hard to do so by extending the image to plot in either x or y direction The larger the grid the better the approximation Geographically correct images can be obtained by modifiying par pin Read the examples image a 2 x 2 grid and play with par pin if you want to learn more about this Author s Edzer Pebesma Examples data meuse data meuse grid g lt gstat formula 10g zinc 1 locations x ty data meuse model vgm 1 Exp 300 x lt predict g meuse grid image x 4 main kriging variance and data points points meuse x meuse y pch non square cell test jura 17 image x x y 20 1 main 40 x 80 cells image x x x 20 1 main 80 x 40 cells the following works for square cells only oldpin lt par pin ratio lt length unique x x length unique xSy par pin c oldpin 2 ratio oldpin 2 image x main Exactly square cells using par pin par pin oldpin library lattice 80 0 80 0 levelplot varl var xty x aspect iso main kriging varian
33. ce jura Jura data set Description The jura data set from Pierre Goovaerts book see references below It contains four data frames prediction dat validation dat and transect dat and juragrid dat and three data frames with consis tently coded land use and rock type factors The examples below show how to transform these into spatial sp objects Usage data jura Format This data frame contains the following columns Xloc see book Yloc see book Landuse see book and below Rock see book and below Cd see book Co see book Cr see book Cu see book Ni see book Pb see book Zn see book 18 jura Note The points data sets were obtained from http home comcast net goovaerts book html the grid data were kindly provided by Pierre Goovaerts Rock Types 1 Argovian 2 Kimmeridgian 3 Sequanian 4 Portlandian 5 Quaternary Land uses 1 Forest 2 Pasture Weide land Wiese Grasland 3 Meadow Wiese Flur Matte Anger 4 Tillage Ackerland bestelltes Land Points 22 and 100 in the validation set validation dat c 22 100 seem not to lie exactly on the grid origininally intended but are kept as such to be consistent with the book Author s Data preparation by David Rossiter rossiter itc nl and Edzer Pebesma References Goovaerts P 1997 Geostatistics for Natural Resources Evaluation Oxford Univ Press New York 483 p Appendix C describes and gives the Jura data set Atteia
34. d possible regressors in case of ab sence of regressors use e g z 1 locations spatial data locations a formula with the coordinate variables in the right hand dependent variable side data data frame where the names in formula and locations are to be found model variogram model to be fitted output of vgm debug level debug level set to 65 to see the iteration trace and log likelihood set additional options that can be set use set list iter 100 to set the max number of iterations to 100 degree order of trend surface in the location between 0 and 3 Value an object of class variogramModel see fit variogram Note This implementation only uses REML fitting of sill parameters For each iteration an n x n matrix is inverted with n the number of observations so for large data sets this method becomes demand ing I guess there is much more to likelihood variogram fitting in package geoR and probably also in nlme Author s Edzer Pebesma References Christensen R Linear models for multivariate Time Series and Spatial Data Springer NY 1991 Kitanidis P Minimum Variance Quadratic Estimation of Covariances of Regionalized Variables Mathematical Geology 17 2 195 208 1985 See Also fit variogram Examples data meuse fit variogram reml log zinc 1 x y meuse model vgm 1 Sph 900 1 fulmar 9 fulmar Fulmaris glacialis data Description Airborne counts of Fulmaris glaci
35. d optionally a set of Matern models with varying smoothness Usage show vgms min le 12 x max max 3 n 50 sill 1 range 1g 44 show vgms models as character vgm Sshort c 1 17 nugget 0 kappa range 0 5 plot TRUE Arguments min numeric start distance value for semivariance calculation beyond the first point at exactly zero max numeric maximum distance for semivariance calculation and plotting n integer number of points to calculate distance values sill numeric partial sill of the variogram model range numeric range of the variogram model models character variogram models to be plotted nugget numeric nugget component for variogram models kappa range numeric if this is a vector with more than one element only a range of Matern models is plotted with these kappa values plot logical if TRUE a plot is returned with the models specified if FALSE the data prepared for this plot is returned passed on to the call to xyplot Value returns a Trellis plot of the variogram models requested see examples I do currently have strong doubts about the correctness of the Hol model The Sp model does seem to need a very large range value larger than the study area to be of some value If plot is FALSE a data frame with the data prepared to plot is being returned Note the min argument is supplied because the variogram function may be discontinuous at distance zero s
36. data sic97 image demstd points sic full pch 1 points sic obs pch 3 spplot vcov Plot map matrix of prediction error variances and covariances Description Plot map matrix of prediction error variances and covariances Usage spplot vcov x Arguments x Object of class SpatialPixelsDataFrame or SpatialGridDataFrame resulting from a krige call with multiple variables cokriging remaining arguments passed to spplot Value The plotted object of class trellis see spplot in package sp Author s Edzer Pebesma tull S lt c3 gt lt bc gt dliche Tullnerfeld data set Description The Siidliche Tullnerfeld is a part of the Danube river basin in central Lower Austria and due to its homogeneous aquifer well suited for a model oriented geostatistical analysis It contains 36 official water quality measurement stations which are irregularly spread over the region Usage data tull tull Format The data frames contain the following columns x X location in meter y Y location in meter S411 Station name S429 Station name S849 Station name S854 Station name S1502 Station name S1584 Station name S1591 Station name S2046 Station name S2047 Station name S2048 Station name S2049 Station name S2051 Station name S2052 Station name S2053 Station name S2054 Station name S2055 Station name S2057 Station name S2058 Station name S2059 Station name S2060 Station name S2061 Station name S2062 Station name
37. de vari ables variable pairs and colors indicate direction logical can be used to arrange panels see xyplot integer vector can be used to set panel layout c ncol nrow logical only for plotting variogram maps if TRUE plot number of point pairs if FALSE plot semivariances semivariogram map values based on fewer point pairs than threshold will not be plotted any arguments that will be passed to the panel plotting functions such as auto key in examples below returns or plots the variogram plot Note currently plotting models and or point pair numbers is not supported when a variogram is both directional and multivariable also three dimensional directional variograms will probably not be displayed correctly Author s Edzer Pebesma References http www gstat org See Also variogram fit variogram vgm variogramLine Examples data meuse coordinates meuse x y vgml lt variogram log zinc 1 meuse plot vgm1 model 1 lt fit variogram vgml vgm 1 Sph 300 1 plot vgml plot vgml model model 1 plot numbers TRUE pch vgm2 lt variogram log zinc 1 meuse alpha c 0 45 90 135 plot vgm2 the following demonstrates plotting of directional models model 2 lt vgm 59 Sph 926 06 anis c 0 0 3 plot vgm2 model model 2 plot pointPairs g g g v gstat g gstat g 37 gstat NULL zinc lt 200 I zinc lt 200 1
38. ded data held in a data frame keeping the right aspect ratio for axes and the right cell shape Usage S3 method for class data frame image Xx zcol 3 xcol 1 ycol 2 asp 1 xyz2img xyz zcol 3 xcol 1 ycol 2 tolerance 10 MachineSdouble eps 16 image Arguments x data frame or matrix with x coordinate y coordinate and z coordinate in its columns zcol column number or name of z variable xcol column number or name of x coordinate ycol column number or name of y coordinate asp aspect ratio for the x and y axes arguments passed to image default XYZ data frame same as x tolerance maximum allowed deviation for coordinats from being exactly on a regularly spaced grid Value image data frame plots an image from gridded data organized in arbritrary order in a data frame It uses xyz2img and image default for this In the S Plus version xyz2img tries to make an image object with a size such that it will plot with an equal aspect ratio for the R version image data frame uses the asp 1 argument to guarantee this xyz2img returns a list with components z a matrix containing the z values x the increasing coordinates of the rows of z y the increasing coordinates of the columns of z This list is suitable input to image default Note I wrote this function before I found out about levelplot a Lattice Trellis function that lets you control the aspect ratio by the aspect argument and that automati
39. e variance specifies location specific measurement error see references section below either character vector of length 2 indicating two ids that share a common mean the more general gstat merging of any two coefficients across variables is ob tained when a list is passed with each element a character vector of length 4 in the form c id1 1 id2 2 This merges the first parameter for variable 141 to the second of variable id2 order of trend surface in the location between O and 3 logical if TRUE instead of Euclidian distance variogram distance is used for se lecting the nmax nearest neighbours after observations within distance maxdist Euclidian geographic have been pre selected test feature doesn t do anything yet arguments that are passed to the printing of variogram models only to print the full contents of the object g returned use as list g or print default g Value an object of class gst at which inherits from 1i st Its components are data list each element is a list with the formula locations data nvars beta etc for a variable gstat 13 model list each element contains a variogram model names are those of the elements of data cross variograms have names of the pairs of data elements separated bya e g varl var2 set list named list corresponding to set name value gstat commands look up the set command in the gstat manual for a full list Note The function currently
40. ed at these 808 locations will be released only at the end of the exercise to allow participants to write their manuscripts sic test variables dayx and joker In addition a joker data set was released sic val variable joker which contains an anomaly The anomaly was generated by a simulation model and does not represent measured levels 46 sic2004 Usage data sic2004 Format The data frames contain the following columns record this integer value is the number unique value of the monitoring station chosen by us x X coordinate of the monitoring station indicated in meters y Y coordinate of the monitoring station indicated in meters day01 mean gamma dose rate measured during 24 hours at day01 Units are nanoSieverts hour day02 same for day 02 day03 day04 day05 day06 day07 day08 day09 day10 dayx the data observed at the 11 th day joker the joker data set containing an anomaly not present in the training data Note the data set sic grid provides a set of points on a regular grid almost 10000 points covering the area this is convenient for interpolation see the function makegrid in package sp The coordinates have been projected around a point located in the South West of Germany Hence a few coordinates have negative values as can be guessed from the Figures below Author s Data the German Federal Office for Radiation Protection BfS http www bfs de data
41. ed is col Line the value passed to this argument will be used as plotting symbol pch title of plot arguments further passed to xyplot 38 plot variogramCloud Value plots the data locations with lines connecting the point pairs identified and refered to by indices in x Author s Edzer Pebesma References http www gstat org See Also plot variogramCloud Examples The following requires interaction and is therefore outcommented data meuse coordinates meuse xty vgml lt variogram log zinc 1 meuse cloud TRUE pp lt plot vgml id TRUE Identify the point pairs plot pp data meuse meuse has x and y as coordinates plot variogramCloud Plot and Identify Data Pairs on Sample Variogram Cloud Description Plot a sample variogram cloud possibly with identification of individual point pairs Usage S3 method for class variogramCloud plot x identify FALSE digitize FALSE xlim ylim xlab ylab keep FALSE Arguments x object of class variogramCloud identify logical if TRUE the plot allows identification of a series of individual point pairs that correspond to individual variogram cloud points use left mouse button to select right mouse button ends digitize logical if TRUE select point pairs by digitizing a region with the mouse left mouse button adds a point right mouse button ends plot variogramCloud 39 xlim li
42. el NULL beta NULL nmax nmin 0 maxdist Inf nfold nrow data verbose TRUE debug level 0 krige cv spatial formula locations model NULL beta NULL nmax Inf nmin 0 maxdist Inf nfold nrow locations verbose TRUE debug level 0 krige cv Arguments object nfold remove all verbose 23 object of class gstat see function gstat integer if larger than 1 then apply n fold cross validation if nfold equals nrow data the default apply leave one out cross validation if set to e g 5 five fold cross validation is done To specify the folds pass an integer vector of length nrow data with fold indexes logical if TRUE remove observations at cross validation locations not only for the first but for all subsequent variables as well logical if FALSE progress bar is suppressed all residuals formula locations data model beta nmax nmin maxdist debug level Details logical if TRUE residuals for all variables are returned instead of for the first variable only other arguments that will be passed to predict gstat in case of gst at cv or to gstat in case of krige cv formula that defines the dependent variable as a linear model of independent variables suppose the dependent variable has name z for ordinary and simple kriging use the formula z 1 for simple kriging also define beta see below for universal kriging suppose z i
43. formula are to be found locations spatial data locations For variogram formula a formula with only the coor dinate variables in the right hand explanatory variable side e g x y see examples For variogram default list with coordinate matrices each with the number of rows matching that of corresponding vectors in y the number of columns should match the number of spatial dimensions spanned by the data 1 x 2 x y or 3 A2 any other arguments that will be passed to variogram default ignored y list with for each variable the vector with responses X optional list with for each variable the matrix with regressors covariates the number of rows should match that of the correspoding element in y the number of columns equals the number of regressors including intercept cutoff spatial separation distance up to which point pairs are included in semivariance estimates as a default the length of the diagonal of the box spanning the data is divided by three width the width of subsequent distance intervals into which data point pairs are grouped for semivariance estimates 52 alpha beta tol hor tol ver cressie dX boundaries cloud trend beta debug level Cross grid map deprecate projected lambda variogram direction in plane x y in positive degrees clockwise from positive y North alpha 0 for direction North increasing y alpha 90 for direction East increas ing x option
44. ging varieties and function for inverse distance weighted interpolation For multivariable prediction see gstat and predict gstat Usage krige formula locations krige locations formula locations data newdata model beta nmax Inf nmin 0 maxdist Inf block nsim 0 indicators FALSE na action na pass debug level 1 krige spatial formula locations newdata model beta nmax Inf nmin 0 maxdist Inf block nsim 0 indicators FALSE na action na pass debug level 1 krige0 formula data newdata model beta y computeVar FALSE fullCovariance FALSE krigeST formula data fullCovariance FALSE idw formula locations newdata modelList Y computeVar FALSE idw locations formula locations data newdata nmax Inf nmin 0 maxdist Inf block na action na pass idp 2 0 debug level 1 idw spatial formula locations newdata nmax Inf nmin 0 maxdist Inf block numeric 0 na action na pass idp 2 0 debug level 1 idw0 formula data newdata y Arguments formula formula that defines the dependent variable as a linear model of independent variables suppose the dependent variable has name z for ordinary and simple kriging use the formula z 1 for simple kriging also define beta see below for universal kriging suppose z is linearly dependent on x and y use the for mula z x y l
45. graphical map coordinates y anumeric vector y coordinate m in RDM Dutch topographical map coordinates cadmium topsoil cadmium concentration ppm note that zero cadmium values in the original data set have been shifted to 0 2 half the lowest non zero value copper topsoil copper concentration ppm lead topsoil lead concentration ppm zine topsoil zinc concentration ppm elev relative elevation om organic matter as percentage ffreq flooding frequency class soil soil type lime lime class landuse landuse class dist m distance to river Meuse metres as obtained during the field survey in pit logical indicates whether this is a sample taken in a pit in meuse155 logical indicates whether the sample is part of the meuse i e filtered data set in addition to the samples in a pit an sample 139 with outlying zinc content was removed in BMcD logical indicates whether the sample is used as part of the subset of 98 points in the various interpolation examples of Burrough amp McDonnell Note sample refers to original sample number Eight samples were left out because they were not indicative for the metal content of the soil They were taken in an old pit One sample contains an outlying zinc value which was also discarded for the meuse 155 data set meuse alt 29 Author s The actual field data were collected by Ruud van Rijn and Mathieu Rikken data compiled for R by Edzer Pebesma References P A Burrough
46. he number of nearest observations within distance maxdist is less than nmin a missing value will be generated see maxdist for local kriging only observations within a distance of maxdi st from the pre diction location are used for prediction or simulation if combined with nmax both criteria apply block size a vector with 1 2 or 3 values containing the size of a rectangular in x y and z dimension respectively 0 1f 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 of predict gstat By default predictions or simulations refer to the support of the data values 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 logical only relevant if nsim is non zero 1f TRUE use indicator simulation else use Gaussian simulation 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 debug level passed to predict gstat use 1 to see progress in percentage and 0 to suppress all printed information other arguments that will be passed to gstat idp numeric specify
47. if TRUE each coefficient matrices of partial sills is guaranteed to be positive definite 4 fit variogram correct diagonal multiplicative correction factor to be applied to partial sills of direct variograms only the default value 1 0 does not correct If you encounter problems with singular covariance matrices during cokriging or cosimulation you may want to try to increase this to e g 1 01 parameters that get passed to fit variogram Value returns an object of class gst at with fitted variograms Note This function does not use the iterative procedure proposed by M Goulard and M Voltz Math Geol 24 3 269 286 reproduced in Goovaerts 1997 book but uses simply two steps first each variogram model is fitted to a direct or cross variogram next each of the partial sill coefficient matrices is approached by its in least squares sense closest positive definite matrices by setting any negative eigenvalues to zero The argument correct diagonal was introduced by experience by zeroing the negative eigenvalues for fitting positive definite partial sill matrices apparently still perfect correlation may result leading to singular cokriging cosimulation matrices If someone knows of a more elegant way to get around this please let me know Author s Edzer Pebesma References http www gstat org See Also variogram vgm fit variogram demo cokriging fit variogram Fit a Variogram Model to a Sample V
48. ift the label right of the symbol mode to be set by calling function only line pch symbol type to be used for point of selected point pairs e g to highlight point pairs with distance close to zero pairs two column matrix with pair indexes to be highlighted parameters that get passed to Ipoints walker 59 Value ignored the enclosing function returns a plot of class trellis Author s Edzer Pebesma References http www gstat org See Also plot gstatVariogram vgm Examples library lattice data meuse coordinates meuse lt c x Ty mypanel function x y vgm panel xyplot x y panel abline h var log meuse zinc color red plot variogram log zinc 1 meuse panel mypanel walker Walker Lake sample and exhaustive data sets Description This is the Walker Lake data sets sample and exhaustive data set used in Isaaks and Srivastava s Applied Geostatistics Usage data walker Format This data frame contains the following columns Id Identification Number X Xlocation in meter Y Ylocation in meter V V variable concentration in ppm U U variable concentration in ppm T T variable indicator variable 60 wind Note This data sets were obtained from the data sets on http www ai geostats org References Applied Geostatistics by Edward H Isaaks R Mohan Srivastava Oxford University Press Examples data walker summary walker
49. iso layout c 16 11 summary cl st plot TULLNREG pch 3 asp 1 points y x cl st add TRUE pch 16 variogram Calculate Sample or Residual Variogram or Variogram Cloud Description Calculates the sample variogram from data or in case of a linear model is given for the residuals with options for directional robust and pooled variogram and for irregular distance intervals variogram 51 Usage variogram object Usage S3 method for class formula variogram object S3 method for class gstat variogram formula locations data Default S3 method variogram y locations X cutoff width cutoff 15 alpha 0 beta 0 tol hor 90 length alpha tol ver 90 length beta cressie FALSE dX numeric 0 boundaries numeric 0 cloud FALSE trend beta NULL debug level 1 cross TRUE grid map FALSE g NULL projected TRUE lambda 1 0 S3 method for class line variogram deprecate TRUE S3 method for class gstatVariogram PEINE Ty sie S3 method for class variogramCloud DEn Iw sse Arguments object object of class gst at in this form direct and cross residual variograms are calculated for all variables and variable pairs defined in object formula formula defining the response vector and possible regressors in case of ab sence of regressors use e g z 1 data data frame where the names in
50. ith multivariable predictions say y and its n x n covariance matrix SVS Given a contrast matrix in SXS this function computes the contrast vector C X y and its variance SVar C ZX V X Value a data frame containing for each row in data the generalized least squares estimates named beta 1 beta 2 their variances named var beta 1 var beta 2 and covariances named cov beta 1 2 cov beta 1 3 Author s Edzer Pebesma References http www gstat org See Also predict gstat gstat 11 gstat Create gstat objects or subset it Description Function that creates gstat objects objects that hold all the information necessary for univariate or multivariate geostatistical prediction simple ordinary or universal co kriging or its conditional or unconditional Gaussian or indicator simulation equivalents Multivariate gstat object can be subsetted Usage gstat g id formula locations data model NULL beta nmax Inf nmin 0 maxdist Inf dummy FALSE set fill all FALSE fill cross TRUE variance identity weights NULL merge degree 0 vdist FALSE lambda 1 0 S3 method for class gstat print x Arguments gstat object to append to if missing a new gstat object is created id identifier of new variable if missing varn is used with n the number for this variable If a cross variogram is entered id should be a vector with the two id
51. l as vector dists nr sel pch 3 xlim c 0 500 ylim c 4 1 xlab distance km ylab correlation add outlier points corv ros ros dists ros ros pch 16 cex 5 xdiscr 1 500 add correlation model lines xdiscr 968 x exp 00134 x xdiscr Index Topic datasets coalash 2 fulmar 9 jura 17 meuse all 28 meuse alt 29 ncp grid 30 oxford 32 pcb 34 sic2004 45 sic97 47 tull 48 walker 59 wind 60 Topic dplot image 15 map to lev 27 plot gstatVariogram 35 plot pointPairs 37 plot variogramCloud 38 show vgms 43 spplot vcov 48 Topic models fit lmc 3 fit variogram 4 fit variogram gls 6 fit variogram reml 7 get contr 10 gstat 11 hscat 14 krige 19 krige cv 22 krigeTg 25 ossfim 31 predict gstat 40 variogram 50 variogramLine 54 vgm 55 vgm panel xyplot 58 gstat gstat 11 as data frame variogramCloud 53 as data frame variogramCloud variogram 50 as vgm variomodel vgm 55 Chlorid92 tul1 48 coalash 2 demstd sic97 47 fit lmc 3 fit variogran 4 4 7 8 20 23 25 35 36 53 57 fit variogram gls 6 fi fu variogram reml 7 mar 9 30 RENA get contr 10 getGammas variogramLine 54 gstat 3 11 19 24 26 40 42 gstat cv krige cv 22 hscat 14 identify 39 idw krige 19 idw formula formula method krige 19 idw formula Spatial method krige 19 idw methods krige
52. l 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 approxi mation 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 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 The random number generator used for generating simulations is the native random number gen erator of the environment R S fixing randomness by setting the random number seed with set seed works When mean coefficie
53. lative 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 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 logical only relevant if nsim is non zero if TRUE use indicator simulation else use Gaussian simulation BLUE logical if TRUE return the BLUE trend estimates only if FALSE return the BLUP predictions kriging 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 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 predict gstat 41 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 sps args when newdata is of class Spat ialPolygons or SpatialPolygonsDataFrame this argument list gets passed to spsample in package sp to control the dis cretizing of polygons
54. lt krige formula log zinc 1 meuse meuse grid nmax 15 beta 5 9 nsim 5 show all 5 simulation spplot sim calculate generalised least squares residuals w r t g lt gstat NULL log zinc log zinc 1 meuse model blue0 lt predict g newdata meuse BLUE TRUE blue0Sblue res lt log meuse zinc blue0 log zinc pred bubble blue0 zcol blue res main GLS residuals calculate generalised least squares residuals w r t m lt fit variogram variogram log zinc sqrt dist m me vogm 1 Sph 300 1 g lt gstat NULL log zinc log zinc sqrt dist m me BLU TRU bluel lt predict g E meuse bluelSblue res lt log meuse zinc bluelSlog zinc pred bubble bluel zcol blue res main GLS residuals w r t linear trend unconditional simulation on a 100 x 100 grid xy lt expand grid 1 100 1 100 names xy lt c x y g dummy lt gstat formula z 1 locations xty dummy model vgm 1 Exp 15 nmax 20 yy lt predict g dummy newdata xy nsim 4 show one realisation gridded yy xty spplot yy 1 show all four spplot yy 43 model m constant trend m w r t constant linear trend use use model m TRUE show vgms Plot Variogram Model Functions Description Creates a trellis plot for a range of variogram models possibly with nugget an
55. meuse zinc lt 400 I zinc lt 400 1 meuse zinc lt 800 I zinc lt 800 1 meuse calculate multivariable directional variogram variogram g alpha c 0 45 90 135 plot v group id FALSE auto key TR plot v group id E id and id pairs panels direction panels PIG TRUE auto key TRU variogram maps plot variogram g cutoff 1000 width 100 map TRUE main cross semivariance maps plot variogram g cutoff 1000 width 100 map TRUE np TRUE main number of point pairs plot pointPairs Plot a point pairs identified from a variogram cloud Description Plot a point pairs identified from a variogram cloud Usage S3 method for class pointPairs plot x xcol data x ycol data y xlab x coordinate ylab y coordinate col line 2 line pch 0 main Selected point pairs Arguments x data xcol ycol xlab ylab col line line pch main object of class pointPairs obtained from the function plot variogramCloud containing point pair indices data frame to which the indices refer from which the variogram cloud was cal culated numeric vector with x coordinates of data numeric vector with y coordinates of data x axis label y axis label color for lines connecting points 1f non zero symbols are also plotted at the middle of line segments to mark lines too short to be visible on the plot the color us
56. mits of x axis ylim limits of y axis xlab x axis label ylab y axis label keep logical if TRUE and identify is TRUE the labels identified and their posi tion are kept and glued to object x which is returned Subsequent calls to plot this object will now have the labels shown e g to plot to hardcopy parameters that are passed through to plot gstatVariogram in case of identify FALSE or to plot in case of identify TRUE Value If identify or digitize is TRUE a data frame of class pointPairs with in its rows the point pairs identified pairs of row numbers in the original data set if identify is E a plot of the variogram cloud which uses plot gstat Variogram If in addition to identify keep is also TRUE an object of class variogramCloud is re turned having attached to it attributes sel and text which will be used in subsequent calls to plot variogramCloud with identify set to FALSE to plot the text previously identified If in addition to digitize keep is also TRUE an object of class variogramCloud is re turned having attached to it attribute poly which will be used in subsequent calls to plot variogramCloud with digitize set to FALSE to plot the digitized line Co In both of the keep TRUE cases the attribute ppairs of class pointPairs is present containing the point pairs identified Author s Edzer Pebesma References http www gstat org See Also variogram plot gstatVariogram
57. my set fill cross variance weights merge degree vdist lambda Details gstat for local kriging if the number of nearest observations within distance maxdist is less than nmin a missing value will be generated see maxdist for local kriging only observations within a distance of maxdi st from the pre diction location are used for prediction or simulation if combined with nmax both criteria apply logical if TRUE consider this data as a dummy variable only necessary for unconditional simulation named list with optional parameters to be passed to gstat only set commands of gstat are allowed and not all of them may be relevant see the manual for gstat stand alone URL below gstat object to print logical if TRUE fill all of the direct variogram and depending on the value of fill cross also all cross variogram model slots in g with the given vari ogram model logical if TRUE fill all of the cross variograms if FALSE fill only all direct variogram model slots in g with the given variogram model only if fill all is used character variance function to transform to non stationary covariances iden tity does not transform other options are mu Poisson and mu 1 mu bi nomial numeric vector if present covariates are present and variograms are missing weights are passed to OLS prediction routines resulting in WLS if variograms are given weights should be 1 variance wher
58. nc 1 meuse meuse grid m lambda 25 spplot x varlTG pred col regions bpy colors summary meuse zinc summary x var1TG pred map to lev rearrange data frame for plotting with levelplot Description rearrange data frame for plotting with levelplot Usage map to lev data xcol 1 ycol 2 zcol c 3 4 ns names data zcol Arguments data data frame e g output from krige or predict gstat xcol x coordinate column number ycol y coordinate column number zcol z coordinate column number range ns names of the set of z columns to be viewed Value data frame with the following elements x coordinate for each row y coordinate for each row Z column vector with each of the elements in columns zcol of data stacked name factor name of each of the stacked z columns See Also image data frame krige for examples see predict gstat Levelplot in package lattice 28 meuse all meuse all Meuse river data set original full data set Description This data set gives locations and top soil heavy metal concentrations ppm along with a number of soil and landscape variables collected in a flood plain of the river Meuse near the village Stein Heavy metal concentrations are bulk sampled from an area of approximately 15 m x 15 m Usage data meuse all Format This data frame contains the following columns sample sample number x a numeric vector x coordinate m in RDM Dutch topo
59. ncipal direction but it should be counter clockwise This is a documentation error Although rarely used the correct specification of the third angle is critical if used Note that anis c p s is equivalent to anis c p 0 0 s 1 The implementation in gstat for 2D and 3D anisotropy was taken from the gslib probably 1992 code I have seen a paper where it is argued that the 3D anisotropy code implemented in gslib and so in gstat is in error but I have not corrected anything afterwards Author s Edzer Pebesma References http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers amp Geo sciences 30 683 691 Deutsch C V and Journel A G 1998 GSLIB Geostatistical software library and user s guide second edition Oxford University Press See Also show vgms to view the available models fit variogram variogramLine variogram for the sample variogram Examples vgm vgm 10 Exp 300 x lt vgm 10 Exp 300 vgm 10 Nug 0 vgm 10 Exp 300 4 5 vgm 10 Mat 300 4 5 kappa 0 7 vgm 5 Exp 300 add to vgm 5 Exp 60 nugget 2 5 vgm 10 Exp 300 anis c 30 0 5 vgm 10 Exp 300 anis c 30 10 O 0 5 0 3 Matern variogram model vgm l Mat 1 kappa 3 x lt vgm 0 39527463 Sph 953 8942 nugget 0 06105141 x print x digits 3 to see all components do print data frame x
60. ns 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 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 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 Author s Edzer Pebesma References N A C Cressie 1993 Statistics for Spatial Data Wiley http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers 1 Geo sciences 30 683 691 For bucket PR quadtrees excellent demos are found at http www cs umd edu brabec quadtree index html See Also gstat krige Examples generate 5 conditional simulations data meuse coordinates meuse x y show vgms v lt variogram log zinc 1 meuse m lt fit variogram v vgm 1 Sph 300 1 plot v model m set seed 131 data meuse grid gridded meuse grid xty sim
61. nt are not supplied they are generated as well from their conditional distri bution 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 42 predict gstat 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 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 iteratio
62. o use these data for comparison with PCB measurements elsewhere or if you want to compare them to regulation standards or want to use these data for any other purpose you should first contact mailto basisinfodesk rikz rws minvenw nl The reason for this is that several normalisations were carried out that are not reported here nor in the paper below References http www gstat org http www rikz nl Pebesma E J amp Duin R N M 2005 Spatial patterns of temporal change in North Sea sediment quality on different spatial scales In P Renard H Demougeot Renard amp R Froidevaux Eds Geostatistics for Environmental Applications Proceedings of the Fifth European Conference on Geostatistics for Environmental Applications pp 367 378 Springer See Also ncp grid plot gstat Variogram Examples data pcb library lattice xyplot y xlas demo pcb factor yf pcb aspect iso 35 plot gstatVariogram Plot a Sample Variogram Description Creates a variogram plot Usage S3 method plot x mode ylab semi scales ids S3 method plot x np Arguments x model ylim xlim xlab ylab panel multipanel plot numbers scales for class gstatVariogram 1 NULL ylim xlim xlab distance variance panel vgm panel xyplot multipanel xSid group id TRUE skip layout for class variogramMap FALSE skip threshold TR
63. ocations object of class Spat ial or deprecated formula defines the spatial data loca tions coordinates such as x y data data frame should contain the dependent variable independent variables and coordinates should be missing if locations contains data 20 newdata model modelList beta nmax nmin maxdist block nsim indicators na action debug level krige data frame or Spatial object with prediction simulation locations should contain attribute columns with the independent variables if present and if locations is a formula the coordinates with names as defined in Locations variogram model of dependent variable or its residuals defined by a call to vem or fit variogram for krige0 also a user supplied covariance function is allowed see example below list with two named elements space and time these should either be the output of vgm or user defined covariance functions that takes one or two ST objects for simple kriging and simulation based on simple kriging vector with the trend coefficients including intercept if no independent variables are defined the model only contains an intercept and beta should be the simple kriging mean for local kriging the number of nearest observations that should be used for a kriging prediction or simulation where nearest is defined in terms of the space of the spatial locations By default all observations are used for local kriging if t
64. our component CHROMA 20 40 cm LIME2 Lime content tested using HCl 20 40 cm DEPTHCM soil depth cm DEP2LIME depth to lime cm PCLAY1 percentage clay 0 20 cm PCLAY 2 percentage clay 20 40 cm MG1 Magnesium content ppm 0 20 cm OM1 organic matter 0 20 cm CEC1 CES as mequ 100g air dry soil 0 20 cm PH1 pH 0 20 cm PHOS1 Phosphorous 0 20 cm ppm POT 1 K potassium 0 20 cm ppm Note oxford jpg in the gstat package data directory shows an image of the soil map for the region Author s P A Burrough compiled for R by Edzer Pebesma References P A Burrough R A McDonnell 1998 Principles of Geographical Information Systems Oxford University Press Examples data oxford summary oxford 34 pcb pcb PCB138 measurements in sediment at the NCP the Dutch part of the North Sea Description This data set gives a point set with altitudes digitized from the 1 10 000 topographical map of the Netherlands Usage data pcb Format This data frame contains the following columns year measurement year x x coordinate UTM31 y y coordinate UTM31 coast distance to coast m depth sea water depth m PCB138 PCB 138 measured on the sediment fraction smaller than 63 u in ug kg dry matter BUT SEE NOTE BELOW yf year as factor Note A note of caution The PCB 138 data are provided only to be able to re run the analysis done in Pebesma and Duin 2004 see references below If you want t
65. ppa smoothness parameter for the Matern class of variogram models nugget nugget component of the variogram this basically adds a nugget compontent to the model add to the variogram model to which we want to add a component structure anis anisotropy parameters see notes below x a variogram model to print arguments that will be passed to print e g digits see examples covtable if model is Tab instead of model parameters a one dimensional covariance table can be passed here See covtable R in tests directory and example below m object of class variomodel see geoR Value an object of class variogramModel which extends data frame When called without a model argument a data frame with available models is returned having two columns short abbreviated names to be used as model argument Exp Sph etc and long with some description as vgm variomodel tries to convert an object of class variomodel geoR to vgm Note Geometric anisotropy can be modelled for each individual simple model by giving two or five anisotropy parameters two for two dimensional and five for three dimensional data In any case the range defined is the range in the direction of the strongest correlation or the major range Anisotropy parameters define which direction this is the main axis and how much shorter the range is in the direction s perpendicular to this main axis In two dimensions two parameters define an anisotropy ellipse say anis
66. pred xty aspect iso see demo cokriging and demo examples for further examples and the manuals for predict gstat and image Z hscat Produce h scatterplot Description Produces h scatterplots where point pairs having specific separation distances are plotted This function is a wrapper around xyplot Usage hscat formula data breaks pch 3 cex 6 mirror FALSE variogram alpha 0 Arguments formula specifies the dependent variable data data where the variable in formula is resolved breaks distance class boundaries image 15 pch plotting symbol cex plotting symbol size mirror logical duplicate all points mirrored along x y note that correlations are those of the points plotted variogram alpha parameter to be passed as alpha parameter to variogram if alpha is specified it will only affect xyplot by being passed through parameters passed to variogram and xyplot Value an object of class trellis normally the h scatter plot Note Data pairs are plotted once so the h scatterplot are not symmetric Author s Edzer Pebesma References http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers amp Geo sciences 30 683 691 Examples data meuse coordinates meuse x y hscat log zinc 1 meuse c 0 80 120 250 500 1000 image Image Gridded Coordinates in Data Frame Description Image grid
67. provided by Gregoire Dubois R compilation by Edzer Pebesma References http www ai geostats org http www ai geostats org resources sic2004_ data htm http www ai geostats org events sic2004 index htm sic97 47 Examples data sic2004 FIGURE 1 Locations of the 200 monitoring stations for the 11 data sets The values taken by the variable are known plot y x Sic train pch 1 col red asp 1 FIGURE 2 Locations of the 808 remaining monitoring stations at which the values of the variable must be estimated plot y x Sic pred pch asp 1 cex 8 Figure 2 FIGURE 3 Locations of the 1008 monitoring stations exhaustive data sets Red circles are used to estimate values located at the questions marks plot y x Sic train pch 1 col red asp 1 points y x sic pred pch cex 8 sic97 Spatial Interpolation Comparison 1997 data set Swiss Rainfall Description The text below is copied from the data item at http www ai geostats org Usage data sic97 Format The data frames contain the following columns ID this integer value is the number unique value of the monitoring station rainfall rainfall amount in 10th of mm Note See the pdf that accompanies the original file for a description of the data The dxf file with the Swiss border is not included here Author s Gregoire Dubois and others References http www ai geostats org 48 tull Examples
68. s linearly dependent on x and y use the for mula z x y formula with only independent variables that define the spatial data locations coordinates e g x y OR data object deriving from class Spatial which has a coordinates method to extract its coordinates data frame should contain the dependent variable independent variables and coordinates only to be provided if locations is a formula variogram model of dependent variable or its residuals defined by a call to vgm or fit variogram only for simple kriging and simulation based on simple kriging vector with the trend coefficients including intercept if no independent variables are defined the model only contains an intercept and this should be the simple kriging mean for local kriging the number of nearest observations that should be used for a kriging prediction or simulation where nearest is defined in terms of the space of the spatial locations By default all observations are used for local kriging if the number of nearest observations within distance maxdist is less than nmin a missing value will be generated see maxdist for local kriging only observations within a distance of maxdi st from the pre diction location are used for prediction or simulation if combined with nmax both criteria apply print debugging information 0 suppresses debug information Leave one out cross validation LOOCV visits a data point and predicts the value at that location b
69. se be sure you want the data before you request it The data were obtained on Oct 12 2008 from http www stat washington edu raftery software html The data are also available from statlib Locations of 11 of the stations ROS Rosslare has been thrown out because it fits poorly the spatial correlations of the other stations were obtained from http www stat washington edu research reports 2005 tr475 pdf Roslare lat lon was obtained from google maps location Roslare The mean wind value for Roslare comes from Fig 1 in the original paper Haslett and Raftery proposed to use a sqrt transform to stabilize the variance Author s Adrian Raftery imported to R by Edzer Pebesma References These data were analyzed in detail in the following article Haslett J and Raftery A E 1989 Space time Modelling with Long memory Dependence As sessing Ireland s Wind Power Resource with Discussion Applied Statistics 38 1 50 and in many later papers on space time analysis for example Tilmann Gneiting Marc G Genton Peter Guttorp Geostatistical Space Time Models Stationarity Separability and Full symmetry Ch 4 in B Finkenstaedt L Held V Isham Statistical Methods for Spatio Temporal Systems Examples data wind summary wind wind loc wind loc y as numeric char2dms as character wind loc Latitude wind loc x as numeric char2dms as character wind loc Longitude coordinates wind loc
70. sill such as the spherical is fit with a nugget and the range parameter starts or converges to a value smaller than the distance of the second sample variogram estimate In this case again an infinite number of possibilities occur essentially for fitting a line through a single first sample variogram point In both cases fixing one or more of the variogram model parameters may help you out 6 fit variogram gls Author s Edzer Pebesma References http www gstat org Pebesma E J 2004 Multivariable geostatistics in S the gstat package Computers 1 Geo sciences 30 683 691 See Also variogram vgm Examples data meuse vgml lt variogram log zinc 1 x y meuse fit variogram vgml vgm 1 sSph 300 1 fit variogram gls GLS fitting of variogram parameters Description Fits variogram parameters nugget sill range to variogram cloud using GLS generalized least squares fitting Only for direct variograms Usage fit variogram gls formula data model maxiter 30 eps 01 trace TRUE ignoreInitial TRUE cutoff Inf plot FALSE Arguments formula formula defining the response vector and possible regressors in case of ab sence of regressors use e g z 1 data object of class Spatial model variogram model to be fitted output of vgm maxiter maximum number of iterations eps convergence criterium trace logical if TRUE prints parameter trace ignoreInitial logi
71. ssfim Kriging standard errors as function of grid spacing and block size Description Calculate for a given variogram model ordinary block kriging standard errors as a function of sampling spaces and block sizes Usage ossfim spacings 1 5 block sizes 1 5 model nmax 25 debug 0 Arguments spacings range of grid data spacings to be used block sizes range of block sizes to be used model variogram model output of vgm nmax set the kriging neighbourhood size debug debug level set to 32 to see a lot of output Value data frame with columns spacing the grid spacing block size the block size and kriging se block kriging standard error Note The idea is old simple but still of value If you want to map a variable with a given accuracy you will have to sample it Suppose the variogram of the variable is known Given a regular sampling scheme the kriging standard error decreases when either i the data spacing is smaller or ii predictions are made for larger blocks This function helps quantifying this relationship Ossfim probably refers to optimal sampling scheme for isarithmic mapping Author s Edzer Pebesma References Burrough P A R A McDonnell 1999 Principles of Geographical Information Systems Oxford University Press e g figure 10 11 on page 261 Burgess T M R Webster A B McBratney 1981 Optimal interpolation and isarithmic mapping of soil properties V Sampling strateg
72. the inverse distance weighting power y matrix to krige multiple fields in a single step pass data as columns of matrix y This will ignore the value of the response in formula computeVar logical if TRUE prediction variances will be returned fullCovariance logical if FALSE a vector with prediction variances will be returned if TRUE the full covariance matrix of all predictions will be returned krige 21 Details Function krige is a simple wrapper method around gstat and predict gstat for univariate kriging prediction and conditional simulation methods available in gstat For multivariate prediction or simulation or for other interpolation methods provided by gstat such as inverse distance weighted interpolation or trend surface interpolation use the functions gstat and predict gstat directly Function idw performs just as krige without a model being passed but allows direct specification of the inverse distance weighting power Don t use with predictors in the formula For further details see predict gstat Value if locations is not a formula object of the same class as newdata deriving from Spatial else a data frame containing the coordinates of newdata Attributes columns contain prediction and prediction variance in case of kriging or the abs nsim columns of the conditional Gaussian or indicator simulations krige0 and idw0 are alternative functions that have reduced functionality and larger memory requirements
73. tion an independent landscape soil map was made by interpolating soil boundaries between these soil types using information from the changes in landform Because the soil varies over short distances this field mapping caused some soil borings to receive a different classification from the classification based on the point data Also registered at each auger point were the site elevation m the depth to solid chalk rock in cm and the depth to lime in cm Also the percent clay content the Munsell colour components of VALUE and CHROMA and the lime content of the soil as tested using HCl were recorded for the top two soil layers 0 20cm and 20 40cm Samples of topsoil taken as a bulk sample within a circle of radius 2 5m around each sample point were used for the laboratory determination of Mg ppm OM1 CEC as mequ 100g air dry soil pH P as ppm and K ppm Usage data oxford oxford 33 Format This data frame contains the following columns PROFILE profile number XCOORD x coordinate field non projected YCOORD y coordinate field non projected ELEV elevation m PROFCLASS soil class obtained by classifying the soil profile at the sample site MAPCLASS soil class obtained by looking up the site location in the soil map VAL1 Munsell colour component VALUE 0 20 cm CHR1 Munsell colour component CHROMA 20 40 cm LIME1 Lime content tested using HCl 0 20 cm VAL2 Munsell colour component VALUE 0 20 cm CHR2 Munsell col
74. urely when a positive nugget is present Author s Edzer Pebesma References http www gstat org See Also vgm variogramLine sic2004 45 Examples show vgms show vgms models c Exp Mat Gau nugget 0 1 show a set of Matern models with different smoothness show vgms kappa range c 1 2 5 1 2 5 10 max 10 show a set of Exponential class models with different shape parameter show vgms kappa range c 05 1 2 5 1 1 5 1 8 1 9 2 models Exc max 10 show a set of models with different shape parameter of M Stein s representation of the Ma show vgms kappa range c 01 02 05 1 2 5 1 2 5 1000 models Ste max sic2004 Spatial Interpolation Comparison 2004 data set Natural Ambient Ra dioactivity Description The text below is copied from http www ai geostats org events sic2004 index htm subsection Data The variable used in the SIC 2004 exercise is natural ambient radioactivity measured in Germany The data provided kindly by the German Federal Office for Radiation Protection BfS are gamma dose rates reported by means of the national automatic monitoring network IMIS In the frame of SIC2004 a rectangular area was used to select 1008 monitoring stations from a total of around 2000 stations For these 1008 stations 11 days of measurements have been randomly selected during the last 12 months and the average daily dose r
75. ww math umd edu bnk bak Splus kriging html As it uses the R gstat krige function to derive everything it needs in addition to ordinary kriging on the transformed scale a simple kriging step to find m from the difference between the OK and SK prediction variance and a kriging BLUE estimation step to obtain the estimate of u For further details see krige and predict gstat Value an SpatialPointsDataFrame object containing the fields m for the m Lagrange parameter for each location var1SK pred the cgC correction obtained by muhat for the mean estimate at each location var1SK var the simple kriging variance var1 pred the OK prediction on the trans formed scale var var the OK kriging variance on the transformed scale var1TG pred the transGaussian kriging predictor var1TG var the transGaussian kriging variance obtained by d it Alois Author s Edzer Pebesma References N A C Cressie 1993 Statistics for Spatial Data Wiley http www gstat org See Also gstat predict gstat map to lev 27 Examples data meuse coordinates meuse x y data meuse grid gridded meuse grid x y v vgm 1 Exp 300 xl krigeTg zinc 1 meuse meuse grid v lambda 1 no transform x2 krige zinc 1 meuse meuse grid v summary x2Svarl var x1Svar1TG var summary x2Svar1l pred x1Svar1TG pred lambda 0 25 m fit variogram variogram zinc lambda 1 lambda 1 meuse vgm l Exp 300 x krigeTg zi
76. y The journal of soil science 32 4 643 660 McBratney A B R Webster 1981 The design of optimal sampling schemes for local estimation and mapping of regionalized variables 2 program and examples Computers and Geosciences 7 335 365 read more on a simplified web based version on http www gstat org ossfim html 32 oxford See Also krige Examples x lt ossfim 1 15 1 15 model vgm 1 Exp 15 library lattice levelplot kriging se spacingtblock size x main Ossfim results variogram 1 Exp 15 if you wonder about the decrease in the upper left corner of the graph try the above with nmax set to 100 or perhaps 200 oxford Oxford soil samples Description Data 126 soil augerings on a 100 x 100m square grid with 6 columns and 21 rows Grid is oriented with long axis North north west to South south east Origin of grid is South south east point 100m outside grid Original data are part of a soil survey carried out by P A Burrough in 1967 The survey area is located on the chalk downlands on the Berkshire Downs in Oxfordshire UK Three soil profile units were recognised on the shallow Rendzina soils these are Ia very shallow grey calcareous soils less than 40cm deep over chalk Ct shallow to moderately deep grey brown calcareous soils on calcareous colluvium and Cr deep moderately acid red brown clayey soils These soil profile classes were registered at every augering In addi
77. y leaving out the observed value and proceeds with the next data point The observed value is left out because kriging would otherwise predict the value itself N fold cross validation makes a 24 krige cv partitions the data set in N parts For all observation in a part predictions are made based on the remaining N 1 parts this is repeated for each of the N parts N fold cross validation may be faster than LOOCV Value data frame containing the coordinates of data or those of the first variable in object and columns of prediction and prediction variance of cross validated data points observed values resid uals zscore residual divided by kriging standard error and fold If all residuals is true a data frame with residuals for all variables is returned without coor dinates Methods formula formula locations formula locations specifies which coordinates in data re fer to spatial coordinates formula formula locations Spatial Object locations knows about its own spatial loca tions Note Leave one out cross validation seems to be much faster in plain stand alone gstat apparently quite a bit of the effort is spent moving data around from R to gstat Author s Edzer Pebesma References http www gstat org See Also krige gstat predict gstat Examples data meuse coordinates meuse x x y m lt vgm 59 Sph 874 04 five fold cross validation x lt krige cv log
78. zinc 1 meuse m nmax 40 nfold 5 bubble x residual main log zinc 5 fold CV residuals multivariable thanks to M Rufino meuse g lt gstat id zn formula log zinc 1 data meuse meuse g lt gstat meuse g cu log copper 1 meuse meuse g lt gstat meuse g model vgm 1 Sph 900 1 fill all TRU x lt variogram meuse g cutoff 1000 je krigeTg 25 meuse fit fit lmc x meuse g out gstat cv meuse fit nmax 40 nfold 5 summary out out gstat cv meuse fit nmax 40 nfold c rep 1 100 rep 2 55 summary out mean error ideally 0 mean out residual MSPE ideally small mean out residual 2 Mean square normalized error ideally close to 1 mean out zscore 2 correlation observed and predicted ideally 1 cor outSobserved out observed out Sresidual correlation predicted and residual ideally 0 cor out Sobserved out residual outSresidual krigeTg TransGaussian kriging using Box Cox transforms Description TransGaussian ordinary kriging function using Box Cox transforms Usage krigeTg formula locations newdata model NULL nmax Inf nmin 0 maxdist Inf block numeric 0 nsim 0 na action na pass debug level 1 lambda 1 0 Arguments formula formula that defines the dependent variable as a linear model of independent variables suppose the dependent variable has name z for ordinary and use a formula like z

Download Pdf Manuals

image

Related Search

Related Contents

  manual AT6 - Burigotto    Model No. KX-TG4061LAT KX-TG4062LAT KX  Ville de Corbas  Oracle FLEXCUBE Investor Servicing  User manual for Segment - Software for Quantitative Medical Image  Manual do usuário Manual del usuario  XR SERIES UNIVERSAL RECESSED SUPPORT 03.M007 rel 1.4 eng  Victorinox Air Boss 24833 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file