nspope / radish

Fast gradient-based optimization of resistance surfaces
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

Maxit reached in backtrackingError in pmax(x, lower) : invalid input type #5

Open nataliemyers12 opened 1 year ago

nataliemyers12 commented 1 year ago

Hi Dr. Pope,

I am running radish as mlpe and when I run my model, halfway through it gives this error: Warning: Maxit reached in backtrackingError in pmax(x, lower) : invalid input type

and stops. Could someone decode what this error is saying and why it may be doing this?

Here is my code as is with the model, can provide further info.

surface <- conductance_surface(covariates = scaled_raster_stack, coords = sample.localespl, directions = 8)

fit_mlpe <- radish(distgenPL ~ Airports + Bridges + BusRoutes + Buildings + CRoutes + GolfCourses + Hotels + MajorRoads, data=surface, conductance_model = loglinear_conductance, measurement_model= mlpe)

Cheers, Natalie Myers

nspope commented 1 year ago

Hi Natalie, I expect what's going on is that there's numeric issues with optimization (overflow / underflow), but there's a bug in the error handling so that it runs until the maximum number of iterations rather than aborting (which is why you get that obtuse error message).

As to why there'd be numeric issues in the first place, it may be that your model is overparameterized. Does it work if you fit univariate models with each of the covariates?