Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GENLIN Generalised Linear Model error when changing reference category: at least one invalid case in the last iteration ???

1,685 views
Skip to first unread message

Jos Hendrikx

unread,
Dec 17, 2013, 8:08:50 AM12/17/13
to
Hi everyone,

I'm experiencing a strange problem whilst trying to run a GENLIN with a binomial distribution and a log link function.

I'm using v20.0.0.2

I have a dichotomous DV (escalate) coded (0,1) and 2 IV (passdi and patwat) also dichotomous and both coded (0,1).

When I run the following syntax there are no problems:

* Generalized Linear Models.
GENLIN escalate (REFERENCE=First) BY passdi patwat (ORDER=ASCENDING)
/MODEL passdi patwat INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOG
/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100 MAXSTEPHALVING=5
PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD
LIKELIHOOD=FULL
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.

However when I change the reference category of the DV with the following syntax I get the error mentioned below:

* Generalized Linear Models.
GENLIN escalate (REFERENCE=Last) BY passdi patwat (ORDER=ASCENDING)
/MODEL passdi patwat INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOG
/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100 MAXSTEPHALVING=5
PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD
LIKELIHOOD=FULL
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.

Warning:
'There is at least one invalid case in the last iteration. A case is invalid if there are errors in computing the inverse log link function, the log-likelihood, the gradient, or the Hessian matrix in the iterative process. Only the iteration history is displayed.'

Can anyone shed some light on this error and how I could deal with it? It seems strange to me that first model runs without a hitch and the second produces the error when all else is the same and to my knowledge only the parameter estimates should change?

R

unread,
Dec 17, 2013, 8:07:40 PM12/17/13
to
Jos,

It is not uncommon to run into numerical instability since the log link allows probabilities to exceed 1.0. Perhaps changing the "event" from "First" to "Last" has resulted in probabilities exceeding 1.0. I'd need to give this more thought before stating unequivocally that this is your problem.

Regardless, I would suggest that you consider employing the logit link with the binomial distribution (a.k.a. binomial logistic regression). Doing so should eliminate any convergence problems you are experiencing. Afterwards, you could easily apply the inverse logit, 1 / [1 + exp(-eta)], to transform the parameter estimates from the logit scale to the probability scale, if that is what you are after.

HTH.

Ryan

Jos Hendrikx

unread,
Dec 19, 2013, 8:06:39 AM12/19/13
to
Hello Ryan,

Thank you for your input. I ran a logistic model and indeed this computes without problems. Without going into too much statistical detail I am using these models in a counterfactual mediation analysis framework where there are reasons to prefer to run a loglinear model instead of a logistic in case of outcomes that are not rare. That is why I posted the question and it still remains. Conceptually I still do not really understand why changing the outcome reference category would cause convergence problems.
Thanks again for your thoughts,

Jos

Op woensdag 18 december 2013 02:07:40 UTC+1 schreef Ryan:

Ryan

unread,
Dec 19, 2013, 9:56:34 AM12/19/13
to
Jos,

My thoughts are interspersed below.

On Thursday, December 19, 2013 8:06:39 AM UTC-5, Jos Hendrikx wrote:
> Hello Ryan,
>
>
>
> Thank you for your input. I ran a logistic model and indeed this computes without problems. Without going into too much statistical detail I am using these models in a counterfactual mediation analysis framework where there are reasons to prefer to run a loglinear model instead of a logistic in case of outcomes that are not rare.

-->I do not agree with the idea of fitting a log-binomial model when the outcome is *not* rare. If anything, the recommendation should be the opposite.

That is why I posted the question and it still remains. Conceptually I still do not really understand why changing the outcome reference category would cause convergence problems.

-->Mathematically, it does make sense. If you have a high likelihood of an event ocurring, then it is possible in a log-binomial model to obtain predicted values [on the probability scale] that exceed 1.0. By using the log link function, you ensure that the predicted probabilities do not fall below zero, but you have no guarantee that they will not exceed 1.0. There is no upper boundary. By applying the logit transformation, you are guaranteed to always have predicted probabilities that fall between 0 and 1.

-->When you changed the event from one value to the other, you went from modeling a rare event (which should converge without a problem) to a likely event (which often results in convergence problems).

-->I still think you ought to employ a binomial logistic regression model, especially if the event is not rare. I still would like to know what it is so important to fit a log-binomial model with two categorica predictors and a binary outcome. Is it because you are interested in obtaining relative risks (e.g., pr(event|A=1,B=0) / pr(event|A=1,B=1)? You can obtain those relative risks even if you fit a binomial/binary logistic regression.

-->As I think about it, you MAY be able to get the log-binomial to converge if you set the starting value of the intercept to be very small (-4), but I would advise against fitting a log-binomial model at all in your situation.

Ryan

Bruce Weaver

unread,
Dec 19, 2013, 10:36:23 AM12/19/13
to
On 19/12/2013 8:06 AM, Jos Hendrikx wrote:
> Hello Ryan,
>
> Thank you for your input. I ran a logistic model and indeed this computes without problems. Without going into too much statistical detail I am using these models in a counterfactual mediation analysis framework where there are reasons to prefer to run a loglinear model instead of a logistic in case of outcomes that are not rare. That is why I posted the question and it still remains. Conceptually I still do not really understand why changing the outcome reference category would cause convergence problems.
> Thanks again for your thoughts,
>
> Jos

This is a complete shot in the dark, but does it make any difference if
you change COVB=MODEL to COVB=ROBUST?

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

Ryan

unread,
Dec 20, 2013, 9:50:36 AM12/20/13
to
Below is an example of what I was describing.

Ryan
--

*Generate Data.
set seed 98765432.
new file.

input program.

loop ID= 1 to 10000.

compute A = rv.bernoulli(0.5).
compute B = rv.bernoulli(0.5).
compute #eta = 1.5 + 0.9*A + 0.5*B.
compute #prob = 1 / (1 + exp(-#eta)).

compute y = rv.bernoulli(#prob).

end case.
end loop.
end file.
end input program.
execute.

*Fit the model with first category as reference.
GENLIN y (REFERENCE=FIRST) BY A B (ORDER=DESCENDING)
/MODEL A B INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOG
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.

*Fit the model with last category as reference.
GENLIN y (REFERENCE=LAST) BY A B (ORDER=DESCENDING)
/MODEL A B INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOG
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.

Jos Hendrikx

unread,
Jun 2, 2014, 7:13:53 AM6/2/14
to
Hello Bruce,

Sorry for the extremely late reaction to your post; I did not receive an e-mail so I did not notice that there were new posts.
I tried your suggestion, but unfortunately it did not help.
Thanks for your thoughts though!
Kind regards,
Jos

Op donderdag 19 december 2013 16:36:23 UTC+1 schreef Bruce Weaver:

Jos Hendrikx

unread,
Jun 2, 2014, 10:46:30 AM6/2/14
to
Hello Ryan,

My sincere apologies for the extremely late reply; I did not receive an e-mail about this, so I thought there was no new input. Thank you very much for your clear explanation about changing the reference category. Now it makes perfect sense to me!

About the choice for a Loglinear model instead of a Logistic model:
I am trying to use a SPSS mediation macro by Valeri and VanderWeele (2013). They recommend using a loglinear model in instances were the outcome is not rare because they state that odds ratios do not approximate risk ratios and that causal effects will therefore be biased. Adjusting the parameter estimates after the regression modelling is a bit difficult for me, because the macro uses the estimates for further calculation and I am not quite sure at what points in 4000 lines of code :S

Thanks for your help.

Kind regards,

Jos



Op donderdag 19 december 2013 15:56:34 UTC+1 schreef Ryan:

David Marso

unread,
Jun 2, 2014, 2:12:17 PM6/2/14
to
From staring at that monster it appears that depending upon a variety of conditions it runs specific analyses and captures the regression coefficients using OMS and their variance covariance using OUTFILE. Then churns it all up in MATRIX beginning at line 1987 doing all sorts of repetitive mumbo jumbo.
So, that should gibe you some hint as to where you would intervene and do your 'adjustments'.
My eyes are bleeding.....
HTH

Ryan

unread,
Jun 2, 2014, 6:58:57 PM6/2/14
to
Jos,

I wish you had indicated that your intention was to evaluate "mediation" with a binary outcome. With that new piece of information, I would recommend that you use the SPSS custom dialog, PROCESS (based on bootstrap methods), offered by Andrew Hayes:

http://www.afhayes.com/introduction-to-mediation-moderation-and-conditional-process-analysis.html

OT with respect to SPSS but related to mediation: David Kenny provides an eye-opening historical overview of mediation on his website you might consider reading:

http://davidakenny.net/cm/mediate.htm

He discusses how the concept and approach to evaluating mediation have evolved over the years.

One can certainly evaluate indirect effects in a multilevel model using the MIXED procedure and/or indirect effects in a latent variable framework using AMOS, but I don't believe either of these types of models are applicable to your situation.

HTH.

Ryan

David Marso

unread,
Jun 3, 2014, 11:00:39 AM6/3/14
to
FWIW: Here is the link to the code abyss I referred to previously
http://www.hsph.harvard.edu/tyler-vanderweele/tools-and-tutorials/
Don't think I would venture into that mess without a Hazmat suit!
Obviously written by someone who knows their stats but has absolutely no clue about simple programming concepts!

Jos Hendrikx

unread,
Aug 7, 2014, 4:06:33 AM8/7/14
to
Hello Ryan,

Thank you for your post and sorry for my late reply (again); I'm working on several projects at once giving me mild PhD-finishing amnesia ;)
I was aware of Andrew Hayes's SPSS dialogs. Though very helpful and flexible they do not support my data: binary mediator with a binary outcome.

I have found a page by Dr Nathaniel R. Herr, explaining how to standardize coefficients when dealing with binary mediators and/or outcomes in order to use the classic Baron and Kenny approach:
http://www.nrhpsych.com/mediation/logmed.html

For me this is a feasible alternative to the counterfactual approach (with which I had the problems stated above) by Van der Weele and Valeri. Though I will still pursue getting that analysis to run as well.

Kind regards,

Jos




Op dinsdag 3 juni 2014 00:58:57 UTC+2 schreef Ryan:

kolipa...@gmail.com

unread,
Feb 1, 2016, 6:15:00 AM2/1/16
to
Hi, I am running a GLMM Logistic regression model with a binary (0,1) dependent variable and 6 other Independent variables of which 2 are scale and other are just categorical variables.

I keep getting the error : There are no valid records for the LOGIT link function. No output will be displayed.

Can some one throw some sense into this I am loosing my mind.

Thanks

Shekhar

Bruce Weaver

unread,
Feb 1, 2016, 7:45:55 AM2/1/16
to
Please post your command syntax plus a list of variables including which ones are dichotomous, categorical and quantitative.

HTH.

Bruce Weaver

unread,
Feb 1, 2016, 7:49:04 AM2/1/16
to
And one more thing: This newsgroup is now rather moribund. The SPSSX-L mailing list is far more active, so you might consider posting your question (with command syntax and variable info) there. One convenient way to join and interact with the list is via the Nabble archive:

http://spssx-discussion.1045642.n5.nabble.com/

Clicking the "more options" link at the top takes you to a page where you can join the list.

HTH.

maarten....@gmail.com

unread,
May 11, 2016, 4:51:12 PM5/11/16
to
Hello

I am working on a research with logistic regression, but when I enter some extra variables to a model which ran just fine, I receive the following message:
glmm: There are no valid records for the LOGIT link function. No output will be displayed. Execution of this command stops.

I am working with SPSS 23. It is a rather small database I am working with, but I would be surprised if that was the cause of all trouble. The Syntax I am using is the following:


DATASET ACTIVATE DataSet1.
*Generalized Linear Mixed Models.
GENLINMIXED
/DATA_STRUCTURE SUBJECTS=mergeid REPEATED_MEASURES=DummyVignetteAdemhaling*
DummyVignetteConcentratie*DummyVignHoofdpijn*DummyVignetteSlaap*DummyVignetteStappen
COVARIANCE_TYPE=DIAGONAL
/FIELDS TARGET=DummySubjGez TRIALS=NONE OFFSET=NONE
/TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
/FIXED EFFECTS=Autochtoon agecentered Gender DummyAzië DummyOostEU Dummysubsaharisch
DummyZuidAmerika DummyWestEU USE_INTERCEPT=TRUE
/RANDOM USE_INTERCEPT=TRUE COVARIANCE_TYPE=VARIANCE_COMPONENTS
/BUILD_OPTIONS TARGET_CATEGORY_ORDER=DESCENDING INPUTS_CATEGORY_ORDER=DESCENDING
MAX_ITERATIONS=100 CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL PCONVERGE=0.000001(ABSOLUTE)
SCORING=0 SINGULAR=0.000000000001
/EMMEANS TABLES=Autochtoon CONTRAST=NONE
/EMMEANS TABLES=Gender CONTRAST=NONE
/EMMEANS TABLES=DummyAzië CONTRAST=NONE
/EMMEANS TABLES=DummyOostEU CONTRAST=NONE
/EMMEANS TABLES=Dummysubsaharisch CONTRAST=NONE
/EMMEANS TABLES=DummyZuidAmerika CONTRAST=NONE
/EMMEANS TABLES=DummyWestEU CONTRAST=NONE
/EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.

Is there anybody familiar with this error and, more important, has a solution? Thanks in advance.

Bruce Weaver

unread,
May 11, 2016, 5:11:10 PM5/11/16
to
I just want to note that the same question has been posted to the SPSS mailing list:

http://spssx-discussion.1045642.n5.nabble.com/GLMM-Logit-link-error-message-td5732141.html

That forum is currently much more active than this usenet newsgroup. So anyone reading the archives of this group may want to check the link above.

HTH.

Shiva Nischal

unread,
Sep 14, 2021, 10:03:00 AM9/14/21
to
Same issue and the link doesn't work. Can anyone help?

Rich Ulrich

unread,
Sep 14, 2021, 12:49:17 PM9/14/21
to
On Tue, 14 Sep 2021 07:02:58 -0700 (PDT), Shiva Nischal
<lingam....@gmail.com> wrote:

>Same issue and the link doesn't work. Can anyone help?

Here is the whole of the thread that is referenced, which started in
2013. The article cited refers to "no valid records" rather than what
the subject line indicates.
https://groups.google.com/g/comp.soft-sys.stat.spss/c/x0L4S_n6-R4?pli=1

Nabble: As of today, the link that doesn't work seems to
have a new identification, as
http://spssx-discussion.165.s1.nabble.com/GLMM-Logit-link-error-message-td5732141.html

"165.s1" replaces what was there before. We can hope that this
will be stable. Nabble has reently become partly disconnected from
the other source of the SPSSX list. - I went to nabble.com and
clicked on the SPSS option in the list given.

There is one reply to the post made there.

--
Rich Ulrich
0 new messages