stoufferlab / general-functional-responses

Code (and most data) for two manuscripts about consumer functional responses
MIT License
2 stars 0 forks source link

AAmethod() non-positive weights #63

Closed marknovak closed 5 years ago

marknovak commented 6 years ago

Figure out why they sometimes happen.

Error in lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok,  : 
  missing or negative weights not allowed
In addition: Warning messages:
1: In bbmle::mle2(holling.like.1pred.1prey.NLL, start = list(attack = coef(ffr.sn1)[1],  :
  couldn't invert Hessian
2: In sqrt(diag(object@vcov)) : NaNs produced
marknovak commented 6 years ago

This happens when mle2 can't estimate SE's for each's predator density's attack rate, which are needed to estimate regression weights. Sometimes the issue is simply starting values (from sbplx), but other times nothing helps. In these cases I now either run unweighted regression (when none of the errors can be estimated) or replace the estimated variance of the problem estimate with the value of the largest variance estimate. Thoughts?

marknovak commented 5 years ago

Updated to use twice the largest variance.