binary logistic mixed model

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

binary logistic mixed model

maister.lara
I am trying to used the Generalized Mixed Model in SPSS (GENLINMIXED) to fit a binary logistic model to some accuracy data, and I have a couple of questions…I am only a beginner in all this!

My DV is accuracy on each trial (1=correct response, 0=incorrect response), and I have two repeated factors: congruency(0=incongruent, 1=congruent) and trial_type(1=blue, 2=green, 3=red). I have 29 participants who do 20 trials for each combination of levels for the repeated measures (therefore, I have 120 accuracy values for each participant; i.e. 20 values for incongruent-blue trials, 20 values for congruent-red trials, etc.). I want to add reaction time (RT, a continuous variable) into the model too as I want to see if the relationship between accuracy and RT changes between different levels of the repeated factors.

So, I have set up my analysis like so:
factor: accuracy score for each trial
random effects: Participant ID
fixed factors: congruency, trial_type and RT (main effects, all two-way and all three-way interactions)
->fitting a binomial distribution with Logit link function

However, this set-up gives an error saying “the levels of the repeated measures effect are not different for each case within a repeated subject”. I think this is because I have 20 cases per level of the repeated measure per participant.

I can only think of two ways to fix this:
1) average my accuracy scores across each repeated measure for each participant; but this means my data isn’t binomial any more and I lose the original structure
2) enter another random variable, which is ‘trial repetition’ (1-20); but when I run this, it takes two days and then has a hessian matrix warning and fails to fit anything.

I am very new to all this. Do I have the general set-up even vaguely right for what I am trying to do, or is there some fundamental error?

Many thanks!

Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

David Marso
Administrator
First off when posting questions to this forum PASTE YOUR SYNTAX!
i.e. hit the PASTE button rather than RUN and post it!
Strikes me off the bat that accuracy is NOT a factor, it is the dependent variable.
I don't have access to GenLinMixed so not sure what appears in the dialogs.
Have you consulted the manual to study the various examples which are presented for various types of analyses?
--
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

maister.lara
sorry, here is the syntax below. And apologies, I made a mistake in my email, rather than accuracy being a 'factor' I meant 'target' which I assume is what the DV is called in GENLINMIXED. I did look at some examples but I could see none that had repeated measurements within the repeated factors (and who's repetition was not interesting to the design). The syntax below includes a 'trial repetition' variable as a random factor (called 'rep' below), and this is what generates either a hessian matrix warning or tells me convergence hasn't been acheived (after several days).

*Generalized Linear Mixed Models.
GENLINMIXED
  /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=type*cong*rep COVARIANCE_TYPE=DIAGONAL
  /FIELDS TARGET=acc TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
  /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE    
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS
  /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100
    CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL
  /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.

Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

maister.lara
In reply to this post by David Marso
sorry, here is the syntax below. And apologies, I made a mistake in my email, rather than accuracy being a 'factor' I meant 'target' which I assume is what the DV is called in GENLINMIXED. I did look at some examples but I could see none that had repeated measurements within the repeated factors (and who's repetition was not interesting to the design). The syntax below includes a 'trial repetition' variable as a random factor (called 'rep' below), and this is what generates either a hessian matrix warning or tells me convergence hasn't been acheived (after several days).

*Generalized Linear Mixed Models.
GENLINMIXED
  /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=type*cong*rep COVARIANCE_TYPE=DIAGONAL
  /FIELDS TARGET=acc TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
  /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE    
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS
  /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100
    CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL
  /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

David Marso
Administrator
From your previous:
“the levels of the repeated measures effect are not different for each case within a repeated subject”.
OK, verify that you don't have a data input error?
Easy to check as

DATASET DECLARE agg.
AGGREGATE OUTFILE agg / BREAK ppt type cong rep / count=N.
DATASET ACTIVATE agg.
FREQUENCIES count.

I'll bet you have something other than 1 in the aggregate and that would explain the error message.
Fix that.  See if it runs.
If not post the new error message .
Secondly?  Maybe suppress the 3 way interaction and see if it works?

maister.lara wrote
sorry, here is the syntax below. And apologies, I made a mistake in my email, rather than accuracy being a 'factor' I meant 'target' which I assume is what the DV is called in GENLINMIXED. I did look at some examples but I could see none that had repeated measurements within the repeated factors (and who's repetition was not interesting to the design). The syntax below includes a 'trial repetition' variable as a random factor (called 'rep' below), and this is what generates either a hessian matrix warning or tells me convergence hasn't been acheived (after several days).

*Generalized Linear Mixed Models.
GENLINMIXED
  /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=type*cong*rep COVARIANCE_TYPE=DIAGONAL
  /FIELDS TARGET=acc TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
  /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE    
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS
  /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100
    CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL
  /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

maister.lara
There is no data input error - aggregate only has 1's.

I think I receive a "levels of the repeated measures effect are not different for each case within a repeated subject” error because I have 20 cases for each level combination of the repeated factors (i.e. my participants did 20 trials, and thus gave 20 accuracy scores, for each combination of trial_type and congruency).

So I inserted another repeated factor, 'rep', which runs from 1-20 and reflects the number of times the participant repeats each trial type. So the problem I think now is not the previous error, but the fact that this new analysis with 'rep' will not run.

I am currently trying without the three-way interaction, but each analysis lasts at least a day so it is not a quick check unfortunately. In the meantime, I am unclear which covariance structure to use for the random effects: it has produced errors with diagonal, variance_components, and unstructured so far...

<quote author="David Marso">
From your previous:
“the levels of the repeated measures effect are not different for each case within a repeated subject”.
OK, verify that you don't have a data input error?
Easy to check as

DATASET DECLARE agg.
AGGREGATE OUTFILE agg / BREAK ppt type cong rep / count=N.
DATASET ACTIVATE agg.
FREQUENCIES count.

I'll bet you have something other than 1 in the aggregate and that would explain the error message.
Fix that.  See if it runs.
If not post the new error message .
Secondly?  Maybe suppress the 3 way interaction and see if it works?

Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

David Marso
Administrator
Can you verify that the measurement levels for your variables are set up correctly?
From the FM:
•To include a term for the main effect of a factor (categorical predictor) or covariate (continuous predictor), enter its field name. Whether a field is treated as a factor or covariate depends upon its measurement level. Fields with categorical (flag, nominal, or ordinal) measurement level are treated as factors while fields with continuous (scale) measurement level are treated as covariates.

If your LogRT variable is NOT defined as Scale that could create an ENORMOUS problem.


<quote author="maister.lara">
There is no data input error - aggregate only has 1's.

I think I receive a "levels of the repeated measures effect are not different for each case within a repeated subject” error because I have 20 cases for each level combination of the repeated factors (i.e. my participants did 20 trials, and thus gave 20 accuracy scores, for each combination of trial_type and congruency).

So I inserted another repeated factor, 'rep', which runs from 1-20 and reflects the number of times the participant repeats each trial type. So the problem I think now is not the previous error, but the fact that this new analysis with 'rep' will not run.

I am currently trying without the three-way interaction, but each analysis lasts at least a day so it is not a quick check unfortunately. In the meantime, I am unclear which covariance structure to use for the random effects: it has produced errors with diagonal, variance_components, and unstructured so far...

David Marso wrote
From your previous:
“the levels of the repeated measures effect are not different for each case within a repeated subject”.
OK, verify that you don't have a data input error?
Easy to check as

DATASET DECLARE agg.
AGGREGATE OUTFILE agg / BREAK ppt type cong rep / count=N.
DATASET ACTIVATE agg.
FREQUENCIES count.

I'll bet you have something other than 1 in the aggregate and that would explain the error message.
Fix that.  See if it runs.
If not post the new error message .
Secondly?  Maybe suppress the 3 way interaction and see if it works?
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

maister.lara
Yes I think they are all correct:

Factors:
type = Nominal
cong = Nominal

Covariate:
LogRT = Scale

Target/DV:
acc = Nominal

Random Factors:
rep = Ordinal
ppt = Nominal

<quote author="David Marso">
Can you verify that the measurement levels for your variables are set up correctly?
From the FM:
•To include a term for the main effect of a factor (categorical predictor) or covariate (continuous predictor), enter its field name. Whether a field is treated as a factor or covariate depends upon its measurement level. Fields with categorical (flag, nominal, or ordinal) measurement level are treated as factors while fields with continuous (scale) measurement level are treated as covariates.

If your LogRT variable is NOT defined as Scale that could create an ENORMOUS problem.
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

Maguin, Eugene
In reply to this post by maister.lara
I may be wrong but I very strongly think that the COVARIANCE_TYPE=DIAGONAL is wrong. Read the documentation, page 832-833. I don't believe that the residuals from one trial type-congruency combination will have covariance=0 with any other combination. I'd kind of be the structure will be kind of complicated--unless you randomized the presentation of type-cong-rep combinations, which hasn't been mentioned yet.

I am suspicious of the Random effects statement but I don't have the experience to really comment.
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of maister.lara
Sent: Thursday, May 15, 2014 11:06 AM
To: [hidden email]
Subject: Re: binary logistic mixed model

sorry, here is the syntax below. And apologies, I made a mistake in my email, rather than accuracy being a 'factor' I meant 'target' which I assume is what the DV is called in GENLINMIXED. I did look at some examples but I could see none that had repeated measurements within the repeated factors (and who's repetition was not interesting to the design). The syntax below includes a 'trial repetition' variable as a random factor (called 'rep'
below), and this is what generates either a hessian matrix warning or tells me convergence hasn't been acheived (after several days).

*Generalized Linear Mixed Models.
GENLINMIXED
  /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=type*cong*rep COVARIANCE_TYPE=DIAGONAL
  /FIELDS TARGET=acc TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
  /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS
  /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100
    CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL
  /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.





--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/binary-logistic-mixed-model-tp5726074p5726077.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

Ryan
In reply to this post by maister.lara
You're much better off using the GLIMMIX procedure in SAS for this particular design. Do you have access to SAS?

Ryan

On Thu, May 15, 2014 at 10:22 AM, maister.lara <[hidden email]> wrote:
I am trying to used the Generalized Mixed Model in SPSS (GENLINMIXED) to fit a binary logistic model to some accuracy data, and I have a couple of questions…I am only a beginner in all this!

My DV is accuracy on each trial (1=correct response, 0=incorrect response), and I have two repeated factors: congruency(0=incongruent, 1=congruent) and trial_type(1=blue, 2=green, 3=red). I have 29 participants who do 20 trials for each combination of levels for the repeated measures (therefore, I have 120 accuracy values for each participant; i.e. 20 values for incongruent-blue trials, 20 values for congruent-red trials, etc.). I want to add reaction time (RT, a continuous variable) into the model too as I want to see if the relationship between accuracy and RT changes between different levels of the repeated factors.

So, I have set up my analysis like so:
factor: accuracy score for each trial
random effects: Participant ID
fixed factors: congruency, trial_type and RT (main effects, all two-way and all three-way interactions)
->fitting a binomial distribution with Logit link function

However, this set-up gives an error saying “the levels of the repeated measures effect are not different for each case within a repeated subject”. I think this is because I have 20 cases per level of the repeated measure per participant.

I can only think of two ways to fix this:
1) average my accuracy scores across each repeated measure for each participant; but this means my data isn’t binomial any more and I lose the original structure
2) enter another random variable, which is ‘trial repetition’ (1-20); but when I run this, it takes two days and then has a hessian matrix warning and fails to fit anything.

I am very new to all this. Do I have the general set-up even vaguely right for what I am trying to do, or is there some fundamental error?

Many thanks!



View this message in context: binary logistic mixed model
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

maister.lara
In reply to this post by Maguin, Eugene
Unfortunately I don't have SAS...

In reply to Eugene, you are right, maybe diagonal covariance structure is incorrect for my data. Type-cong combinations were randomised, but type-cong-rep combinations are not: this is because rep runs from 1-20 sequentially, counting which repetition of that type-cong combination is being presented (1st time to 20th time). However, sequential reps are not necessarily performed sequentially in time (e.g. participants might perform the 1st rep of one type-cong combination, followed by the 4th rep of another combination).

So I have three questions:
1) I have now read the documentation but still not really sure which would be the best covariance structure to go for?

2) Should rep be entered as a 'subject' factor with ppt, or should it be a repeated measure?
In other words, does this:
 /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=rep*face*cong
make more sense than this:
 /DATA_STRUCTURE SUBJECTS=ppt rep REPEATED_MEASURES=face*cong

3) I think my variables 'rep' (trial repetition) and 'ppt' (participant) should be random effects, but I can't work out the difference between adding a variable as a 'subject' in the random effects block, e.g.
/RANDOM USE_INTERCEPT=TRUE SUBJECTS=ppt COVARIANCE_TYPE=UNSTRUCTURED
or entering it as a 'term', e.g.
/RANDOM EFFECTS=ppt USE_INTERCEPT=TRUE COVARIANCE_TYPE=UNSTRUCTURED


Maguin, Eugene wrote
I may be wrong but I very strongly think that the COVARIANCE_TYPE=DIAGONAL is wrong. Read the documentation, page 832-833. I don't believe that the residuals from one trial type-congruency combination will have covariance=0 with any other combination. I'd kind of be the structure will be kind of complicated--unless you randomized the presentation of type-cong-rep combinations, which hasn't been mentioned yet.

I am suspicious of the Random effects statement but I don't have the experience to really comment.
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of maister.lara
Sent: Thursday, May 15, 2014 11:06 AM
To: [hidden email]
Subject: Re: binary logistic mixed model

sorry, here is the syntax below. And apologies, I made a mistake in my email, rather than accuracy being a 'factor' I meant 'target' which I assume is what the DV is called in GENLINMIXED. I did look at some examples but I could see none that had repeated measurements within the repeated factors (and who's repetition was not interesting to the design). The syntax below includes a 'trial repetition' variable as a random factor (called 'rep'
below), and this is what generates either a hessian matrix warning or tells me convergence hasn't been acheived (after several days).

*Generalized Linear Mixed Models.
GENLINMIXED
  /DATA_STRUCTURE SUBJECTS=ppt REPEATED_MEASURES=type*cong*rep COVARIANCE_TYPE=DIAGONAL
  /FIELDS TARGET=acc TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
  /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS
  /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100
    CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL
  /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=LSD.





--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/binary-logistic-mixed-model-tp5726074p5726077.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: binary logistic mixed model

Alex Reutter
A late contribution to the discussion, but assuming you're still unable to build the model, I would suggest taking a step back.  Rather than going after the full model with mixed effects straightaway, stop for a moment and think about what it is that you actually want to model.  So maybe start with the fixed effects:

*Generalized Linear Mixed Models.
GENLINMIXED
 /FIELDS TARGET=acc
 /TARGET_OPTIONS DISTRIBUTION=BINOMIAL LINK=LOGIT
 /FIXED  EFFECTS=type cong logRT type*cong type*logRT cong*logRT type*cong*logRT USE_INTERCEPT=TRUE.

Assuming that builds successfully, then maybe you're ready to add random effects.  When you specify:
  /RANDOM EFFECTS=ppt rep USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS

you are asking for a separate variance parameter to be estimated for *every single repetition for every single participant*.  It's possible that's what you really wanted, but I doubt it.  To start, you probably want to look at:
  /RANDOM SUBJECTS=ppt USE_INTERCEPT=TRUE COVARIANCE_TYPE=VARIANCE_COMPONENTS

which much more reasonably suggests that the patient-to-patient variability can be modeled by draws from a normal distribution with a single estimated variance component.  Now, if you want to propose that the variance components differ by repetition, you could model:
  /RANDOM EFFECTS=rep SUBJECTS=ppt USE_INTERCEPT=FALSE COVARIANCE_TYPE=VARIANCE_COMPONENTS

you can then vary the COVARIANCE_TYPE to see whether the components of repetition are related.  You could add type and cong as random effects and have a useful model without getting into the R matrix at all.  If you do decide to model the R matrix, go through a similar exercise of thinking about what it is you're trying to model before hoping for the best and letting it run for days.

Based upon your description of how the repetitions were administered, you may also find this example of how to analyze a crossover trial useful (it's for MIXED, but the principles also apply to GENLINMIXED): http://www-01.ibm.com/support/knowledgecenter/SSLVMB_22.0.0/com.ibm.spss.statistics.cs/spss/tutorials/mixed_groc_intro.htm.

Good luck,
Alex