[vsni.co.uk] Contact us
Author Message
Post new topic

  GenStat  ~  Use of SUBMAT function to get pieces of a symmetric matrix

david@vsn.co.nz
Posted: Wed Aug 01, 2018 5:18 am Reply with quote
Joined: 30 Jul 2009 Posts: 283
Dear Andrew,

SUBMAT assumes that the matrix has a pointer for the rows labels.

VARIATE W,X,Y,Z
SYMMETRIC [ROWS=!P(W,X,Y,Z)] SX; VALUES=!(1...10)
PRINT SX; DEC=0
SYMMETRIC [ROWS=!P(W,X)] S1
CALC S1 = SUBMAT(SX)
PRINT S1; DEC=0

If you want to access by position use the ELEMENTS function with two
arguments
(one for rows and one for columns). You need to type the results as
symmetric matrices
or else the will come out as regular matrices:

SYMMETRIC [4] S; !(1...10)
SYMMETRIC S1,S2
CALC First,Last = !(1...2),!(3...4)
CALC S1,S2 = ELEMENT(2(S);First,Last;First,Last)
PRINT S1,S2; DEC=0

Regards, David.
______________________________________________
Dr David Baird      Statistical Consultant and GenStat Developer
VSN (NZ) Limited (David@VSN.CO.NZ)
8 Mariposa Crescent, Aidanfield, Christchurch 8025, New Zealand
Ph +64 3 3350588 Cell +64 21 1160803

-----Original Message-----
From: GENSTAT-Request <GENSTAT@jiscmail.ac.uk> On Behalf Of Andrew McLachlan
Sent: 1 August 2018 4:54 PM
To: GENSTAT@JISCMAIL.AC.UK
Subject: Use of SUBMAT function to get pieces of a symmetric matrix

Hi All

I want to get sub-triangles from a symmetric matrix. The Help has lead me to
the SUBMAT function, but after reading the Help I still don't understand how
to get the function to work. Does anyone have a simple example that they
could show me?

For example, with a symmetric matrix with four rows:
1
2, 3
4, 5, 6
7, 8, 9, 10

I wish to get sub-triangles:
1
2, 3

and
6
9, 10


Cheers,
Andrew Mc

Andrew McLachlan
Biometrician



T: +64 6 355 6110
M: +64 212581882
F: +64 6 351 7050
E: andrew.mclachlan@plantandfood.co.nz
www.plantandfood.co.nz
The New Zealand Institute for Plant & Food Research Limited

Postal Address: Plant & Food Research
Private Bag 11600, Palmerston North 4442, New Zealand Physical Address:
Plant & Food Research Food Industry Science Centre, Fitzherbert Science
Centre, Batchelar Road, Palmerston North 4474, New Zealand

The contents of this e-mail are confidential and may be subject to legal
privilege.
If you are not the intended recipient you must not use, disseminate,
distribute or reproduce all or any part of this e-mail or attachments. If
you have received this e-mail in error, please notify the sender and delete
all material pertaining to this e-mail. Any opinion or views expressed in
this e-mail are those of the individual sender and may not represent those
of The New Zealand Institute for Plant and Food Research Limited.

########################################################################

To unsubscribe from the GENSTAT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=GENSTAT&A=1

########################################################################

To unsubscribe from the GENSTAT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=GENSTAT&A=1

Post generated using Mail2Forum (http://www.mail2forum.com)
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum