outputting proximity matrices only below the diagonal

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

outputting proximity matrices only below the diagonal

TomR
Hello: I am doing multiple Cluster analyses in SPSS 24 and saving the
proximity distance matrices. I need to output these as text files but only
for values beneath the diagonal. This is to allow me to do Mantel tests for
comparing different datasets (SPSS does not do this test) but the outside
software requires an explicit input matrix for values below the diagonal and
excluding the diagonal (0 values). My matrices are large so how can I output
the matrix in this format. I thought Scripts might work but cannot find any
autoscripts when I use the Cluster program. I am not clever enough to write
the script to do this.
Thanks,
Tom




--
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: outputting proximity matrices only below the diagonal

David Marso
Administrator
Simplest way is to suck it into MATRIX, nuke the upper triangle then a little
massage.
/* The next 3 lines simply create test data */.
MATRIX.
SAVE UNIFORM(1000,100) /OUTFILE * /VARIABLES x001 TO x100.
END MATRIX.

/* Actual work starts here */.
PROXIMITIES x001 TO x100 /MATRIX OUT(*).

/* MATRIX can be stupid */.
SET MXLOOPS=10000000.

/* Change  VAR1000 to VARn where n is the number of cases in your data */.
MATRIX.
GET DATA/FILE * /VARIABLES VAR1 TO VAR1000.
LOOP #=1 TO NROW(DATA).
LOOP ##=# TO NCOL(DATA).
COMPUTE DATA(#,##)=-999.
END LOOP.
END LOOP.
SAVE DATA / OUTFILE * .
END MATRIX.

/* F20.16 is selected to output to maximum precision.  Modify if you want
thinner output */.
RECODE ALL (-999=SYSMIS).
FORMATS ALL (F20.16).
ALTER TYPE ALL (A20).
RECODE ALL ("."=" ").
/* Do your desired method of writing the text file */.


TomR wrote

> Hello: I am doing multiple Cluster analyses in SPSS 24 and saving the
> proximity distance matrices. I need to output these as text files but only
> for values beneath the diagonal. This is to allow me to do Mantel tests
> for
> comparing different datasets (SPSS does not do this test) but the outside
> software requires an explicit input matrix for values below the diagonal
> and
> excluding the diagonal (0 values). My matrices are large so how can I
> output
> the matrix in this format. I thought Scripts might work but cannot find
> any
> autoscripts when I use the Cluster program. I am not clever enough to
> write
> the script to do this.
> Thanks,
> Tom
>
>
>
>
> --
> 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





-----
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?"
--
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
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: outputting proximity matrices only below the diagonal

Jon Peck
In reply to this post by TomR
An alternative would be to use the R plugin for Statistics to do this calculation.  The R ape [sic] package can do this test.  There are, however, some statistical objections to this test (not to the package itself).  No need to mess with extracting the lower triangle or exporting the data.

If you want to send me two sav files with the distance matrices, I can show you the code.  ([hidden email])

On Wed, Sep 6, 2017 at 3:10 PM, TomR <[hidden email]> wrote:
Hello: I am doing multiple Cluster analyses in SPSS 24 and saving the
proximity distance matrices. I need to output these as text files but only
for values beneath the diagonal. This is to allow me to do Mantel tests for
comparing different datasets (SPSS does not do this test) but the outside
software requires an explicit input matrix for values below the diagonal and
excluding the diagonal (0 values). My matrices are large so how can I output
the matrix in this format. I thought Scripts might work but cannot find any
autoscripts when I use the Cluster program. I am not clever enough to write
the script to do this.
Thanks,
Tom




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



--
Jon K Peck
[hidden email]

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