You are on page 1of 46

geoRglm

Software for generalised linear spatial models using R


Ole F. Christensen and Paulo J. Ribeiro Jr.

Package geoRglm is an extension to the package geoR by Paulo J. Ribeiro Jr and Peter J. Diggle. One need first to install geoR from the geoR homepage.

An Introduction to geoRglm
Click for an introductory session illustrating some of the capabilities of geoRglm.

Latest ersions
We no longer provide the package source here but refer to CR!" #here the latest version can be found. $ome extensions provided by %ichel &oulard are 'for the moment( given here) bionimal kriging using #ith moving neighborhood 'function binom.krige* is a modification of binom.krige( andcrossvalidation #ith binomial kriging 'function xvalid.binom(.

License information
is available as +ree $oft#are under the terms of the +ree $oft#are +oundation,s &"- &eneral Public .icense.
geoRglm

Please note that as a free librar!" geoRglm is supplied without an! warrant!.

#ocumentation

reference manual) ! manual compiled from the help pages can be found on CR!". ! geoRglm developer page is found here.
geoRglm

$ugs
/ugs or broken features may exist. -sage0bugs reports are very #elcome and may be send to ) Ole+.Christensen 1at1 agrsci.dk 'for protection against spam2mail replace 1at1 by 3(.

Collaborators
We are grateful to Peter J. Diggle for giving encouragement and support to the development of the package. 4he original version of the function asympvar #as made by Rasmus Waagepetersen. !lso some of the C2code for the %C%C2algorithms is based on code originally developed together #ith Rasmus. Remaining bugs are the authors, sole responsibility.

/ack to Ole's home2page. /ack to Paulo's home2page. Site contact: OleF.Christensen "at" agrsci.dk (for protection against spam-mail replace "at" b !"

geoRglm Introductory session


Ole F. Christensen & Paulo J. Ribeiro Jr. 27 May 2005

The package geoRglm provides functions for inference in generalised linear spatial models using the software R. This document illustrates some of the capabilities of the package. We assume that the user has a substantial knowledge about geostatistics, is familar with the geoR package (see the introductory session for geoR), and has a basic knowledge about Markov chain Monte Carlo methods. We also encourage the reader to study the literature about generalised linear spatial models. list of books, articles and a short ! " can be found here.

The main introduction to geoRglm is the package vignette, which is shown by typing vignette(#geo$glmintro#) in a session, and with R commands available in theinst%doc% directory of the package.

1.

ADD ! O"A#

"FORMA! O"

n old introductory page for geo$glm. &ee here.

2. The commands for the analysis in Christensen ('(()) *JCGS+ for


MCMC,M-. are found here.

3. The commands for the e/ample in 0iggle, $ibeiro 1r and Christensen


('((2) *bookchapter+, and Christensen and $ibeiro 1r ('((') *Rnews+ are found here.

4. The empirical covariogram derived in Christensen, Moller and


Waagepetersen ('((() for the 3oisson,log normal model. &ee here.

4.

short demonstration shown at my 3h.0. viva is found here.

geoRglm $ a pac%age for generalised linear spatial models


introductory session
Ole F. Christensen & Paulo J. Ribeiro Jr. '( )arch '**+

4he package geoRglm provides functions for inference in generalised linear spatial models using the soft#are R. 4his document illustrates some of the capabilities of the package. We assume that the user has a substantial kno#ledge about geostatistics is familar #ith the geoR package 'see the introductory session for geoR( and has a basic kno#ledge about %arkov chain %onte Carlo methods. We also encourage

the reader to study the literature about generalised linear spatial models. ! list of books articles and a short +!5 can be found here(. 4he ob6ective of this page is to introduce the reader to the geoRglm commands and sho# ho# they can be used. 4he commands used here are basic examples of the package handling #here #e typically use default arguments for the function calls. We encourage the user also to inspect other function arguments. +or further details on the functions included in geoRglm #e refer to the geoRglm documentation.

,. S-AR-I./ A S0SSIO. A.# LOA#I./ #A-A


After starting an R session, we first load geoR and geoRglm with the commands:
library(geo$) library(geo$glm)

7f the installation directories for the packages are not the default locations for R packages type)
library(geo$, lib.loc 5 #3 T67T87geo$#) library(geo$glm, lib.loc 5 #3 T67T87geo$glm#)

#here #3 T67T87geo$# and #3 T67T87geo$glm# are the paths to the directories #here geoR and geoRglm are installed respectively. 7f the packages are correctly loaded the follo#ing messages #ill be displayed)
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, geo$ , a package for geostatistical analysis in $ geo$ version 9.2,9( ('((2,(2,9() is now loaded ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, geo$glm , a package for generalised linear spatial models geo$glm version (.:,' ('((2,(2,')) is now loaded ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

4ypically data are stored as an ob6ect 'a list( of class #geodata# 'see the geoR introductory session for more details on this(. +or the data sets

considered here the ob6ect #ill sometimes include a vectorunits.m consisting of observation times 'for the Poisson distribution( or numbers ; in bi(;,p) 'for the binomial distribution(. We use the data sets p4( and rongelap included in the geoRglm distribution for the examples presented in this document. 4hese data sets can be loaded by typing)
data(p4() data(rongelap)

8elpfiles are available for geo$glm. +or getting help on the function pois.krige 6ust type)
help(pois.krige)

'. CO.#I-IO.AL SI)1LA-IO. and SPA-IAL PR0#IC-IO.


8ere #e describe conditional simulation using %C%C and spatial prediction in the Poisson2log normal model #hen covariance parameters are fixed. +ull /ayesian methods are also implemented and #ill be presented in $ection 9. 4he nugget effect parameter 'microscale variation( in the underlying &aussian field can be set to a fixed value. 4he same applies for the smoothness and anisotropy parameters. Options for taking covariates 'trends( into account are also included. Conditional simulation and prediction #ith fixed covariance parameters in the Poisson2log normal model can be performed #ith options for either fixed beta 'O:( or flat prior on beta '$:(. 4he function uses a .angevin2 8astings %C%C algorithm for simulating from the conditional distribution. !n example #here all parameters are fixed is sho#n belo# 'for illustration purposes some parameter values are 6ust taken(. +irst #e need to tune the algorithm by scaling the proposal variance so that acceptance rate is approximately ;< percent 'optimal acceptance rate for .angevin28astings algorithm(. 4his is done by trial and error.

model' <, krige.glm.control(cov.pars 5 c(9,9), beta 5 9) test'.tune <, pois.krige(p4(, krige 5 model', mcmc.input 5 list(&.scale 5 (.', thin 5 9))

!fter a fe# tryouts #e decide to use &.scale ho# #ell the chain is mixing.

5 (.4.

We also need to study

test'.tune <, pois.krige(p4(, krige 5 model', mcmc.input 5 list(&.scale 5 (.4, thin 5 9)) plot(log(test'.tune=intensity*)4,+), type 5 #l#) acf(log(test'.tune=intensity*)4,+), type 5 #correlation#, plot 5 T$>.)

8ere the functions in the coda package #ould be useful for assessing the convergence and inspect the mixing of the %C%C algorithm. +or a small demonstration of a fe# COD! functions used on the output above see here. 4o reduce the autocorrelation of the samples #e decide to subsample every *< iterations 'default(= #hen #orking #ith real data sets #e may need to make a more enxtensive subsampling say storing only every *<<< iterations. "o# #e make 'minimal mean s>uare error( prediction of the intensity at the t#o locations '<.? <.?( and '* <.@(.

test' <, pois.krige(p4(, locations 5 cbind(c((.4,(.4),c(9,(.))), krige 5 model', mcmc.input 5 mcmc.control(&.scale 5 (.4), output 5 output.glm.control(sim.predict 5 T$>.))

4he output is a list including the predicted values ' test'=predict( the prediction variances 'test'=krige.var( and the estimated %onte Carlo standard errors on the predicted values 'test'=mcmc.error(. Please consider printing out the predicted values and the associated %onte Carlo standard errors)
test'=predict test'=mcmc.error

Note that the Monte Carlo standard errors (the errors due to the MCMC-simulation are small com!ared to !redicted "alues, which is "er# satisfactor#. (Monte Carlo standard errors on the !rediction "ariances is not im!lemented #et . /y specifying sim.predict 5 T$>. simulations are dra#n from the predictive intensity at the t#o prediction locations 'testABsimulations(. 4hese simulations are plotted belo#.
par(mfrow 5 c(9,')) hist(test'=simulations*9,+, main 5 #((.4, (.4) #) hist(test'=simulations*',+, main 5#(9, (.))#)

4he #ay to specify that beta should follo# a uniform prior #ould be)
model'.u <, krige.glm.control(cov.pars 5 c(9,9), beta 5 9, type.krige 5 #ok#) test'.unif.beta <, pois.krige(p4(, krige 5 model'.u, mcmc.input 5 list(&.scale 5 (.4))

+. $A20SIA. A.AL2SIS
/ayesian analysis for the Poisson2log normal model and the binomial2logit model is implemented by the functions pois.krige.bayes and binom.krige.bayes respectively. %odel parameters can be treated as fixed or random. !s an example consider first a model #ithout nugget and including uncertainty in the beta and sigmas? parameters 'mean and variance of the random effects $ respectively(. ! /ayesian analysis is made by typing commands like)
prior4 <, prior.glm.control(phi.prior 5 #fi/ed#, phi 5 (.9) mcmc4.tune <, mcmc.control(&.scale 5 (.(9, thin 5 9) test4.tune <, pois.krige.bayes(p4(, prior 5 prior4, mcmc.input 5 mcmc4.tune)

"o# chose &.scale '!cc2rateC<.;< is preferable(. !fter having ad6usted the parameters for the %C%C algorithm and checking the output #e run an analysis.
mcmc4 <, mcmc.control(&.scale 5 (.(@4, thin 5 9(() test4 <, pois.krige.bayes(p4(, locations 5 t(cbind(c('.4,2),c(, :(4(,,2'@())), prior 5 prior4, mcmc.input 5 mcmc4, output 5 list(threshold 5 9(, ?uantile 5 c((.(4,(.AA)))

4he output is a list #hich contains the five arguments posterior predictive model prior and mcmc.input. 4he posterior contains information on the posterior distribution of the parameters and the conditional simulations of the signal gBC,9D(&) at the data locations. 4he predictive contains information on the predictions #here predictive=median is the predicted signal and predictive=uncertainty is the associated uncertainty.

4he threshold 5 9( argument gives probabilities of the predictive distribution of the signal being less than *< 'test?BpredictiveBprobability(. 4he ?uantiles 5 c((.(4,(.AA) gives the <.<? and <.DD >uantiles of the predictive distribution of the signal 'test?BpredictiveB>uantiles(. /elo# #e sho# the simulations from the posterior distribution of the signal at a fe# data locations.
par(mfrow 5 c(9,2)) hist(test4=posterior=simulations*9(,+, main 5 #(A, ()#) hist(test4=posterior=simulations*'2,+, main 5 #(',')#) hist(test4=posterior=simulations*2:,+, main 5#(4,2)#)

"o# #e consider an example #ith a random correlation scale parameter phi and a positive nugget for the random effects $. 4he program is using a discretised prior fpr phi #here the discretisation is given by the argument phi.discrete(. 4he argument 'taus?.rel 5 (.(4 gives the relative nugget for $ i.e. the relative microscale variation(.
mcmc:.tune <, mcmc.control(&.scale 5 (.(@4, n.iter 5 '(((, thin 5 9((, phi.scale 5 (.(9) prior: <, prior.glm.control(phi.prior 5 #uniform#, phi.discrete 5 se?((.(', 9, (.('), taus?.rel 5 (.(4) test:.tune <, pois.krige.bayes(p4(, prior 5 prior:, mcmc.input 5 mcmc:.tune)

!cc2rateC<.;< acc2rate2phi C <.A?2<.9< are preferable. !fter having ad6usted the parameters for the %C%C algorithm and checking the output #e run an analysis. 3AR.I./4 R1..I./ -50 .06- CO))A.# CA. $0 -I)07 CO.S1)I./
mcmc: <, mcmc.control(&.scale 5 (.(@4, n.iter 5 )(((((, thin 5 '((, burn.in 5 4(((, phi.scale 5 (.9', phi.start 5 (.4) test: <, pois.krige.bayes(p4(, locations 5 t(cbind(c('.4,2.4),c(, :(,,2@))), prior 5 prior:, mcmc.input 5 mcmc:)

/elo# #e sho# the posterior distribution of the t#o covariance parameters and the beta parameter.
par(mfrow 5 c(9,2)) hist(test:=posterior=beta=sample, main 5#beta#) hist(test:=posterior=sigmas?=sample, main 5 #sigmas?#) hist(test:=posterior=phi=sample, main 5 #phi#)

$o calculate the Monte Carlo standard errors on the !osterior means of the !arameters, we use the function asympvar.
s?rt(asympvar(test:=posterior=beta=sample)%'((() s?rt(asympvar(test:=posterior=sigmas?=sample)%'((() s?rt(asympvar(test:=posterior=phi=sample)%'((()

s?rt(asympvar(log(test:=posterior=simulations))%'((()

Exercise
Construct similar commands using binom.krige.bayes on the data set b4( yourself 'you load the data set by typing data(b4()(.

(. SI)1LA-IO. of a /0.0RALIS0# LI.0AR SPA-IAL )O#0L


$he geo$ function grf generates a simulation from a %aussian random field. $his function can &e used to generate a simulation from a generalised linear s!atial model as follows.
sim <, grf(grid 5 e/pand.grid(/ 5 se?(9, 9(, l 5 9(), y 5 se?(9, 9(, l 5 9()), cov.pars 5 c((.9, (.')) attr(sim,#class#) <, #geodata# sim=units.m <, c(rep(9, 4(), rep(4, 4()) sim=data <, rpois(9((, lambda 5 sim=units.mEe/p(sim=data)) plot(sim=coords*,9+, sim=coords*,'+, type 5 #n#) te/t(sim=coords*,9+, sim=coords*,'+, format(sim=data))

'&ser"e that the u!!er !art of the figure corres!onds to o&ser"ation times e(ual to ). $herefore the simulated counts are larger.

Exercise
&enerate a simulation from a spatial binomial random field.

8. A##I-IO.AL I.FOR)A-IO.
1.

*m!irical co"ariogram for the +oisson-log normal model. ,ee here.

2.

A short demonstration shown at m# +h.-. "i"a is found here.

3.

$he commands from the e.am!le in -iggle, /i&eiro 0r and Christensen (2113 2bookchapter3, and

Christensen and /i&eiro 0r (2112 2R-news3 are found here.

htt!:44g&i.agrsci.d546ofch4geo/glm47ntro40C%,./
FF FF (2,(9,'((4 FF

FF This page contains the commands used for the article FF 8le !. Christensen ('(()) GGMonte Carlo ma/imum likelihood in model, based geostatisticsHH FF 1ournal of computational and graphical statistics 92, @(',@9I. library(geo$) library(geo$glm) data(rongelap) MCmle.input.fi/ed <, glsm.mcmc(rongelap, model5list(family5#poisson#, link 5 #bo/co/#, cov.pars5c('.)(, 2)(), beta 5 :.', nugget 5 '.(@4E'.)(, lambda59), mcmc.input 5 mcmc.control(&.scale 5 (.4,thin5'(,burn.in59(((()) FF investigating mi/ing and convergence library(coda) MCmle.coda <, create.mcmc.coda(MCmle.input.fi/ed, mcmc.input 5 list(thin 5 '(, burn.in59(((()) plot(MCmle.coda) autocorr.plot(MCmle.coda) FF ma/imum likelihood mcmcobJ <, prepare.likfit.glsm(MCmle.input.fi/ed) lik.bo/co/.9.e/pon <, likfit.glsm(mcmcobJ, ini.phi59(, fi/.nugget.rel5T$>.) lik.bo/co/.9.e/pon.nugget <, likfit.glsm(mcmcobJ, ini.phi59(() lik.bo/co/.9.nospatial <, likfit.glsm(mcmcobJ, fi/.nugget.rel5T$>.,cov.model5#pure.nugget#) lik.bo/co/.9.matern9.nugget <, likfit.glsm(mcmcobJ, ini.phi5)(,cov.model5#matern#,kappa59) lik.bo/co/.9.spherical.nugget <, likfit.glsm(mcmcobJ, ini.phi5)((,cov.model5#spherical#, nugget.rel5') FF investigating other link functions mcmcobJ.mu <, prepare.likfit.glsm(MCmle.input.fi/ed, use.intensity 5 T$>.) lik.e/pon.bo/co/9.( <, likfit.glsm(mcmcobJ.mu, ini.phi594(.A92(A94, nugget.rel5(.9'::)9:,lambda 5 () lik.gaussian.bo/co/9.( <, likfit.glsm(mcmcobJ.mu, cov.model5#gaussian#, ini.phi59((, nugget.rel5(.92,lambda 5 () lik.e/pon.bo/co/9.(4 <, likfit.glsm(mcmcobJ.mu, ini.phi59A:, nugget.rel5(.@I@,lambda 5 (.4) lik.e/pon.bo/co/9.lambda <, likfit.glsm(mcmcobJ.mu, ini.phi522A.:, nugget.rel5'.(@4,lambda 5 9,fi/.lambda5! -&.)

FF profile likelihood for (phi,taus?.rel) *two,dimensional figure+. pr.lik.rongelap <, proflik.glsm(mcmcobJ, lik.bo/co/.9.e/pon.nugget, phi.values 5 se?(I,)()E'(, nugget.rel.values5se?(9,2,l5'9)) par(ce/5(.A) plot(pr.lik.rongelap, levels 5 se?(,4, 9, by5(.9), labce/5(.44) dev.off() F !igure 9K postscript(#profile.phitaus?.ps#, height 5 4, width 5 :.4, horiLontal5! -&.) par(ce/5(.A) plot(pr.lik.rongelap, levels 5 se?(,4, 9, by5(.9), labce/5(.44) dev.off()

FFFFFFFFFFFF grid for prediction being definedK FF 3aulo har fJernet afhaengigheden af splancs. FF library(splancs) ng/ <, 9': ngy <, @4 temp.grid <, polygrid(se?(,:'4(,(,l5ng/),se?(,2:((,9((,l5ngy), borders5rongelap=borders, vec.inout5T$>.) ng <, ng/ E ngy grid <, temp.grid=/ypoly grid.ind <, temp.grid=vec.inout rm(temp.grid) FF prediction K emp.mean <, apply(MCmle.input.fi/ed=sim,9,mean) emp.var <, cov(t(MCmle.input.fi/ed=sim)) nug.value <, lik.bo/co/.9.e/pon.nugget=nugget.relElik.bo/co/.9.e/pon.nugget=cov.pars*9 + resultat <, krige.conv(data5emp.mean,lik.bo/co/.9.e/pon.nugget=beta, coords5rongelap=coords, locations 5 grid, krige5krige.control(type.krige 5 #sk#, beta5(, cov.pars5lik.bo/co/.9.e/pon.nugget=cov.pars, nugget 5 nug.value)) rongelap.mean <, resultat=predict M lik.bo/co/.9.e/pon.nugget=beta M 9 d( <, loccoords(coords 5 rongelap=coords, locations 5 grid) v( <, ifelse(d( N 9e,9(, cov.spatial(obJ 5 d(, cov.pars 5 lik.bo/co/.9.e/pon.nugget=cov.pars), lik.bo/co/.9.e/pon.nugget=cov.pars*9+ M nug.value) invcov <, varcov.spatial(coords 5 rongelap=coords, nugget 5 nug.value, cov.pars 5 lik.bo/co/.9.e/pon.nugget=cov.pars, inv 5 T$>.) <, t(v()OEOinvcov=inverse rongelap.var <, diag( OEOemp.varOEOt( ))M resultat=krige.var FFFF !igure ' K

postscript(#predict.ps#, height5A.(, width5@.94, horiLontal5! -&.) par(mfrow5c(',9), mar5c(2,2,9,.@4), mgp5c(',.:,(), ce/5(.I) grid.mat <, rep(; ,ng) grid.mat*grid.ind 55 T$>.+ <, rongelap.mean plot(cbind(c(,:'((, , 9((), c(,24((, 4()), type5#n#, /lab5#Coordinate P (m)#, ylab5#Coordinate Q (m)#) image.kriging(locations 5 e/pand.grid(se?(,:'4(, (,l5ng/),se?(,2:((, 9((,l5ngy)), values 5 grid.mat, col5gray(se?(9,(,l52()), /.leg5c(,:(((,,2(((), y.leg 5 c(,@((,,2((), ce/.leg5(.@, add 5 T$>., Llim5c(2,92)) lines(rongelap=borders, lwd5'.4) grid.mat*grid.ind 55 T$>.+ <,s?rt(rongelap.var) plot(cbind(c(,:'((, ,9((), c(,24((, 4()), type5#n#, /lab5#Coordinate P (m)#, ylab5#Coordinate Q (m)#) image.kriging(locations 5 e/pand.grid(se?(,:'4(, (,l5ng/),se?(,2:((, 9((,l5ngy)), values 5 grid.mat, col5gray(se?(9,(,l52()), /.leg5c(,:(((,,2(((), y.leg 5 c(,@((,,2((), ce/.leg5(.@, add 5 T$>., Llim5c((,4)) lines(rongelap=borders, lwd5'.4) dev.off() FF the prediction uncertainties for data locations K s?rt(rongelap.var)*s?rt(rongelap.var)<9+ summary(s?rt(rongelap.var)*s?rt(rongelap.var)<9+) FF the prediction uncertainties for other locations K s?rt(rongelap.var)*s?rt(rongelap.var)N9+ summary(s?rt(rongelap.var)*s?rt(rongelap.var)N9+)

FFF prediction when assuming that taus? is measurement error resultat' <, krige.conv(data5emp.mean,lik.bo/co/.9.e/pon.nugget=beta, coords5rongelap=coords, locations 5 grid, krige5krige.control(type.krige 5 #sk#,beta5(, cov.pars5lik.bo/co/.9.e/pon.nugget=cov.pars, nugget 5 nug.value),output5output.control(signal5T$>.)) rongelap.mean' <, resultat'=predict M lik.bo/co/.9.e/pon.nugget=beta M 9 v(.' <, cov.spatial(obJ 5 d(, cov.pars 5 lik.bo/co/.9.e/pon.nugget=cov.pars) .' <, t(v(.')OEOinvcov=inverse rongelap.var' <, diag( .'OEOemp.varOEOt( .'))M resultat'=krige.var FFFF !igure 2 K postscript(#predict'.ps#, height5A.(, width5@.94, horiLontal5! -&.) par(mfrow5c(',9), mar5c(2,2,9,.@4), mgp5c(',.:,(), ce/5(.I) grid.mat <, rep(; ,ng) grid.mat*grid.ind 55 T$>.+ <, rongelap.mean' plot(cbind(c(,:'((, , 9((), c(,24((, 4()), type5#n#, /lab5#Coordinate P (m)#, ylab5#Coordinate Q (m)#)

image.kriging(locations 5 e/pand.grid(se?(,:'4(, (,l5ng/),se?(,2:((, 9((,l5ngy)), values 5 grid.mat, col5gray(se?(9,(,l52()), /.leg5c(,:(((,,2(((), y.leg 5 c(,@((,,2((), ce/.leg5(.@, add 5 T$>., Llim5c(2,92)) lines(rongelap=borders, lwd5'.4) grid.mat*grid.ind 55 T$>.+ <,s?rt(rongelap.var') plot(cbind(c(,:'((, ,9((), c(,24((, 4()), type5#n#, /lab5#Coordinate P (m)#, ylab5#Coordinate Q (m)#) image.kriging(locations 5 e/pand.grid(se?(,:'4(, (,l5ng/),se?(,2:((, 9((,l5ngy)), values 5 grid.mat, col5gray(se?(9,(,l52()), /.leg5c(,:(((,,2(((), y.leg 5 c(,@((,,2((), ce/.leg5(.@, add 5 T$>., Llim5c((,4)) lines(rongelap=borders, lwd5'.4) dev.off()

FF the prediction uncertainties for data locations K s?rt(rongelap.var')*s?rt(rongelap.var)<9+ summary(s?rt(rongelap.var')*s?rt(rongelap.var)<9+) FF the prediction uncertainties for other locations K s?rt(rongelap.var')*s?rt(rongelap.var)N9+ summary(s?rt(rongelap.var')*s?rt(rongelap.var)N9+)

htt!:44g&i.agrsci.d546ofch4geo/glm47ntro4&oo5cha!.html

4he commands for the example in Diggle Ribeiro Jr and Christensen 'A<<9( EbookchapterF and Christensen and Ribeiro Jr 'A<<A( E#-ne$sF. 3AR.I./4 R1..I./ -5IS IS 90R2 -I)07CO.S1)I./ A.# )0)OR27#0)A.#I./

GG $imulating data sim H2 grf'grid C expand.grid'x C se>'<.<??? <.D@@@@@ l C I( y C se>'<.<??? <.D@@@@@ l C I(( cov.pars C c'<.? <.A(( attr'sim 1class1( H2 1geodata1 simBunits.m H2 rep'@ ;@( simBprob H2 exp'simBdata(0'*Jexp'simBdata(( simBdata H2 rbinom';@ siKe C simBunits.m prob C simBprob( GG Lisualising the data and the 'unobserved( random effects par'mfro# C c'* A( marCc'A.9 A.? .? .M( mgpCc'*.? .; <( cexC<.;( plot'c'< *( c'2<.* *( typeC1n1 xlabC1Coordinate N1 ylabC1Coordinate O1( text'simBcoordsE *F simBcoordsE AF format'round'simBprob digitsCA(( cexC<.D( plot'c'< *( c'2<.* *( typeC1n1 xlabC1Coordinate N1 ylabC1Coordinate O1( text'simBcoordsE *F simBcoordsE AF format'simBdata( cexC*.*( points'simBcoordsEc'* AD( F cexC?.?( GG $etting input options and running the function prior.sim H2 prior.glm.control'beta.prior C 1normal1 beta C < beta.var C * phi.prior C 1exponential1 phi C <.A phi.discrete C se>'<.<<? <.9 lC;<( sigmas>.prior C 1sc.inv.chis>1 df.sigmas> C ? sigmas> C <.?( mcmc.sim H2 mcmc.control'$.scale C <.<? phi.scale C <.<*? thin C *<< burn.in C *<<<<( pred.grid H2 expand.grid'x C se>'<.<*A? <.DIM? l C @<( y C se>'<.<*A? <.DIM? l C @<(( out.sim H2 output.glm.control'sim.predict C 4R-P( run.sim H2 binom.krige.bayes'sim locations C pred.grid prior C prior.sim mcmc.input C mcmc.sim outputCout.sim( GG !utocorrelations par'mfro#Cc'9 A( marCc'A.9 A.? .? .M( mgpCc'*.? .; <( cexC<.;( plot'run.simBposteriorBsimE* F typeC1l1 ylab C 1$'<.<?; <.<?;(1( acf'run.simBposteriorBsimE* F main C11( plot'run.simBposteriorBsimEAD F typeC1l1 ylab C 1$'<.?;9 <.@9;(1( acf'run.simBposteriorBsimEAD F main C11( plot'run.simBposteriorBphi.s typeC1l1 ylab C 1phi1( acf'run.simBposteriorBphi.s main C11( GG Plot of timeseries

par'mfro#Cc'9 *( marCc'A.9 A.? .? .M( mgpCc'*.? .; <( cexC<.;( plot'run.simBposteriorBsimE* F typeC1l1 ylab C 1$'<.<?; <.<?;(1( plot'run.simBposteriorBsimEAD F typeC1l1 ylab C 1$'<.?;9 <.@9;(1( plot'run.simBposteriorBphi.s typeC1l1 ylab C 1phi1( GG Predictions sim.predict H2 apply'run.simBpredBsim * mean( sim.predict.var H2 apply'run.simBpredBsim * var( par'mfro#Cc'* A( marCc'A.9 A.? .? .M( mgpCc'*.? .; <( cexC<.;( image.kriging'xC sim.predict locations C pred.grid values C sim.predict colCgray'se>'* < lC9<(( x.legCc'<.* <.D( y.leg C c'2<.*A 2<.<M( cex.legC<.M xlabC1Coordinate N1 ylabC1Coordinate O1( image.kriging'xC sim.predict.var locations C pred.grid values C sim.predict.var colCgray'se>'* < lC9<(( x.legCc'<.* <.D( y.leg C c'2<.*A 2<.<M( cex.legC<.M xlabC1Coordinate N1 ylabC1Coordinate O1(

4he empirical covariogram in Christensen %Qller and Waagepetersen 'A<<<( for the Poisson2log normal model can be calculated using the function covariog.
covar <, covariog(rongelap, uvec 5 c((9K'()E)())

4heoretical and empirical variograms can be plotted and visually compared. +or example the figure belo# sho#s the estimated covariogram a theoretical covariogram model '#hich in fact #as estimated( and an envelope 'A.? and DM.? percent >uantiles( based on simulating the covariogram for the model having parameters given in parms.$.
parm$ <, list(cov.model 5 #powered.e/ponential#, kappa 5 (.I)2, cov.pars 5 c((.29,:@('%:9.A), beta 5 9.I2:) class(parm$) <, #covariomodel# konvol <, covariog.model.env(rongelap, obJ.covariog 5 covar, model.pars 5 parm$) plot(covar, envelope.obJ 5 konvol) lines(parm$, ma/.dist 5 I((, lty 5 9)

2222222222222 last change) A@ %arch A<<9. he follo#ing short demonstation #as presented at my Ph.D. viva in !alborg December A<<*. Ea fe# minor changes have been made since then to accomodate changes in R geoR and geoRglmF. 3AR.I./4 R1..I./ -5IS IS 90R2 -I)07CO.S1)I./ R GG R GG *. $imulating data R GG R sim H2 grf'grid C expand.grid'x C se>'*.* M.* l C M( y C se>'*.* M.* l C M(( cov.pars C c'<.* A(( grf) process #ith * covariance structure's( grf) nugget effect is) taus>C < grf) covariance model * is) exponential'sigmas>C<.* phiCA( grf) decomposition algorithm used is) cholesky grf) simulation's( on a grid provided by the user

grf) Pnd of simulation procedure. "umber of realiKations) * R simBunits.m H2 rep'@ @D( R simBdata H2 rbinom'@D siKe C rep'@ @D( prob C exp'simBdata(0 '*Jexp'simBdata((( R R GG A. Lisualising the data R GG R plot'simBcoords type C 1n1( R text'simBcoordsE *F simBcoordsE AF format'simBdata( cexC*.?(

R GG 9. $etting input options R R sim.pr H2 prior.glm.control'phi.discrete C se>'<.<? 9 lC;<(( R sim.mcmc H2 mcmc.control'$.scale C <.* phi.scale C <.<@ burn.inC*<<<<( R grid H2 expand.grid'x C se>'* M l C ?*( y C se>'* M l C ?*(( R R run.sim H2 binom.krige.bayes'sim locations C grid prior C sim.pr mcmc.input C sim.mcmc( binom.krige.bayes) analysis assuming constant mean burn2in C *<<<< is finished= !cc.2rate C <.;M = !cc2rate2phi C <.MA

iter. numb. **<<< = !cc.2rate C <.MM = !cc2rate2phi C <.;D iter. numb. *A<<< = !cc.2rate C <.;D = !cc2rate2phi C <.;M iter. numb. *9<<< = !cc.2rate C <.M* = !cc2rate2phi C <.;? iter. numb. *@<<< = !cc.2rate C <.A@ = !cc2rate2phi C <.?D iter. numb. *?<<< = !cc.2rate C <.;M = !cc2rate2phi C <.M< iter. numb. *;<<< = !cc.2rate C <.MI = !cc2rate2phi C <.M; iter. numb. *M<<< = !cc.2rate C <.M? = !cc2rate2phi C <.M9 iter. numb. *I<<< = !cc.2rate C <.M* = !cc2rate2phi C <.;M iter. numb. *D<<< = !cc.2rate C <.M* = !cc2rate2phi C <.;M iter. numb. A<<<< = !cc.2rate C <.;M = !cc2rate2phi C <.;@ %C%C performed) n.iter. C *<<<< = thinning C *< = burn.in C *<<<< binom.krige.bayes) Prediction performed binom.krige.bayes) doneS R R GG inspecting output R names'run.sim( E*F 1posterior1 1predictive1 1model1 1prior1 1mcmc.input1 E;F 1.Random.seed1 1call1 R names'run.simBposterior( E*F 1phi1 1beta1 1sigmas>1 1simulations1 R names'run.simBposteriorBphi( E*F 1sample1 1mean1 1var1 R R par'mfro#Cc'A A( marCc'A.9 A.? .? .M( mgpCc'*.? .; <( cexC<.;( R plot'run.simBposteriorBphiBsample typeC1l1( R acf'run.simBposteriorBphiBsample( R plot'run.simBposteriorBsimE* F typeC1l1( R acf'run.simBposteriorBsimE* F(

R GG Predictions R GG R R names'run.simBpredictive( E*F 1simulations1 1median1 1uncertainty1 1>uantiles1 R R GG R GG Plotting predictions R GG R image.kriging'locations C grid values C run.simBpredBmedian (

F F 0Rcembre '((@ F F modif de Michel Soulard pour faire du voisinage glissant F Gbinom.krige9G <, function (geodata, coords 5 geodata=coords, data 5 geodata=data, units.m 5 #default#, locations 5 ;>--, borders, mcmc.input, krige, output,nwin5#full#,trend(5T) C if (missing(geodata)) geodata <, list(coords 5 coords, data 5 data, units.m 5 units.m) if (missing(borders)) borders <, geodata=borders call.fc <, match.call() n <, length(data) if (any(units.m 55 #default#)) C if (Tis.null(geodata=units.m)) units.m <, geodata=units.m else units.m <, rep(9, n) D if (any(units.m <5 ()) stop(#units.m must be postive#) if (missing(krige)) stop(#must provide obJect krige#) krige <, .krige.glm.check.au/(krige, fct 5 #binom.krige#) cov.model <, krige=cov.model

kappa <, krige=kappa beta <, krige=beta cov.pars <, krige=cov.pars nugget <, krige=nugget micro.scale <, krige=micro.scale aniso.pars <, krige=aniso.pars trend.d <, krige=trend.d trend.l <, krige=trend.l dist.epsilon <, krige=dist.epsilon if (krige=type.krige 55 #ok#) beta.prior <, #flat# if (krige=type.krige 55 #sk#) beta.prior <, #deg# if (missing(output)) output <, output.glm.control() else output <, .output.glm.check.au/(output, fct 5 #binom.krige#) sim.predict <, output=sim.predict messages.screen <, output=messages.screen if (is.vector(coords)) C coords <, cbind(coords, () warning(#vector of coordinatesK one spatial dimension assumed#) D coords <, as.matri/(coords) dimnames(coords) <, list(;>--, ;>--) if (is.null(locations)) C if (messages.screen) cat(paste(#locations need to be specified for predictionU prediction not performed Vn#)) D else C locations <, .check.locations(locations) if (is.null(trend.l)) stop(#trend.l needed for prediction#) if (length(uni?ue(locations*, 9+)) 55 9 W length(uni?ue(locations*, '+)) 55 9) krige9d <, T$>. else krige9d <, ! -&. D trend.data <, unclass(trend.spatial(trend 5 trend.d, geodata 5 geodata)) beta.siLe <, ncol(trend.data) if (nrow(trend.data) T5 n) stop(#length of trend is different from the length of the data#) if (beta.prior 55 #deg#) if (beta.siLe T5 length(beta)) stop(#siLe of mean vector is incompatible with trend specified#) if (beta.siLe N 9) beta.names <, paste(#beta#, ((K(beta.siLe , 9)), sep 5 ##) else beta.names <, #beta# if (missing(mcmc.input)) stop(#binom.krigeK argument mcmc.input must be given#) mcmc.input <, .mcmc.check.au/(mcmc.input, fct 5 #binom.krige#) if (beta.prior 55 #deg#) mean.d <, as.vector(trend.data OEO beta) else mean.d <, rep((, n)

if (Tis.null(aniso.pars)) C invcov <, varcov.spatial(coords 5 coords.aniso(coords 5 coords, aniso.pars 5 aniso.pars), cov.model 5 cov.model, kappa 5 kappa, nugget 5 nugget, cov.pars 5 cov.pars, inv 5 T$>., func.inv 5 #cholesky#, try.another.decomposition 5 ! -&.)=inverse D else C invcov <, varcov.spatial(coords 5 coords, cov.model 5 cov.model, kappa 5 kappa, nugget 5 nugget, cov.pars 5 cov.pars, inv 5 T$>., func.inv 5 #cholesky#, try.another.decomposition 5 ! -&.)=inverse D if (beta.prior 55 #flat#) C ivtt <, invcov OEO trend.data invcov <, invcov , ivtt OEO .solve.geo$(crossprod(trend.data, ivtt), t(ivtt)) D res.mcmc <, .mcmc.binom.logit(data 5 data, units.m 5 units.m, mean& 5 mean.d, invcov 5 invcov, mcmc.input 5 mcmc.input, messages.screen 5 messages.screen) acc.rate <, res.mcmc=acc.rate if (Tis.null(locations)) C if(trend()C krige <, list(type.krige 5 krige=type.krige, beta 5 beta, trend.d 5 trend.d, trend.l 5 trend.l, cov.model 5 cov.model, cov.pars 5 cov.pars, kappa 5 kappa, nugget 5 nugget, micro.scale 5 micro.scale, dist.epsilon 5 dist.epsilon, aniso.pars 5 aniso.pars, link 5 #logit#) D elseC krige <, list(type.krige 5 krige=type.krige, cov.model 5 cov.model, cov.pars 5 cov.pars, kappa 5 kappa, nugget 5 nugget, micro.scale 5 micro.scale, dist.epsilon 5 dist.epsilon, aniso.pars 5 aniso.pars, link 5 #logit#) D kpl.result <, glm.krige.au/9(data 5 res.mcmc=&data, coords 5 coords, locations 5 locations, borders 5 borders, krige 5 krige, output 5 list(n.predictive 5 ifelse(sim.predict, 9, (), signal 5 T$>., messages 5 T$>.),nwin5nwin) remove(list 5 c(#res.mcmc#)) kpl.result=krige.var <, rowMeans(kpl.result=krige.var) M apply(kpl.result=predict, 9, var) if (nrow(locations) N 9) kpl.result=mcmc.error <, s?rt(asympvar(kpl.result=predict)%ncol(kpl.result=predict)) else kpl.result=mcmc.error <, s?rt(asympvar(as.vector(kpl.result=predict), messages 5 ! -&.)%length(as.vector(kpl.result=predict))) kpl.result=predict <, rowMeans(kpl.result=predict) kpl.result=nvar5rowMeans(kpl.result=nvar)M apply(kpl.result=predict, 9, var) kpl.result=npred 5 rowMeans(kpl.result=npred) if (beta.prior 55 #flat#) C F kpl.result=beta.est <, rowMeans(kpl.result=beta.est)

D else C if (beta.prior 55 #flat#) C beta.est <, .solve.geo$(crossprod(trend.data, ivtt), t(ivtt)) OEO rowMeans(res.mcmc=&data) kpl.result <, list(prevalence 5 plogis(res.mcmc=&data), beta.est 5 beta.est, acc.rate 5 acc.rate) D else kpl.result <, list(prevalence 5 plogis(res.mcmc=&data), acc.rate 5 acc.rate) D kpl.result=call <, call.fc attr(kpl.result, #prediction.locations#) <, call.fc=locations if (Tis.null(locations)) attr(kpl.result, #sp.dim#) <, ifelse(krige9d, #9d#, #'d#) if (Tis.null(call.fc=borders)) attr(kpl.result, #borders#) <, call.fc=borders class(kpl.result) <, #kriging# return(kpl.result) D Gglm.krige.au/9G <, function (data, coords, locations, borders, krige, output,nwin5#full#) C F F 0Rcembre '((@ aJout voisinage glissant F et raJout rRcup du prRdicteur avant transfo. F le prRdicteur de la proba est npred et sa variance de pred nvar F krige=lambda <, 9 krige=link <, ;>-kc.result <, krige.conv.e/tnd9(data 5 data, coords 5 coords, locations 5 locations, borders 5 borders, krige 5 krige, output 5 output,nwin5nwin) kc.result=message <, ;>-ivlogit' <, ifelse(kc.result=predict < @((, e/p(kc.result=predict) E (,e/pm9(kc.result=predict))%(9 M e/p(kc.result=predict))B2, () kc.result=npred <, plogis(kc.result=predict) M (.4 E ivlogit' E kc.result=krige.var kc.result=nvar <, ifelse(kc.result=predict < @((, e/p(kc.result=predict)%(9 M e/p(kc.result=predict))B', ()B' E kc.result=krige.var M (99%)) E ivlogit'B' E kc.result=krige.varB' remove(list 5 c(#ivlogit'#)) if (output=n.predictive N () C kc.result=simulations <, plogis(kc.result=simulations) D return(kc.result) D Gkrige.conv.e/tnd9G <, function (geodata, coords 5 geodata=coords, data 5 geodata=data, locations, borders, krige, output,nwin5#full#) C

D kpl.result=beta <, ;>--

kpl.result=mean.est <, rowMeans(kpl.result=mean.est) names(kpl.result=beta.est) <, beta.names

base.env <, sys.frame(sys.nframe()) if (missing(geodata)) geodata <, list(coords 5 coords, data 5 data) cl <, match.call() data <, as.matri/(data) n.datasets <, ncol(data) n <, nrow(data) if (missing(krige)) krige <, krige.control() else C if (class(krige) T5 #krige.geo$#) C if (Tis.list(krige)) stop(#.krige.conv.e/tndK the argument krige only takes a list or an output of the function krige.control#) else C krige.names <, c(#type.krige#, #trend.d#, #trend.l#, #obJ.model#, #beta#, #cov.model#, #cov.pars#, #kappa#, #nugget#, #micro.scale#, #dist.epsilon#, #lambda#, #aniso.pars#) krige <, .obJect.match.names(krige, krige.names) if (is.null(krige=type.krige)) krige=type.krige <, #ok# if (is.null(krige=trend.d)) krige=trend.d <, #cte# if (is.null(krige=trend.l)) krige=trend.l <, #cte# if (is.null(krige=obJ.model)) krige=obJ.model <, ;>-if (is.null(krige=beta)) krige=beta <, ;>-if (is.null(krige=cov.model)) krige=cov.model <, #matern# if (is.null(krige=cov.pars)) stop(#covariance parameters (sigmas? and phi) should be provided in cov.pars#) if (is.null(krige=kappa)) krige=kappa <, (.4 if (is.null(krige=nugget)) krige=nugget <, ( if (is.null(krige=micro.scale)) krige=micro.scale <, ( if (is.null(krige=dist.epsilon)) krige=dist.epsilon <, 9e,9( if (is.null(krige=aniso.pars)) krige=aniso.pars <, ;>-if (is.null(krige=lambda)) krige=lambda <, 9 krige <, krige.control(type.krige 5 krige=type.krige, trend.d 5 krige=trend.d, trend.l 5 krige=trend.l, obJ.model 5 krige=obJ.model, beta 5 krige=beta, cov.model 5 krige=cov.model, cov.pars 5 krige=cov.pars, kappa 5 krige=kappa, nugget 5 krige=nugget, micro.scale 5 krige=micro.scale, dist.epsilon 5 krige=dist.epsilon, aniso.pars 5 krige=aniso.pars, lambda 5 krige=lambda) D D

D cov.model <, krige=cov.model kappa <, krige=kappa lambda <, krige=lambda beta <, krige=beta cov.pars <, krige=cov.pars nugget <, krige=nugget if (missing(output)) output <, output.control() else C if (class(output) T5 #output.geo$#) C if (Tis.list(output)) stop(#.krige.conv.e/tndK the argument output only takes a list or an output of the function output.control#) else C output.names <, c(#n.posterior#, #n.predictive#, #moments#, #n.back.moments#, #simulations.predictive#, #mean.var#, #?uantile#, #threshold#, #signal#, #messages.screen#) output <, .obJect.match.names(output, output.names) if (is.null(output=n.posterior)) output=n.posterior <, 9((( if (is.null(output=n.predictive)) output=n.predictive <, ;>-if (is.null(output=moments)) output=moments <, T$>. if (is.null(output=n.back.moments)) output=n.back.moments <, 9((( if (is.null(output=simulations.predictive)) C if (is.null(output=n.predictive)) output=simulations.predictive <, ;>-else output=simulations.predictive <, ifelse(output=n.predictive N (, T$>., ! -&.) D if (is.null(output=mean.var)) output=mean.var <, ;>-if (is.null(output=?uantile)) output=?uantile <, ;>-if (is.null(output=threshold)) output=threshold <, ;>-if (is.null(output=signal)) output=signal <, ;>-if (is.null(output=messages.screen)) output=messages.screen <, T$>. output <, output.control(n.posterior 5 output=n.posterior, n.predictive 5 output=n.predictive, moments 5 output=moments, n.back.moments 5 output=n.back.moments, simulations.predictive 5 output=simulations.predictive, mean.var 5 output=mean.var, ?uantile 5 output=?uantile, threshold 5 output=threshold, signal 5 output=signal, messages 5 output=messages.screen) D D D

signal <, ifelse(is.null(output=signal), ! -&., output=signal) messages.screen <, output=messages.screen n.predictive <, output=n.predictive n.back.moments <, output=n.back.moments if (krige=type.krige 55 #ok#) beta.prior <, #flat# else beta.prior <, #deg# if (n.predictive N 9) C warning(#n.predictive redefinedK n.predictive59#) n.predictive <, 9 D if (n.datasets 55 9) stop(#8nly one datasetU please use krige.conv instead#) if (is.vector(coords)) C coords <, cbind(coords, () warning(#vector of coordinatesK one spatial dimension assumed#) D coords <, as.matri/(coords) locations <, .check.locations(locations) if (Tis.null(borders)) C nloc( <, nrow(locations) ind.loc( <, .geo$7inout(locations, borders) locations <, locations*ind.loc(, , drop 5 ! -&.+ if (nrow(locations) 55 () stop(#Vn .krige.conv.e/tnd K there are no prediction locations inside the borders#) if (messages.screen) cat(#krige.convK results will be returned only for prediction locations inside the bordersVn#) D dimnames(coords) <, list(;>--, ;>--) dimnames(locations) <, list(;>--, ;>--) if (messages.screen) C if (is.numeric(krige=trend.d)) cat(#.krige.conv.e/tndK model with covariates matri/ provided by the user#) else cat(switch(as.character(krige=trend.d)*9+, cte 5 #.krige.conv.e/tndK model with mean being constant#, #9st# 5 #.krige.conv.e/tndK model with mean given by a 9st order polynomial on the coordinates#, #'nd# 5 #.krige.conv.e/tndK model with mean given by a 'nd order polynomial on the coordinates#, #.krige.conv.e/tndK model with mean defined by covariates provided by the user#)) cat(#Vn#) D trend.data <, unclass(trend.spatial(trend 5 krige=trend.d, geodata 5 geodata)) beta.siLe <, ncol(trend.data) if (nrow(trend.data) T5 n) stop(#length of trend is different from the length of the data#) trend.l <, unclass(trend.spatial(trend 5 krige=trend.l, geodata 5 list(coords 5 locations))) if (Tis.null(borders) XX nrow(trend.l) 55 nloc() trend.l <, trend.l*ind.loc(, , drop 5 ! -&.+ if (nrow(trend.l) T5 nrow(locations)) stop(#locations and trend.l have incompatible siLes#)

ni <, nrow(trend.l) if (Tis.null(krige=aniso.pars)) C if (messages.screen) cat(#.krige.conv.e/tndK anisotropy correction performedVn#) coords <, coords.aniso(coords 5 coords, aniso.pars 5 krige=aniso.pars) locations <, coords.aniso(coords 5 locations, aniso.pars 5 krige=aniso.pars) D if (lambda T5 9) C if (messages.screen) cat(#.krige.conv.e/tndK 0ata transformation (Yo/,Co/) performed.Vn#) if (lambda 55 () data <, log(data) else data <, ((dataBlambda) , 9)%lambda D taus? <, nugget if (is.vector(cov.pars)) C sigmas? <, cov.pars*9+ phi <, cov.pars*'+ D else stop(#covariance parameter should be given as a vector#) cpars <, c(9, phi) taus?.rel <, taus?%sigmas? nug.factor <, ifelse(signal, krige=micro.scale%sigmas?, taus?.rel) kc.result <, list() F F F modif voisinage uni?ue

if(nwin55#full#)C out.message <, #krige.conv.e/tndK Zriging performed using global neighbourhood# if (messages.screen) cat(paste(out.message, #Vn#)) [cov <, varcov.spatial(coords 5 coords, cov.model 5 cov.model, kappa 5 kappa, nugget 5 taus?.rel, cov.pars 5 cpars)=varcov ivtt <, solve([cov, trend.data) ttivtt <, crossprod(ivtt, trend.data) if (beta.prior 55 #flat#) beta.flat <, solve(ttivtt, crossprod(ivtt, data)) remove(#ivtt#) temp <, ;>-v( <, loccoords(coords 5 coords, locations 5 locations) if (n.predictive N () C loc.coincide <, apply(v(, ', function(/, min.dist) C any(/ < min.dist) D, min.dist 5 krige=dist.epsilon) if (any(loc.coincide)) loc.coincide <, (9Kni)*loc.coincide+ else loc.coincide <, ;>-if (Tis.null(loc.coincide)) C temp.f <, function(/, data, dist.eps) C return(data*/ < dist.eps, , drop 5 ! -&.+) D data.coincide <, apply(v(*, loc.coincide, drop 5 ! -&.+,

', temp.f, data 5 data, dist.eps 5 krige=dist.epsilon) D else data.coincide <, ;>-D ind.v( <, which(v( < krige=dist.epsilon) v( <, cov.spatial(obJ 5 v(, cov.model 5 cov.model, kappa 5 kappa, cov.pars 5 cpars) v(*ind.v(+ <, 9 M nug.factor ivv( <, solve([cov, v() tv(ivv( <, col&ums(v( E ivv() b <, t(trend.l , crossprod(ivv(, trend.data)) tv(ivdata <, crossprod(ivv(, data) if (n.predictive 55 () C remove(list 5 #v(#) gc(verbose 5 ! -&.) D if (beta.prior 55 #deg#) C kc.result=predict <, array(tv(ivdata M rep(drop(crossprod(b, beta)), n.datasets), dim 5 c(ni, n.datasets)) if (n.predictive 55 () remove(list 5 c(#b#, #tv(ivdata#)) else remove(#tv(ivdata#) kc.result=krige.var <, sigmas? E drop(9 M nug.factor , tv(ivv() beta.est <, paste(#.krige.conv.e/tndK &imple kriging (beta provided by user)Vn#) D if (beta.prior 55 #flat#) C kc.result=predict <, array(tv(ivdata, dim 5 c(ni, n.datasets)) M crossprod(b, beta.flat) remove(list 5 c(#tv(ivdata#)) bitb5col&ums(b E solve(ttivtt, b)) kc.result=krige.var <, sigmas? E drop(9 M nug.factor , tv(ivv( M bitb) kc.result=beta.est <, apply(beta.flat,9,mean) remove(#beta.flat#) D D F F voisinage glissant nwin est numRri?ue F elseCF nwin numRri?ue out.message <, #krige.conv.e/tndK Zriging performed using local neighbourhood# if (messages.screen) cat(paste(out.message, #Vn#)) kc.result <, list(predict 5 matri/((,ni,n.datasets), krige.var 5 rep((,ni), var5rep((,ni), mean.est5rep((,ni),beta.est5matri/((,ni,ncol(trend.l))) v(tot <, loccoords(coords 5 coords, locations 5 locations) for (i in 9Kni) C if (messages.screen)C if(iOO9((55() cat(paste(#krige.convK kriging locationK #, i, #out of#, ni, #Vn#)) D FF FF choi/ de la fen\tre FF

dm( <, v(tot*,i+ coordswin <, coords*order(dm()*9Knwin+, + trend.dwin <, trend.data*order(dm()*9Knwin+,+ trend.li<, trend.l*i,+ trend.li <, matri/(trend.li,nrow59) datawin <, data*order(dm()*9Knwin+,+ [cov <, varcov.spatial(coords 5 coordswin, cov.model 5 cov.model, kappa 5 kappa, nugget 5 taus?.rel, cov.pars 5 cpars)=varcov ivtt <, solve([cov, trend.dwin) ttivtt <, crossprod(ivtt, trend.dwin) if (beta.prior 55 #flat#) beta.flat <, solve(ttivtt, crossprod(ivtt, datawin)) remove(#ivtt#) temp <, ;>-dm(5dm(*order(dm()*9Knwin++ v( <, cov.spatial(obJ 5 dm(, cov.model 5 cov.model, kappa 5 kappa, cov.pars 5 cpars) ind.v( <, which(dm( < krige=dist.epsilon) v(*ind.v(+ <, 9 M nug.factor ivv( <, solve([cov, v() tv(ivv( <, sum(v( E ivv() tv(iv/5crossprod(ivv(, trend.dwin) b <, trend.li , tv(iv/ b5as.double(b) tv(ivdata <, crossprod(ivv(, datawin) if (beta.prior 55 #deg#) C kc.result=predict*i,+ <, tv(ivdata M rep(crossprod(b,beta),n.datasets) kc.result=krige.var*i+ <, sigmas? E (9 M nug.factor , tv(ivv() kc.result=beta.est <, paste(#.krige.conv.e/tndK &imple kriging (beta provided by user)Vn#) kc.result=mean.est <, paste(#.krige.conv.e/tndK &imple kriging (beta provided by user)Vn#) D if (beta.prior 55 #flat#) C kc.result=predict*i,+ <, tv(ivdata M crossprod(b,beta.flat) bitb5sum(b E solve(ttivtt, b)) kc.result=krige.var <, sigmas? E drop(9 M nug.factor , tv(ivv( M bitb) kc.result=mean.est*i+ <, mean(crossprod(matri/(trend.li,ncol59),beta.flat)) kc.result=beta.est*i,+5apply(beta.flat,9,mean) remove(#beta.flat#) D D D F F fin modif nwin F kc.result=krige.var*kc.result=krige.var < 9e,9'+ <, ( if (any(kc.result=krige.var < ()) warning(#.krige.conv.e/tndK negative kriging variance foundT ]nvestigate why this is happening.Vn#) out.message <, #.krige.conv.e/tndK Zriging performed using global neighbourhood# if (messages.screen)

cat(paste(out.message, #Vn#)) if (n.predictive N () C if (messages.screen) cat(#.krige.conv.e/tndK sampling from the predictive distribution (conditional simulations)Vn#) 0val <, 9 M nug.factor if (beta.prior 55 #deg#) vbetai <, matri/((, ncol 5 beta.siLe, nrow 5 beta.siLe) else vbetai <, matri/(.solve.geo$(ttivtt), ncol 5 beta.siLe, nrow 5 beta.siLe) coincide.cond <, (((round(9eM9' E nugget) 55 () W Tsignal) X (Tis.null(loc.coincide))) nloc <, ni , length(loc.coincide) if (coincide.cond) C ind.not.coincide <, ,(loc.coincide) v( <, v(*, ind.not.coincide, drop 5 ! -&.+ b <, b*, ind.not.coincide, drop 5 ! -&.+ D else ind.not.coincide <, T$>. kc.result=simulations <, matri/((, nrow 5 ni, ncol 5 n.datasets) if (nloc N () C invcov <, varcov.spatial(coords 5 coords, cov.model 5 cov.model, kappa 5 kappa, nugget 5 taus?.rel, cov.pars 5 cpars, inv 5 T$>., only.inv.lower.diag 5 T$>.) kc.result=simulations*ind.not.coincide, + <, .cond.sim(env.loc 5 base.env, env.iter 5 base.env, loc.coincide 5 loc.coincide, coincide.cond 5 coincide.cond, tmean 5 kc.result=predict*ind.not.coincide, , drop 5 ! -&.+, $inv 5 invcov, mod 5 list(beta.siLe 5 beta.siLe, nloc 5 nloc, ;sims 5 n.datasets, n 5 n, 0val 5 0val, df.model 5 ;>--, s' 5 sigmas?, cov.model.number 5 .cor.number(cov.model), phi 5 phi, kappa 5 kappa), vbetai 5 vbetai, fi/ed.sigmas? 5 T$>.) D if (coincide.cond) kc.result=simulations*loc.coincide, + <, kc.result=predict*loc.coincide, , drop 5 ! -&.+ remove(list 5 c(#v(#, #invcov#, #b#)) D if (lambda T5 9) C if (lambda 55 () C predict.transf <, kc.result=predict if (messages.screen) cat(#.krige.conv.e/tndK back,transforming the predictions using formula for .P3() Vn#) kc.result=predict <, e/p(predict.transf M (.4 E kc.result=krige.var) kc.result=krige.var <, (e/p(' E predict.transf M kc.result=krige.var)) E e/pm9(kc.result=krige.var) remove(#predict.transf#) D if (lambda N () C

if (messages.screen) cat(#.krige.conv.e/tndK back,transforming predictions using '. order Taylor e/pansion for gBC,9D() Vn#) ivYC <, .YC.inv(kc.result=predict, lambda) kc.result=predict <, ivYC M (.4 E ((9 , lambda) E ivYCB(9 , ' E lambda)) E kc.result=krige.var kc.result=krige.var <, (ivYCB(9 , lambda))B' E kc.result=krige.var M (99%)) E ((9 , lambda) E ivYCB(9 , ' E lambda))B' E kc.result=krige.varB' remove(#ivYC#) D if (lambda < () C if (messages.screen) cat(#.krige.conv.e/tndK resulting distribution has no mean for lambda < ( , back transformation not performedVn#) D if (n.predictive N () C kc.result=simulations <, .YC.inv(kc.result=simulations, lambda) D D else C temp <, kc.result=krige.var kc.result=krige.var <, matri/((, nrow 5 ni, ncol 5 n.datasets) kc.result=krige.var*+ <, temp D kc.result <, c(kc.result, list(message 5 out.message, call 5 cl)) return(kc.result) D binom.krige.simul95function(data, coords, units.m,mcmc.input, cov.model, kappa,beta,cov.pars,nugget,aniso.pars,trend.data, beta.prior,messages.screen,nwin) C n5nrow(coords) if (beta.prior 55 #deg#) mean.d <, as.vector(trend.data OEO beta) else mean.d <, rep((, n) if (Tis.null(aniso.pars)) C invcov <, varcov.spatial(coords 5 coords.aniso(coords 5 coords, aniso.pars 5 aniso.pars), cov.model 5 cov.model, kappa 5 kappa, nugget 5 nugget, cov.pars 5 cov.pars, inv 5 T$>., func.inv 5 #cholesky#, try.another.decomposition 5 ! -&.)=inverse D else C invcov <, varcov.spatial(coords 5 coords, cov.model 5 cov.model, kappa 5 kappa, nugget 5 nugget, cov.pars 5 cov.pars, inv 5 T$>., func.inv 5 #cholesky#, try.another.decomposition 5 ! -&.)=inverse D if (beta.prior 55 #flat#) C ivtt <, invcov OEO trend.data invcov <, invcov , ivtt OEO .solve.geo$(crossprod(trend.data, ivtt), t(ivtt)) D res.mcmc <, .mcmc.binom.logit(data 5 data, units.m 5 units.m,

mean& 5 mean.d, invcov 5 invcov, mcmc.input 5 mcmc.input, messages.screen 5 messages.screen)

htt!:44g&i.agrsci.d546ofch4geo/glm4."alid.&inom./

F F fonction pour faire /valid sur du S-&M F G/valid.binomG <, function (geodata, coords 5 geodata=coords, data 5 geodata=data, model, units.m 5 #default#,mcmc.input, variog.obJ 5 ;>--, locations./valid 5 #all#, data./valid 5 ;>--, trend.data, trend.loc, messages, nwin5#full#, ask5T,borders5;>--, logitp.data,trend(5T,resid5!, ...) C call.fc <, match.call() if (missing(messages)) messages.screen <, as.logical(ifelse(is.null(get8ption(#geo$.messages#)), T$>., get8ption(#geo$.messages#))) else messages.screen <, messages if (any(class(model) 55 #eyefit#)) C model <, model**9++ model=method <, #eyefit# D if (missing(geodata)) geodata <, list(coords 5 coords, data 5 data, units.m 5units.m) if (any(units.m 55 #default#)) C if (Tis.null(geodata=units.m)) units.m <, geodata=units.m else units.m <, rep(9, n) D n <, nrow(coords) data <, as.vector(data) if (length(data) T5 n) stop(#coords and data have incompatible siLes#) if(trend()C /mat <, trend.spatial(trend 5 trend.data, geodata 5 geodata) if (nrow(/mat) T5 n) stop(#coords and trend have incompatible siLes#) D else /mat5;>-if (missing(mcmc.input)) stop(#/valid.binom K argument mcmc.input must be given#) mcmc.input <, .mcmc.check.au/(mcmc.input, fct 5 #binom.krige#) F if (is.null(model=aniso.pars)) F model=aniso.pars <, c((, 9) if (is.null(model=kappa)) model=kappa <, (.4 if (all(locations./valid 55 #all#) W is.vector(locations./valid)) C autocross <, T$>. if (all(locations./valid 55 #all#)) locations./valid <, 9Kn else if (any(locations./valid N n) W mode(locations./valid) T5 #numeric#) stop(#Vn/validK vector indicating locations to be validated is not a numeric vector and%or has element(s) with value greater than the number of data loccations#) crossvalid <, T$>. D else C

autocross <, ! -&. if (is.matri/(locations./valid) W is.data.frame(locations./valid)) if (dim(locations./valid)*'+ <5 ') C if (dim(locations./valid)*'+ 55 9) C locations./valid <, is.vector(locations./valid) crossvalid <, T$>. if (any(locations./valid) N n W length(locations./valid) N n) stop(#incorrect value to the argument locations./valid.VnThis must be a numeric vector with numbers indicating the locations to be cross,validated#) D else C if (messages.screen) cat(#/validK cross,validation to be performed on locations provided by the userVn#) if (is.null(data./valid)) stop(#the argument V#data./validV# must be provided in order to perform validation on a set of locations different from the original data#) crossvalid <, ! -&. D D else if (Tis.vector(locations./valid) W mode(locations./valid) T5 #numeric#) stop(#Vnargument locations./valid must be eitherKVn a numeric vector with numbers indicating the locations to be cross, validatedVn a matri/ with coordinates for the locations to be cross, validated.#) else if (any(locations./valid) N n W length(locations./valid) N n) stop(#incorrect value to the argument locations./valid.VnThis must be a numeric vector with numbers indicating the locations to be cross,validated#) D if (crossvalid 55 ! -&.) n.pt./v <, dim(locations./valid)**9++ else n.pt./v <, length(locations./valid) if (messages.screen) C cat(paste(#/validK number of data locations 5#, n)) cat(#Vn#) cat(paste(#/validK number of validation locations 5#, n.pt./v)) cat(#Vn#) if (crossvalid) cat(#/validK performing cross,validation#) else cat(#/validK performing validation at the locations provided#) cat(#Vn#) D if (crossvalid) C

F F pb dHallocation Je mets le calcul ?ui ^_tait sous forme apply F res <, as.data.frame(t(apply(matri/(locations./valid),9, cv.f,data.mcmc5Tres.mcmc))) F dans une boucle F F if(Task) &scale5mcmc.input=&.scale repeatC if(ask)C print(#valeur pour &.scale (( pour continuer)#) &scale5scan(n59) D if(&scale<5() break F &.scale5(.94 mcmc.input=&.scale5&scale beta.prior <, #flat# Tres.mcmc5binom.krige.simul9(data, coords, units.m,mcmc.input, model=cov.model,model=kappa,model=beta,model=cov.pars,model=nugget,model= aniso.pars,trend.data,beta.prior,messages.screen,nwin5nwin)=&data if(Task) &scale5( D res5matri/((,n.pt./v,4) for(ndata in 9Kn.pt./v)C if (messages.screen) cat(paste(ndata, #, #, sep 5 ##)) coords.out <, coords*ndata, , drop 5 ! -&.+ data.out <, data*ndata+%units.m*ndata+ if(trend() /mat.out <, /mat*ndata, , drop 5 ! -&.+ if(nwinT5#full#)C cv.coords5coords*,ndata,+ dm( <, loccoords(coords 5 cv.coords, locations 5 coords.out) cv.coords <, cv.coords*order(dm()*9Knwin+, + cv.data.mcmc 5 Tres.mcmc*,ndata,+*order(dm()*9Knwin+,+ if(trend() cv./mat <, /mat*,ndata, , drop 5 ! -&.+ *order(dm()*9Knwin+, , drop 5 ! -&.+ D elseC cv.coords <, coords*,ndata, + cv.data.mcmc <, Tres.mcmc*,ndata,+ if(trend() cv./mat <, /mat*,ndata, , drop 5 ! -&.+ D if(trend()C Tkgc5krige.control(type.krige5#ok#,trend.d 5 `cv./mat M (, trend.l 5 `/mat.out M (, cov.model 5 model=cov.model, beta5model=beta,cov.pars 5 model=cov.pars, nugget 5 model=nugget, kappa 5 model=kappa, lambda 5 model=lambda, aniso.pars 5 model=aniso.pars) D elseC Tkgc5krige.control(type.krige5#ok#, cov.model 5 model=cov.model, cov.pars 5 model=cov.pars, nugget 5 model=nugget, kappa 5 model=kappa, lambda 5 model=lambda, aniso.pars 5 model=aniso.pars) D kr <, glm.krige.au/9(data5cv.data.mcmc, coords 5 cv.coords, loc 5 coords.out, borders5borders, krige 5 Tkgc,

output 5 output.control(n.pred5(,mess 5 ! -&.)) res*ndata,9+5data.out res*ndata,'+5mean(kr=pred) res*ndata,2+5kr=krige.var*9+ M var(as.double(kr=pred)) res*ndata,)+5mean(kr=npred) res*ndata,4+5mean(kr=nvar)Mvar(as.double(kr=npred)) D res5as.data.frame(res) D else C Tkgc5krige.glm.control(trend.d 5 `/mat , trend.l 5 trend.loc, cov.model 5 model=cov.model, cov.pars 5 model=cov.pars, nugget 5 model=nugget, kappa 5 model=kappa, lambda 5 model=lambda, aniso.pars 5 model=aniso) res <, binom.krige9(coords 5 coords, data 5 data, loc 5 locations./valid, krige 5 Tkgc,output 5 output.glm.control(mess 5 ! -&.),nwin5nwin)*9K'+ res <, data.frame(data./valid, res=pred, res=krige.var, res=npred, res=nvar) D if (messages.screen) cat(#Vn/validK end of cross,validationVn#) names(res) <, c(#pdata#, #predicted#, #krige.var#,#npred#,#nvar#) res=nerr <, res=pdata , res=npred res=std.nerr <, res=nerr%s?rt(res=nvar) res=data5logitp.data res=error <, res=data , res=pred res=std.error <, res=err%s?rt(res=krige.var) res=prob <, pnorm(res=data, mean 5 res=pred, sd 5 s?rt(res=krige.var)) attr(res, #row.names#) <, ;>-if (autocross) C if (Tis.null(call.fc=geodata)) attr(res, #geodata./valid#) <, call.fc=geodata else attr(res, #locations./valid#) <, call.fc=locations./valid D elseC if (Tis.null(locations./valid)) attr(res, #locations./valid#) <, call.fc=locations./valid D attr(res, #class#) <, #/valid# if(resid)C resn5list(err5res=error,nerr5res=nerr,nerrs5res=std.nerr) D elseC resn5list(Yias5mean(res=error),Yias$5mean(res=error%abs(res=data)), M&.5mean(res=errorB'), M&.&td5mean(res=std.errB'),YiasT5mean(res=nerr), YiasT$5mean(res=nerr%abs(res=pdata)), M&.T5mean(res=nerrB'),M&.T&td5mean(res=std.nerrB')) D resn D

geoRglm #e eloper Page


4his page is mainly intended for the t#o developers of geoRglm geoR functions used by geoRglm : 8 .bilinearformP Q (used &#: !re!are.li5fit.glsm, .ma.im.au.1 , 8 .check.locations (used &#: &inom.5rige, &inom.5rige.&a#es, glsm.5rige, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, !ois.5rige, !ois.5rige.&a#es, .!red.au. , 8 .cond.sim (used &#: .5rige.&a#es.e.tnd, .5rige.con".e.tnd , 8 .cor.number (used &#: .mcmc.&a#es.&inom.logit, .mcmc.&a#es.con9.&inom.logit, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, .mcmc.&a#es.!ois.log, .mcmc.&a#es.!ois.&o.co., .mcmc.&a#es.con9.!ois.log, .mcmc.&a#es.con9.!ois.&o.co. , 8 .diag?uadraticformP P (used &#: .5rige.&a#es.e.tnd, .5rige.con".e.tnd, !re!are.li5fit.glsm, .ma.im.au.1 , 8 .geo$7inout (used &#: .5rige.&a#es.e.tnd, .5rige.con".e.tnd, &inom.5rige.&a#es, !ois.5rige.&a#es 8 .ldots.set (used &#: image.glm.5rige.&a#es, !ers!.glm.5rige.&a#es , 8 .prepare.graph.krige.bayes (used &#: image.glm.5rige.&a#es, !ers!.glm.5rige.&a#es , 8 .solve.geo$ (used &#: &inom.5rige, &inom.5rige.&a#es, .5rige.&a#es.e.tnd, !ois.5rige, !ois.5rige.&a#es ,

8 YCtransform (used &#: :C.in" , 8 coords.aniso (used &#: &inom.5rige, &inom.5rige.&a#es, glsm.mcmc, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, li5fit.glsm, !ois.5rige, !ois.5rige.&a#es, !re!are.li5fit.glsm, !rofli5.glsm , .mcmc.&a#es.!ois.log, .mcmc.&a#es.!ois.&o.co., .mcmc.&a#es.con9.!ois.log, .mcmc.&a#es.con9.!ois.&o.co. , 8 cov.spatial (used &#: .5rige.&a#es.e.tnd, .5rige.con".e.tnd, lines.co"ariomodel , 8 grf (used &#: .!ois.log.grf , 8 hist.krige.bayes (used &#: hist.glm.5rige.&a#es , 8 image.kriging (used in hel! file for : &inom.5rige.&a#es , 8 krige.bayes (used &#: &inom.5rige.&a#es, !ois.5rige.&a#es , 8 krige.control (used &#: .5rige.con".e.tnd , 8 legend.krige (used &#: image.glm.5rige.&a#es , 8 locations.inside (used &#: .5rige.con".e.tnd , 8 loccoords (used &#: &inom.5rige.&a#es, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, !ois.5rige.&a#es , 8 model.control (used &#: .5rige.&a#es.e.tnd , 8 output.control (used &#: .5rige.&a#es.e.tnd, .5rige.con".e.tnd , 8 pars.limits (used &#: li5fit.glsm , 8 plot.9d (used &#: image.glm.5rige.&a#es, !ers!.glm.5rige.&a#es , 8 prior.control (used &#: .5rige.&a#es.e.tnd 8 trend.spatial (used &#: &inom.5rige, &inom.5rige.&a#es, glsm.mcmc, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, li5fit.glsm, .!ois.log.grf, !ois.5rige, !ois.5rige.&a#es, !re!are.li5.sim, !rofli5.glsm , 8 varcov.spatial (used &#: &inom.5rige, &inom.5rige.&a#es, glsm.mcmc, .5rige.&a#es.e.tnd, .5rige.con".e.tnd, !re!are.li5fit.glsm, .li5.sim, .li5.sim.&o.co., li5fit.glsm, !ois.5rige, !ois.5rige.&a#es, !re!are.li5fit.glsm .

7n addition the C2functions corrfctvalue and geo$matern are included in both the geoR and the geoRglm distribution. geoR classes used by geoRglm : 8 kriging (used &#: &inom.5rige, glsm.5rige, !ois.5rige , 8 proflik (used &#: !rofli5.glsm .

Future plans/things to be done: 7 am currentl# not wor5ing on new features in the !ac5age. $he !lan for the future is to 5ee! the !ac5age running &# res!onding to &ug re!orts and to changes in /. :elow is list which was com!iled some #ears ago a&out !lans for future de"elo!ment. ;igh !riorit#: 8 <or fi.ed !arameters the re(uired memor# can reduced &# constructing the matrices in the C-!art of the code instead of the /-!art of the code. 8 $he re!arameterisation stuff is not cle"erl# done from a numerical !oint of "iew. Needs fi.ing, &ut is de!ending on how the !oint a&o"e (reducing memor# &# constructing matrices in C is sol"ed. 8 -efault starting "alue &.start needs some im!ro"ement. 8 Consider ha"ing a default "alue of the scaling !arameter &.scale =ower !riorit# (if e"er : 8 A!!ro.imati"e methods for large data sets. +resented in a series of !a!ers &# /ue and coauthors. $his a"oids using

MCMC, and is therefore using a different !aradigm than geo/glm. +ossi&l# the &etter solution is to start from scratch here. 8 Mar5o" chain Monte Carlo *M algorithm as in >hang (2112 . $he function glsm.mcmc can &e used for the MCMC !art. 8 'ne-dimensional !rofile li5elihood in proflik.glsm. 8 *.tend likfit.glsm to o!timisation w.r.t. anisotro!# and kappa !arameters. 8 ?sing the control() argument in optim in a automatic wa# in the o!timisation !rocedures. 8 *.tend likfit.glsm to o!timisation for fi.ed phi. 8 7m!lement the ro&ust MCMC-algorithms (from ideas in the !a!er with %areth and Martin for :a#esian inference 2fi.ed !arameter case is alread# im!lemented3. 8 Calculation of !redicti"e mean and "ariance in binom.krige.bayes (a!!ro.imati"e or &# simulation . 8 Calculation of (uantiles im!ro"ed in binom.krige.bayes and pois.krige.bayes. 8 :inomial model with !ro&it lin5. 8 +rediction of the data (incoor!orating the measurement error . 8 Com!osite li5elihood as in @arin, ;ost and ,5are (211) . Christiano @arin ma# &e wor5ing on a !ac5age for this. ,ome da# (!ro&a&l# ne"er : 8 /e!eated o&ser"ations at each location.

8 Automatising of se(uential !rocedures (!osterior of !arameters to &e used as !riors in a new anal#sis . 8 Circulant em&edding method for correlation matri. in MCMC algorithm (regular grid . 8 ,ome re"ision of the functions for the em!irical co"ariogram (other than log-lin5, and !ro&a&l# some further thin5ingAsimulation studies . 8 Considerations a&out !rior for sigmas? and phi (default !riors B .

History (short) : 8 -ecem&er 2111 : geo/glm was initiated (originall# as an ,!lus li&rar# called glmm, . 8 March 2111 : home!age constructedC "ersion 1.1-1 a"aila&le on the we&C con"ersion to /. 8 0une 2111 : 'le "isted +aulo in =ancasterC hel! !ages were made. 8 August 2111 : geo/glm "ersion 1.1-4 used for summerschool in Aal&org. 8 13 <e&ruar# 2112: geo/glm "ersion 1.4-1 su&mitted to C/AN. 8 1D 0une 2112 : Article in / News a&out geo/glm.

You might also like