phenology_MHmcmc_p: Generates set of parameters to be used with...

View source: R/phenology_MHmcmc_p.R

phenology_MHmcmc_pR Documentation

Generates set of parameters to be used with phenology_MHmcmc()

Description

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

Usage

phenology_MHmcmc_p(
  result = stop("An output from fit_phenology() must be provided"),
  default.density = "dunif",
  accept = FALSE
)

Arguments

result

An object obtained after a fit_phenology() fit

default.density

The default density, "dnorm" or "dunif'

accept

If TRUE, does not wait for use interaction

Details

phenology_MHmcmc_p generates set of parameters to be used with phenology_MHmcmc()

Value

A matrix with the parameters

Author(s)

Marc Girondot

See Also

Other Phenology model: AutoFitPhenology(), BE_to_LBLE(), Gratiot, LBLE_to_BE(), LBLE_to_L(), L_to_LBLE(), MarineTurtles_2002, MinBMinE_to_Min(), adapt_parameters(), add_SE(), add_phenology(), extract_result(), fit_phenology(), likelihood_phenology(), logLik.phenology(), map_Gratiot, map_phenology(), par_init(), phenology2fitRMU(), phenology_MHmcmc(), phenology(), plot.phenologymap(), plot.phenology(), plot_delta(), plot_phi(), print.phenologymap(), print.phenologyout(), print.phenology(), remove_site(), result_Gratiot1, result_Gratiot2, result_Gratiot_Flat, result_Gratiot_mcmc, result_Gratiot, summary.phenologymap(), summary.phenologyout(), summary.phenology()

Examples

## Not run: 
library(phenology)
data(Gratiot)
# Generate a formatted list named data_Gratiot 
data_Gratiot<-add_phenology(Gratiot, name="Complete", 
  	reference=as.Date("2001-01-01"), format="%d/%m/%Y")
# Generate initial points for the optimisation
parg<-par_init(data_Gratiot, fixed.parameters=NULL)
# Run the optimisation
result_Gratiot<-fit_phenology(data=data_Gratiot, 
		fitted.parameters=parg, fixed.parameters=NULL)
# Generate set of priors for Bayesian analysis
pmcmc <- phenology_MHmcmc_p(result_Gratiot, accept = TRUE)
result_Gratiot_mcmc <- phenology_MHmcmc(result = result_Gratiot, n.iter = 10000, 
parametersMCMC = pmcmc, n.chains = 1, n.adapt = 0, thin = 1, trace = FALSE)
# Get standard error of parameters
summary(result_Gratiot_mcmc)
# Make diagnostics of the mcmc results using coda package
mcmc <- as.mcmc(result_Gratiot_mcmc)
require(coda)
heidel.diag(mcmc)
raftery.diag(mcmc)
autocorr.diag(mcmc)
acf(mcmc[[1]][,"LengthB"], lag.max=200, bty="n", las=1)
acf(mcmc[[1]][,"Max_Gratiot"], lag.max=50, bty="n", las=1)
batchSE(mcmc, batchSize=100)
# The batch standard error procedure is usually thought to 
# be not as accurate as the time series methods used in summary
summary(mcmc)$statistics[,"Time-series SE"]
plot(result_Gratiot_mcmc, parameters=3, las=1, xlim=c(-10, 300))

## End(Not run)

phenology documentation built on Oct. 16, 2023, 9:06 a.m.