Learn R Programming

embryogrowth (version 6.4)

plotR: Show the fitted growth rate dependent on temperature

Description

To show the growth rate, the syntaxe is: plotR(result=res) If SE is a matrix with two raws, the row values will use to draw the CI.

Usage

plotR(result = NULL, parameters = NULL, fixed.parameters = NULL, col = "black", legend = NA, show.legend = TRUE, SE = NULL, x.SE = qnorm(0.975), set.par = 1, size = NULL, xlim = c(20, 35), scaleY = "auto", lty = 1, ltyCI = 3, lwd = 1, lwdCI = 1, xlimR = xlim, xlimSE = xlim, replicate.CI = 100, show.box = TRUE, local.box = "topleft", pch.anchors = 19, cex.anchors = 1, col.anchors = "black", y.anchors = 0, show.anchors = TRUE, ...)

Arguments

result
A result object or a list of result objects
parameters
Indicate some parameters if the result object is not supplied
fixed.parameters
Indicate some parameters if the result object is not supplied
col
The color to use for a list of colors if several results
legend
Text to show in bottom right legend or a list of text if several results
show.legend
Should the legend about several series be shown?
SE
The standard error for the parameters or a list of SE if several results. Use NA to force not use SE
x.SE
The factor used to show the confidence interval envelope
set.par
1 or 2 or a list of 1 or 2 to designate with set of parameters to show
size
If indicated, will show the growth rate for this size. Useful only for model with two sets of parameters, High and Low and a transition
xlim
Range of values for x-axis
scaleY
Scaling factor for y axis or "auto"
lty
The type of line to use if several results as a list
ltyCI
The type of line to use for confidence interval as a list
lwd
The type of line to use if several results as a list
lwdCI
The type of line to use for confidence interval as a list
xlimR
Range of values to be displayed for R curve or vector of values; can be a list if a list of results is used
xlimSE
Range of values to be displayed for SE curves; can be a list if a list of results is used
replicate.CI
Number of replicates to estimate CI
show.box
If TRUE show a box with "mean" and "confidence interval"
local.box
Position of the box with "mean" and "confidence interval", default="topleft"
pch.anchors
Symbol used to show anchors
cex.anchors
Size of symbol used to show anchors
col.anchors
Color of symbols used to show anchors
y.anchors
Position of anchors in y axis
show.anchors
Should the anchors been shown
...
Parameters for plot() such as main= or ylim=

Value

A list with data.frame with the confidence interval and the average.

Details

plotR shows the fitted growth rate dependent on temperature

Examples

Run this code
## Not run: 
# library(embryogrowth)
# data(nest)
# formated <- FormatNests(nest)
# # The initial parameters value can be:
# # "T12H", "DHA",  "DHH", "Rho25"
# # Or
# # "T12L", "DT", "DHA",  "DHH", "DHL", "Rho25"
# x <- structure(c(118.768297442004, 475.750095909406, 306.243694918151, 
# 116.055824800264), .Names = c("DHA", "DHH", "T12H", "Rho25"))
# # pfixed <- c(K=82.33) or rK=82.33/39.33
# pfixed <- c(rK=2.093313)
# resultNest_4p <- searchR(parameters=x, fixed.parameters=pfixed, 
# 	temperatures=formated, derivate=dydt.Gompertz, M0=1.7, 
# 	test=c(Mean=39.33, SD=1.92))
# data(resultNest_4p)
# plotR(resultNest_4p, ylim=c(0,3))
# pMCMC <- TRN_MHmcmc_p(resultNest_4p, accept=TRUE)
# # Take care, it can be very long, sometimes several days
# result_mcmc_4p_80 <- GRTRN_MHmcmc(result=resultNest_4p,  
# 	parametersMCMC=pMCMC, n.iter=10000, n.chains = 1, n.adapt = 0,  
# 	thin=1, trace=TRUE)
# data(result_mcmc_4p)
# plotR(result=resultNest_4p, SE=result_mcmc_4p$SD,  
#  ylim=c(0, 3), x.SE=1)
# x <- structure(c(115.758929130522, 428.649022170996, 503.687251738993, 
# 12.2621455821612, 306.308841227278, 116.35048615105), .Names = c("DHA", 
# "DHH", "DHL", "DT", "T12L", "Rho25"))
# plotR(parameters=x, xlim=c(20, 35))
# pfixed <- c(rK=2.093313)
# resultNest_6p <- searchR(parameters=x, fixed.parameters=pfixed, 
# 	temperatures=formated, derivate=dydt.Gompertz, M0=1.7, 
# 	test=c(Mean=39.33, SD=1.92))
# data(resultNest_6p)
# plotR(list(resultNest_4p, resultNest_6p), ylim=c(0, 3), 
# col=c("black", "red"), legend=c("4 parameters", "6 parameters"))
# ##########################################
# # new formulation of parameters using anchors
# data(resultNest_newp)
# # without envelope
# plotR(resultNest_newp, ylim=c(0, 5))
# # with envelope based in 1.96*SE and central curve based on mean
# plotR(result=resultNest_newp, ylim=c(0, 5), 
#  SE=result_mcmc_newp$SD)
# # with envelope based on quantiles and central curve based on mean
# plotR(result=resultNest_newp, ylim=c(0, 5), 
#  SE=apply(result_mcmc_newp[["resultMCMC"]][[1]], 
#    MARGIN=2, FUN=quantile, probs=c(0.025, 0.975)))
# # with envelope based on quantiles and central curve based on median
# plotR(result=resultNest_newp, ylim=c(0, 5), 
#  SE=apply(result_mcmc_newp[["resultMCMC"]][[1]], 
#    MARGIN=2, FUN=quantile, probs=c(0.025, 0.975)),
#  parameters=apply(result_mcmc_newp[["resultMCMC"]][[1]], 
#    MARGIN=2, FUN=quantile, probs=c(0.5)))
# # Example to get the results
# (plotR(result=resultNest_newp, ylim=c(0, 5), 
#        SE=apply(result_mcmc_newp[["resultMCMC"]][[1]], 
#                 MARGIN=2, FUN=quantile, probs=c(0.025, 0.975)),
#        parameters=apply(result_mcmc_newp[["resultMCMC"]][[1]],
#                        MARGIN=2, FUN=quantile, probs=c(0.5)), 
#        xlimR=as.numeric(names(resultNest_newp$par))-273.15)[[1]])
#  ##########################################
#  # New Weilbull model
#  ##########################################
#  x <- c(k=3, lambda=3, theta=290)
#  resultNest_4p_Weibull <- searchR(parameters=x, fixed.parameters=pfixed,
#    temperatures=formated, derivate=dydt.Gompertz, M0=1.7,
#    test=c(Mean=39.33, SD=1.92))
#  plotR(resultNest_4p_Weibull)
# ## End(Not run)

Run the code above in your browser using DataLab