## 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