plotrisk {spgam}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

plotrisk(risk, tp = "range", zlim, clevels = default, tolvals = c(0.025, 0.975), toptitle = NA, pval = F, legend = FALSE)

Arguments

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~~
legend ~~Describe legend here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- 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, legend = FALSE) 
{
    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]
    par(pty = "s", font = 3)
    my.polymap(risk$poly, add.poly = F, cex = 0.8)
    image(risk$est, add = T, zlim = zlim,col=rev(heat.colors(30)))
    if (legend == TRUE) {
        aux = locator(2)
        image.legend(x.leg = aux$x, y.leg = aux$y, values = zlim,col=rev(heat.colors(30)))
    }
    my.polymap(risk$poly, add = T, add.poly = T)
    contour(risk$est, lwd = 0.7, cex = 0.5, levels = clevels, 
        add = T, lty = 2)
    if ((tolvals[1] == 0.025) & (tolvals[2] == 0.975)) {
        contour(risk, levels = 0.975, cex = 0.001, lwd = 3, add = T, 
            lty = 1)
        contour(risk, levels = 0.025, cex = 0.001, lwd = 3, add = T, 
            lty = 3)
    }
    else {
        contour(risk, levels = tolvals, cex = 0.7, 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.8)
  }

[Package spgam version 1.0 Index]