strange behaviour of SPSS mixed with random effects of dichotomous predictors

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

strange behaviour of SPSS mixed with random effects of dichotomous predictors

Dr Chris Stride
Hi all

When I have a dichotomous predictor in any form of regression analysis I
almost always set the codes to 0 vs 1 and treat it as continuous (i.e. I
do the dummy coding myself)


However, when playing around with something in SPSS mixed I decided to
let SPSS do this coding for me by treating my dichotomous predictor, X,
as categorical, using the 'by' keyword, i.e. entering the code as

MIXED Y by X...

as opposed to

MIXED Y with X...

And in doing so I ran up against something very odd...


If I just look at the fixed effect of X I get the same result if I do
the dummy coding or if SPSS does it e.g.

MIXED Y with X  /fixed = X /random = intercept | subject(TEAMID) /print
= solution testcov.

gives the same interpretation as

MIXED Y by X  /fixed = X /random = intercept | subject(TEAMID) /print =
solution testcov.

This is exactly as it should be


But... if I also include X as a random effect, and allow for covarying
intercepts and slopes e.g.

MIXED Y with X  /fixed = X /random = intercept X | subject(TEAMID)
covtype(UN)  /print = solution testcov.

DOES NOT give the same results as when I use SPSS to do the dummy
coding, e.g.

MIXED Y by X  /fixed = X /random = intercept X | subject(TEAMID)
covtype(UN)  /print = solution testcov.


The former code seems OK in terms of the results given - but the latter
code, i.e the automated spss way of dummy coding X, gives a very odd
result, in that, when calculating the random effects, it seems to treat
the reference category of X as a variable too, and gives a 3x3
variance-covariance matrix, albeit with un1,3), un(2,3) and un(3,3)
unable to be estimated, and the usual warning re: the Hessian matrix!?


Has anyone else run into this issue?! Any idea what is going on?


cheers

Chris




--

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

  - Data management using SPSS syntax
  - Advanced SPSS syntax and SPSS macros
  - Testing for Mediation and Moderation using SPSS
  - Multi-level Modelling using SPSS
  - Introduction to Structural Equation Modelling using Mplus
  - Testing for Mediation and Moderation using Mplus
  - Multi-level Modelling using Mplus
  - Latent Growth Curve Modelling using Mplus

=====================
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
|

Fwd: strange behaviour of SPSS mixed with random effects of dichotomous predictors

Ryan Black
Chris,

Do you have exactly two measurements on each subject "TEAM_ID"? Is the binary predictor variable analogous to a time predictor variable in which each subject is measured on the dependent variable y at time t=0 and t=1? If I am correct so far, you get no additional information by adding a random slope term.

 Ryan

---------- Forwarded message ----------
From: Dr Chris Stride <[hidden email]>
Date: Fri, Sep 1, 2017 at 5:33 PM
Subject: strange behaviour of SPSS mixed with random effects of dichotomous predictors
To: [hidden email]


Hi all

When I have a dichotomous predictor in any form of regression analysis I almost always set the codes to 0 vs 1 and treat it as continuous (i.e. I do the dummy coding myself)


However, when playing around with something in SPSS mixed I decided to let SPSS do this coding for me by treating my dichotomous predictor, X, as categorical, using the 'by' keyword, i.e. entering the code as

MIXED Y by X...

as opposed to

MIXED Y with X...

And in doing so I ran up against something very odd...


If I just look at the fixed effect of X I get the same result if I do the dummy coding or if SPSS does it e.g.

MIXED Y with X  /fixed = X /random = intercept | subject(TEAMID) /print = solution testcov.

gives the same interpretation as

MIXED Y by X  /fixed = X /random = intercept | subject(TEAMID) /print = solution testcov.

This is exactly as it should be


But... if I also include X as a random effect, and allow for covarying intercepts and slopes e.g.

MIXED Y with X  /fixed = X /random = intercept X | subject(TEAMID) covtype(UN)  /print = solution testcov.

DOES NOT give the same results as when I use SPSS to do the dummy coding, e.g.

MIXED Y by X  /fixed = X /random = intercept X | subject(TEAMID) covtype(UN)  /print = solution testcov.


The former code seems OK in terms of the results given - but the latter code, i.e the automated spss way of dummy coding X, gives a very odd result, in that, when calculating the random effects, it seems to treat the reference category of X as a variable too, and gives a 3x3 variance-covariance matrix, albeit with un1,3), un(2,3) and un(3,3) unable to be estimated, and the usual warning re: the Hessian matrix!?


Has anyone else run into this issue?! Any idea what is going on?


cheers

Chris




--

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus

=====================
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: strange behaviour of SPSS mixed with random effects ofdichotomous predictors

Dr Chris Stride
No... I have > 20 people in each team, some of whom will s core 1 on X, and others who will score 2 on X.

So fitting random effect of X is not an issue as far as I'm aware... and works fine, ie intercept, slope variances and intercept-slope covariance are estimated if I recode X to 0 vs 1 and treat X as a continuous var, ie place it after WITH.


From: [hidden email]
Sent: ‎04/‎09/‎2017 00:00
To: [hidden email]
Subject: Fwd: strange behaviour of SPSS mixed with random effects ofdichotomous predictors

Chris,

Do you have exactly two measurements on each subject "TEAM_ID"? Is the binary predictor variable analogous to a time predictor variable in which each subject is measured on the dependent variable y at time t=0 and t=1? If I am correct so far, you get no additional information by adding a random slope term.

 Ryan

---------- Forwarded message ----------
From: Dr Chris Stride <[hidden email]>
Date: Fri, Sep 1, 2017 at 5:33 PM
Subject: strange behaviour of SPSS mixed with random effects of dichotomous predictors
To: [hidden email]


Hi all

When I have a dichotomous predictor in any form of regression analysis I almost always set the codes to 0 vs 1 and treat it as continuous (i.e. I do the dummy coding myself)


However, when playing around with something in SPSS mixed I decided to let SPSS do this coding for me by treating my dichotomous predictor, X, as categorical, using the 'by' keyword, i.e. entering the code as

MIXED Y by X...

as opposed to

MIXED Y with X...

And in doing so I ran up against something very odd...


If I just look at the fixed effect of X I get the same result if I do the dummy coding or if SPSS does it e.g.

MIXED Y with X  /fixed = X /random = intercept | subject(TEAMID) /print = solution testcov.

gives the same interpretation as

MIXED Y by X  /fixed = X /random = intercept | subject(TEAMID) /print = solution testcov.

This is exactly as it should be


But... if I also include X as a random effect, and allow for covarying intercepts and slopes e.g.

MIXED Y with X  /fixed = X /random = intercept X | subject(TEAMID) covtype(UN)  /print = solution testcov.

DOES NOT give the same results as when I use SPSS to do the dummy coding, e.g.

MIXED Y by X  /fixed = X /random = intercept X | subject(TEAMID) covtype(UN)  /print = solution testcov.


The former code seems OK in terms of the results given - but the latter code, i.e the automated spss way of dummy coding X, gives a very odd result, in that, when calculating the random effects, it seems to treat the reference category of X as a variable too, and gives a 3x3 variance-covariance matrix, albeit with un1,3), un(2,3) and un(3,3) unable to be estimated, and the usual warning re: the Hessian matrix!?


Has anyone else run into this issue?! Any idea what is going on?


cheers

Chris




--

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus

=====================
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 ===================== 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