famuvie / breedR

Statistical methods for forest genetic resources analysts
http://famuvie.github.io/breedR/
GNU General Public License v3.0
31 stars 24 forks source link

competition model w/o pec requires initial variance #47

Closed famuvie closed 8 years ago

famuvie commented 9 years ago

Here is a MRE:

ped = data.frame(self = 3:11, dad = 1, mum = 2)
coord = expand.grid(x = 1:3, y = 1:3)
vi  <- diag(1, 2)
dat = data.frame(z = rnorm(9), coord, ped)

## This one works ok and returns a list with 
# $pec
# $pec$present
# [1] FALSE
# 
# $pec$var.ini
# [1] 1
breedR::check_genetic(model = 'competition',
                      pedigree = ped,
                      coordinates = coord,
                      id = 'self',
                      data = dat)

## When we specify initial variances it asks for the initial
## value of the pec variance, even if pec = FALSE by default
breedR::check_genetic(model = 'competition',
                      pedigree = ped,
                      coordinates = coord,
                      id = 'self',
                      var.ini = vi,
                      data = dat)
# Error in breedR::check_genetic(model = "competition", pedigree = ped,  : 
#   var.ini must be specified for pec as well, in the competition specification.
# e.g. pec = list(present = TRUE, var.ini = 1)

The expected behaviour would be to return pec = list(present = FALSE) in both cases.

Thanks to S. Lecourieux for reporting.