Manual Geor Web
-
Upload
gloria-acosta -
Category
Documents
-
view
244 -
download
0
Transcript of Manual Geor Web
-
8/13/2019 Manual Geor Web
1/42
geoR : Package for Geostatistical Data Analysis
An illustrative session
Paulo J. Ribeiro Jr. & Peter J. Diggle
Last update: November 21, 2006
1 Itrodu!tio
2 "tartig a "essio ad Loadig Data
2.1 Loadig t#e pa!$age
2.2 %sig data
'(plorator) *ools
.1 Plottig data lo!atios ad values
.2 'mpiri!al variograms
+ Parameter 'stimatio -ross/alidatio
6 "patial Iterpolatio
a)esia al)sis
3 "imulatio o4 5aussia Radom ields
7 -itig geoR
1 Introduction
*#e pa!$age geoR provides 4u!tios 4or geostatisti!al data aal)sis usig t#e
so4t8are R. *#is do!umet illustrates some 9but ot all; o4 t#e !apabilities o4 t#epa!$age.
*#e ob
-
8/13/2019 Manual Geor Web
2/42
*)pi!all), de4ault argumets are used 4or t#e 4u!tio !alls ad t#e user is
e!ouraged to ispe!t ot#er argumets o4 t#e 4u!tios usig
t#e args ad help 4u!tios. or ista!e, to see all t#e argumets 4or t#e
4u!tiovariog t)pe args(variog) ad@or help(variog).
*#e !ommads s#o8 i t#is page are also available i t#e?le http://www.leg.ufpr.br/geoR/geoRdoc/geoRintro.R.
>e re4er to t#e geoR do!umetatio
9http://www.leg.ufpr.br/geoR/geoR.html#help; 4or more details
o t#e 4u!tios i!luded i t#e pa!$age geoR.
Ae(tB A4rotB AupB
2 Starting a Session and Loading Data
2.1 Loading the package
4ter startig a R sessio, load geoR 8it# t#e
!ommad library 9or require;. I4 t#e pa!$age is loaded !orre!tl) a
message 8ill be displa)ed.
> library(geoR)
I4 t#e istallatio dire!tor) 4or t#e pa!$age is t#e de4ault lo!atio
4or Rpa!$ages, t)pe:
> library(geoR, lib.loc="PA!#geoR")
8#ere C!"$%&%geoR= is t#e pat# to t#e dire!tor) 8#ere geoR 8as
istalled.
2.2 Using data
*)pi!all), data are stored as a ob
-
8/13/2019 Manual Geor Web
3/42
>e re4er to t#e do!umetatio 4or t#e
4u!tios as.geodata ad read.geodata 4or more i4ormatio o #o8
to import@!overt data ad o t#e de?itios 4or t#e !lass geodata.
-#e!$http://www.leg.ufpr.br/geoR/importing"**.html4or
i4ormatio o #o8 to read data 4rom a "-II 9te(t; ?le.
*#ere a a 4e8 datasets i!luded i t#e pa!$age distributio. or t#e e(amples
i!luded i t#is do!umet 8e use t#e data set s+,, i!luded i
t#e geoR distributio. *o load t#is data t)pe:
> data(s$%%)
*#e list o4 all datasets i!luded i t#e pa!$age is give
b) data(package-geoR).
Ae(tB AprevB AprevtailB A4rotB AupB
ommands in the geoRintro webpage## #### his is a script file illustrating some features of geoR## *t may be used as an introduction to usage of geoR#### &nly a few key commands and options are illustrated here.## his is 0& an e1austive demonstration of the package resources.##
## he commands are for illustrative purposes only.## 2e do not attempt to perform a definitive analysis of the data.###### +. ourcing the package#### uncomment one of the following inf necessaryrequire(geoR)##library(geoR3 lib.loc-!"$%&%geoR)
data(s+,,)par.ori 4 par(no.readonly-R56)
#### 7. 8escriptive plots####9peg(s+,,plot/s+,,p,+.9peg3 wid-;,3 hei-;,)plot(s+,,)##dev.off()####9peg(s+,,plot/s+,,p,7.9peg3 wid-;,3 hei-;,)par(mfrow - c(737)3 mar-c(
-
8/13/2019 Manual Geor Web
4/42
points(s+,,3 1lab - oord >3 ylab - oord ?3 pt.divide - rank.prop)points(s+,,3 1lab - oord >3 ylab - oord ?3 ce1.ma1 - +.@3 col -gray(seq(+3 ,.+3 l-+,,))3 pt.divide - equal)points(s+,,3 pt.divide - quintile3 1lab - oord >3 ylab - oord ?)##dev.off()par(par.ori)
####
-
8/13/2019 Manual Geor Web
5/42
##9peg(s+,,plot/s+,,p,;a.9peg3 wid-;,,3 hei-7@;)par(mfrow-c(+37)3mar-c(
-
8/13/2019 Manual Geor Web
6/42
legend(,.;;3 ,.
-
8/13/2019 Manual Geor Web
7/42
save.image()##
##9peg(s+,,plot/s+,,p,=a.9peg3 wid-;,,3 hei-=,,)par(mfcol - c(;37)3 mar-c(7.;37.;3.;3.;)3 mgp-c(+.=3,.=3,))plot(1v.wls)##dev.off()
par(par.ori)#### =. Jriging####9peg(s+,,plot/s+,,p,K.9peg3 wid-
-
8/13/2019 Manual Geor Web
8/42
##9peg(s+,,plot/s+,,p+7.9peg3 wid-
-
8/13/2019 Manual Geor Web
9/42
## +,. imulation##sim+ 4 grf(+,,3 cov.pars-c(+3 .7;))
##9peg(s+,,plot/s+,,p+;.9peg3 wid-;,,3 hei-7;,)par(mfrow-c(+37)3mar-c(7.;37.;3+3,.7)3mgp-c(+.;3.=3,))points.geodata(sim+3 main-simulated data)
plot(sim+3 ma1.dist-+3 main-true and empirical variograms)##dev.off()
sim7 4 grf(+3 grid-reg3 cov.pars-c(+3 .7;))
##9peg(s+,,plot/s+,,p+B.9peg3 wid-
-
8/13/2019 Manual Geor Web
10/42
8ata summary
Fin. +st Su. Fedian Fean
-
8/13/2019 Manual Geor Web
11/42
!igure
1"
Plot produced
by plot.geodata.
*#e 4u!tio points.geodata produ!es a plot s#o8ig t#e data
lo!atios. lterativel), poits idi!atig t#e data lo!atios !a be added to a
!urret plot. *#ere are optios to spe!i4) poit siFes, patters ad !olors, 8#i!#
!a be set to be proportioal to t#e data values or spe!i?ed Euatiles. "ome
e(amples o4 grap#i!al outputs are illustrated b) t#e !ommads belo8 ad
!orrespodig plots as s#o8 i igure .1.
> par(mfrow = c(&, &))
> points(s$%%, 'lab = "oord ", ylab = "oord *")
> points(s$%%, 'lab = "oord ", ylab = "oord *",
+ pt.diide = "ran-.prop")
> points(s$%%, 'lab = "oord ", ylab = "oord *",
+ ce'.ma' = $., col = gray(se/($, %.$, l = $%%)),
+ pt.diide = "e/ual")
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-60003.1http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-60003.1 -
8/13/2019 Manual Geor Web
12/42
> points(s$%%, pt.diide = "/uintile", 'lab = "oord ",
+ ylab = "oord *")
!igure
2"
Plot produced
by points.geodata.
3.2 E#pirical ariogra#s
'mpiri!al variograms are !al!ulated usig t#e 4u!tio variog. *#ere are
optios 4or t#e classical or modulus estimator. Results !a be retured as
variogram !louds, bied or smoot#ed variograms. *#ere are met#ods
4or plot to 4a!ilitate t#e displa) o4 t#e results as s#o8 i igure .
> cloud$ 01 ariog(s$%%, option = "cloud", ma'.dist = $)
> cloud& 01 ariog(s$%%, option = "cloud", estimator.type = "
modulus",
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70233http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70233 -
8/13/2019 Manual Geor Web
13/42
+ ma'.dist = $)
> bin$ 01 ariog(s$%%, uec = se/(%, $, l = $$))
> bin& 01 ariog(s$%%, uec = se/(%, $, l = $$),
+ estimator.type = "modulus")
> par(mfrow = c(&, &))> plot(cloud$, main = "classical estimator")
> plot(cloud&, main = "modulus estimator")
> plot(bin$, main = "classical estimator")
> plot(bin&, main = "modulus estimator")
!igure
3"
Ploting
of variog results.
"everal results are retured b) t#e 4u!tio variog. *#e ?rst t#ree are t#e
more importat oes ad !otais t#e dista!es, t#e estimated semivaria!e ad
t#e umber o4 pairs 4or ea!# bi.
-
8/13/2019 Manual Geor Web
14/42
> names(bin$)
N+O u v
N bin& 01 ariog(s$%%, uec = se/(%, $, l = $$),+ estimator.type = "modulus", bin.cloud = )
> par(mfrow = c($, &))
> plot(bin$, bin.cloud = , main = "classical estimator")
> plot(bin&, bin.cloud = , main = "modulus estimator")
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70003.2http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70003.2 -
8/13/2019 Manual Geor Web
15/42
!igure
$"
2o'1plots for each of the
ariogram bins.
Dire!tioal variograms !a also be !omputed b) t#e 4u!tio variog usig
t#e argumets Cdirection= ad Ctolerance=. or e(ample, to !ompute a
variogram 4or t#e dire!tio 60 degrees 8it# t#e de4ault tolera!e agle 922.
degrees; t#e !ommad 8ould be:
> ario3% 01 ariog(s$%%, ma'.dist = $, direction = pi45)
or a Eui!$ !omputatio i 4our dire!tios 8e !a use t#e
4u!tio variog 8#i!# b) de4ault !omputes variogram 4or t#e dire!tio
agles 0o, +o, 70oad 1o.
> ario.6 01 ariog6(s$%%, ma'.dist = $)
*#e igure s#o8 t#e dire!tioal variograms obtaied 8it# t#e !ommadsabove.
> par(mfrow = c($, &), mar = c(5, 5, $.7, %.7))
> plot(ario3%)
> title(main = e'pression(paste("directional, angle = ",
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70755http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose3.html#x4-70755 -
8/13/2019 Manual Geor Web
16/42
+ 3% 8 degree)))
> plot(ario.6, lwd = &)
!igure
%"
9irectional
ariograms
$ Para#eter Esti#ation
*#eoreti!al ad empiri!al variograms !a be plotted ad visuall) !ompared. or
e(ample, t#e le4t pael i igure 6s#o8s t#e t#eoreti!al variogram model used tosimulate t#e data s+,, ad t8o estimated variograms.
> bin$ 01 ariog(s$%%, uec = se/(%, $, l = $$))
> plot(bin$)
> lines.ariomodel(co.model = "e'p", co.pars = c($,
+ %.5), nugget = %, ma'.dist = $, lwd = 5)
> smooth 01 ariog(s$%%, option = "smooth", ma'.dist = $,
+ n.points = $%%, -ernel = "normal", band = %.&)> lines(smooth, type = "l", lty = &)
> legend(%.6, %.5, c("empirical", "e'ponential model",
+ "smoothed"), lty = c($, $, &), lwd = c($,
+ 5, $))
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose4.html#x5-80456http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose4.html#x5-80456 -
8/13/2019 Manual Geor Web
17/42
I pra!ti!e 8e usuall) do=t $o8 t#e true parameters 8#i!# #ave top be
estimated b) some met#od. I t#e pa!$age geoR t#e model parameters !a be
estimated:
$. by eye: trying different models oer empirical ariograms
(using the function lines.variomodel),
&. by least squares fit of empirical variograms: with optionsfor ordinary (#;
-
8/13/2019 Manual Geor Web
18/42
!igure
&"
heoretical ariogram cures added to empirical
ariograms.
>#e usig t#e parameter estimatio
4u!tios variofit ad likfit t#e ugget e44e!t parameter !a eit#er be
estimated or set to a ?(ed value. *#e same applies 4or smoot#ess, aisotrop)
ad tras4ormatio parameters. ptios 4or ta$ig treds ito a!!out are also
i!luded. *reds !a be spe!i?ed as pol)omial 4u!tios o4 t#e !oordiates
ad@or liear 4u!tios o4 give !ovariates.
e(ample !all to likfit is give belo8. Ket#ods
4or print() ad summary() #ave bee 8ritte to summariFe t#e resultig
ob ml 01 li-fit(s$%%, ini = c($, %.7))
likfit: likelihood ma1imisation using the function o
ptim.
likfit: 5se control() to pass additional
arguments for the ma1imisation function.
-
8/13/2019 Manual Geor Web
19/42
Dor further details see documentation for op
tim.
likfit: *t is highly advisable to run this function
several
times with different initial values for theparameters.
likfit: 2"R0*0T: his step can be time demandingU
likfit: end of numerical ma1imisation.
> ml
likfit: estimated model parameters:
beta tausq sigmasq phi
,.@@BB ,.,,,, ,.@;+@ ,.+=7@
likfit: ma1imised loglikelihood - = summary(ml)
ummary of the parameter estimation
6stimation method: ma1imum likelihood
!arameters of the mean component (trend):
beta
,.@@BB
!arameters of the spatial component:
correlation function: e1ponential
(estimated) variance parameter sigmasq (partia
l sill) - ,.@;+@
-
8/13/2019 Manual Geor Web
20/42
(estimated) cor. fct. parameter phi (range par
ameter) - ,.+=7@
anisotropy parameters:
(fi1ed) anisotropy angle - , ( , degrees )
(fi1ed) anisotropy ratio - +
!arameter of the error component:
(estimated) nugget - ,
ransformation parameter:
(fi1ed) Lo1o1 parameter - + (no transformati
on)
Fa1imised Gikelihood:
log.G n.params "* L*
= options(geoR.messages = A;
-
8/13/2019 Manual Geor Web
21/42
> ml 01 li-fit(s$%%, ini = c($, %.7), fi'.nugget = )
> reml 01 li-fit(s$%%, ini = c($, %.7), fi'.nugget = ,
+ method = "R;")
> ols 01 ariofit(bin$, ini = c($, %.7), fi'.nugget = ,+ weights = "e/ual")
> wls 01 ariofit(bin$, ini = c($, %.7), fi'.nugget = )
itting models with a B'ed alue for the nugget
> ml.fn 01 li-fit(s$%%, ini = c($, %.7), fi'.nugget = ,
+ nugget = %.$7)
> reml.fn 01 li-fit(s$%%, ini = c($, %.7), fi'.nugget = ,+ nugget = %.$7, method = "R;")
> ols.fn 01 ariofit(bin$, ini = c($, %.7), fi'.nugget = ,
+ nugget = %.$7, weights = "e/ual")
> wls.fn 01 ariofit(bin$, ini = c($, %.7), fi'.nugget = ,
+ nugget = %.$7)
itting models estimated nugget
> ml.n 01 li-fit(s$%%, ini = c($, %.7), nug = %.7)
> reml.n 01 li-fit(s$%%, ini = c($, %.7), nug = %.7,
+ method = "R;")
> ols.n 01 ariofit(bin$, ini = c($, %.7), nugget = %.7,
+ weights = "e/ual")
> wls.n 01 ariofit(bin$, ini = c($, %.7), nugget = %.7)
No8, t#e !omads 4or plottig ?tted models agaist empiri!al variogram as
s#o8 i igure +are:
> par(mfrow = c($, 5))
> plot(bin$, main = e'pression(paste("fi'ed ", tauD& ==
+ %)))
> lines(ml, ma'.dist = $)
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose4.html#x5-80004http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose4.html#x5-80004http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose4.html#x5-80004 -
8/13/2019 Manual Geor Web
22/42
-
8/13/2019 Manual Geor Web
23/42
*8o $ids o4 variogram envelopes !omputed b) simulatio are illustrated i
t#e ?gure belo8.
*#e plot o t#e le4t#ad side s#o8s a evelope based o permutatios o4
t#e data values a!ross t#e lo!atios, i.e. evelopes built uder t#e assumptio o4
o spatial !orrelatio. *#e evelopes s#o8 o t#e rig#t#ad side are based osimulatios 4rom a give set o4 model parameters, i t#is e(ample t#e parameter
estimates 4rom t#e >L" variogram ?t. *#is evelope s#o8s t#e variabilit) o4 t#e
empiri!al variogram.
> en.mc 01 ariog.mc.en(s$%%, obE.ar = bin$)
> en.model 01 ariog.model.en(s$%%, obE.ar = bin$,
+ model = wls)
> par(mfrow = c($, &))
> plot(bin$, enelope = en.mc)
> plot(bin$, enelope = en.model)
!igure
("
Fariogram
enelopes.
Pro?le li$eli#oods 91D ad 2D; are !omputed b) t#e 4u!tio proflik.
Mere 8e s#o8 t#e pro?le li$eli#oods 4or t#e !ovaria!e parameters o4 t#e model
-
8/13/2019 Manual Geor Web
24/42
8it#out ugget e44e!t previousl) ?tted b) likfit.
>RNIN5: R%NNIN5 *M' N'* -KKND -N ' *IK'
-N"%KIN5
> prof 01 profli-(ml, geodata = s$%%, sill.al = se/(%.6@,
+ &, l = $$), range.al = se/(%.$, %.7&, l = $$),
+ uni.only = A;
-
8/13/2019 Manual Geor Web
25/42
-rossvalidatio residuals are obtaied subtra!tig t#e observed data mius t#e
predi!ted value. "tadardised residuals are obtaied dividig b) t#e sEuare root
o4 t#e predi!tio varia!e 9C$rigig varia!e=;. ) de4ault t#e 10 plots s#o8 i
t#e igure 10are produ!ed but t#e user !a restri!t t#e !#oi!e usig t#e 4u!tio
argumets.
> par(mfcol = c(7, &), mar = c(5, 5, $, %.7), mgp = c($.7,
+ %., %))
> plot('.wls)
!igure
1-"
ross1alidations
results
variatio o4 t#is met#od is illustrated b) t#e e(t t8o !alls 8#ere t#e model
parameters are reestimated ea!# time a poit is removed 4rom t#e dataset.
>RNIN5: R%NNIN5 *M' N'* -KKND -N ' *IK'
-N"%KIN5
http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose5.html#x6-901110http://www.leg.ufpr.br/geoR/geoRdoc/vignette/geoRintro/geoRintrose5.html#x6-901110 -
8/13/2019 Manual Geor Web
26/42
> 'R.ml 01 'alid(s$%%, model = ml, reest = RG?)
> 'R.wls 01 'alid(s$%%, model = wls, reest = RG?,
+ ariog.obE = bin$)
& Spatial Interpolation
-ovetioal geostatisti!al spatial iterpolatio 9kriging; !a be per4ormed 8it#
optios 4or:
$. Simple kriging
&. Ordinary kriging
5. Trend universal! kriging
6. "#ternal trend kriging
*#ere are additioal optios 4or o(-o( tras4ormatio 9ad ba!$
tras4ormatio o4 t#e results; ad aisotropi! models. "imulatios !a be dra8
4rom t#e resultig predi!tive distributios i4 reEuested.
s a ?rst e(ample !osider t#e predi!tio at 4our lo!atios labeled 1, 2, 3,
4 ad idi!ated i t#e ?gure belo8.
> plot(s$%%Hcoords, 'lim = c(%, $.&), ylim
= c(%,
+ $.&), 'lab = "oord ", ylab = "oord
*")
> loci 01 matri'(c(%.&, %.3, %.&, $.$, %.&, %
.5,
+ $, $.$), ncol = &)
> te't(loci, as.character($:6), col = "red")
> polygon(' = c(%, $, $, %), y = c(%, %, $,
$),
+ lty = &)
-
8/13/2019 Manual Geor Web
27/42
!igure
11"
9ata locations and points to be
predicted
*#e !ommad to per4orm ordinary kriging usig t#e parameters estimated b)
8eig#ted least sEuares 8it# ugget ?(ed to Fero 8ould be:
> -c6 01 -rige.con(s$%%, locations = loci, -rige = -rige.control
(obE.m = wls))
*#e output is a list i!ludig t#e predi!ted values 9kc'predict; ad t#e
$rigig varia!es 9kc'krige.var;.
-osider o8 a se!od e(ample. *#e goal is to per4orm predi!tio o a grid
!overig t#e area ad to displa) t#e results. gai, 8e use ordiar) $rigig. *#e
!ommads !ommads belo8 de?es a grid o4 lo!atios ad per4orms t#e
predi!tio at t#ose lo!atios.
> pred.grid 01 e'pand.grid(se/(%, $, l = 7$), se/(%,
+ $, l = 7$))
> -c 01 -rige.con(s$%%, loc = pred.grid, -rige = -rige.control(
obE.m = ml))
-
8/13/2019 Manual Geor Web
28/42
met#od 4or t#e 4u!tio image !a be used 4or displa)ig predi!ted values as
s#o8 i t#e e(t igure, as 8ell as ot#er predi!tio results retured
b) krige.conv.
> image(-c, loc = pred.grid, col = gray
(se/($, %.$,
+ l = 5%)), 'lab = "oord ", ylab =
"oord *")
!igure
12"
ap of the -riging
estimates
' ayesian /nalysis
a)esia aal)sis 4or 5aussia models is implemeted b) t#e
4u!tio krige.bayes. It !a be per4ormed 4or di44eret Hdegrees o4
u!ertait)H, meaig t#at model parameters !a be treated as ?(ed or radom.
s a e(ample !osider a model 8it#out ugget ad i!ludig u!ertait) i
t#e mea, sill ad rage parameters. Predi!tio at t#e 4our lo!atios idi!ated
above is per4ormed b) t)pig a !ommad li$e:
>RNIN5: R%NNIN5 *M' N'* -KKND -N ' *IK'
-N"%KIN5
-
8/13/2019 Manual Geor Web
29/42
> bsp6 01 -rige.bayes(s$%%, loc = loci, prior = prior.control(phi
.discrete = se/(%,
+ 7, l = $%$), phi.prior = "rec"), output = output.control(n.po
st = 7%%%))
Mistograms s#o8ig posterior distributio 4or t#e model parameters !a be
plotted b) t)pig:
> par(mfrow = c($, 5), mar = c(5, 5, $, %.7), mgp = c(&,
+ $, %))
> hist(bsp6HposteriorHsampleHbeta, main = "", 'lab = e'
pression(beta),
+ prob = )
> hist(bsp6HposteriorHsampleHsigmas/, main = "",
+ 'lab = e'pression(sigmaD&), prob = )
> hist(bsp6HposteriorHsampleHphi, main = "", 'lab = e'p
ression(phi),
+ prob = )
!igure
13"
!istograms of samples from posterior
distribution
%sig summaries o4 t#ese posterior distributios 9meas, medias or modes;
8e !a !#e!$ t#e Hestimated a)esia variogramsH agaist t#e empiri!alvariogram, as s#o8 i t#e e(t ?gure. Noti!e t#at it is also possible to !ompare
t#ese estimates 8it# ot#er ?tted variograms su!# as t#e oes !omputed i "e!tio
.
-
8/13/2019 Manual Geor Web
30/42
> plot(bin$, ylim = c(%, $.7))
> lines(bsp6, ma'.dist = $.&, summ = mean)
> lines(bsp6, ma'.dist = $.&, summ = median, lty =
&)
> lines(bsp6, ma'.dist = $.&, summ = "mode", post
= "par",+ lwd = &, lty = &)
> legend(%.&7, %.6, legend = c("ariogram posterior
mean",
+ "ariogram posterior median", "parameters post
erior mode"),
+ lty = c($, &, &), lwd = c($, $, &), ce' = %.@)
!igure
1$"
Fariogram models based on the posterior
distributions
*#e e(t ?gure s#o8s predi!tive distributios at t#e 4our sele!ted lo!atios.
Das#ed lies s#o8 5aussia distributios 8it# mea ad varia!e give b)
results o4 ordiar) $rigig obtaied i "e!tio +. *#e 4ull lies !orrespod to t#e
a)esia predi!tio. *#e plot s#o8s results o4 desit) estimatio usig samples4rom t#e predi!tive distributios.
> par(mfrow = c(&, &))
> for (i in $:6) I
+ -p' 01 se/(-c6HpredJiK 1 5 8 s/rt(-c6H-rige.arJiK),
-
8/13/2019 Manual Geor Web
31/42
+ -c6HpredJiK + 5 8 s/rt(-c6H-rige.arJiK),
+ l = $%%)
+ -py 01 dnorm(-p', mean = -c6HpredJiK, sd = s/rt(-c6H-ri
ge.arJiK))
+ bp 01 density(bsp6HpredicHsimulJi, K)+ r' 01 range(c(-p', bpH'))
+ ry 01 range(c(-py, bpHy))
+ plot(cbind(r', ry), type = "n", 'lab = paste(";ocation",
+ i), ylab = "density", 'lim = c(16, 6),
+ ylim = c(%, $.$))
+ lines(-p', -py, lty = &)
+ lines(bp)
+ L
!igure
1%"
Predictie distributions at the four selected
locations
-
8/13/2019 Manual Geor Web
32/42
-
8/13/2019 Manual Geor Web
33/42
!igure
1&"
aps obtained from the predictie
distribution
( Si#ulation o0 aussian ando# !ields
*#e 4u!tio grf geerates simulatios o4 5aussia radom ?elds o regular or
irregular sets o4 lo!atios. It relies o t#e de!ompositio o4 t#e !ovaria!e matri(
ad t#er4ore 8o=t 8or$ 4or large umber o4 lo!atios i 8#i!# !ase 8e suggest
t#e usage o4 t#e pa!$age Radomields. "ome o4 its 4u!tioalit) is illustrated
b) t#e e(t !ommads.
> par(mfrow = c($, &))
> sim$ 01 grf($%%, co.pars = c($, %.&7))
> points.geodata(sim$, main = "simulated locations and alues")
> plot(sim$, ma'.dist = $, main = "true and empirical ariograms")
-
8/13/2019 Manual Geor Web
34/42
!igure
1'"
par(mfrow = c($, &))
> sim& 01 grf(66$, grid = "reg", co.pars = c($,
+ %.&7))
> image(sim&, main = "a small1ish simulation", col = gray(se/($,
+ %.$, l = 5%)))
-
8/13/2019 Manual Geor Web
35/42
!igure
1("
-
8/13/2019 Manual Geor Web
36/42
pages - M+;+=Q3
issn - M+B,K
-
8/13/2019 Manual Geor Web
37/42
ee also Ycitation(pkgname)Y for citing R packages
.
Note: urther e'amples for the function krige.bayes are gien in
the
Ble http://www.leg.ufpr.br/geoR/geoRdoc/e1amples.krige.
bayes.R.
require(geoR)set.seed(7=;)#### Durther e1amples for the usage of krige.bayes()## #### Lefore reading this see documentation for krige.bayes
## H help(krige.bayes)#### 2"R0*0T: $66 "GG "0 L6 *F6 "08 !"*0T 86FF"08*0T
## imulating datae1.data 4 grf(;,3 cov.pars-c(+,3 .7;))
#### Lasic usage##
## a basic and simple call to the functione1.post 4 krige.bayes(e1.data)
e1.postnames(e1.post)
## different input and output optionse1+ 4 krige.bayes(e1.data3 prior - list(phi.prior - fi1ed3 phi - ,.
-
8/13/2019 Manual Geor Web
38/42
e1.bayes 4 krige.bayes(e1.data3 loc-e1.grid3 prior - prior.control(phi.discrete-seq(,3 73 l-
-
8/13/2019 Manual Geor Web
39/42
ap.kb
#### 0ow including tausq##! 4 prior.control(tausq.rel.prior - uni3 tausq.rel.discrete -seq(,3 .;3 l-B))
ap;.kb 4 krige.bayes(ap+)ap;.kb## using the previous posterior as prior for ne1t callapB.kb 4 krige.bayes(ap73 prior-post7prior(ap;.kb))apB.kb######! 4 prior.control(phi.prior-c(.73.
-
8/13/2019 Manual Geor Web
40/42
par(op)
N#?: we recommend the
pac-age Randomields (http://cran.r
pro9ect.org/src/contrib/!"J"T6.html#RandomDields) for
a more comprehensie implementation for simulation of
Oaussian Random ields.
require(geoR)set.seed(7=;)#### Durther e1amples for the usage of krige.bayes()## #### Lefore reading this see documentation for krige.bayes## H help(krige.bayes)#### 2"R0*0T: $66 "GG "0 L6 *F6 "08 !"*0T 86FF"08*0T
## imulating datae1.data 4 grf(;,3 cov.pars-c(+,3 .7;))
#### Lasic usage##
## a basic and simple call to the functione1.post 4 krige.bayes(e1.data)e1.postnames(e1.post)
## different input and output optionse1+ 4 krige.bayes(e1.data3 prior - list(phi.prior - fi1ed3 phi - ,.
-
8/13/2019 Manual Geor Web
41/42
plot(e1.bayes)lines(e1.bayes3 summ-median3 lty-73 post-par)lines(e1.bayes3 summ-mean3 lwd-73 lty-73 post-par)
## ... and for the predictiveop 4 par(no.readonly - R56)par(mfrow-c(737))
par(mar-c(
-
8/13/2019 Manual Geor Web
42/42
apB.kb 4 krige.bayes(ap73 prior-post7prior(ap;.kb))apB.kb######! 4 prior.control(phi.prior-c(.73.