TIP: Cartesian product using MATRIX

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

TIP: Cartesian product using MATRIX

David Marso
Administrator
MATRIX.
COMPUTE x={1;2;3;4;5}.
COMPUTE XX={KRONEKER(X,MAKE(NROW(X),1,1)),KRONEKER(MAKE(NROW(X),1,1),X)}.
PRINT XX.
END MATRIX.
---
Run MATRIX procedure:

XX
  1  1
  1  2
  1  3
  1  4
  1  5
  2  1
  2  2
  2  3
  2  4
  2  5
  3  1
  3  2
  3  3
  3  4
  3  5
  4  1
  4  2
  4  3
  4  4
  4  5
  5  1
  5  2
  5  3
  5  4
  5  5

------ END MATRIX -----
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: TIP: Cartesian product using MATRIX

Ryan Black
David,
 
This could come in handy for a mixed model simulation.
 
Thank you for sharing!
 
Ryan


On Sat, Apr 20, 2013 at 12:09 PM, David Marso <[hidden email]> wrote:
MATRIX.
COMPUTE x={1;2;3;4;5}.
COMPUTE XX={KRONEKER(X,MAKE(NROW(X),1,1)),KRONEKER(MAKE(NROW(X),1,1),X)}.
PRINT XX.
END MATRIX.
---
Run MATRIX procedure:

XX
  1  1
  1  2
  1  3
  1  4
  1  5
  2  1
  2  2
  2  3
  2  4
  2  5
  3  1
  3  2
  3  3
  3  4
  3  5
  4  1
  4  2
  4  3
  4  4
  4  5
  5  1
  5  2
  5  3
  5  4
  5  5

------ END MATRIX -----



-----
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?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/TIP-Cartesian-product-using-MATRIX-tp5719597.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: TIP: Cartesian product using MATRIX

David Marso
Administrator
Thanks Ryan,
I would love to see what you use it for.
David
--
R B wrote
David,

This could come in handy for a mixed model simulation.

Thank you for sharing!

Ryan


On Sat, Apr 20, 2013 at 12:09 PM, David Marso <[hidden email]> wrote:

> MATRIX.
> COMPUTE x={1;2;3;4;5}.
> COMPUTE XX={KRONEKER(X,MAKE(NROW(X),1,1)),KRONEKER(MAKE(NROW(X),1,1),X)}.
> PRINT XX.
> END MATRIX.
> ---
> Run MATRIX procedure:
>
> XX
>   1  1
>   1  2
>   1  3
>   1  4
>   1  5
>   2  1
>   2  2
>   2  3
>   2  4
>   2  5
>   3  1
>   3  2
>   3  3
>   3  4
>   3  5
>   4  1
>   4  2
>   4  3
>   4  4
>   4  5
>   5  1
>   5  2
>   5  3
>   5  4
>   5  5
>
> ------ END MATRIX -----
>
>
>
> -----
> 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?"
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/TIP-Cartesian-product-using-MATRIX-tp5719597.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
>
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?"