statnet / latentnet

Latent Position and Cluster Models for Statistical Networks
http://www.statnet.org
Other
19 stars 6 forks source link

exp(eta[obs]) exceeds .Machine$double.xmax #14

Open brooksambrose opened 5 months ago

brooksambrose commented 5 months ago

I am experiencing an error in a call to ergmm using a nodecov term.

Error in optim(par = start.vals, fn = optim.fs[["f"]], gr = optim.fs[["grad.f"]], : L-BFGS-B needs finite values of 'fn'

Where I tracked it down to latentnet:::ergmm.lpY and specifically this line https://github.com/statnet/latentnet/blob/09ba17538456ddf0a0a305f29a2ee9dc33d958a4/R/ergmm.probs.R#L89

That list returns a function that is a formula Y * eta - exp(eta) and at least one value in my eta exceeds .Machine$double.xmax when exponentiated. I'm not familiar enough with the method to know what eta is exactly, but on my machine the largest integer that can be exponentiated is exp(709) before it returns Inf. In my data the largest value for eta was 6842.

The call would complete if I rescaled the original data to be in a range about 100 times smaller than the original.

krivit commented 5 months ago

Thanks for the report! Can you please provide a reproducible example?