tsd_MHmcmc_p: Generates set of parameters to be used with tsd_MHmcmc()

View source: R/tsd_MHmcmc_p.R

tsd_MHmcmc_pR Documentation

Generates set of parameters to be used with tsd_MHmcmc()

Description

Interactive script used to generate set of parameters to be used with tsd_MHmcmc().

Usage

tsd_MHmcmc_p(
  result = stop("An output from tsd() must be provided"),
  default = "dnorm",
  accept = FALSE
)

Arguments

result

An object obtained after a tsd fit

default

The default distribution for priors; can be dnorm only at that time

accept

If TRUE, the script does not wait user information

Details

tsd_MHmcmc_p generates set of parameters to be used with tsd_MHmcmc()

Value

A matrix with the parameters

Author(s)

Marc Girondot

See Also

Other Functions for temperature-dependent sex determination: DatabaseTSD, DatabaseTSD.version(), P_TRT(), ROSIE, ROSIE.version(), TSP.list, plot.tsd(), predict.tsd(), stages, tsd(), tsd_MHmcmc()

Examples

## Not run: 
library(embryogrowth)
eo <- subset(DatabaseTSD, Species=="Emys orbicularis", c("Males", "Females", 
                                       "Incubation.temperature"))
eo_logistic <- with(eo, tsd(males=Males, females=Females, 
                                 temperatures=Incubation.temperature))
pMCMC <- tsd_MHmcmc_p(eo_logistic, accept=TRUE)
# Take care, it can be very long
result_mcmc_tsd <- tsd_MHmcmc(result=eo_logistic, 
		parametersMCMC=pMCMC, n.iter=10000, n.chains = 1,  
		n.adapt = 0, thin=1, trace=FALSE, adaptive=TRUE)
# summary() permits to get rapidly the standard errors for parameters
summary(result_mcmc_tsd)
plot(result_mcmc_tsd, parameters="S", scale.prior=TRUE, xlim=c(-3, 3), las=1)
plot(result_mcmc_tsd, parameters="P", scale.prior=TRUE, xlim=c(25, 35), las=1)

eo_flexit <- with(eo, tsd(males=Males, females=Females,
                                 parameters.initial=c(eo_logistic$par["P"], 
                                 1/(4*eo_logistic$par["S"]), 
                                 K1=1, K2=1), 
                                 temperatures=Incubation.temperature,
                                 equation="flexit", replicate.CI=NULL))
pMCMC <- tsd_MHmcmc_p(eo_flexit, accept=TRUE)
result_mcmc_tsd <- tsd_MHmcmc(result=eo_flexit, 
		parametersMCMC=pMCMC, n.iter=10000, n.chains = 1,  
		n.adapt = 0, thin=1, trace=FALSE, adaptive=TRUE)
# summary() permits to get rapidly the standard errors for parameters
summary(result_mcmc_tsd)
plot(result_mcmc_tsd, parameters="S", scale.prior=TRUE, xlim=c(-3, 3), las=1)
plot(result_mcmc_tsd, parameters="P", scale.prior=TRUE, xlim=c(25, 35), las=1)
plot(result_mcmc_tsd, parameters="K1", scale.prior=TRUE, xlim=c(-10, 10), las=1)
plot(result_mcmc_tsd, parameters="K2", scale.prior=TRUE, xlim=c(-10, 10), las=1)

plot(eo_flexit, resultmcmc = result_mcmc_tsd)


## End(Not run)

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