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

  ASReml  ~  animal model

rvallejo
Posted: Tue May 26, 2009 9:40 pm Reply with quote
Joined: 11 May 2009 Posts: 11 Location: USDA-ARS
I am trying to replicate the animal model from the ASReml User's Guide, section Examples (Last chapter). I got this error message "Structure/ Factor Mistmatch". So, something must be wrong with the G structure definition in my job file. Could you please point out the mistake or errors in the "mt.as" file? Thank you very much.
Roger
View user's profile Send private message
Arthur
Posted: Tue May 26, 2009 10:21 pm Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Roger,

I can't see where you atached the mt.as file.

The job as in the guide is rather complicated with PARTs etc so there could be many places where a small error would confuse the job.

If your .asr file contains a data summary,
it has successfully read down to the modeeel line.

The summary should include all the terms in the model listed (with maybe others inserted by ASReml).

Then, as it reads the remaining rows, (the variance structures) it reports what it finds to the .asr file.

So, if it has read the R structure lines, the variance structure for the residual term will bebr reported. Since there are 3 G structures, you should be able to see which one is failing because the earlier ones will be (correctly) reported.

You might like to strip the job down to one particular part (rename mt1.as
for part 1).

If this doesn't get you going, include the model line and R and G structure lines and someone can look at what you have typed.

Structure/Factor mismatch may indicate that the model term to which the structure applies is not spelt correctly, or that the product of component sizes does not match the term size.


Tr.tag 2 # Direct animal effects.
!PATH 2
Tr 0 FA1 !GP
0.5 0.5 -.01 -.01 0.1
2.4 5.2 0.06 .8 .14
!PATH 3
Tr 0 US
2.4800
2.8 6.4
0.0128 0.03 0.06
-.1 -.22 -.0011 0.72
0.24 0.55 0.0026 -0.0202 0.14
!PATH
tag

If you have typed in the list of starting values, and missed one,
that would throw things out as well.

_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
rvallejo
Posted: Wed May 27, 2009 1:05 am Reply with quote
Joined: 11 May 2009 Posts: 11 Location: USDA-ARS
Dear Arthur:
I am sorry, I did not attach using the accepted extensions by the forum server. Now , I attach a compressed file "mt.zip", it includes my data and job files. Basically, my job file "mt.as" is a copy and paste from the User's Guide. So, they should work, but here for the animal model it did not. To my relief, all the examples from the ASREML User's Guide worked perfect with exception of this chapter 15 last example on "animal model". The previous sire-dam model was great with lot of details, etc. I think this last example on animal model was not nicely described as the half-sib analysis example.

Another question: In line 25 of the attached "mt.as" file, is this correct?
at(Tr,1).dam, at(Tr,2).dam, -at(Tr,3).dam .003,
It seems odd to see "-at(Tr,3).dam"; also are the "comas" between model items correct, I thought we use the "," only at the end of line to indicate that the model continues in the next line.

I am new to scripting for ASReml, so my apologies if I am asking trivial questions.
Thank you very much for your help.
Roger



mt.zip
 Description:

Download
 Filename:  mt.zip
 Filesize:  91.52 KB
 Downloaded:  2757 Time(s)

View user's profile Send private message
Arthur
Posted: Thu May 28, 2009 11:23 am Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Roger,
Thanks for your copies of coop.fmt and mt.as

The first issue is that your version of coop.fmt had different coding of 'dam'
to mine. Originally the data was analysed under a sire and dam model with sire coded 1:92 and dam coded 1:3591 as in the file you have. However,
obviously sire 1 is not the same animal as dam 1.
My version of the file had 10000 added to the 'dam' number to create a
dam id. This is the file 'pcoop.fmt' used in the published job.

i.e.
==> coop.fmt <== My version
500001 1 10001 18 2 2 2737 31. 37.0 48.0 3.2 0.0 0.0
500002 1 10002 18 2 3 2738 40. 28.5 42.5 2.7 0.0 0.0
500003 1 10002 18 1 3 2738 40. 30.0 49.0 2.5 0.0 0.0
500004 1 10003 18 1 2 2739 46. 44.0 53.5 3.0 0.0 0.0
500005 1 10004 18 1 1 2740 54. 43.0 59.5 2.5 0.0 0.0

==> coop.FMT <== Your version
500001 1 1 18 2 2 2737 31. 37.0 48.0 3.2 0.0 0.0

500002 1 2 18 2 3 2738 40. 28.5 42.5 2.7 0.0 0.0

500003 1 2 18 1 3 2738 40. 30.0 49.0 2.5 0.0 0.0

500004 1 3 18 1 2 2739 46. 44.0 53.5 3.0 0.0 0.0

500005 1 4 18 1 1 2740 54. 43.0 59.5 2.5 0.0 0.0


========================

2) There is an inconsequential error in thhe code as reported in the User Guide in that

4 0 FA1 !GP # Factor Analytic

.5 .5 .01 .1 .01

4.95 4.63 0.037 0.941 0.102


has 10 rather than 8 initial values.
At some stage, I recoded the job to drop the litter variance component for the fifth trait 'fat' by replacing Tr.lit by at(Tr,1).lit, at(Tr,2).lit, at(Tr,3).lit, at(Tr,4).lit,

in the model. However, I neglected to remove the corresponding staring value for the FA1 model.

Now the G header line is
at(Tr,1).lit 2

but the G structure is for a term representing 4 sets of 'litter'.
I.e. The variance structure actually applies to all four terms in
at(Tr,1).lit at(Tr,2).lit at(Tr,3).lit at(Tr,4).lit


Your version of the code had 'Tr 0 FA1 !GP'
which is wrong because Trait has 5 levels but only 4 are present.

3) In your coding, there were 2 lines with the comment

# changed 2 into Tr
This change is wrong because we are just defining the structure for two traits
at(Tr,1).dam, at(Tr,2).dam,

4) So,
after using the data file with dam recoded, and changing
Tr to 2 in the dam structure definitions
Tr to 4 in the litter structure definitions,

the job runs.

I attach the revised data and job and outputs.



mtr.zip
 Description:
modified data and mt.as job file

Download
 Filename:  mtr.zip
 Filesize:  98.18 KB
 Downloaded:  2813 Time(s)


_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
rvallejo
Posted: Thu May 28, 2009 5:25 pm Reply with quote
Joined: 11 May 2009 Posts: 11 Location: USDA-ARS
Thanks Arthur. Now using your input data and job files, it runs but I still see that error message [Fault 1 Structure/ Factor mistmatch] when running these first two commands:

asreml mt.as
asreml -nrw64 mt 1

However, when I followed up this analysis with these commands:

asreml -nrw64 mt 2

It runs with no error message, but it does not converge. Then next I copied the mt2.rsv file into mt3.rsv, and run this command:

asreml -cnrw64 mt 3

This works perfect, reached convergence this time, the results are identical to the output files that you sent me lately "mt3.asr" So, this is intriguing. Is there any error in PATH 1 section but in PATH 2 and 3 sections?

Now, assumign that my output is correct, how do I develop my PIN file to estimate phenotypic variances, genetic variances, heritability, and genetic correlations as nicely shown for the half-sib analysis example in the User's Guide. My enclosed PIN file is basically a copy of the variance/covariance lines from mt3.asr out file.
Thank you very much.
Roger



mt3-052809.zip
 Description:
pin file

Download
 Filename:  mt3-052809.zip
 Filesize:  93.31 KB
 Downloaded:  2783 Time(s)

View user's profile Send private message
Arthur
Posted: Fri May 29, 2009 5:04 am Reply with quote
Joined: 05 Aug 2008 Posts: 471 Location: Orange, NSW
Dear Roger,

The job is not set up to process PATH 1, which is the default of no argument is provided on the command line.

Using PATH 1, the job looks like

...
wwt ywt gfw fdm fat ~ Trait Tr.age Tr.brr Tr.sex Tr.age.sex,

!r Tr.tag ,

at(Tr,1).dam, at(Tr,2).dam, -at(Tr,3).dam .003,

at(Tr,1).lit, at(Tr,2).lit, at(Tr,3).lit, at(Tr,4).lit,

at(Trait,1).age.grp .0024,

at(Trait,2).age.grp .0019,

at(Trait,4).age.grp .0020,

at(Trait,5).age.grp .00026,

at(Trait,1).sex.grp .93,

at(Trait,2).sex.grp 16.0,

at(Trait,3).sex.grp .28,

at(Trait,5).sex.grp 1.18,

!f Tr.grp

1 2 3 # One multivariate R structure, 3 G structures

0 0 0 # No structure across lamb records

# First zero lets ASReml count te number of records

Tr 0 US #General structure across traits

7.66

5.33 13

.18 .66 .10

.78 2.1 .27 3.2

.73 2.02 .08 .20 1.44

Tr.tag 2 # Direct animal effects.


tag

at(Tr,1).dam 2 # Maternal effects.


dam

at(Tr,1).lit 2 # Litter effects.


lit


The G structure fails to parse because each of the 3 terms is defined as being a direct product of two terms but only one is supplied.

2)
PATH 2 ends with 'LogL not converged' although the last 9 LogL values are
LogL=-1425.20. WhY? Well looking at the %change column in
at(Tr,1).dam CORRelat 2 0.990000 0.990000 0.00 0 F
at(Tr,1).dam CORRelat 2 1.05652 1.05652 2.80 0 U
at(Tr,1).dam CORRelat 2 0.407193 0.407193 1.00 2 U
at(Tr,1).lit FA D(LL'+E)D 1 1 0.636898 0.636898 7.41 -1 P
at(Tr,1).lit FA D(LL'+E)D 1 2 0.999500 0.999500 0.00 0 B
at(Tr,1).lit FA D(LL'+E)D 1 3 0.460883 0.460883 2.87 0 P
at(Tr,1).lit FA D(LL'+E)D 1 4 -0.195717 -0.195717 -0.64 0 P
shows an issue with the last dam term and the first litter term.

Fnding the convergence sequence in the .res files shows
Iteration 1 16 17 18 19 20
LogL -1636.767 -1425.197 -1425.197 -1425.196 -1425.196 -1425.196
Change % 4 4 4 3 3 2
66 G 2.540000 0.393028 0.411087 0.395389 0.408824 0.397221 0.407193 2.5
67 L 0.500000 0.638125 0.636547 0.637927 0.636750 0.637771 0.636898 -0.2

So these two terms are oscillating and slowly converging
ASReml is checking both the change in LogL and the % change in parameters to determine convergence.

For practical purposes, I would say this has converged, and if you wanted a compromise final value, average the final two values, or do something more sophisticated with the last 6 values.




3)
A basic pin file is
# Ignore components 1:8 as adjustemnt factors

# 9:23 is Residual

# 24:38 is Additive

# 39:41 is dam

# 42:51 is litter
F PhenWY 9:11 + 24:26 + 39:41 + 42:44
F PhenWYGD 12:18 + 27:33 + 45:51
F PhenWYGDF 19:23 + 34:38
R Rphen 52:66
R Rgen 24:38
H H2W 24 52
H H2Y 26 54
H H2G 29 57
H H2D 33 61
H H2F 38 66

_________________
Arthur Gilmour

Retired Principal Research Scientist (Biometrics)
View user's profile Send private message Send e-mail Visit poster's website
rvallejo
Posted: Fri May 29, 2009 3:17 pm Reply with quote
Joined: 11 May 2009 Posts: 11 Location: USDA-ARS
Dear Arthur,
This explanation on the animal model and its corresponding pin file to estimate genetic parameters parameters is quite clear. Thank you very much.
Roger
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