melff / mclogit

mclogit: Multinomial Logit Models, with or without Random Effects or Overdispersion
http://melff.github.io/mclogit/
22 stars 4 forks source link

non-convergence and errors with random effects models using mblogit #7

Closed rebeccaltaylor closed 4 years ago

rebeccaltaylor commented 4 years ago

Hi. I was using the CRAN version of package mclogit and none of my random effects models using the mblogit command converged, whether or not I used the control argument. I read an online post from another user who encountered this and said it was a package error that had been fixed in the version currently on Github, so I installed that version. The random effects model still fails to converge if I do not use the control argument and the summary warns, "In sqrt(diag(vcov.phi)) : NaNs produced." I understand my data may simply be unable to support a random effects model. However, I tried, but failed, to implement the control argument in the Github version of the package.

Here is the command and error message when I use control = mmclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, control=mmclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE, trace.inner=FALSE, avoid.increase = FALSE,break.on.increase = FALSE, break.on.infinite = FALSE, break.on.negative = FALSE))

Error in mmclogit.control(epsilon = 1e-12, maxit = 100, trace = TRUE, :

could not find function "mmclogit.control"

Here is the command and error message when I use control = mclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, control=mclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE))

Error in mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : object 'step.truncated' not found

In addition: Warning messages:

1: In mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : Numeric problems in inner iteration, bailing out

2: Algorithm did not converge

Anything you could do to help me would be wonderful. Thank you.

melff commented 4 years ago

Hi Rebecca Taylor, Am Donnerstag, den 28.05.2020, 13:03 -0700 schrieb rebeccaltaylor:

Hi. I was using the CRAN version of package mclogit and none of my random effects models using the mblogit command converged, whether or not I used the control argument. I read an online post from another user who encountered this and said it was a package error that had been fixed in the version currently on Github, so I installed that version. The random effects model still fails to converge if I do not use the control argument and the summary warns, "In sqrt(diag(vcov.phi)) : NaNs produced." I understand my data may simply be unable to support a random effects model. However, I tried, but failed, to implement the control argument in the Github version of the package.

Here is the command and error message when I use control = mmclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO,

control=mmclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE,

trace.inner=FALSE, avoid.increase = FALSE,break.on.increase = FALSE,

break.on.infinite = FALSE, break.on.negative = FALSE))

Error in mmclogit.control(epsilon = 1e-12, maxit = 100, trace = TRUE, : could not find function "mmclogit.control"

Thanks of for the bug report. Indeed, I forgot to include mmclogit.control among the namespace exports. The reason I did not notice this is that there is no need to call mmclogit.control explicitly, because all extraneous arguments to mclogit or mblogit are passed on to mclogit.control or mmclogit.control, respectively. The following code should work without this error message appearing: MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, epsilon = 1e- 12, maxit = 100)) The other arguments you pass to mmclogit.control are defaults, so there is no need to specify them either.However, I would advise against using such a small epsilon, because it might make convergence infeasible as it goes beyond the limits of a computer's precision. Usually you would use an epsilon like 1e-6 or 1e-7. So better use MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, maxi t = 100))

Here is the command and error message when I use control = mclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO,

control=mclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE))

Error in mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : object 'step.truncated' not found Another bug, easy to fix (and soon). In addition: Warning messages: 1: In mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : Numeric problems in inner iteration, bailing out 2: Algorithm did not converge

Anything you could do to help me would be wonderful. Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/melff/mclogit/issues/7", "url": "https://github.com/melff/mclogit/issues/7", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

melff commented 4 years ago

Just created release 0.8.2.1, where this is hopefully resolved.

rebeccaltaylor commented 4 years ago

Thank you!!!


From: Martin Elff notifications@github.com Sent: Thursday, May 28, 2020 1:47 PM To: melff/mclogit mclogit@noreply.github.com Cc: Taylor, Rebecca L rebeccataylor@usgs.gov; Author author@noreply.github.com Subject: [EXTERNAL] Re: [melff/mclogit] non-convergence and errors with random effects models using mblogit (#7)

Just created release 0.8.2.1https://github.com/melff/mclogit/releases/tag/0.8.2.1, where this is hopefully resolved.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/melff/mclogit/issues/7#issuecomment-635626017, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACARZ6UPJ4EBAQUEZKJ2KJLRT3LXXANCNFSM4NNMJVTQ.

rebeccaltaylor commented 4 years ago

Thank you again, Martin.

I ran the following commands, and the call printed 100 iterations, so I assume everything is working.

devtools::install_github("melff/mclogit",subdir="pkg") MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, maxit = 100)

The reason I previously had the defaults listed for the other arguments was as a place holder until I could figure out how I might change them in order to help achieve convergence. Can you point me to any material that explains the other arguments and how to use them if convergence is not being achieved?

Thank you!

Rebecca


From: Martin Elff notifications@github.com Sent: Thursday, May 28, 2020 1:24 PM To: melff/mclogit mclogit@noreply.github.com Cc: Taylor, Rebecca L rebeccataylor@usgs.gov; Author author@noreply.github.com Subject: [EXTERNAL] Re: [melff/mclogit] non-convergence and errors with random effects models using mblogit (#7)

Hi Rebecca Taylor, Am Donnerstag, den 28.05.2020, 13:03 -0700 schrieb rebeccaltaylor:

Hi. I was using the CRAN version of package mclogit and none of my random effects models using the mblogit command converged, whether or not I used the control argument. I read an online post from another user who encountered this and said it was a package error that had been fixed in the version currently on Github, so I installed that version. The random effects model still fails to converge if I do not use the control argument and the summary warns, "In sqrt(diag(vcov.phi)) : NaNs produced." I understand my data may simply be unable to support a random effects model. However, I tried, but failed, to implement the control argument in the Github version of the package.

Here is the command and error message when I use control = mmclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO,

control=mmclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE,

trace.inner=FALSE, avoid.increase = FALSE,break.on.increase = FALSE,

break.on.infinite = FALSE, break.on.negative = FALSE))

Error in mmclogit.control(epsilon = 1e-12, maxit = 100, trace = TRUE, : could not find function "mmclogit.control"

Thanks of for the bug report. Indeed, I forgot to include mmclogit.control among the namespace exports. The reason I did not notice this is that there is no need to call mmclogit.control explicitly, because all extraneous arguments to mclogit or mblogit are passed on to mclogit.control or mmclogit.control, respectively. The following code should work without this error message appearing: MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, epsilon = 1e- 12, maxit = 100)) The other arguments you pass to mmclogit.control are defaults, so there is no need to specify them either.However, I would advise against using such a small epsilon, because it might make convergence infeasible as it goes beyond the limits of a computer's precision. Usually you would use an epsilon like 1e-6 or 1e-7. So better use MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO, maxi t = 100))

Here is the command and error message when I use control = mclogit.control

MBLrW <- mblogit(aBehavior ~ Trt15_25_5min, random=~1|Deployment, data=HO,

control=mclogit.control(epsilon = 1e-12, maxit = 100, trace=TRUE))

Error in mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : object 'step.truncated' not found Another bug, easy to fix (and soon). In addition: Warning messages: 1: In mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, : Numeric problems in inner iteration, bailing out 2: Algorithm did not converge

Anything you could do to help me would be wonderful. Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/melff/mclogit/issues/7", "url": "https://github.com/melff/mclogit/issues/7", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/melff/mclogit/issues/7#issuecomment-635616143, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACARZ6WPV7A2M3OZJE2M4F3RT3JBNANCNFSM4NNMJVTQ.