Skip to content

genetic distance as covariance matrix through ginverse?

3 messages · Dean Castillo, Matthew Wolak

#
Dear Dean,

MCMCglmm needs the generalized inverse (your M1) formatted in a specific
way - for example as the "dgCMatrix" class defined in the Matrix package.

Substituting the lines below gets the model to work.  NOTE, I had to
substitute "0.00" wherever you had NA in the M matrix in order to invert
it.  This is probably not the best practice and maybe some simulations
to determine the sensitivity of your parameter estimates when there is
error (i.e., saying NA=0.00) in your genetic distance matrix.

INSTEAD OF:

M1<-ginv(M) #I have also been using M in the model with the same error

dimnames(M1) <- list(c("sp1","sp2","sp3","sp4"),c("sp1","sp2","sp3","sp4"))


DO

M1 <- as(ginv(M), "dgCMatrix")

M1 at Dimnames <- list(c("sp1", "sp2", "sp3", "sp4"), c("sp1", "sp2", "sp3", "sp4"))



Sincerely,
Matthew

....................................................
Dr. Matthew E. Wolak
School of Biological Sciences
Zoology Building
University of Aberdeen
Tillydrone Avenue
Aberdeen AB24 2TZ
office phone: +44 (0)1224 273255
On 04/06/14 19:33, Dean Castillo wrote:
The University of Aberdeen is a charity registered in Scotland, No SC013683.
Tha Oilthigh Obar Dheathain na charthannas cl?raichte ann an Alba, ?ir. SC013683.