plotR: Plot the fitted growth rate dependent on temperature and its...

View source: R/plotR.R

plotRR Documentation

Plot 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 curve is case insensitive. If only parameters is given, curve must be ML.

Usage

plotR(
  result = NULL,
  resultmcmc = NULL,
  chain = 1,
  parameters = NULL,
  fixed.parameters = NULL,
  temperatures = NULL,
  curve = "ML quantiles",
  set.par = 1,
  ylim = c(0, 5),
  xlim = c(20, 35),
  xlimR = NULL,
  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,
  yaxt = "s",
  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

chain

The chain to use in resultmcmc

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

curve

What curve to show: "MCMC quantiles" or "MCMC mean-SD" based on mcmc or "ML" or "ML quantiles" or "ML mean-SE" for maximum-likelihood. Or "none"

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

xlimR

description to show the curve

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

yaxt

The yaxt parameter of 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").

Details

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

Value

A list with the value of scaleY to be used with other plotR function and the plot data in xy list element

Author(s)

Marc Girondot marc.girondot@gmail.com

Examples

## Not run: 
library(embryogrowth)
# Note that the confidence interval is not the same for mcmc and ml quantiles
plotR(result = resultNest_4p_SSM, 
             resultmcmc=resultNest_mcmc_4p_SSM, 
             curve = "MCMC quantiles", ylim=c(0, 8))
plotR(resultNest_4p_SSM, curve="ML quantiles", ylim=c(0, 6))
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM, ylim=c(0, 10), 
             curve = "MCMC quantiles", show.density=TRUE)
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM, 
             curve = "MCMC quantiles", polygon=TRUE, ylim=c(0, 10))
#################
plotR(resultmcmc=resultNest_mcmc_6p_SSM, ylim=c(0,8), 
      curve = "MCMC quantiles", polygon=TRUE, col.polygon = rgb(0, 1, 0, 1))
plotR(resultmcmc=resultNest_mcmc_4p_SSM, ylim=c(0,8), 
       curve = "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_SSM, ylim=c(0, 8), 
             curve = "MCMC quantiles", show.density=FALSE)
plotR(resultmcmc=resultNest_mcmc_6p_SSM, col="red", ylim=c(0, 8), 
             curve = "MCMC quantiles", show.density=FALSE, 
             new=FALSE, scaleY=sy$scaleY)
#################
sy <- plotR(result=resultNest_6p_SSM, curve="none", 
             scaleY=1E5, 
             ylim=c(0, 8), 
             show.hist = TRUE, new = TRUE, mar=c(4, 4, 1, 4))
#################
plotR(result=resultNest_6p_SSM, curve="ML", 
             ylim=c(0, 8), 
             show.hist = TRUE, ylimH=c(0,1), atH=c(0, 0.1, 0.2))
################
plotR(result = resultNest_4p_SSM, ylim=c(0, 8), 
             resultmcmc=resultNest_mcmc_4p_SSM, 
             show.density = TRUE, 
             curve = "MCMC quantiles")
#################
plotR(resultmcmc=resultNest_mcmc_4p_SSM, ylim=c(0, 8), 
             curve = "MCMC quantiles", show.density=TRUE, scaleY=1E5)

## End(Not run)

embryogrowth documentation built on Sept. 11, 2024, 8:16 p.m.