I am trying to find the heritability of animals. When I use dummy data on the function, it works just fine but when I insert my data from the database, I get the following error:
Error in inverseA(pedigree = pedigree, scale = scale, nodes = nodes) : individuals appearing as dams but not in pedigree
I have removed all animals who appear in the pedigree but do not have any phenotypic data, yet the error prevails.
prior <- list(R = list(V = 1, nu = 0.002), G = list(G1 = list(V = 1, nu = 0.002), G2 = list(V = 1, nu = 0.002)))
heritmodel <- MCMCglmm(birthweight ~ 1, random = ~animal + year, family = "gaussian", prior = prior, pedigree = pedigree, data = data, nitt = 1e+05, burnin = 10000, thin = 10)
PS. the data file is very large, I am only entering the first ten animals of the dataset.
I found a solution to the problem using extend
function from geneticsped package. Extend the pedigree first and then use it within mcmcglmm