Resolves a Prior Specification in MCMCglmm
resolve_prior.RdGenerates the (co)variance matrix prior parameters in MCMCglmm given a prior specification that might utilise a prior_generator.
Details
Primarily used internally to generate the (co)variance matrix prior parameters used in MCMCglmm: V, nu, alpha.mu and alpha.V. If these are already passed as a list, the list is simply returned. If a prior_generator is used then the prior parameters are generated given dimension of the (co)variance matrix, k and its stucture type vtype.
Author
Jarrod Hadfield j.hadfield@ed.ac.uk
Examples
prior_element1<-list(V=diag(2)/2, nu=2, alpha.mu=c(0,0), alpha.V=diag(2)*1000)
resolve_prior(prior_element1)
#> $V
#> [,1] [,2]
#> [1,] 0.5 0.0
#> [2,] 0.0 0.5
#>
#> $nu
#> [1] 2
#>
#> $alpha.mu
#> [1] 0 0
#>
#> $alpha.V
#> [,1] [,2]
#> [1,] 1000 0
#> [2,] 0 1000
#>
prior_element2<-F(df2=1, scale=1000)
resolve_prior(prior_element2, k=2, vtype="us")
#> $V
#> [,1] [,2]
#> [1,] 0.5 0.0
#> [2,] 0.0 0.5
#>
#> $nu
#> [1] 2
#>
#> $alpha.mu
#> [1] 0 0
#>
#> $alpha.V
#> [,1] [,2]
#> [1,] 1000 0
#> [2,] 0 1000
#>
resolve_prior(prior_element2, k=2, vtype="idh")
#> $V
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
#> $nu
#> [1] 1
#>
#> $alpha.mu
#> [1] 0 0
#>
#> $alpha.V
#> [,1] [,2]
#> [1,] 1000 0
#> [2,] 0 1000
#>