\chapter{کدهای مربوط به مثال سرطان خون غرب انگلستان}\label{appendix1}
\begin{latin}
\renewcommand{\baselinestretch}{1.5}
\begin{verbatim}
R>library(INLA)
R>library(lattice)
R>library(fields)
## Read data:
R> data(Leuk)
R> source(system.file("demodata/Leuk-map.R", package="INLA"))
R> g = system.file("demodata/Leuk.graph", package="INLA")     
R>Leuk$id = 1:dim(Leuk)[1]
R>Leuk$wbc2<-Leuk$wbc
R>Leuk$wbc2<-Leuk$wbc2-min(Leuk$wbc2)
R>Leuk$wbc2<-Leuk$wbc2/max(Leuk$wbc2)*64
R>Leuk$wbc2<-floor(Leuk$wbc2)
R>Leuk$tpi2<-Leuk$tpi
R>Leuk$tpi2<-Leuk$tpi2-min(Leuk$tpi2)
R>Leuk$tpi2<-Leuk$tpi2/max(Leuk$tpi2)*64
R>Leuk$tpi2<-floor(Leuk$tpi2)
###################ModelI##############################
R>formula1=inla.surv(time, cens) ~ 1 + sex + age 
           + f(wbc2,model="rw2") + f(tpi2,model="rw2")
R>model.1 = inla(formula1, family="coxph", data=Leuk, 
verbose=TRUE, control.hazard=list(model="rw1",n.intervals=20,
param=c(1,0.001)), control.compute=list(dic=TRUE))
R>summary(model.1)
###################ModelII##############################
R>formula2=inla.surv(time,cens)~sex+age + wbc
           + f(inla.group(tpi,n=50),model="rw2") 
           + f(district,model="besag",graph.file=g)
R>model.2  = inla(formula2, family="coxph", data=Leuk, 
verbose=TRUE, control.hazard=list(model="rw1",n.intervals=20,
param=c(1,0.001)), control.compute=list(dic=TRUE))
R>summary(model.2)
###################ModelIII##############################
R>formula3=inla.surv(time, cens) ~ 1 + sex + age + wbc 
R>model.3  = inla(formula3, family="coxph", data=Leuk, 
          control.hazard=list(model="rw1",n.intervals=20,
          param=c(1,0.001)), verbose=TRUE,
          control.compute=list(dic=TRUE))
R>summary(model.3)
###################ModelIV##############################
R>formula4=inla.surv(time, cens) ~ 1 + sex + age + wbc 
            + f(inla.group(tpi,n=50),model="rw2")
             + f(district, model="bym",graph.file=g)
R>model.4= inla(formula4, family="coxph", data=Leuk, 
            control.hazard=list(model="rw1",n.intervals=20,
            param=c(1,0.001)), verbose=TRUE,
            control.compute=list(dic=TRUE))
R>summary(model.4)
R>plot(model.4)

\end{verbatim}
\end{latin}
