imputeSider: Running MCMCglmm

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/imputeSider.R

Description

Runs a MCMCglmm model to impute delta

Usage

1
2
3
imputeSider(mulTree.data, formula, random.terms, parameters = c(1200000,
  500, 2e+05), priors, chains = 2, convergence = 1.1, ESS = 1000,
  output = "teff_output", save.model = TRUE, verbose = TRUE, ...)

Arguments

mulTree.data

output from prepareSider containing data and phylogeny as a mulTree object.

formula

an object of class formula describing the fixed effects.

random.terms

Optional. An object of class formula describing the random effects. If missing, the formula from mulTree.data$random.terms is used.

parameters

a list of three numerical values to be used respectively as: (1) the number of iterations, (2) the sampling value, (3) the burnin.

priors

optional list of prior specifications (see details).

chains

The number of MCMC for each run (default = 2).

convergence

limits set for the point estimates of the potential scale reduction factor (see link[coda]{gelman.diag} - default = 1.1).

ESS

effective sample size of MCMC iterations for each model estimate (default = 1000).

output

The name of the output files (default = "teff_output")

save.model

whether to save the models out of R environment (default) or just get the estimates.

verbose

whether to be verbose or not (default = TRUE).

...

any optional arguments to be passed to mulTree.

Details

The priors argument must be of 3 possible elements: R (R-structure) G (G-structure) and B (fixed effects). B is a list containing the expected value (mu) and a (co)variance matrix (V) representing the strength of belief: the defaults are B$mu = 0 and B$V = I*1e+10, where where I is an identity matrix of appropriate dimension. The priors for the variance structures (R and G) are lists with the expected (co)variances (V) and degree of belief parameter (nu) for the inverse-Wishart, and also the mean vector (alpha.mu) and covariance matrix (alpha.V) for the redundant working parameters. The defaults are nu = 0, V = 1, alpha.mu = 0, and alpha.V = 0. When alpha.V is non-zero, parameter expanded algorithms are used.

Value

list containing Posterior Distributions of imputed discrimination factors including a posterior distribution for each individual chain in Tef.est and a combined chain in Tef.global.

Author(s)

Kevin Healy

See Also

recipeSider, prepareSider, combined_trees, isotope_data, as.mulTree, mulTree, MCMCglmm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Loading data
data(combined_trees); data(isotope_data)

## Setting up the isotope estimation for one species
taxa_estimate <- recipeSider(species = "Meles_meles", habitat = "terrestrial",
     taxonomic.class = "mammalia", tissue = "blood", diet.type = "omnivore", 
     tree = combined_trees)

## Generating the "mulTree" object for the estimation
taxa_est_mulTree <- prepareSider(data.estimate = taxa_estimate,
     data.isotope = isotope_data, tree = combined_trees, isotope = "carbon")

## Setting up the MCMCglmm parameters
MCMC_parameters <- c(1200, 200, 5)
MCMC_formula <- delta13C ~ diet.type + habitat
isotope_estimate <- imputeSider(taxa_est_mulTree, formula = MCMC_formula,
     parameters = MCMC_parameters, save.model = FALSE)

## Print out the results
summary(isotope_estimate$tdf_global)
plot(isotope_estimate$tdf_global)

healyke/TESIR documentation built on April 28, 2020, 4:11 p.m.