GENLINMIXED: EMMEANS with no additional keywords not working

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

GENLINMIXED: EMMEANS with no additional keywords not working

Bruce Weaver
Administrator
I considered tacking this question on to the thread Robert started recently (http://spssx-discussion.1045642.n5.nabble.com/EMMEANS-in-GENLINMIXED-td5732536.html), but decided it was sufficiently different to merit its own thread.  

I am working on some course material to demonstrate that the same model can be estimated using several different procedures.  It is a simple model with respondent's years of education (educ) being predicted by their father's years of education (paeduc).  I estimate the model using REGRESSION, UNIANOVA, GLM, MIXED, and finally GENLINMIXED.  For all of them except REGRESSION, I use EMMEANS sub-commands to get fitted values of educ at several levels of paeduc.  E.g., the MIXED syntax looks like this:

MIXED educ WITH paeduc
  /FIXED=intercept paeduc | SSTYPE(3)
  /METHOD=ML
  /PRINT=SOLUTION R
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=0)
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=4)
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=8)
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=12)
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=16)
  /EMMEANS=TABLES(OVERALL) WITH(paeduc=20)
.

When I try this with GENLINMIXED, I run into trouble on a couple of fronts.  First of all, the Command Syntax Reference manual (aka., the Fine Manual, or FM) for v23 says this:

"The EMMEANS_OPTIONS subcommand contains specifications that are used across all EMMEANS subcommands."

This suggests that I cannot get all of the EMMEANS that I want (i.e., with paeduc = 0, 4, 8, 12, 16 and 20) with a single GENLINMIXED command.  Instead, I'll need six GENLINMIXED commands, one for each control value of paeduc.  Am I interpreting that correctly?

The CSR also says:  "The EMMEANS subcommand [for GENLINMIXED] can be specified with no additional keywords.  The output for an empty EMMEANS subcommand is the overall estimated marginal mean of the response, collapsing over any factors."

After reading that, I tried the following:

GENLINMIXED
  /FIELDS TARGET=educ TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY
  /FIXED  EFFECTS=paeduc USE_INTERCEPT=TRUE
  /EMMEANS
  /EMMEANS_OPTIONS SCALE=ORIGINAL CONTROL = paeduc(0)
.

But it does not execute.  I get this warning:

   Subcommand EMMEANS 1 is empty.
   Execution of this command stops.

I then speculated that it may be necessary to have at least one fixed factor in the model, even if one just wants the overall fitted value (as in the MIXED command above).  But I don't want to actually include another explanatory variable, so I tried adding a constant, as follows:

COMPUTE k = 1.
VARIABLE LEVEL k (NOMINAL).
FORMATS k (F1).
GENLINMIXED
  /FIELDS TARGET=educ TRIALS=NONE OFFSET=NONE
  /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY
  /FIXED  EFFECTS=k paeduc USE_INTERCEPT=TRUE
  /EMMEANS TABLES = k
  /EMMEANS_OPTIONS SCALE=ORIGINAL CONTROL = paeduc(0)
.

Believe it or not, this actually works.  I now get two EMMEANS tables that show the fitted value of educ when paeduc=0.  One table is labeled "Grand Mean Estimates", and the second  shows "Estimated Means: k", with one fitted value for k = 1.  The estimates, SEs and CIs are identical in the two sets of output.

After all that, my question boils down to this:  Must one really resort to including a constant as a fixed factor in GENLINMIXED to get an "overall" estimated marginal mean for a model with continuous explanatory variables only?  

I am using v23 for Windows, by the way.  And the data are from a General Social Survey dataset, one version of which used to come with SPSS as a "sample" dataset.

Thanks for any insights (or commiserations) you can offer.  And apologies for the length of the post.

Bruce
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: GENLINMIXED: EMMEANS with no additional keywords not working

Bruce Weaver
Administrator
I should have said v23.0.0.2.  So I don't think it's a problem with missing patches.

Bruce Weaver wrote
--- snip most of the original post ---

I am using v23 for Windows, by the way.  And the data are from a General Social Survey dataset, one version of which used to come with SPSS as a "sample" dataset.

Bruce
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: GENLINMIXED: EMMEANS with no additional keywords not working

Maguin, Eugene
Bruce, I understand that your focus is different but I'm curious since you're running 23 patched whether you see the problem (missing sig and CI values given just one IV) that Robert described.
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver
Sent: Wednesday, June 29, 2016 4:51 PM
To: [hidden email]
Subject: Re: GENLINMIXED: EMMEANS with no additional keywords not working

I should have said v23.0.0.2.  So I don't think it's a problem with missing patches.


Bruce Weaver wrote
> --- snip most of the original post ---
>
> I am using v23 for Windows, by the way.  And the data are from a
> General Social Survey dataset, one version of which used to come with
> SPSS as a "sample" dataset.
>
> Bruce





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/GENLINMIXED-EMMEANS-with-no-additional-keywords-not-working-tp5732547p5732548.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: GENLINMIXED: EMMEANS with no additional keywords not working

Alex Reutter
In reply to this post by Bruce Weaver
Hi Bruce,

It looks like you can only specify one set of control values for covariates.  :-(  

The error on the empty EMMEANS subcommand looks like a bug.

Alex




From:        Bruce Weaver <[hidden email]>
To:        [hidden email]
Date:        06/29/2016 04:29 PM
Subject:        GENLINMIXED: EMMEANS with no additional keywords not working
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I considered tacking this question on to the thread Robert started recently
(
http://spssx-discussion.1045642.n5.nabble.com/EMMEANS-in-GENLINMIXED-td5732536.html),
but decided it was sufficiently different to merit its own thread.  

I am working on some course material to demonstrate that the same model can
be estimated using several different procedures.  It is a simple model with
respondent's years of education (educ) being predicted by their father's
years of education (paeduc).  I estimate the model using REGRESSION,
UNIANOVA, GLM, MIXED, and finally GENLINMIXED.  For all of them except
REGRESSION, I use EMMEANS sub-commands to get fitted values of educ at
several levels of paeduc.  E.g., the MIXED syntax looks like this:

MIXED educ WITH paeduc
 /FIXED=intercept paeduc | SSTYPE(3)
 /METHOD=ML
 /PRINT=SOLUTION R
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=0)
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=4)
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=8)
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=12)
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=16)
 /EMMEANS=TABLES(OVERALL) WITH(paeduc=20)
.

When I try this with GENLINMIXED, I run into trouble on a couple of fronts.
First of all, the Command Syntax Reference manual (aka., the Fine Manual, or
FM) for v23 says this:

"The EMMEANS_OPTIONS subcommand contains specifications that are used across
all EMMEANS subcommands."

This suggests that I *cannot* get all of the EMMEANS that I want (i.e., with
paeduc = 0, 4, 8, 12, 16 and 20) with a single GENLINMIXED command.
Instead, I'll need six GENLINMIXED commands, one for each control value of
paeduc.  Am I interpreting that correctly?

The CSR also says:  "The EMMEANS subcommand [for GENLINMIXED] can be
specified with no additional keywords.  The output for an empty EMMEANS
subcommand is the overall estimated marginal mean of the response,
collapsing over any factors."

After reading that, I tried the following:

GENLINMIXED
 /FIELDS TARGET=educ TRIALS=NONE OFFSET=NONE
 /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY
 /FIXED  EFFECTS=paeduc USE_INTERCEPT=TRUE
 /EMMEANS
 /EMMEANS_OPTIONS SCALE=ORIGINAL CONTROL = paeduc(0)
.

But it does not execute.  I get this warning:

  Subcommand EMMEANS 1 is empty.
  Execution of this command stops.

I then speculated that it may be necessary to have at least one fixed factor
in the model, even if one just wants the overall fitted value (as in the
MIXED command above).  But I don't want to actually include another
explanatory variable, so I tried adding a constant, as follows:

COMPUTE k = 1.
VARIABLE LEVEL k (NOMINAL).
FORMATS k (F1).
GENLINMIXED
 /FIELDS TARGET=educ TRIALS=NONE OFFSET=NONE
 /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY
 /FIXED  EFFECTS=k paeduc USE_INTERCEPT=TRUE
 /EMMEANS TABLES = k
 /EMMEANS_OPTIONS SCALE=ORIGINAL CONTROL = paeduc(0)
.

Believe it or not, this actually works.  I now get two EMMEANS tables that
show the fitted value of educ when paeduc=0.  One table is labeled "Grand
Mean Estimates", and the second  shows "Estimated Means: k", with one fitted
value for k = 1.  The estimates, SEs and CIs are identical in the two sets
of output.

After all that, my question boils down to this:  Must one /really/ resort to
including a constant as a fixed factor in GENLINMIXED to get an "overall"
estimated marginal mean for a model with continuous explanatory variables
only?  

I am using v23 for Windows, by the way.  And the data are from a General
Social Survey dataset, one version of which used to come with SPSS as a
"sample" dataset.

Thanks for any insights (or commiserations) you can offer.  And apologies
for the length of the post.

Bruce




-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/GENLINMIXED-EMMEANS-with-no-additional-keywords-not-working-tp5732547.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: GENLINMIXED: EMMEANS with no additional keywords not working

Bruce Weaver
Administrator
Good morning Alex.  Yeah, that's what I thought too.  Pity about only one set of control values.  It would be preferable, IMO, to have EMMEANS work the same way it does for MIXED.  


Alex Reutter wrote
Hi Bruce,

It looks like you can only specify one set of control values for
covariates.  :-(

The error on the empty EMMEANS subcommand looks like a bug.

Alex
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: GENLINMIXED: EMMEANS with no additional keywords not working

antong123
In reply to this post by Bruce Weaver
I signed up literally just to post the answer! haha  

You can get it to work without the extra factor by changing it to
TRANSFORMED instead of ORIGINAL. Also, this will show you ALL pairwise
comparisons. The important line is below:

 /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(0)
COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD

Here is the whole command.

* Generalized Estimating Equations.
GENLIN Steps1 BY Time (ORDER=ASCENDING) WITH ZZSocDistanceAvgSelf
CovidCasesPerCapita JoggingApril
  /MODEL ZZSocDistanceAvgSelf Time Time*ZZSocDistanceAvgSelf JoggingApril
CovidCasesPerCapita
    INTERCEPT=YES
 DISTRIBUTION=NEGBIN(1) LINK=LOG
  /CRITERIA METHOD=FISHER(1) SCALE=1 MAXITERATIONS=100 MAXSTEPHALVING=5
PCONVERGE=1E-006(ABSOLUTE)
    SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 LIKELIHOOD=FULL
  /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(-2)
COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
  /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(0)
COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
/EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(2)
COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
  /REPEATED SUBJECT=id WITHINSUBJECT=Time SORT=YES CORRTYPE=INDEPENDENT
ADJUSTCORR=YES COVB=ROBUST
    MAXITERATIONS=100 PCONVERGE=1e-006(ABSOLUTE) UPDATECORR=1
  /MISSING CLASSMISSING=EXCLUDE
  /PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: GENLINMIXED: EMMEANS with no additional keywords not working

Bruce Weaver
Administrator
Thanks.  But notice that your example uses GENLIN, whereas the original
question was about GENLINMIXED.  ;-)  



antong123 wrote

> I signed up literally just to post the answer! haha  
>
> You can get it to work without the extra factor by changing it to
> TRANSFORMED instead of ORIGINAL. Also, this will show you ALL pairwise
> comparisons. The important line is below:
>
>  /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(0)
> COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
>
> Here is the whole command.
>
> * Generalized Estimating Equations.
> GENLIN Steps1 BY Time (ORDER=ASCENDING) WITH ZZSocDistanceAvgSelf
> CovidCasesPerCapita JoggingApril
>   /MODEL ZZSocDistanceAvgSelf Time Time*ZZSocDistanceAvgSelf JoggingApril
> CovidCasesPerCapita
>     INTERCEPT=YES
>  DISTRIBUTION=NEGBIN(1) LINK=LOG
>   /CRITERIA METHOD=FISHER(1) SCALE=1 MAXITERATIONS=100 MAXSTEPHALVING=5
> PCONVERGE=1E-006(ABSOLUTE)
>     SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 LIKELIHOOD=FULL
>   /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL =
> ZZSocDistanceAvgSelf(-2)
> COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
>   /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL =
> ZZSocDistanceAvgSelf(0)
> COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
> /EMMEANS TABLES=Time SCALE=TRANSFORMED  CONTROL = ZZSocDistanceAvgSelf(2)
> COMPARE=Time CONTRAST=PAIRWISE  PADJUST=LSD
>   /REPEATED SUBJECT=id WITHINSUBJECT=Time SORT=YES CORRTYPE=INDEPENDENT
> ADJUSTCORR=YES COVB=ROBUST
>     MAXITERATIONS=100 PCONVERGE=1e-006(ABSOLUTE) UPDATECORR=1
>   /MISSING CLASSMISSING=EXCLUDE
>   /PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).