Skip to content
Prev 8591 / 20628 Next

MCMCglmm question

Hi Jackson,

You can set up the appropriate constraint by fitting the model as an  
animal model. For MZ twins you have to give them the same identifier  
in the pedigree though.  For example, if the data (my.data) are like  
this:

animal  individual twin  family
A           A       DZ     A
B           B       DZ     A
C           C       MZ     B
C           D       MZ     B
D           E       DZ     C
E           F       DZ     C

and the parents unknown:

ped<-cbind(my.data$animal, paste("mum", my.data$family, sep="."),  
paste("dad", my.data$family, sep="."))

ped<-ped[which(!duplicated(ped[,1])),]

ped<-insertPed(ped)  # this parental records into the pedigree  
(insertPed is in the package MasterBayes)

The analysis is then

Ainv<-inverseA(ped)$Ainv

m1<-MCMCglmm(y~1, random=animal+family, ginverse=list(animal=Ainv),  
data=my.data)

where the animal variance is Va  and the family variance is Vce.

If your data do have no structure (i.e just sets of outbred unrelated  
twins) then the above is quite an inefficient set up. A better option  
is to derive Ainv without the phantom parents:


n<-nlevels(my.data$animal)
nDZ<-sum(my.data$twin=="DZ")  # makes sure DZ is level 1 and MZ is level 2

Ainv<-bandSparse(n, n, 0:1,diagonal=list(c(rep(4/3,nDZ), rep(1,  
n-nDZ)), c(rep(c(-2/3,0), nDZ/2),rep(0, n-nDZ))), symmetric=TRUE)

rownames(Ainv)<-levels(my.data$animal)[order(my.data$twin[which(!duplicated(my.data$animal))])]

This should be quicker.


Cheers,

Jarrod









Quoting Jackson King <jackson.king722 at gmail.com> on Mon, 16 Jul 2012  
17:54:31 -0500: