Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NA/NaN/Inf in foreign function call (arg 5)

I don't know if I need to get rid of some data, or what is going on here. Models 1 and 2 work perfectly fine. Model 3 won't run.

model1 <- clogit(Used ~ Slope + strata(OBJECTID), data=old)

model2 <- clogit(Used ~ Aspect + strata(OBJECTID), data=old)

model3 <- clogit(Used ~ Slope + Aspect + strata(OBJECTID), data=old)

Model 3 gives the following error:

> Error in fitter(X, Y, strats, offset, init, control, weights =
> weights,  :    NA/NaN/Inf in foreign function call (arg 5)

It additionaly gives warnings of:

> In fitter(X, Y, strats, offset, init, control, weights = weights,  :  
> Ran out of iterations and did not converge

I am less concerned about the warnings as other models also give this, but actually have outputs.

I can post the data if I need to, or if you have an idea that can point me in the right direction, that would be awesome.

-dan

****** Additional Info *******

RPackages: survival

> o.s.model <- clogit(Used ~ Slope + strata(OBJECTID), data=old)
> o.a.model <- clogit(Used ~ Aspect + strata(OBJECTID), data=old)
> o.sa.model <- clogit(Used ~ Slope + Aspect + strata(OBJECTID), data=old)
Error in fitter(X, Y, strats, offset, init, control, weights = weights,  : 
  NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message:
In fitter(X, Y, strats, offset, init, control, weights = weights,  :
  Ran out of iterations and did not converge
> 

Both Slope and Aspect are numberical.

dataset at: https://drive.google.com/file/d/1AXKMJnDs_JYZmy_gB3IaMXHL34_ejxz3/view?usp=sharing

like image 210
Dan Graham Avatar asked Oct 16 '22 22:10

Dan Graham


1 Answers

This could be due to ties in the dataset. Try fitting the model with either the efron or breslow approximation (method='efron'). Solved the issue for me...

see also here: https://stats.stackexchange.com/questions/109222/conditional-logistic-regression-model-does-not-converge-but-logistic-regression

like image 110
jayathecat Avatar answered Oct 20 '22 23:10

jayathecat