I am conducting a complex analysis in R involving the phylogeographic reconstruction of a disease dynamic over time and space. As part of the process, I use the spreadGraphic2
function from the seraphim
package to reconstruct spatial polygons for visualization. However, I’ve encountered an issue with this function.
The spreadGraphic2
function internally uses the Hpi
function from the ks
package to estimate a bandwidth matrix. Specifically, the relevant line of code in the spreadGraphic2
function is as follows:
H = Hpi(cbind(selectedNodes[,"lon"], selectedNodes[,"lat"]))
The problem arises when I run this code. Although the input data matrix (attached here: https://file.io/z3X7aImnqvzQ) contains only positive values, the resulting bandwidth matrix H
is as follows:
H
[,1] [,2]
[1,] 6.269884e+37 -2.335728e+38
[2,] -2.335728e+38 8.731985e+38
These extreme and seemingly nonsensical values (large positive and negative numbers) cause subsequent steps of my analysis to fail.
Additional Information:
- The input data matrix consists of longitude and latitude values that are well within expected ranges.
- No warnings or errors are thrown during the execution of
Hpi
.
Question:
Does anyone know why Hpi
might produce such extreme values for the bandwidth matrix?
Any insights, suggestions, or troubleshooting tips would be greatly appreciated!
Thank you in advance!
Ayaki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.