Tagloss_mcmc | R Documentation |
This function fits a model of tag loss using a CMR database using Bayesian mcmc.
The parameters must be stored in a data.frame with named rows for each parameter with the following columns:
Density. The density function name, example dnorm
, dlnorm
, dunif
Prior1. The first parameter to send to the Density
function
Prior2. The second parameter to send to the Density
function
SDProp. The standard error from new proposition value of this parameter
Min. The minimum value for this parameter
Max. The maximum value for this parameter
Init. The initial value for this parameter
Tagloss_mcmc(
data = stop("A database formated using Tagloss_format() must be used"),
parameters = stop("Priors must be supplied"),
fixed.parameters = NULL,
model_before = NULL,
model_after = NULL,
mc.cores = detectCores(all.tests = FALSE, logical = TRUE),
groups = detectCores(all.tests = FALSE, logical = TRUE),
n.iter = 10000,
n.chains = 1,
n.adapt = 100,
thin = 30,
trace = FALSE,
traceML = FALSE,
adaptive = FALSE,
adaptive.lag = 500,
adaptive.fun = function(x) {
ifelse(x > 0.234, 1.3, 0.7)
},
intermediate = NULL,
filename = "intermediate.Rdata",
previous = NULL
)
data |
An object formated using Tagloss_format |
parameters |
A data.frame with priors; see description and examples |
fixed.parameters |
Set of fixed parameters |
model_before |
Transformation of parameters before to use Tagloss_model() |
model_after |
Transformation of parameters after to use Tagloss_model() |
mc.cores |
Number of cores to use for parallel computing |
groups |
Number of groups for parallel computing |
n.iter |
Number of iterations for each chain |
n.chains |
Number of chains |
n.adapt |
Number of iteration to stabilize likelihood |
thin |
Interval for thinning Markov chain |
trace |
Or FALSE or period to show progress |
traceML |
TRUE or FALSE to show ML |
adaptive |
Should an adaptive process for SDProp be used |
adaptive.lag |
Lag to analyze the SDProp value in an adaptive context |
adaptive.fun |
Function used to change the SDProp |
intermediate |
Or NULL of period to save intermediate result |
filename |
Name of file in which intermediate results are saved |
previous |
The content of the file in which intermediate results are saved |
Tagloss_mcmc Bayesian model of tag loss using a CMR database.
Return a list object with the Bayesian model describing tag loss.
Marc Girondot
Other Model of Tag-loss:
Tagloss_L()
,
Tagloss_LengthObs()
,
Tagloss_cumul()
,
Tagloss_daymax()
,
Tagloss_fit()
,
Tagloss_format()
,
Tagloss_mcmc_p()
,
Tagloss_model()
,
Tagloss_simulate()
,
logLik.Tagloss()
,
o_4p_p1p2
,
plot.Tagloss()
,
plot.TaglossData()
## Not run:
library(phenology)
# Example
data_f_21 <- Tagloss_format(outLR, model="21")
# model fitted by Rivalan et al. 2005
par <- c(a0_2=-5.43E-2, a1_2=-103.52, a4_2=5.62E-4,
delta_1=3.2E-4)
pfixed <- c(a2_2=0, a3_2=0, a2_1=0, a3_1=0)
model_before <- "par['a0_1']=par['a0_2'];par['a1_1']=par['a1_2'];par['a4_1']=par['a4_2']"
o <- Tagloss_fit(data=data_f_21, fitted.parameters=par, fixed.parameters=pfixed,
model_before=model_before)
pMCMC <- Tagloss_mcmc_p(o, accept=TRUE)
o_MCMC <- Tagloss_mcmc(data=data_f_21, parameters=pMCMC, fixed.parameters=pfixed,
model_before=model_before,
n.iter=10000, n.chains = 1, n.adapt = 100, thin=30)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.