Giter Site home page Giter Site logo

Comments (14)

melff avatar melff commented on September 21, 2024 1

Yep, that's a bug, fixed in release 0.7.2. See https://github.com/melff/mclogit/releases/tag/0.7.2

from mclogit.

melff avatar melff commented on September 21, 2024 1

from mclogit.

melff avatar melff commented on September 21, 2024 1

Hi,

4 days ago I put up the 0.8 release. The algorithm should be more stable now. Let me know if you still encounter convergence problems. If all else fails, 0.8.2 supports estimation of an overdispersion parameter, which allows for a (rather crude) alternative of dealing with clustered data.

from mclogit.

melff avatar melff commented on September 21, 2024 1

from mclogit.

melff avatar melff commented on September 21, 2024 1

This should be fixed by release 0.8.6.1

from mclogit.

melff avatar melff commented on September 21, 2024 1

I think I identified the bug, which is now fixed in the current release: 0.8.6.3.

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Hello Prof. Elff,

Just a follow up. I estimated again the model and now this problem doesn't occur anymore, but I receive the following messages while estimating a complete model. This is probably related to my data set and you can ignore, but I thought that maybe would be important to send a feedback.

>mblogit(formula = dropout ~ sex + age_group + secondary_school + fam_income + color_race +
+ receive_grant + extracurricular,
+random = ~ 1 | institution/program_id,
+data = stud.db)

Iteration 1 - Deviance = 157998.1
Iteration 2 - Deviance = 147780.8
Iteration 3 - Deviance = 146485.8
Iteration 4 - Deviance = 146400.7
Iteration 5 - Deviance = 146399.1
Iteration 6 - Deviance = 146399.1
Iteration 7 - Deviance = 146399.1
converged
Iteration 1 - deviance = 150283.3 - criterion = 0.1145848
    Stepsize halved - new deviance =  Inf 
  Stepsize halved - new deviance =  Inf 
  Stepsize halved - new deviance =  Inf 
  Stepsize halved - new deviance =  Inf 
  Stepsize halved - new deviance =  193007 
  Stepsize halved - new deviance =  183789.1 
  Stepsize halved - new deviance =  179251.9 
  Stepsize halved - new deviance =  177098.2 
  Stepsize halved - new deviance =  176032 
  Stepsize halved - new deviance =  175514.9 
  Stepsize halved - new deviance =  175640.2 
  Stepsize halved - new deviance =  175837 
  Stepsize halved - new deviance =  175936.8 
  Stepsize halved - new deviance =  175986.8 
  Stepsize halved - new deviance =  176011.7 
  Stepsize halved - new deviance =  176024.2 
  Stepsize halved - new deviance =  176030.5 
  Stepsize halved - new deviance =  176033.6 
  Stepsize halved - new deviance =  176035.2 
  Stepsize halved - new deviance =  176035.9 
Iteration 2 - deviance = 176035.9 - criterion = 2.816581e-09
converged

Warning messages:
1: step size truncated due to possible divergence 
2: Algorithm stopped due to false convergence 

Again, thanks a lot for all the help.

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Hello Martin,

Thanks for let me know about the release.

Tried again and now it converged. Just to report some results, when I run the model with limited variables, it produces NaN in the grouping level 2.

>mblogit(formula = dropout ~ sex + age_group,
+random = ~ 1 | institution/program_id,
+data = stud.db)

Iteration 1 - deviance = 166003 - criterion = 0.8051472
Iteration 2 - deviance = 145565 - criterion = 0.05297786
Iteration 3 - deviance = 139727.4 - criterion = 0.02102629
Iteration 4 - deviance = 137573.3 - criterion = 0.008212973
Iteration 5 - deviance = 136641.2 - criterion = 0.002999969
Iteration 6 - deviance = 136343.1 - criterion = 0.000300909
Iteration 7 - deviance = 136278.7 - criterion = 1.705491e-05
Iteration 8 - deviance = 136251.1 - criterion = 5.813921e-07
Iteration 9 - deviance = 136246 - criterion = 1.285311e-08
Iteration 10 - deviance = 136245.3 - criterion = 3.098197e-10
converged

(Co-)Variances:
Grouping level: 1 
                                 Estimate      Std.Err.     
Dropout~1 1.494          4.758       
Stopout~1      2.143 3.948    8.221 14.188
Grouping level: 2 
                                 Estimate      Std.Err.
Dropout~1 2.206         NaN     
Stopout~1      1.447 3.139   NaN NaN 

Null Deviance:     482500 
Residual Deviance: 136200 
Number of Fisher Scoring iterations:  10 
Number of observations:  219597 

Warning message:
In sqrt(diag(vcov.phi)) : NaNs produced

And with the complete model, it doesn't produce NaNs.

>mblogit(formula = dropout ~ sex + age_group + secondary_school + fam_income + color_race +
+ receive_grant + extracurricular,
+random = ~ 1 | institution/program_id,
+data = stud.db)

Iteration 1 - deviance = 165108.2 - criterion = 0.8049309
Iteration 2 - deviance = 143677.5 - criterion = 0.05636877
Iteration 3 - deviance = 137233.2 - criterion = 0.0243093
Iteration 4 - deviance = 134822 - criterion = 0.01024263
Iteration 5 - deviance = 133809.7 - criterion = 0.003024441
Iteration 6 - deviance = 133378.3 - criterion = 0.0007326398
Iteration 7 - deviance = 133226.5 - criterion = 7.890494e-05
Iteration 8 - deviance = 133181.8 - criterion = 4.898939e-06
Iteration 9 - deviance = 133171.1 - criterion = 3.000677e-07
Iteration 10 - deviance = 133168.8 - criterion = 2.003485e-08
Iteration 11 - deviance = 133168.3 - criterion = 1.462663e-09
converged

(Co-)Variances:
Grouping level: 1 
                                 Estimate      Std.Err.     
Stopout~1 1.638          3.661       
Dropout~1      2.356 4.344    6.334 10.948
Grouping level: 2 
                                 Estimate      Std.Err.     
Stopout~1 2.871         0.2844       
Dropout~1      2.288 5.060   0.2637 0.3159

Null Deviance:     482500 
Residual Deviance: 133200 
Number of Fisher Scoring iterations:  11 
Number of observations:  219597 

A very newby question: how the estimation is determined by the package and it is possible to change these parameters?

Again, thank you very much.

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Understood! Thanks!

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Hello Martin,

In the newest version of the package, I fitted the first model that I posted here, without any modifications, and I'm getting this message:

Error in res[[i, j]] <- t(x[[i, j]]) : [[ ]] subscript out of bounds

I modified the method and estimator arguments to other options and used more or less variables, but I receive the same message.

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Hi Martin, thanks for the return!

Tested again and now I get this message:

Error in x[[j, i]] : subscript out of bounds

Followed the same tests as before. This happens with a model with two random effects. When I exclude one of them, It works.

from mclogit.

melff avatar melff commented on September 21, 2024

Dang, I thought I got it. Can you please show what traceback() shows if immediately called after the error message has been shown? That would help me in bug-hunting.

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Sure! Like this?

Error in x[[j, i]] : subscript out of bounds
> traceback()
8: t(x[[j, i]])
7: bMatTrns(ZWX)
6: cbind(blockMatrix(XWX), bMatTrns(ZWX))
5: rbind(cbind(blockMatrix(XWX), bMatTrns(ZWX)), cbind(ZWX, ZWZiSigma))
4: structure(rbind(cbind(blockMatrix(XWX), bMatTrns(ZWX)), cbind(ZWX, 
       ZWZiSigma)), class = "blockMatrix")
3: PQLMQL_innerFit(y.star, X, Z, W, d, groups, offset, method, estimator, 
       control)
2: mmclogit.fitPQLMQL(y = Y, s = s, w = weights, X = XD, Z = ZD, 
       groups = groups, method = method, estimator = estimator, 
       control = control, offset = offset)
1: mblogit(formula = ind_EVASAO_TER ~ dep_SEXO + dep_IDADE_FAIXA + 
       dep_ORIGEM_ESCOLAR, random = ~1 | COD_IES_2016/COD_IES_CURSO_2016, 
       data = bd.subset)

from mclogit.

gustavobrp avatar gustavobrp commented on September 21, 2024

Just tested again and it's working! Thanks a lot.

from mclogit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.