plot2Q: Function to produce image plot of 2-dimensional data modeled...

Description Usage Arguments Details Value Author(s) Examples

Description

Function to produce image plot of 2-dimensional data modeled with 2 separate structure matrices.

Usage

1
2
plot2Q(objname, numcols = 64, col = rev(terrain.colors(numcols)), 
rev.inds = c(FALSE, FALSE))

Arguments

objname

name of output object produced by CARrampsOcl.fit

numcols

number of shades from the color palette to be used

col

color palette to be used in plotting; the default plots high values in green and low values in pink.

rev.inds

Should the plotting indices on the two-dimensional plot be reversed? Setting rev.inds = c(TRUE,FALSE) flips the plot from left to right; rev.inds = c(FALSE,TRUE) turns the plot upside down.

Details

This function plots two two-dimensional plots side-by-side. The left plot is of the raw data input into the CARrampsOcl.fit function, and the right plot is of the estimated means of the posterior distributions of the corresponding random effects.

Value

This function plots two two-dimensional plots side-by-side. The left plot is of the raw data input into the CARrampsOcl.fit function, and the right plot is of the estimated means of the posterior distributions of the corresponding random effects.

Author(s)

Kate Cowles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# load data
  data(iowaSW06)

# construct structure matrix
  Q1<- makeRW2Q(33)       # for rows
  Q2<- makeRW2Q(24)       # for columns


# dimensions of Q1, Q2,  in that order
    na<- nrow(Q1)
    nb<- nrow(Q2)

Q <- list( list(type="Gen",content=Q1), list(type="Gen",content=Q2) )

# construct the design matrix with with as many columns as there are
# in null space of kronecker prod of Q's

X2 <- cbind( rep(1,nb), 1:nb)
X1 <- cbind( rep(1,na), 1:na)
X <-  kronecker( X2, X1)

# parameters of gamma prior densities on tausqy, tausqphi[1], tausqphi[2]
alpha2 = beta2 <- c(.1, .1, .1)

# number of samples
nsamp = 100

#random seed
myseed = 314

output <- CARrampsOcl.fit(alpha=alpha2,
            beta=beta2, Q=Q, y=iowaSW06,  nsamp=nsamp,
            seed=myseed,
            fixed = FALSE, randeffs=TRUE, coefs=TRUE,designMat=X,
            mult= 50)

# plot the raw data and the posterior means of the site-specific random effects

plot2Q( output, numcols=32, col = rev(terrain.colors(32)), rev.inds = c(FALSE, TRUE))

CARrampsOcl documentation built on May 2, 2019, 3:27 a.m.