tmcd82070 / Rdistance

An R package for simple, regression-like, distance-based analyses
8 stars 3 forks source link

Abnormal termination in some optimization cases #39

Closed jcarlis3 closed 7 years ago

jcarlis3 commented 7 years ago

@tmcd82070 Using example sparrow data and the example below, there are issues in the optimization for one covariate (bare), but not another (shrub, which happens to have strong inverse correlation to bare).

Produced by code below: Warning message: In F.dfunc.estim(formula = dist ~ bare, data = sparrow.merge, likelihood = "halfnorm", : ERROR: ABNORMAL_TERMINATION_IN_LNSRCH


Prep reproducible example with package data. data(sparrow.detections) data(sparrow.sites) sparrow.merge <- merge(sparrow.detections, sparrow.sites, by="siteID")

No problems when shrub is the covariate good <- F.dfunc.estim(formula=dist~shrub, data=sparrow.merge, likelihood="halfnorm", w.hi=150)

Convergence failure when bare is the covariate bad <- F.dfunc.estim(formula=dist~bare, data=sparrow.merge, likelihood="halfnorm", w.hi=150)


Some leads:

jcarlis3 commented 7 years ago

Now, a different error is returned: image

The reproducible code above was before renaming some functions -- see below for current.

data(sparrowDetectionData) data(sparrowSiteData)

good <- dfuncEstim(formula=dist~shrub, detectionData=sparrowDetectionData, siteData=sparrowSiteData, likelihood="halfnorm", w.hi=100)

bad <- dfuncEstim(formula=dist~bare, detectionData=sparrowDetectionData, siteData=sparrowSiteData, likelihood="halfnorm", w.hi=100)

jcarlis3 commented 7 years ago

For the time being, we recommend standardizing problematic covariates, which appears to help. We're working to stabilize optimization in another issue.