R/model_bh_intra_location.R
model_bh_intra_location.Rd
model_bh_intra_location
runs Hierarchical Bayesian intra-location model to get mean comparisons on each environment of the network. See details for more information.
model_bh_intra_location(data, variable, nb_iterations = 1e+05, thin = 10, return.mu = TRUE, return.beta = TRUE, return.sigma = TRUE, return.nu = TRUE, return.rho = TRUE, return.epsilon = FALSE, return.DIC = FALSE, nu.max = 10)
data | The data frame on which the model is run. It should come from |
---|---|
variable | The variable on which runs the model |
nb_iterations | Number of iterations of the MCMC |
thin | thinning interval to reduce autocorrelations between samples of the MCMC |
return.mu | Return the value for each entry in each environment (mu_ij) |
return.beta | Return the value for each block in each environment (beta_jk) |
return.sigma | Return the value for each within-environment variance (sigma_j) |
return.nu | Return the value of nu |
return.rho | Return the value of rho |
return.epsilon | Return the value of all residuals in each environment (epsilon_ijk) |
return.DIC | Return the DIC value of the model. See details for more information. |
nu.max | Set the nu.max. It is 10 by default |
The function returns a list with
"data.model1": the dataframe used to run Hierarchical Bayesian intra-location model
"presence.absence.matrix": a matrix entry x environment with the number of occurence
"vec_env_with_no_data": a vector with the environments without data for the given variable
"vec_env_with_no_controls": a vector with the environments with no controls
"data_env_with_no_controls": a dataframe with the data from environments without controls.
"vec_env_with_controls": a vector with the environments with controls
"vec_env_RF": a vector with the environments as regional farms (i.e. with at least two blocks)
"vec_env_SF": a vector with the environments as satellite farms (i.e. with one block)
"MCMC": a list with the two MCMC chains (mcmc object)
"epsilon": a vector with the median value of the epsilon_ijk
"DIC": the DIC value of the model
This model estimates entry effects (mu_ij), block effects (beta_jk), residuals (epsilon_ijk) and within-environment variance (sigma_j) on each environment. An environment is a combinaison of a location and a year.
The variance are taken in an inverse Gamma distribution of parameters nu and rho. This model takes into acount all the information on the network in order to cope with the high disequilibrium within each environment (i.e. low degree of freedom at the residual in each environment).
More information can be found in the book : https://priviere.github.io/PPBstats_book/family-1.html#model-1
For DIC value, see ?dic.samples
from the rjags
package for more information.
P. Riviere, J.C. Dawson, I. Goldringer, and O. David. Hierarchical Bayesian Modeling for Flexible Experiments in Decentralized Participatory Plant Breeding. Crop Science, 55, 2015.