Learn R Programming

embryogrowth (version 7.1)

plotR: Show the fitted growth rate dependent on temperature and its density

Description

Show the fitted growth rate dependent on temperature and its density. The curve "ML quantiles" is based on delta method. The curve "ML" just shows the fitted model. The curve "MCMC quantiles" uses the mcmc replicates to build the quantiles. The curve "MCMC mean-SD" uses the mcmc replicates to build a symetric credibility interval. The parameter curves is case insensitive. If only parameters is given, curves must be ML.

Usage

plotR(result = NULL, resultmcmc = NULL, parameters = NULL,
  fixed.parameters = NULL, temperatures = NULL, curves = "ML quantiles",
  set.par = 1, ylim = c(0, 5), xlim = c(20, 35), hessian = NULL,
  replicate.CI = 1000, cex.lab = par("cex"), cex.axis = par("cex"),
  scaleY = "auto", lty = 1, ltyCI = 3, lwd = 1, lwdCI = 1,
  col = "black", col.polygon = "grey", polygon = FALSE, probs = 0.95,
  colramp = colorRampPalette(c("white", rgb(red = 0.5, green = 0.5, blue =
  0.5))), bandwidth = c(0.1, 0.01), pch = "", main = "",
  xlab = expression("Temperature in " * degree * "C"), ylab = NULL,
  bty = "n", las = 1, by.temperature = 0.1, show.density = FALSE,
  new = TRUE, show.hist = FALSE, ylimH = NULL, atH = NULL,
  ylabH = "Temperature density", breaks = "Sturges", log.hist = FALSE,
  mar = NULL)

Arguments

result

A result object or a list of result objects

resultmcmc

A result object from GRTN_MHmcmc() function

parameters

A set of parameters - Has the priority over result

fixed.parameters

A set of fixed parameters

temperatures

A set of temperatures - Has the priority over result

curves

What curves to show: "MCMC quantiles" or "MCMC mean-SD" based on mcmc or "ML" or "ML quantiles" for maximum-likelihood

set.par

1 or 2 to designate with set of parameters to show

ylim

Range of values for y-axis

xlim

Range of values for x-axis

hessian

An hessian matrix

replicate.CI

Number of replicates to estimate confidence interval with Hessian if delta method failed

cex.lab

cex value for axis

cex.axis

cex value for axis

scaleY

Scaling factor for y axis or "auto"

lty

The type of lines

ltyCI

The type of lines

lwd

The type of lines

lwdCI

The type of lines

col

The color of the lines

col.polygon

The color of the polygon

polygon

If TRUE, confidence interval is shown as a polygon with color

probs

Confidence or credibility interval to show

colramp

Ramp function accepting an integer as an argument and returning n colors.

bandwidth

numeric vector (length 1 or 2) of smoothing bandwidth(s). If missing, a more or less useful default is used. bandwidth is subsequently passed to function bkde2D.

pch

Character for outlayers

main

Title of the graph

xlab

Label for x axis

ylab

Label for y axis

bty

Box around the pot

las

Orientation for labels in y axis

by.temperature

Step to built the temperatures

show.density

TRUE or FALSE for use with Hessian or MCMC

new

Should the graphics be a new one (TRUE) or superimposed to a previous one (FALSE)

show.hist

TRUE or FALSE

ylimH

Scale of histogram using ylimH=c(min, max)

atH

Position of ticks for scale of histogram

ylabH

Label for histogram scale

breaks

See ?hist

log.hist

SHould the y scale for hist is log ?

mar

The value of par("mar"). If null, it will use default depending on show.dist. If NA, does not change par("mar").

Value

The value of scaleY to be used with other plotR function

Details

plotR shows the fitted growth rate dependent on temperature and the density of the mcmc

Examples

Run this code
# NOT RUN {
library(embryogrowth)
plotR(result = resultNest_4p_SSM4p, 
             resultmcmc=resultNest_mcmc_4p_SSM4p, 
             curves = "MCMC quantiles")
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM4p, 
             curves = "MCMC quantiles", show.density=TRUE)
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM4p, 
             curves = "MCMC quantiles", polygon=TRUE)
#################
plotR(resultmcmc=resultNest_mcmc_6p_SSM6p, ylim=c(0,4), 
      curves = "MCMC quantiles", polygon=TRUE, col.polygon = rgb(0, 1, 0, 1))
plotR(resultmcmc=resultNest_mcmc_4p_SSM4p,
       curves = "MCMC quantiles", polygon=TRUE, col.polygon = rgb(1, 0, 0, 0.5), new=FALSE)
legend("topleft", legend=c("SSM 4 parameters", "SSM 6 parameters"), 
        pch=c(15, 15), col=c(rgb(1, 0, 0, 0.5), rgb(0, 1, 0, 1)))
#################
sy <- plotR(resultmcmc=resultNest_mcmc_4p_SSM4p, 
             curves = "MCMC quantiles", show.density=FALSE)
plotR(resultmcmc=resultNest_mcmc_6p_SSM6p, col="red",
             curves = "MCMC quantiles", show.density=FALSE, 
             new=FALSE, scaleY=sy)
#################
sy <- plotR(result=resultNest_6p_SSM6p, curves="ML", 
             show.hist = TRUE, new = TRUE)
plotR(result=resultNest_4p_SSM4p, curves="ML", scaleY=sy, 
             show.hist = FALSE, new = FALSE, col="red")
#################
plotR(result=resultNest_6p_SSM6p, curves="ML", 
             show.hist = TRUE, ylimH=c(0,1), atH=c(0, 0.1, 0.2))
################
plotR(result = resultNest_4p_SSM4p, 
             resultmcmc=resultNest_mcmc_4p_SSM4p, 
             show.density = TRUE, 
             curves = "MCMC quantiles")
#################
plotR(result=resultNest_4p_SSM4p, 
             ylim=c(0, 4), curves="ML quantiles", scaleY=1E5)
#################             
plotR(result=resultNest_4p_SSM4p, show.hist = TRUE,
             ylim=c(0, 4), curves="ML quantiles", scaleY=1E5)
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM4p, 
             ylim=c(0, 4), curves = "MCMC quantiles", show.density=TRUE, scaleY=1E5)
# }

Run the code above in your browser using DataLab