adcomp icon indicating copy to clipboard operation
adcomp copied to clipboard

error in OneStepGeneric method of TMB::oneStepPredict

Open timjmiller opened this issue 2 years ago • 0 comments

Description:

This is not likely to happen, but if a value of an unused parameter is NaN, then factor(NaN*NA) here does not produce the right input for the map argument of MakeADFun.

I copied and edited validation.R and tmbprofile.R to deduce where the the map list element for the unused parameter was changed.

Reproducible Steps:

  1. Make input initial parameter list with a value = log(-1) for an unused parameter.
  2. Fit model
  3. run TMB::oneStepPredict(method="oneStepGeneric").

Current Output:

Error in if (xnext + that < parm.range[1]) { : missing value where TRUE/FALSE needed

(repeated for each observation)

Expected Output:

Normal execution of TMB:oneStepPredict: return data.frame with calculated residuals.

Possible Solution:

change referenced line to map <- lapply(args$parameters[fix], function(x)factor(rep(NA,length(x))))

TMB Version:

1.9.1, commit = e499559

R Version:

R version 4.1.3 (2022-03-10)

Operating System:

Windows 10

timjmiller avatar Aug 17 '22 16:08 timjmiller