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

  ASReml  ~  levels seem to be reordered even with !{ !}

j.hadfield@ed.ac.uk
Posted: Fri Aug 31, 2018 9:21 am Reply with quote
Joined: 13 Aug 2008 Posts: 37
Hi,

In asreml-R (using asreml3) I can fit the model

m1.asreml<-asreml(y1~1, random=~str(~id+id2, ~us(2):id(id)), data=dat)

and I get what I expect - a large positive covariance between the two effects (the data are simulated)

id+id2!us(2).1:1 0.9972660 1.1101081 0.08447154 13.14180 Positive
id+id2!us(2).2:1 0.7954737 0.8854827 0.08810587 10.05021 Positive
id+id2!us(2).2:2 1.8779716 2.0904667 0.14632043 14.28691 Positive
R!variance 1.0000000 1.1131514 0.03512833 31.68814 Positive

In stand-alone (asreml4 June 24 version) I fit what I believe to be the equivalent model:

y1 ~ mu !r !{ id id2 !}

0 1 1

id 2
2 0 US * !GP
id 0 ID

However, the likelihood is lower and the covariance is consistently around 0 although the variances seem good:

id US_V 1 1 0.993058 1.10580 13.11 0 P
id US_C 2 1 0.684262E-01 0.761946E-01 0.97 0 P
id US_V 2 2 1.87679 2.08986 14.27 0 P

I guess I must be doing something stupid, but I can't see it. Any help would be appreciated.

Cheers,

Jarrod
View user's profile Send private message
j.hadfield@ed.ac.uk
Posted: Fri Aug 31, 2018 12:37 pm Reply with quote
Joined: 13 Aug 2008 Posts: 37
Hi,

If I treat the id's as coming from a 'blank' pedigree (so that A=I) then I get the answer I was expecting. Is it possible that !{ !} only keeps effects associated with AINV ordered?

Cheers,

Jarrod
View user's profile Send private message
Arthur
Posted: Sun Sep 02, 2018 10:36 pm Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Jarrod,

The .sln file will reveal that actual order used.

!{ id id2 !}
causes id to be fitted before id2
but has no effect on setting the order of levels within id or id2.

The model you have specified ASSUMES the levels of id are in the order that matches the order of levels of
id2. If one is coded from a pedigree file, and the other is not, then this is unlikely to be true.
ASReml should check they are the same size but that is easily arranged by simply declaring the size.
Again, the .sln file will show the actual order of the levels of each term.

Send me the job if you can't see what the issue is.
Since you have not sent the .asr file or all the .as file coding, I can only guess what might be happening.

_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
j.hadfield@ed.ac.uk
Posted: Mon Sep 03, 2018 3:34 am Reply with quote
Joined: 13 Aug 2008 Posts: 37
Hi Arthur,

Thanks for taking a look at it. The levels of id and id2 correspond (i.e. they have the same levels coded in the same way, but clearly they don't appear in the same order in the data file). The dat, as and ped file are attached.

I thought it only gives the correct answer if I replace ID in the G-structure definition with AINV (despite all dam/sires being missing). However, it turns out that simply reading the pedigree in and having !P (rather the !A) after they are defined is enough - even if an ID structure is used. You can simply uncomment the pedigree reading line and change the !A's to !P's to achieve this.

Cheers,

Jarrod



bivexp_test.dat
 Description:

Download
 Filename:  bivexp_test.dat
 Filesize:  386.07 KB
 Downloaded:  161 Time(s)


dummy_ped.txt
 Description:

Download
 Filename:  dummy_ped.txt
 Filesize:  4.79 KB
 Downloaded:  213 Time(s)


bivexp_test.as
 Description:

Download
 Filename:  bivexp_test.as
 Filesize:  211 Bytes
 Downloaded:  173 Time(s)

View user's profile Send private message
Arthur
Posted: Mon Sep 03, 2018 8:28 pm Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Jarad,

The issue is that
id !A

treats the data values as labels, and does not sort the labels.

There are 4 other ways id and id2 can be declared which will cause the levels to align properly


!PART 1
id !A 500 !SORT
id2 !A 500 !SORT
y1 y2 y3 y4 y5 y6 y7

!PART 2
id 500
id2 500
y1 y2 y3 y4 y5 y6 y7

!PART 3
id !A 500
id2 !AS id
y1 y2 y3 y4 y5 y6 y7

!PART 4
id !P 500
id2 !P 500
y1 y2 y3 y4 y5 y6 y7
dummy_ped.txt !SKIP 1

PART 1 only works if both lists are complete as sorting is just within each variable.

PART 2 works here because the labels are actually the numbers 1:500

PART 3 is the recommended way as it uses a common list of labels generated from both fields
and so is not dependent on both lists containing all individuals

PART 4 uses a pedigree file to define the list.

You could also use

id !A 500 !L idnames.txt
id2 !A 500 !L idnames.txt

where idnames contains the list of id labels.

Factors in asreml-r are automatically sorted so provided id and id2 contain all individuals,
no extra action is required.

_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
j.hadfield@ed.ac.uk
Posted: Tue Sep 04, 2018 10:21 am Reply with quote
Joined: 13 Aug 2008 Posts: 37
Hi Arthur,

Than you. I'm sorry -I should have read the manual more carefully. I had only used !{ !} in the context of a pedigree before and just assumed !A would be adequate.

Cheers,

Jarrod
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