> str(example.df)'data.frame': 5474 obs. of 5 variables: $ dat$WNVLabResult: int 0 0 0 0 1 0 0 0 1 0 ... $ dat$Prcp : num 8.14 9.29 0 8.14 1 ... $ dat$MLatX : num 4519163 4519163 4519163 4519163 4519163 ... $ dat$MLongY : num 606832 606832 606832 606832 606832 ... $ dat$Week : num 3 4 5 6 8 9 10 13 14 14 ...#Create the mesh for INLA observationsloc <- cbind(dat$MLongY/1000,dat$MLatX/1000) #Divide by 1000 to get kmbnd<-inla.nonconvex.hull(loc) #Makes a nonconvex hull around the points rather than the spatial extent of the islandmesh<-inla.mesh.2d(boundary=bnd, cutoff=1, max.edge=c(2,3))
#Create the SPDE model using the pc-prior spde <- inla.spde2.pcmatern( mesh=mesh, alpha=2, ### mesh and smoothness parameter prior.range=c(10, 0.01), ### P(practic.range<10 km)=0.01 prior.sigma=c(1, 0.01) ### P(sigma>1 km)=0.01 )
#Create the index set for specifying number of time steps in spacetime modeliset <- inla.spde.make.index('i', n.spde=spde$n.spde, n.group=max(dat$Week))
#Create the projector matrix based on the locations and time of the observationsA <- inla.spde.make.A(mesh=mesh, loc=loc, group=dat$Week)
#Create the data stack. For this example we're just going to use precipitation as the only predictorsdat <- inla.stack(tag='stdata', data=list(y=dat$WNVLabResult), A=list(A,1), effects=list(iset, list(Prcp=dat$Prcp)))> str(sdat$effects)List of 5 $ data :'data.frame': 2529 obs. of 5 variables: ..$ i : int [1:2529] 236 367 613 108 113 136 173 186 197 289 ... ..$ i.group : int [1:2529] 1 1 1 2 2 2 2 2 2 2 ... ..$ i.repl : int [1:2529] 1 1 1 1 1 1 1 1 1 1 ... ..$ Intercept: num [1:2529] 1 1 1 1 1 1 1 1 1 1 ... ..$ Prcp : num [1:2529] NA NA NA NA NA NA NA NA NA NA ... $ nrow : int 2529 $ ncol : Named int [1:5] 1 1 1 1 1 ..- attr(*, "names")= chr [1:5] "i" "i.group" "i.repl" "Intercept" ... $ names:List of 5 ..$ i : chr "i" ..$ i.group : chr "i.group" ..$ i.repl : chr "i.repl" ..$ Intercept: chr "Intercept" ..$ Prcp : chr "Prcp" $ index:List of 1 ..$ stdata: int [1:31763] NA NA NA NA NA NA NA NA NA NA ... - attr(*, "class")= chr "inla.data.stack.info"> --
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion-group+unsub...@googlegroups.com.