[R] "Non-finite finite-difference value" error in eha's aftreg

Milan Bouchet-Valat nalimilan at club.fr
Thu Dec 1 12:08:01 CET 2011


Le mercredi 30 novembre 2011 à 18:41 +0100, Göran Broström a écrit :
> On Wed, Nov 16, 2011 at 3:06 PM, Milan Bouchet-Valat
> <nalimilan at club.fr> wrote:
>         Hi list!
>         
>         
>         I'm getting an error message when trying to fit an accelerated
>         failure
>         time parametric model using the aftreg() function from package
>         eha:
>         > Error in optim(beta, Fmin, method = "BFGS", control =
>         list(trace =
>         >   as.integer(printlevel)),  :
>         > non-finite finite-difference value [2]
>         
>         This only happens when adding four specific covariates at the
>         same time
>         in the model (see below). I understand that kind of problem
>         can come
>         from a too high correlations between my covariates, but is
>         there
>         anything I can do to avoid it? 
> 
> Yes, remove one (or more) covariate(s). The design matrix is almost
> certainly singular. 
Ah, thanks, that's what I feared. ;-)

What do you mean, though, by "almost"? Is there a way to measure that?

>         Does something need to be improved in aftreg.fit?
> 
> Yes, error messages. I'll look at it.  
Cool. It's always good to get a clear message saying that you're asking
for something impossible, so that you don't try to fix it (like I did).


Regards


>         My data set is constituted of 34,505 observations (years) of
2,717
>         individuals, which seems reasonable to me to fit a complex
model like
>         that (covariates are all factors with less than 10 levels). 
>         I can send
>         it by private mail if somebody wants to help debugging this.
>         
>         The details of the model and errors follow, but feel free to
ask for
>         more testing. I'm using R 2.13.1 (x86_64-redhat-linux-gnu),
eha 2.0-5
>         and survival 2.36-9.
>         
>         
>         Thanks for your help!
>         
>         
>         > m <-aftreg(Surv(start, end, event) ~ homo1 + sexego +
dipref1
>         +                                    + t.since.school.q,
>         +            data=ms, dist="loglogistic", id=ident)
>         Error in optim(beta, Fmin, method = "BFGS", control =
list(trace =
>         as.integer(printlevel)),  :
>          non-finite finite-difference value [2]
>         Calls: aftreg -> aftreg.fit -> aftp0 -> optim
>         
>         > traceback()
>         4: optim(beta, Fmin, method = "BFGS", control = list(trace =
>         as.integer(printlevel)),
>               hessian = TRUE)
>         3: aftp0(printlevel, ns, nn, id, strata, Y, X, offset, dis,
means)
>         2: aftreg.fit(X, Y, dist, strats, offset, init, shape, id,
control,
>               center)
>         1: aftreg(Surv(start, end, event) ~ homo1 + sexego + dipref1 +
>               t.since.school.q, data = ms, dist = "loglogistic", id =
ident)
>         
>         ______________________________________________
>         R-help at r-project.org mailing list
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>         and provide commented, minimal, self-contained, reproducible
code.
>         
> 
> 
> -- 
> Göran Broström
>



More information about the R-help mailing list