Polynomial contrast for interaction in completely between-Ss design

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

Re: Polynomial contrast for interaction in completely between-Ss design

Ryan
David (and the last paragraph for Bruce),

Your data generation program produces X1 which has four levels and X2 which has two levels. Therefore, your MIXED code should look like this (for my linear trend interaction code to produce an estimable function):

MIXED Y BY X2 X1
 /FIXED=X2 X1 X2*X1 | SSTYPE(3)
 /METHOD=REML
 /PRINT=SOLUTION
 /TEST =  'linear trend x2_1' x1 -3 -1 1 3 x2*x1 -3 -1 1 3 0 0 0 0 
 /TEST =  'linear trend x2_2' x1 -3 -1 1 3 x2*x1 0 0 0 0 -3 -1 1 3
 /TEST = 'linear trend interaction' x2*x1 -3 -1 1 3 3 1 -1 -3.

Now, whether this is what you are interested in testing is a whole other matter. See my posts to Bruce to see exactly what these TEST statements are producing. You might also find those other posts useful regarding how I arrived at the linear trend coefficients and how GLM has a similar sub-command that utilizes the L MATRIX. (Apologies for the multiple posting previously--couldn't fix the formatting)

With regard to Bruce's data, I noticed that for the interaction linear trend test, the test statistics, SS, and df are exactly the same between GLM (via LMATRIX) and MANOVA. This provides additional confirmation that interaction linear trend test proposed previously is conducting Bruce's test of interest. It should be noted that the LMATRIX from GLM automatically provides the SS that Bruce stated was important to him. 

HTH,

Ryan

On Fri, Oct 28, 2011 at 10:09 AM, David Marso <[hidden email]> wrote:
>
> INPUT PROGRAM.
> LOOP ID=1 TO 1000.
> COMPUTE X1=TRUNC(UNIFORM(4))+1.
> COMPUTE X2=TRUNC(UNIFORM(2))+1.
> end case.
> end loop.
> end file.
> end input program.
>
> DO IF X2=1.
> COMPUTE Y=NORMAL(1)+10.
> ELSE.
> COMPUTE Y=NORMAL(1)+ X1*2.
> END IF.
> RECODE X1 (1=-0.670820393249937)(2= -0.223606797749979  )(3=
> 0.223606797749979  )(4=0.670820393249937) INTO LX1.
> RECODE X2 (1=-0.707106781186547)(2= 0.707106781186547) INTO LX2.
> COMPUTE LX1LX2=LX1*LX2.
>
> MEANS TABLES=y  By x2 BY x1 .
> REGRESSION / DEP Y / METHOD ENTER LX1 LX2 LX1LX2.
> MANOVA Y WITH LX1 LX2 LX1LX2.
>
> manova y by x1(1,4) x2(1,2) /
>  contrast(x1)=poly/
>  contrast(x2)=poly/
>  partition(x1)=(1,1)/
>  print=design/
>  DESIGN=x1 x2 x1(1) by x2.
>
> MIXED Y BY X1 X2
>  /FIXED=X1 X2 X1*X2 | SSTYPE(3)
>  /METHOD=REML
>  /PRINT=SOLUTION
>  /TEST = 'Linear X1'  X1 -0.670820393249937      -0.223606797749979
> 0.223606797749979  0.670820393249937
>  /TEST = 'Linear X2'  X2 -0.707106781186547     0.707106781186547
>  /TEST = 'Linear Trend Interaction' X1*X2 0.474341649025257
> -0.474341649025257      0.158113883008419       -0.158113883008419      -0.158113883008419
> 0.158113883008419       -0.474341649025257      0.474341649025257       .
>
>
>
> Bruce Weaver wrote:
> >
> > Yes, that's right.
> >
> > I forgot to mention when responding to your earlier post that another
> > reason for not using MIXED (with TEST) was that I preferred OLS to MLE,
> > because in a balanced design, the SS for the polynomial components of the
> > A*B interaction will add up exactly to the SS(A*B).  I doubt that will be
> > the case with MLE.
> >
> > I've still not had time to try either method--too many meetings.  Will get
> > to it later today or tomorrow.
> >
> > Cheers,
> > Bruce
> >
> >
> >
> > R B wrote:
> >>
> >> You do have exactly two levels for A and four levels for B, right?
> >>
> >> Ryan
> >>
> >> On Thu, Oct 27, 2011 at 7:23 AM, Bruce Weaver &lt;bruce.weaver@&gt;
> >> wrote:
> >>> Aha...that looks like what I was after, Tony.  I'll give it a try.
> >>> Ryan,
> >>> I'll give your /TEST for MIXED method a try too, and compare the
> >>> results.
> >>>
> >>> Thanks guys.
> >>>
> >>>
> >>>
> >>> Anthony Babinec wrote:
> >>>>
> >>>> I think that you have to use MANOVA. GLM uses "set to 0" contrasts
> >>>> while
> >>>> MANOVA uses "sum to 0" contrasts. Here is a short MANOVA example
> >>>> that you can imitate. I just took some "nonsense" variables from the
> >>>> General Social Survey and recode hhsize as 1=1, 2=2, 3 thru 11=3.
> >>>> The design shows the linear by linear interaction as an example.
> >>>>
> >>>> manova educ by hhsize(1,3) race(1,3) /
> >>>>  contrast(hhsize)=poly/
> >>>>  contrast(race)=poly/
> >>>>  partition(hhsize)=(1,1)/
> >>>>  partition(race)=(1,1)/
> >>>>  print=design/
> >>>>  DESIGN=hhsize race hhsize(1) by race(1).
> >>>>
> >>>> Tony Babinec
> >>>> tbabinec@
> >>>>
> >>>> =====================
> >>>> 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
> >>> bweaver@
> >>> 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/Polynomial-contrast-for-interaction-in-completely-between-Ss-design-tp4941355p4942677.html
> >>> Sent from the SPSSX Discussion mailing list archive at 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
> >>>
> >>
> >> =====================
> >> 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
> >>
> >
>
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Polynomial-contrast-for-interaction-in-completely-between-Ss-design-tp4941355p4946042.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

Reply | Threaded
Open this post in threaded view
|

Re: Polynomial contrast for interaction in completely between-Ss design

Bruce Weaver
Administrator
Yes, LMATRIX does it.  For the sake of tying a bow on this thread, here is the MANOVA syntax I posted earlier, and UNIANOVA syntax that gives tests (and SS) for the linear, quadratic and cubic components of the A*B interaction:

MANOVA Y by A(0,1) B(1,4) /
 contrast(A)=poly/
 contrast(B)=poly/
 partition(B)=(1,1,1)/
 print=design/
 DESIGN=A B
  A by B(1)
  A by B(2)
  A by B(3)
.

UNIANOVA Y BY A B
  /LMATRIX = 'Interaction Linear Trend' A*B -3 -1 1 3  3 1 -1 -3
  /LMATRIX = 'Interaction Quadratic Trend' A*B 1 -1 -1 1  -1 1 1 -1
  /LMATRIX = 'Interaction Cubic Trend' A*B -1 3 -3 1  1 -3 3 -1
  /DESIGN=A B A*B.

For the data set I was using, both of these yield the following:

SS(A*B) = 99.400
SS(linear component of A*B) = 98.000
SS(quadratic component of A*B) = 0.900
SS(cubic component of A*B) = 0.500

% of interaction due to linear component = 98.0*100 / 99.4 = 98.6%

I am still left wondering why this is not a bit easier to do for UNIANOVA.  As I've mentioned before, one gets the polynomial components of the interaction term automatically when using GLM Repeated Measures.  

Thanks again to Tony, Ryan & David.

Cheers,
Bruce


R B wrote
--- snip ---

With regard to Bruce's data, I noticed that for the interaction linear
trend test, the test statistics, SS, and df are exactly the same between
GLM (via LMATRIX) and MANOVA. This provides additional confirmation that
interaction linear trend test proposed previously is conducting Bruce's
test of interest. It should be noted that the LMATRIX from GLM
automatically provides the SS that Bruce stated was important to him.

HTH,

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

syntax for contrasts

Keli Saporta
Dear list
My design is quite simple two independent variables A and B each with two levels(1 or 2).I performed ANOVA
UNIANOVA
  y BY a b
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
    /PRINT = DESCRIPTIVE
  /CRITERIA = ALPHA(.05)
   /DESIGN =a b a*b .

The interaction is significant and I want to test the simple effects of B.
That is, to perform  two contrasts the first between the two levels of B for A=1 and the second between the two levels of B for A=2.
What is the syntax that I should use for this contrast?

I will appreciate any help

Thanks



Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: +972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/

D

=====================
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: syntax for contrasts

Maguin, Eugene
Keli,
Look at the Emmeans command in the documentation.  Most basically,
EMMEANS = TABLES(A*B) COMPARE(B).

The comparison can also be done using the Lmatrix subcommand with which others are far more competent with than I am.

Gene Maguin


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Keli Saporta
Sent: Wednesday, March 07, 2012 2:08 AM
To: [hidden email]
Subject: syntax for contrasts

Dear list
My design is quite simple two independent variables A and B each with two levels(1 or 2).I performed ANOVA
UNIANOVA
  y BY a b
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
    /PRINT = DESCRIPTIVE
  /CRITERIA = ALPHA(.05)
   /DESIGN =a b a*b .

The interaction is significant and I want to test the simple effects of B.
That is, to perform  two contrasts the first between the two levels of B for A=1 and the second between the two levels of B for A=2.
What is the syntax that I should use for this contrast?

I will appreciate any help

Thanks



Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: +972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/

D

=====================
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: syntax for contrasts

Keli Saporta
Thank you Gene
It worked very good.
And another question (if you don’t mind)
What if A has three levels? can I define specific contrasts by setting weights? What is the syntax?
Thank you again

Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: +972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Maguin, Eugene
Sent: Wednesday, March 07, 2012 5:00 PM
To: [hidden email]
Subject: Re: syntax for contrasts

Keli,
Look at the Emmeans command in the documentation.  Most basically,
EMMEANS = TABLES(A*B) COMPARE(B).

The comparison can also be done using the Lmatrix subcommand with which others are far more competent with than I am.

Gene Maguin


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Keli Saporta
Sent: Wednesday, March 07, 2012 2:08 AM
To: [hidden email]
Subject: syntax for contrasts

Dear list
My design is quite simple two independent variables A and B each with two levels(1 or 2).I performed ANOVA
UNIANOVA
  y BY a b
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
    /PRINT = DESCRIPTIVE
  /CRITERIA = ALPHA(.05)
   /DESIGN =a b a*b .

The interaction is significant and I want to test the simple effects of B.
That is, to perform  two contrasts the first between the two levels of B for A=1 and the second between the two levels of B for A=2.
What is the syntax that I should use for this contrast?

I will appreciate any help

Thanks



Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: +972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/

D

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: syntax for contrasts

Poes, Matthew Joseph-2
In reply to this post by Keli Saporta
In terms of the pure simple effects, Use effect coding instead of dummy coding.  Otherwise, given what you want, you could also just reverse your dummy coding values each time you run it, this is not uncommon.

For the contrast table mentioned you will need to use LMatrix and you will need to create your contrast table to put it together.  Example code would be as follows:

/Lmatrix "test"
        A 0 0 A*B  1 -1 -1 1

The following link helped me learn how to do this.
http://www.atlas.illinois.edu/support/stats/resources/spss/How_to_write_contrast_statements_in_SAS_and_SPSS.pdf
You will ultimately have at least 2 lines below the Lmatrix subcommand.  That command is put into your ANOVA anywhere above the last line of code.

In the example code I gave, this compares the values of A at levels 1 and 2, when variable B is fixed at a base value of 0 (reference category).

Matthew J Poes
Research Data Specialist
Center for Prevention Research and Development
University of Illinois
510 Devonshire Dr.
Champaign, IL 61820
Phone: 217-265-4576
email: [hidden email]



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Keli Saporta
Sent: Wednesday, March 07, 2012 1:08 AM
To: [hidden email]
Subject: syntax for contrasts

Dear list
My design is quite simple two independent variables A and B each with two levels(1 or 2).I performed ANOVA UNIANOVA
  y BY a b
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
    /PRINT = DESCRIPTIVE
  /CRITERIA = ALPHA(.05)
   /DESIGN =a b a*b .

The interaction is significant and I want to test the simple effects of B.
That is, to perform  two contrasts the first between the two levels of B for A=1 and the second between the two levels of B for A=2.
What is the syntax that I should use for this contrast?

I will appreciate any help

Thanks



Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: +972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/

D

=====================
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: syntax for contrasts

Ryan
In reply to this post by Keli Saporta
Kelly,
 
A 3X2 design can be depicted as follows:
 
              Factor B
               1    2
             --------- 
          1 |a1b1|a1b2|
Factor A  2 |a2b1|a2b2|
          3 |a3b1|a3b2|
             ---------

With that said, the following LMATRIX statements estimate the cell means:

/lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
/lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
/lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
/lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
/lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
/lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1

Using the statements above we could write the following pairwise contrasts:
 
/lmatrix = 'a1b1 MINUS a1b2' int 0 a 0  0  0 b 1 -1 a*b 1 -1  0  0  0  0
/lmatrix = 'a1b1 MINUS a2b1' int 0 a 1 -1  0 b 0  0 a*b 1  0 -1  0  0  0
/lmatrix = 'a1b1 MINUS a2b2' int 0 a 1 -1  0 b 1 -1 a*b 1  0  0 -1  0  0
/lmatrix = 'a1b1 MINUS a3b1' int 0 a 1  0 -1 b 0  0 a*b 1  0  0  0 -1  0
/lmatrix = 'a1b1 MINUS a3b2' int 0 a 1  0 -1 b 1 -1 a*b 1  0  0  0  0 -1

We could simplify the above statements by eliminating effects which have all zero coefficients as follows:

/lmatrix = 'a1b1 MINUS a1b2' b 1 -1  a*b 1 -1  0  0  0  0
/lmatrix = 'a1b1 MINUS a2b1' a 1 -1  0 a*b 1  0 -1  0  0  0
/lmatrix = 'a1b1 MINUS a2b2' a 1 -1  0 b 1 -1 a*b 1  0  0 -1  0  0
/lmatrix = 'a1b1 MINUS a3b1' a 1  0 -1 a*b 1  0  0  0 -1  0
/lmatrix = 'a1b1 MINUS a3b2' a 1  0 -1 b 1 -1 a*b 1  0  0  0  0 -1

Here's a message I posted a while back which shows additional types of contrasts:

http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1012&L=spssx-l&P=R9561

I hope this gives you some idea of how the lmatrix works.
 
Ryan
2012/3/7 Keli Saporta <[hidden email]>
Thank you Gene
It worked very good.
And another question (if you don’t mind)
What if A has three levels? can I define specific contrasts by setting weights? What is the syntax?
Thank you again

Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: <a href="tel:%2B972-9-7781456" value="+97297781456">+972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Maguin, Eugene
Sent: Wednesday, March 07, 2012 5:00 PM
To: [hidden email]
Subject: Re: syntax for contrasts

Keli,
Look at the Emmeans command in the documentation.  Most basically,
EMMEANS = TABLES(A*B) COMPARE(B).

The comparison can also be done using the Lmatrix subcommand with which others are far more competent with than I am.

Gene Maguin


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Keli Saporta
Sent: Wednesday, March 07, 2012 2:08 AM
To: [hidden email]
Subject: syntax for contrasts

Dear list
My design is quite simple two independent variables A and B each with two levels(1 or 2).I performed ANOVA
UNIANOVA
 y BY a b
 /METHOD = SSTYPE(3)
 /INTERCEPT = INCLUDE
   /PRINT = DESCRIPTIVE
 /CRITERIA = ALPHA(.05)
  /DESIGN =a b a*b .

The interaction is significant and I want to test the simple effects of B.
That is, to perform  two contrasts the first between the two levels of B for A=1 and the second between the two levels of B for A=2.
What is the syntax that I should use for this contrast?

I will appreciate any help

Thanks



Kelly Saporta, Ph.D.
Department of Education and Psychology
The Open University, Ra'anana, Israel 43107
Phone: <a href="tel:%2B972-9-7781456" value="+97297781456">+972-9-7781456,
Email:  [hidden email]
http://www.openu.ac.il/Personal_sites/kelli-saporta/

D

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

Reply | Threaded
Open this post in threaded view
|

Re: syntax for contrasts

Bruce Weaver
Administrator
Ryan, thanks for posting these helpful examples of LMATRIX.  But note that I am having trouble getting the approach you used for obtaining cell means to work.  I illustrate below, using one of your datasets.

* The data used below are from this post to SPSSX-L:
  http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1012&L=spssx-l&P=R9561

data list list / ID Group Y.
begin data
1  1 24
2  1 22
3  1 21
4  1 23
5  2 67
6  2 66
7  2 67
8  2 65
9  3 43
10 3 44
11 3 45
12 3 42
13 4 12
14 4 11
15 4 10
16 4 13
end data.

* In another post to SPSSX-L, Ryan suggested using LMATRIX
* as follows to obtain cell means for a two-factor (3x2) model
* with factors called A and B:

*  /lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
*  /lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
*  /lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
*  /lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
*  /lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
*  /lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1

* I will try a variation on that to obtain the 4 group means
* for my model.

GLM Y BY Group
 /PRINT = PARAMETER
 /DESIGN = Group
 /LMATRIX = "G1" int 1 Group 1 0 0 0
 /LMATRIX = "G2" int 1 Group 0 1 0 0
 /LMATRIX = "G3" int 1 Group 0 0 1 0
 /LMATRIX = "G4" int 1 Group 0 0 0 1
.

* That does not work -- "int" is causing an error.
* Having consulted the FM, I think that when one wishes
* to include the intercept, one must do it via the keyword
* ALL, as shown below.

GLM Y BY Group
 /PRINT = PARAMETER
 /DESIGN = Group
 /LMATRIX = "G1" ALL 1 1 0 0 0
 /LMATRIX = "G1" ALL 1 0 1 0 0
 /LMATRIX = "G1" ALL 1 0 0 1 0
 /LMATRIX = "G1" ALL 1 0 0 0 1
.

* Use MEANS to verify that the group means are correct.

means Y by group.

****** End of demo ****** .

Ryan, are those LMATRIX commands including "int" working for you?  Based on what I've seen (and perusal of the FM), I think they might have to be changed to:

  /lmatrix = 'a1b1' ALL 1  1 0 0   1 0   1 0 0 0 0 0
  /lmatrix = 'a1b2' ALL 1  1 0 0   0 1   0 1 0 0 0 0
  /lmatrix = 'a2b1' ALL 1  0 1 0   1 0   0 0 1 0 0 0
  /lmatrix = 'a2b2' ALL 1  0 1 0   0 1   0 0 0 1 0 0
  /lmatrix = 'a3b1' ALL 1  0 0 1   1 0   0 0 0 0 1 0
  /lmatrix = 'a3b2' ALL 1  0 0 1   0 1   0 0 0 0 0 1

Thanks for clarifying.
Bruce


R B wrote
Kelly,

A 3X2 design can be depicted as follows:

              Factor B
               1    2
             ---------
          1 |a1b1|a1b2|
Factor A  2 |a2b1|a2b2|
          3 |a3b1|a3b2|
             ---------

With that said, the following LMATRIX statements estimate the cell means:

/lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
/lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
/lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
/lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
/lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
/lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1

--- snip ---
--
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: syntax for contrasts

Ryan
I just assumed "int" could be used in the same way it's used in the TEST subcommand in the MIXED procedure. I'm sure you are correct that "ALL" is the KEYWORD to replace "int". Seems silly to me to not allow the the specification of the intercept more directly but it is what it is. This is why I'm such a believer in using data when providing these types of answers. It ensures my assumptions are correct.

Anyway, the point I was making is that if you start by estimating the means, then any pairwise contrast can be easily obtain by subtracting like terms. From there you can test for diff of diff (which is not uncommon) by subtracting like terms from the pairwise contrasts. This approach reduces the possibility of writing the dreaded non-estimable functions.

Often when one is unsure of how to write a contrast for the LMATRIX via GLM or MIXED, starting with estimating the means resolves any confusion.

Good catch, Bruce. Sorry all.

Ryan

On Mar 9, 2012, at 9:57 AM, Bruce Weaver <[hidden email]> wrote:

> Ryan, thanks for posting these helpful examples of LMATRIX.  But note that I
> am having trouble getting the approach you used for obtaining cell means to
> work.  I illustrate below, using one of your datasets.
>
> * The data used below are from this post to SPSSX-L:
>  http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1012&L=spssx-l&P=R9561
>
> data list list / ID Group Y.
> begin data
> 1  1 24
> 2  1 22
> 3  1 21
> 4  1 23
> 5  2 67
> 6  2 66
> 7  2 67
> 8  2 65
> 9  3 43
> 10 3 44
> 11 3 45
> 12 3 42
> 13 4 12
> 14 4 11
> 15 4 10
> 16 4 13
> end data.
>
> * In another post to SPSSX-L, Ryan suggested using LMATRIX
> * as follows to obtain cell means for a two-factor (3x2) model
> * with factors called A and B:
>
> *  /lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
> *  /lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
> *  /lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
> *  /lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
> *  /lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
> *  /lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1
>
> * I will try a variation on that to obtain the 4 group means
> * for my model.
>
> GLM Y BY Group
> /PRINT = PARAMETER
> /DESIGN = Group
> /LMATRIX = "G1" int 1 Group 1 0 0 0
> /LMATRIX = "G2" int 1 Group 0 1 0 0
> /LMATRIX = "G3" int 1 Group 0 0 1 0
> /LMATRIX = "G4" int 1 Group 0 0 0 1
> .
>
> * That does not work -- "int" is causing an error.
> * Having consulted the FM, I think that when one wishes
> * to include the intercept, one must do it via the keyword
> * ALL, as shown below.
>
> GLM Y BY Group
> /PRINT = PARAMETER
> /DESIGN = Group
> /LMATRIX = "G1" ALL 1 1 0 0 0
> /LMATRIX = "G1" ALL 1 0 1 0 0
> /LMATRIX = "G1" ALL 1 0 0 1 0
> /LMATRIX = "G1" ALL 1 0 0 0 1
> .
>
> * Use MEANS to verify that the group means are correct.
>
> means Y by group.
>
> ****** End of demo ****** .
>
> Ryan, are those LMATRIX commands including "int" working for you?  Based on
> what I've seen (and perusal of the FM), I /think/ they might have to be
> changed to:
>
>  /lmatrix = 'a1b1' ALL 1  1 0 0   1 0   1 0 0 0 0 0
>  /lmatrix = 'a1b2' ALL 1  1 0 0   0 1   0 1 0 0 0 0
>  /lmatrix = 'a2b1' ALL 1  0 1 0   1 0   0 0 1 0 0 0
>  /lmatrix = 'a2b2' ALL 1  0 1 0   0 1   0 0 0 1 0 0
>  /lmatrix = 'a3b1' ALL 1  0 0 1   1 0   0 0 0 0 1 0
>  /lmatrix = 'a3b2' ALL 1  0 0 1   0 1   0 0 0 0 0 1
>
> Thanks for clarifying.
> Bruce
>
>
>
> R B wrote
>>
>> Kelly,
>>
>> A 3X2 design can be depicted as follows:
>>
>>              Factor B
>>               1    2
>>             ---------
>>          1 |a1b1|a1b2|
>> Factor A  2 |a2b1|a2b2|
>>          3 |a3b1|a3b2|
>>             ---------
>>
>> With that said, the following LMATRIX statements estimate the cell means:
>>
>> /lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
>> /lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
>> /lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
>> /lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
>> /lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
>> /lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1
>>
>> --- snip ---
>>
>>
>
>
> -----
> --
> 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/Polynomial-contrast-for-interaction-in-completely-between-Ss-design-tp4941355p5550813.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: syntax for contrasts

Bruce Weaver
Administrator
I suspected you were doing something that worked for MIXED.  ;-)  Thanks for clarifying.  

By the way, I do like your suggestion of starting by estimating the means, and then subtracting one vector from another to get any contrasts of interest.  I think that must help reduce the likelihood of specifying a contrast incorrectly.

Cheers,
Bruce


R B wrote
I just assumed "int" could be used in the same way it's used in the TEST subcommand in the MIXED procedure. I'm sure you are correct that "ALL" is the KEYWORD to replace "int". Seems silly to me to not allow the the specification of the intercept more directly but it is what it is. This is why I'm such a believer in using data when providing these types of answers. It ensures my assumptions are correct.

Anyway, the point I was making is that if you start by estimating the means, then any pairwise contrast can be easily obtain by subtracting like terms. From there you can test for diff of diff (which is not uncommon) by subtracting like terms from the pairwise contrasts. This approach reduces the possibility of writing the dreaded non-estimable functions.

Often when one is unsure of how to write a contrast for the LMATRIX via GLM or MIXED, starting with estimating the means resolves any confusion.

Good catch, Bruce. Sorry all.

Ryan

On Mar 9, 2012, at 9:57 AM, Bruce Weaver <[hidden email]> wrote:

> Ryan, thanks for posting these helpful examples of LMATRIX.  But note that I
> am having trouble getting the approach you used for obtaining cell means to
> work.  I illustrate below, using one of your datasets.
>
> * The data used below are from this post to SPSSX-L:
>  http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1012&L=spssx-l&P=R9561
>
> data list list / ID Group Y.
> begin data
> 1  1 24
> 2  1 22
> 3  1 21
> 4  1 23
> 5  2 67
> 6  2 66
> 7  2 67
> 8  2 65
> 9  3 43
> 10 3 44
> 11 3 45
> 12 3 42
> 13 4 12
> 14 4 11
> 15 4 10
> 16 4 13
> end data.
>
> * In another post to SPSSX-L, Ryan suggested using LMATRIX
> * as follows to obtain cell means for a two-factor (3x2) model
> * with factors called A and B:
>
> *  /lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
> *  /lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
> *  /lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
> *  /lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
> *  /lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
> *  /lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1
>
> * I will try a variation on that to obtain the 4 group means
> * for my model.
>
> GLM Y BY Group
> /PRINT = PARAMETER
> /DESIGN = Group
> /LMATRIX = "G1" int 1 Group 1 0 0 0
> /LMATRIX = "G2" int 1 Group 0 1 0 0
> /LMATRIX = "G3" int 1 Group 0 0 1 0
> /LMATRIX = "G4" int 1 Group 0 0 0 1
> .
>
> * That does not work -- "int" is causing an error.
> * Having consulted the FM, I think that when one wishes
> * to include the intercept, one must do it via the keyword
> * ALL, as shown below.
>
> GLM Y BY Group
> /PRINT = PARAMETER
> /DESIGN = Group
> /LMATRIX = "G1" ALL 1 1 0 0 0
> /LMATRIX = "G1" ALL 1 0 1 0 0
> /LMATRIX = "G1" ALL 1 0 0 1 0
> /LMATRIX = "G1" ALL 1 0 0 0 1
> .
>
> * Use MEANS to verify that the group means are correct.
>
> means Y by group.
>
> ****** End of demo ****** .
>
> Ryan, are those LMATRIX commands including "int" working for you?  Based on
> what I've seen (and perusal of the FM), I /think/ they might have to be
> changed to:
>
>  /lmatrix = 'a1b1' ALL 1  1 0 0   1 0   1 0 0 0 0 0
>  /lmatrix = 'a1b2' ALL 1  1 0 0   0 1   0 1 0 0 0 0
>  /lmatrix = 'a2b1' ALL 1  0 1 0   1 0   0 0 1 0 0 0
>  /lmatrix = 'a2b2' ALL 1  0 1 0   0 1   0 0 0 1 0 0
>  /lmatrix = 'a3b1' ALL 1  0 0 1   1 0   0 0 0 0 1 0
>  /lmatrix = 'a3b2' ALL 1  0 0 1   0 1   0 0 0 0 0 1
>
> Thanks for clarifying.
> Bruce
>
>
>
> R B wrote
>>
>> Kelly,
>>
>> A 3X2 design can be depicted as follows:
>>
>>              Factor B
>>               1    2
>>             ---------
>>          1 |a1b1|a1b2|
>> Factor A  2 |a2b1|a2b2|
>>          3 |a3b1|a3b2|
>>             ---------
>>
>> With that said, the following LMATRIX statements estimate the cell means:
>>
>> /lmatrix = 'a1b1' int 1 a 1 0 0 b 1 0 a*b 1 0 0 0 0 0
>> /lmatrix = 'a1b2' int 1 a 1 0 0 b 0 1 a*b 0 1 0 0 0 0
>> /lmatrix = 'a2b1' int 1 a 0 1 0 b 1 0 a*b 0 0 1 0 0 0
>> /lmatrix = 'a2b2' int 1 a 0 1 0 b 0 1 a*b 0 0 0 1 0 0
>> /lmatrix = 'a3b1' int 1 a 0 0 1 b 1 0 a*b 0 0 0 0 1 0
>> /lmatrix = 'a3b2' int 1 a 0 0 1 b 0 1 a*b 0 0 0 0 0 1
>>
>> --- snip ---
>>
>>
>
>
> -----
> --
> 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/Polynomial-contrast-for-interaction-in-completely-between-Ss-design-tp4941355p5550813.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
--
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
|

Factor Analysis

Jarrod Teo-2
Hi,
 
Situation
 
Currently, my company is looking at reducing a set of scale type Key Performance Indicators (KPIs) and these different KPIs are arranged into different segment namely Satisfaction (v1 to v12), efficiently (v1 to v5), etc, etc. The reason why they want to reduce is because there are over 100 KPIs...
 
Methodology used
 
The most immediate solution which I could think of is Factor Analysis using (PCA) Varimax Rotation, based on the individual segment since I am to reduced these 100 scale variables.
 
Problem Faced
 
I have 2 questions namely:
 
1) Am I heading the right direction in this analysis by using Factor analysis using (PCA) Varimax Rotation?
 
2) I am also looking at applying the Factor analysis on all the variables to check across the segments based on 2 methods. Please let me know of the implications if any for the 2 methods:
 
        a) Applying Factor analysis (PCA) Varimax Rotation on all the 100 variables.
        b) Applying Factor analysis again on the PCA components churned out by the individual segements.
 
 
3) In this analysis, there is no dependent variable so I could not use a linear model to measure the importance of all these 100 variables. My management would like to find out if we could measure the importance without the presence of a dependent variable. I would like to know if the extraction could give a hint on which variable is important to Satisfaction (Example : v6, v9 and v11 are the top 3 most important variables for the management to handle should they want to improve Satisfaction).
 

Communalities for Satisfaction

  Initial Extraction
v1 1.000 .563
v2 1.000 .645
v3 1.000 .714
v4 1.000 .582
v5 1.000 .512
v6 1.000 .767
v7 1.000 .633
v8 1.000 .312
v9 1.000 .776
v10 1.000 .416
v11 1.000 .740
v12 1.000 .692

 
Any advise would be great.
 
Thanks.
Dorraj Oet.
 
Reply | Threaded
Open this post in threaded view
|

Re: Factor Analysis

Rich Ulrich
From your example --You are starting with a dozen or 20
different segments that you already have names for, such
as Satisfaction. 

The obvious starting point for data that looks like this is
to define the separate "scales" like satisfaction, probably
as simple item-averages, and look at the relationship among
those scales.  If you want to say something about the items
within the scales, SPSS has available the Reliability procedure.
 - I would expect, for instance -- the items with low communalities
will look the least helpful, according to the criteria available in
Reliabilities... Reliabilities does give you several criteria, in place
of just "communalities", to look at the internal consistency.

All things being equal, psychometricians will prefer a longer
scale over a shorter scale, because the longer scales has a
better reliability.  But a particular added item may result in a
smaller coefficient alpha (Cronbach's alpha), showing that it
should be omitted.

Please keep in mind that the "importance" that you can derive
from staring only at a set of related variables  does not reflect
Importance for some other criterion; it is limited to reporting
"what they have in common".  A low contribution for one item
could be an indication that you need *more* items like that one
to make a better "universe of items"; and not that you should
drop the item.  (Example:  If "satisfaction" has two components,
physical and mental, and your set of items has 6 of one and 1
of the other, the single item will increase the internal reliability.
Dropping it will decrease the *validity* of the broad concept, even
while raising its measure of internal consistency.)

The same principle applies to your overall factor analysis of
scales, too.  That is -- the principal component shows what
is most common across the whole set of items.  That is "most
important" only when the full universe of items is a set that is
balanced and well-measured.

You get from a factor analysis a summary of what you put in it.

--
Rich Ulrich



Date: Mon, 12 Mar 2012 06:30:18 +0000
From: [hidden email]
Subject: Factor Analysis
To: [hidden email]

Hi,
 
Situation
 
Currently, my company is looking at reducing a set of scale type Key Performance Indicators (KPIs) and these different KPIs are arranged into different segment namely Satisfaction (v1 to v12), efficiently (v1 to v5), etc, etc. The reason why they want to reduce is because there are over 100 KPIs...
 
Methodology used
 
The most immediate solution which I could think of is Factor Analysis using (PCA) Varimax Rotation, based on the individual segment since I am to reduced these 100 scale variables.
 
Problem Faced
 
I have 2 questions namely:
 
1) Am I heading the right direction in this analysis by using Factor analysis using (PCA) Varimax Rotation?
 
2) I am also looking at applying the Factor analysis on all the variables to check across the segments based on 2 methods. Please let me know of the implications if any for the 2 methods:
 
        a) Applying Factor analysis (PCA) Varimax Rotation on all the 100 variables.
        b) Applying Factor analysis again on the PCA components churned out by the individual segements.
 
 
3) In this analysis, there is no dependent variable so I could not use a linear model to measure the importance of all these 100 variables. My management would like to find out if we could measure the importance without the presence of a dependent variable. I would like to know if the extraction could give a hint on which variable is important to Satisfaction (Example : v6, v9 and v11 are the top 3 most important variables for the management to handle should they want to improve Satisfaction).
 

Communalities for Satisfaction

  Initial Extraction
v1 1.000 .563
v2 1.000 .645
v3 1.000 .714
v4 1.000 .582
v5 1.000 .512
v6 1.000 .767
v7 1.000 .633
v8 1.000 .312
v9 1.000 .776
v10 1.000 .416
v11 1.000 .740
v12 1.000 .692

 
Any advise would be great.
 
Thanks.
Dorraj Oet.
 
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Factor Analysis

Buhi, Eric
Banned User
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Polynomial contrast for interaction in completely between-Ss design

Ryan
In reply to this post by Ryan
In October of 2011, I posted a message demonstrating how to construct a linear trend contrast using the TEST sub-command in MIXED (link below). The linear trend contrast was correct, but when I explained how to estimate the group-specifc slopes (a=1, a=2), I made a couple of mistatements.
 
First, the DIVISOR actually needed to be:
 
= sum[(ci)^2]
= (-3)^2 + (-1)^2 + (1)^2 + (3)^2
= 9 + 1 + 9 + 1
= 20
 
assuming that the row spacing was 1.
 
Not sure why I stated 10 in that post--I was probably thinking about a linear trend with 5 coefficients: -2 -1 0 1 2.
 
Second, to estimate the group-specific slopes using linear regression the coefficients would be treated as a continuous IV and the group-specific means would be the DV.
 
Best,
 
Ryan
 
On Sat, Oct 29, 2011 at 12:11 PM, R B <[hidden email]> wrote:
You should be able to view my post formatted correctly here:


Apologies for the multiple posts. 

Ryan


On Sat, Oct 29, 2011 at 12:09 PM, R B <[hidden email]> wrote:
Last attempt:

Bruce (and others who might be interested),

My initial understanding was that you were interested in testing for a linear trend interaction derived from a GLM model which included two factors: A (2 levels: a1 and a2) and B (4 levels: b1, b2, b3, b4):

(Place the following in Notepad to see it correctly formatted)


                  B
       1      2      3      4      
     ---------------------------
  1 | a1b1 | a1b2 | a1b3 | a1b4 |
A    ---------------------------
  2 | a2b1 | a2b2 | a2b3 | a2b4 |
    ---------------------------


I responded by defining what I thought you were referring to with respect to a linear trend interaction; that is, a formal test on the interaction between the linear trends of a1 and a2 across B. Concretely, we’re testing if the means of a1 and a2 consistently trend in a linear fashion more closely or farther as they move along the levels of B (b1 through b4), i.e.,

(Place the following in Notepad to see it correctly formatted)


     |  
     |  ^                *
 A   |       ^     *   
     |       *     ^
     |  *                ^   
     ------------------------
        1     2     3     4
                 B
  
where  

^ = a1 means for each level of B
* = a2 means for each level of B



In this type of scenario, one typically assumes that the categorical variable B has ordinal properties. Anyway, it was at this point that I decided to suggest that you construct an interaction linear trend test via MIXED using orthogonal polynomials. If one were to construct a linear trend interaction test for the model specified above via MIXED, one would need to first determine appropriate coefficients of orthogonal polynomials. Further to this point, to appropriately construct linear trends for both a1 and a2, their coefficients should be equally spaced and sum to zero, which for an even # of levels of B for a1 and a2, would be computed by using: 


-(k-1) to (k-1) in increments of 2


where k = # of levels of B


which results in


-3 -1 1 3


(I've seen this described in multiple locations online and in textbooks which describe orthogonal polynomial contrasts for ANOVA type designs)

To obtain the  value of the linear combination using the TEST statement, we would write the following code:


/TEST = 'Linear Trend for a=1' B -3 -1 1 3 A*B -3  -1 1 3 0 0 0 0


We could write out the linear combination ourselves by plugging in the estimated parameters:


-3*(-1.1999999999999993)
-1*(-1.9999999999999982)
+1*(-.6)
+3*(0)
-3*(-8.2)
-1*(-6.4)
+1*(-3)
-3*(0)
+0*(0)
+0*(0)
+0*(0)
+0*(0)= 33


By applying these linear trend coefficients (-3 -1 1 3 0 0 0 0), we are forcing the TEST statement to provide a formal test as to whether there is a linear trend of a1 means across the four levels of B. But “33” is the resulting value of summing the terms. What is the estimated slope? If we wanted to obtain the slope of the linear trend, then we would need to incorporate a divisor:


/TEST = 'Linear Trend a=1 Expectation' B -3 -1 1 3 A*B -3  -1 1 3 0 0 0 0 DIVISOR=10


(If someone is interested in understanding how I arrived at the DIVISOR of 10, feel free to ask. But I prefer to skip over this point for the moment.)

The TEST statement above produces a slope estimate of the linear trend for a=1 of 3.3. Although I haven’t tested this, for Bruce's example, this slope value should be EXACTLY what you would obtain if you were fit a standard linear regression treating the means of a1b1, a1b2, a1b3, and a1b4 as the dependent variable and B (1, 2, 3, 4) as a
covariate. For a similar linear trend test of a=2 across B, we would write:


/TEST = 'Linear Trend a=2 Expectation' B -3 -1 1 3 A*B 0 0 0 0 -3  -1 1 3 


/TEST = 'Linear Trend a=2 Expectation' B -3 -1 1 3 A*B 0 0 0 0 -3 -1 1 3 DIVISOR=10


Based on this approach, if one wanted to test whether there was a significant interaction between the linear trends of a1 and a2 across B, then we would to take the difference of the linear trend coefficients:


-3 -1 1 3 - (-3 -1 1 3)


or when removing the parentheses and placing it in the design figure I presented initially:

(Place this in Notepad to obtain correct formatting)


-3 -1  1  3  
 3  1 -1 -3
 

This, of course, leads to the TEST statement:


/TEST = 'Linear Trend Interaction' A*B -3 -1 1 3 3 1 -1 -3
 

Note: It would take very little effort to test for a quadratic or cubic trends via the TEST statements.

Anyway, I hope this shows how I arrived at my interaction linear trend TEST statement. It may not be the optimal approach, but  it seems valid given Bruce's initial request to construct an interaction linear trend test based on his GLM design. Perhaps I've misunderstood exactly what he's trying to test or perhaps there is simply a better approach using another procedure.

HTH,

Ryan

On Fri, Oct 28, 2011 at 3:45 PM, Bruce Weaver <[hidden email]> wrote:
Bruce Weaver wrote:
>
> Yes, that's right.
>
> I forgot to mention when responding to your earlier post that another
> reason for not using MIXED (with TEST) was that I preferred OLS to MLE,
> because in a balanced design, the SS for the polynomial components of the
> A*B interaction will add up exactly to the SS(A*B).  I doubt that will be
> the case with MLE.
>
> I've still not had time to try either method--too many meetings.  Will get
> to it later today or tomorrow.
>
> Cheers,
> Bruce
>
>

Okay, I finally had (or took) time to get back to this.  WARNING:  There is
a fair bit of syntax here.  But anyone who is interested in the discussion
we've been having here might be interested in working through the various
examples.  I certainly have a better appreciation for how PARTITION works in
MANOVA now!  ;-)

Thanks again to Tony, Ryan & David.


* Read in the data .
data list list / Y A B (3f5.0).
begin data
    6     0     1
    7     0     1
    3     0     1
    4     0     1
    9     0     1
    5     0     2
   11     0     2
    6     0     2
    5     0     2
    7     0     2
   13     0     3
   12     0     3
   10     0     3
   14     0     3
    9     0     3
   15     0     4
   19     0     4
   13     0     4
   17     0     4
   12     0     4
   15     1     1
   18     1     1
   14     1     1
   13     1     1
   15     1     1
   14     1     2
   17     1     2
   15     1     2
   11     1     2
   14     1     2
   16     1     3
   18     1     3
   19     1     3
   11     1     3
   14     1     3
   17     1     4
   15     1     4
   19     1     4
   14     1     4
   16     1     4
end data.

* Run model via UNIANOVA .
UNIANOVA Y BY A B
 /CRITERIA=ALPHA(.05)
 /DESIGN=A B A*B.

* Run model via MANOVA.
manova Y by A(0,1) B(1,4) /
 print=design/
 DESIGN=A B A by B.

* Sums of Squares from UNIANOVA and MANOVA match.
* Now MANOVA with PARTITION to partition the A*B
* interaction into the linear, quadratic and cubic components.

manova Y by A(0,1) B(1,4) /
 contrast(A)=poly/
 contrast(B)=poly/
 partition(B)=(1,1,1)/
 print=design/
 DESIGN=A B
 A by B(1)
 A by B(2)
 A by B(3)
.

* In the model that was just run,
*   A BY B(1) = linear component of the interaction,
*   A BY B(2) = quadratic component of the interaction, and
*   A BY B(3) = cubic component of the interaction.

* The SS for the linear, quadratic & cubic components sum to 99.40,
* the same value as SS(A*B) in the earlier runs.  Good! .

* Now try partitioning into linear vs (quadratic + cubic).

manova Y by A(0,1) B(1,4) /
 contrast(A)=poly/
 contrast(B)=poly/
 partition(B)=(1,2)/
 print=design/
 DESIGN=A B
 A by B(1)
 A by B(2)
.

* In this model,
*   A BY B(1) = linear component of the interaction,
*   A BY B(2) = linear + cubic components of the interaction.

* The SS for A * B(2) in this model is the sum of the SS
* for the quadratic & cubic components of the interaction in the
* previous run that partitioned the SS into 3 components, each with
* df = 1.  So all is well with the world.


* Try Ryan's MIXED with /TEST method.

MIXED Y BY A B
 /FIXED=A B A*B | SSTYPE(3)
 /METHOD=REML
 /PRINT=SOLUTION
 /TEST = 'Linear Trend Interaction' A*B
         3  1 -1 -3
        -3 -1  1  3
.
* The t-value is comparable to what MANOVA gives for the linear component
* of the interaction.  But the value of the estimate is much larger.
* This is because MANOVA concocted a different set of contrast coefficients.
* Plug them into MIXED, and see if the estimated values become more similar.

MIXED Y BY A B
 /FIXED=A B A*B | SSTYPE(3)
 /METHOD=REML
 /PRINT=SOLUTION
 /TEST = 'Linear Trend Interaction' A*B
        .47437  .15811 -.15811 -.47437
       -.47437 -.15811  .15811  .47437
.

* Okay, good.  Now the contrasts from MANOVA and MIXED
* are very similar.

* But one thing the MIXED output doesn't give me is the SS for
* the various components.  These are nice to have, because
* I can use them to work out the percentage of the interaction
* effect that is due to the linear by linear component.
* In this case, it would be 98.0 / 99.4 = 98.6%.

* If MIXED can display SS in the "Tests of Fixed Effects"
* summary table, I can't find how to do it.



-----
--
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/Polynomial-contrast-for-interaction-in-completely-between-Ss-design-tp4941355p4947126.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



I can't believe it's been so long since that post. Time flies when you're
12