GLM question

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

GLM question

Maguin, Eugene
All,

I have a basic one between factor anova with 5 levels (1-5) on the IV. I'd
like to four planned contrasts: 1 vs 2; 2 vs 3,4,5; 3 vs 4; and 3 vs 5. I
had thought I could do that using the contrast command like so.

GLM y BY x/PRINT=DESCRIPTIVES/
   CONTRAST (x)=SPECIAL(
    1 1 1 1 1
   -1 1 0 0 0
    0 -3 1 1 1
    0 0 -1 1 0
    0 0 -1 0 1).

The 2 vs 3,4,5 contrast come out wrong. So I tried

GLM y BY x/PRINT=DESCRIPTIVES/
   CONTRAST (x)=SPECIAL(
    1 1 1 1 1
   -1 1 0 0 0
    0 -1 1/3 1/3 1/3
    0 0 -1 1 0
    0 0 -1 0 1).

This gives an error because, I think, the '/' in the '1/3' is read as a
subcommand separator.

Question is 1) can I fix up the contrast command to work as I want it to?

2) if not, do I use an L matrix only, K only, or L and K and what does it
look like?

Thanks, Gene Maguin

=====================
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: GLM question

Ryan
Gene,

I recently showed how to employ the LMATRIX for similar types of contrasts here:

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

Ryan

On Wed, Dec 29, 2010 at 6:35 PM, Gene Maguin <[hidden email]> wrote:

> All,
>
> I have a basic one between factor anova with 5 levels (1-5) on the IV. I'd
> like to four planned contrasts: 1 vs 2; 2 vs 3,4,5; 3 vs 4; and 3 vs 5. I
> had thought I could do that using the contrast command like so.
>
> GLM y BY x/PRINT=DESCRIPTIVES/
>   CONTRAST (x)=SPECIAL(
>    1 1 1 1 1
>   -1 1 0 0 0
>    0 -3 1 1 1
>    0 0 -1 1 0
>    0 0 -1 0 1).
>
> The 2 vs 3,4,5 contrast come out wrong. So I tried
>
> GLM y BY x/PRINT=DESCRIPTIVES/
>   CONTRAST (x)=SPECIAL(
>    1 1 1 1 1
>   -1 1 0 0 0
>    0 -1 1/3 1/3 1/3
>    0 0 -1 1 0
>    0 0 -1 0 1).
>
> This gives an error because, I think, the '/' in the '1/3' is read as a
> subcommand separator.
>
> Question is 1) can I fix up the contrast command to work as I want it to?
>
> 2) if not, do I use an L matrix only, K only, or L and K and what does it
> look like?
>
> Thanks, Gene Maguin
>
> =====================
> 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: GLM question

Maguin, Eugene
Ryan,

Once I saw your current message I recalled that you had posted that helpful
earlier message. Thank you.

Let me ask a question about the K matrix. For purpose and how would it be
used?


Martin,

1 -1 0 0 0
0 3 -1 -1 -1
0 0 1 -1 0
0 0 1 0 -1

I started with this but rejected it because the estimate for the L2
contrast, 0 3 -1 -1 -1, did not match what I computed by hand. That's why I
switched to 0 -1 1/3 1/3 1/3. If I had thought a bit more generally, I would
have tried 0 -1 .333 .333 .333 and that would have computed. Both 0 3 -1 -1
-1 and 0 -1 .333 .333 .333 yield the same conclusion because the standard
errors of the two contrasts also differ proportionately.


Gene Maguin

=====================
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: GLM question

Ryan
Gene,

According to SPSS documentation, the KMATRIX is the "contrast results
matrix." From what I can tell, the KMATRIX subcommand can be used to
test hypothesized constants. For example, you might hypothesize that
the difference between levels 3 and 1 is equal to 1. Using the sample
data I presented in the other thread, we can construct such a test
using the following code:

*----------------------------------.
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.

GLM Y BY Group
 /PRINT = PARAMETER
 /DESIGN = Group
 /LMATRIX = 'G3 vs G1' Group -1 0 1 0
 /KMATRIX = 1.
*----------------------------------.

HTH,

Ryan

On Thu, Dec 30, 2010 at 10:47 AM, Gene Maguin <[hidden email]> wrote:

> Ryan,
>
> Once I saw your current message I recalled that you had posted that helpful
> earlier message. Thank you.
>
> Let me ask a question about the K matrix. For purpose and how would it be
> used?
>
>
> Martin,
>
> 1 -1 0 0 0
> 0 3 -1 -1 -1
> 0 0 1 -1 0
> 0 0 1 0 -1
>
> I started with this but rejected it because the estimate for the L2
> contrast, 0 3 -1 -1 -1, did not match what I computed by hand. That's why I
> switched to 0 -1 1/3 1/3 1/3. If I had thought a bit more generally, I would
> have tried 0 -1 .333 .333 .333 and that would have computed. Both 0 3 -1 -1
> -1 and 0 -1 .333 .333 .333 yield the same conclusion because the standard
> errors of the two contrasts also differ proportionately.
>
>
> Gene Maguin
>
> =====================
> 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