assessmap: Assesses spatial random effects, such as those mapped with...

View source: R/fillmap.R

assessmapR Documentation

Assesses spatial random effects, such as those mapped with fillmap.

Description

This function offers several options for secondary assessments of spatial random effects.

Usage

assessmap(u, v = rep(0, length(u)), x, bk = "quart", user, graph)

Arguments

u

The random effect to be assessed.

v

The second random effect to be assessed such that u + v.

x

The the risk factor for exploration.

bk

The categorization specification for the random effect. Defaults to "quart." Other options are: "quint", "tert", "med", "trend", "user".

user

The user specified categoriation of the random effect.

graph

The INLA graph file neccessary for the secondary assessment.

Examples

Sr1 = Polygon(cbind(c(0,0,1,1,0),c(0,1,1,0,0)))
Sr2 = Polygon(cbind(c(0,1,1,0,0),c(0,0,-1,-1,0)))
Sr3 = Polygon(cbind(c(0,-1,-1,0,0),c(0,0,1,1,0)))
Sr4 = Polygon(cbind(c(0,0,-1,-1,0),c(0,-1,-1,0,0)))
Sr5 = Polygon(cbind(c(1,1,2,2,1),c(0,1,1,0,0)))
Sr6 = Polygon(cbind(c(0,2,2,1,1),c(0,0,-1,-1,0)))
Sr7 = Polygon(cbind(c(-1,-1,0,0,-1),c(1,2,2,1,1)))
Sr8 = Polygon(cbind(c(-1,-2,-2,-1,-1),c(1,1,2,2,1)))
Sr9 = Polygon(cbind(c(0,0,1,1,0),c(1,2,2,1,1)))
Sr10 = Polygon(cbind(c(-2,-2,-1,-1,-2),c(-2,-1,-1,-2,-2)))
Sr11 = Polygon(cbind(c(-2,-3,-3,-2,-2),c(-2,-2,-1,-1,-2)))
Sr12 = Polygon(cbind(c(-1,-1,0,0,-1),c(-2,-1,-1,-2,-2)))
Srs1 = Polygons(list(Sr1), "s1")
Srs2 = Polygons(list(Sr2), "s2")
Srs3 = Polygons(list(Sr3), "s3")
Srs4 = Polygons(list(Sr4), "s4")
Srs5 = Polygons(list(Sr5), "s5")
Srs6 = Polygons(list(Sr6), "s6")
Srs7 = Polygons(list(Sr7), "s7")
Srs8 = Polygons(list(Sr8), "s8")
Srs9 = Polygons(list(Sr9), "s9")
Srs10 = Polygons(list(Sr10), "s10")
Srs11 = Polygons(list(Sr11), "s11")
Srs12 = Polygons(list(Sr12), "s12")
SpP = SpatialPolygons(list(Srs1,Srs2,Srs3,Srs4,Srs5,Srs6,Srs7,Srs8,Srs9,
	Srs10,Srs11,Srs12), 1:12)
nb.r <- poly2nb(SpP, queen=F)    
mat <- nb2mat(nb.r, style="B",zero.policy=TRUE) # mat is the 0/1 adjacency matrix
n.site <- dim(mat)[1]          # n.site: number of areas
n.edge <- sum(mat)/2           # n.edge: number of unique pairs
nbToInlaGraph(nb.r,graphFile="~\\INLAgraph.dat")

v=as.matrix(runif(12,0,1))
x=as.matrix(runif(12,0,1))
library(INLA)
assessmap(u=v,x=x,graph="~\\INLAgraph.dat")


carrollrm/fillmap documentation built on June 26, 2022, 3:06 a.m.