plotrisk.sil {spgam} | R Documentation |
~~ A concise (1-5 lines) description of what the function does. ~~
plotrisk.sil(risk, tp = "range", zlim, clevels = default, tolvals = c(0.025, 0.975), toptitle = NA, pval = F)
risk |
~~Describe risk here~~ |
tp |
~~Describe tp here~~ |
zlim |
~~Describe zlim here~~ |
clevels |
~~Describe clevels here~~ |
tolvals |
~~Describe tolvals here~~ |
toptitle |
~~Describe toptitle here~~ |
pval |
~~Describe pval here~~ |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
....
~~further notes~~
~Make other sections like Warning with section{Warning }{....} ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function(risk, tp='range', zlim, clevels = default, tolvals = c(0.025, 0.975), toptitle = NA, pval = F) { # Julia Kelsall #******************************** # Sara Morris # November 15th 1995 # inputs: # risk is a list of (x, y, z, est, poly) where x,y are the spatial # locations (probably in a regular grid). z is the matrix of the # proportion of simulated data sets below the observed g(x). est # is the x,y,z values of the observed rel risk surface from the # function relrisk. # # The whole thing can be the output from the significance or # tolerance function. # # contours of risk$z are plotted on the map of risk$est #******************************** default <- c(-20, -15, -10, -8, -6, -5, -4, seq(-3, 3, 0.5), 4, 5, 6, 8, 10, 15, 20) if(missing(zlim)) { if (tp=="quantile"){ zl <- quantile(as.vector(risk$est$z), c(0.25, 0.75), na.rm = T) zlim <- c(2 * zl[1], 10 * zl[2]) } else if(tp=="range") zlim <- range(as.vector(risk$est$z), na.rm = T) } risk$est$z[(risk$est$z) > (zlim[2])] <- zlim[2] risk$est$z[(risk$est$z) < (zlim[1])] <- zlim[1] print(range(risk$est$z[risk$est$z!='NA'])) par(pty = "s", font = 3) pointmap(risk$poly, type = "n", cex = 0.69999999999999996) image(risk$est, add = T, zlim = zlim) image.legend(risk$est$z, zlim = zlim) polymap(risk$poly, add = T) contour(risk$est, lwd = 0.7, cex = 0.5, levels = clevels, add = T, lty = 2) if((tolvals[1] == 0.025000000000000001) & (tolvals[2] == 0.97499999999999998)) { contour(risk, levels = 0.97499999999999998, cex = 0.001, lwd = 3, add = T, lty = 1) contour(risk, levels = 0.025000000000000001, cex = 0.001, lwd = 3, add = T, lty = 3) } else { contour(risk, levels = tolvals, cex = 0.69999999999999996, lwd = 3, add = T, lty = 3) } if(is.na(toptitle)) { toptitle <- " " } if(pval) { toptitle <- paste(toptitle, " (p =", as.character(round(risk$ pval, digits = 3)), ")") } title(toptitle, cex = 0.80000000000000004) }