ASReml 4 Help

functions Control

Iterative Weighted Least Squares

FOR DO statements ASReml 4.

The !FOR ... !DO ... statement is designed to simplify repetitive coding. An example of its use is
 !ASSIGN CHR1   C1-98  C1-119  C1-137   C1-221  C1-278   C1-322
 !FOR CHR1  !DO !MBF mbf(DH)  IBDfiles/S.csv !SKIP 2  !KEY 1  !RENAME $S
 YLD ~ mu !r $CHR1
The !ASSIGN statement defines a list of markers to be fitted. The !FOR statement expands creating a new line from what follows !DO substituting each item in turn whereever $S appears. So the preceding lines are equivalent to
 !MBF mbf(DH)  IBDfiles/C1-98.csv  !SKIP 2  !KEY 1  !RENAME C1-98
 !MBF mbf(DH)  IBDfiles/C1-119.csv !SKIP 2  !KEY 1  !RENAME C1-119
 !MBF mbf(DH)  IBDfiles/C1-137.csv !SKIP 2  !KEY 1  !RENAME C1-137
 !MBF mbf(DH)  IBDfiles/C1-221.csv !SKIP 2  !KEY 1  !RENAME C1-221
 !MBF mbf(DH)  IBDfiles/C1-278.csv !SKIP 2  !KEY 1  !RENAME C1-278
 !MBF mbf(DH)  IBDfiles/C1-322.csv !SKIP 2  !KEY 1  !RENAME C1-322
 YLD ~ mu !r  C1-98  C1-119  C1-137   C1-221  C1-278   C1-322
The advantage of the new syntax is that marker name is just entered once, not three times. Note that this assumes the marker files have been judiciously named. Restrictions:
The list of items between !FOR and !DO is limited to 200 characters. The string after !DO is limited to 200 characters.

IF CALC statements

The purpose of these statements is to allow users to specify weights and response variables that change each iteration.

The general form is
!IF EVEN|ODD|EVERY !CALC ... where the user chooses between
EVEN if the calculations are performed every even iteration (2, 4, 6)
ODD if the calculations are performed every odd iteration (3, 5, 7) but not the first iteration.
EVERY if the calculations are performed every iteration except the first.

After the !CALC qualifier are arithmetic expressions. The expressions use two/three letter variables comprised of 1 letter and 1/2 digits. The following variables are internally defined.
R1 (R2) residual (from .yht) from previous iteration for trait 1 (2)
H1 (H2) hat value (from .yht) from previous iteration for trait 1 (2)
W1 (W2) weight variable from previous iteration for trait 1 (2)
Y1 (Y2) response variable fitted in previous iteration for trait 1 (2)
Gi is the ith gamma parameter value (unscaled by σ2) obtained from the last iteration
Li is the ith variance parameter as used in fitting last iteration
Pi is the ith variance parameter value obtained from the last iteration
Vi is the ith data variable

Note that W1, W2, Y1, Y2 may be redefined.
The permitted operations are +, -, *, /, ^.
Permitted functions are ABS(), EXP(), LOG(), SQRT().

Multiple expressions can be listed in one statement, separated by ';'.
ASReml can parse complex expressions in CALC statements (unlike the case of transformations).

Specify the !DEBUG qualifier on the command line to get ASReml to print intermediate results to check what is happening.

DHGLM example


 Double HGLM algorithm by Felleki and Ronnegard
  Yval Xterm * Zterm *
  Gval !=Yval !-.6   !*V4
  Ywt !=1. Gwt !=1.
 dhglm.dat    !MAXIT 100    !EXTRA 4
  !ASUV  !SIGMAPAR
 !IF ODD !CALC W1=EXP(R2-Y2)

 !IF EVEN !CALC  S1=L7/W1; T1=H1/S1;  Z2= R1*R1/(1-T1)
 !IF EVEN !CALC Y2=LOG(S1) + Z2/S1 -1
 !IF EVEN !CALC W2 = (1-T1)/2

 Yval !WT Ywt Gval !WT Gwt ~ Trait Trait.X,
 !R us(Trait).Z
 residual units.diag(Trait)
snippet of code is from the job used by Felleki etal. (2012) to a bivariate double hierarchical generalized linear models.

IF ASSIGN

Another form of the IF statement is
!IF $1 == wwt !ASSIGN M1 brt DamAge
which makes the !ASSIGN statement active if $1 is 'wwt'

Return to index