# [adegenet-forum] monmonier: Null diagonal problem

Jombart, Thibaut t.jombart at imperial.ac.uk
Mon Jul 4 15:19:25 CEST 2011

```Hello,

I don't know what is wrong, my lucky guess would be a problem with the graph or the locations.neig.util.GtoL is not directly called by monmonier, so there is something messing up in one of the subroutines.

I'll need data allowing to reproduce the error to figure out what is wrong. In the meantime, I would recommend checking that you have no duplicates in locations, no infinite distances in your dist object, that Gabriel's graph is well connected, etc.

By the way, if you use Gabriel's graph, you should use type=2 in chooseCN. I don't think neighbouring by distance works very well with Monmonier, and that may actually be the problem here.

Best

Thibaut
--
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk

________________________________________
Sent: 02 July 2011 17:09
Subject: [adegenet-forum] monmonier: Null diagonal problem

Hi,

I am trying fit a monmonier function to my dataset using [Aedegenet 1.2.8]:

DElk <- dist(Elk\$tab)
gab <- chooseCN(Elk\$other\$xy, ask = FALSE, type = 5)
monElk <- monmonier(Elk\$other\$xy, DElk, gab)

When executing the monmonier command I do get the following error

Error in neig.util.GtoL(output) : Null diagonal expected

The matrix genarated by DElk is a lower triangular one but as the error points
out there it does not have a null diagonal (zero diagonal). IS this the
problem?
Any thoughts on how to fix it?
_______________________________________________