!WORK 150
This is random regression analysis of emd
  animal  !P  sire 89 !I   dam 1052 !I 
  year 2 !I !V21=V4 !==2 !*-365
  flock 5     sex 2 !A     aod 
  tobr 3 !I   dob !-14800 !+V21
  age   wt    fat  emd

sdf01a.ped !SKIP 1
sdfwfml.csv !SKIP 1  !MVremove !DOPART $1
   !DDF !TYPEIIISS !MAXIT 20

!PART 1
emd  ~ mu age year wt sex sex.wt flock,
    tobr aod dob year.dob -year.age,
    -year.sex year.flock -year.tobr,
    sex.dob tobr.dob,
  !r animal animal.age,
     ide(animal) ide(animal).age,
     at(year,1).spl(age,20) at(year,2).spl(age,20)

0 0 2
animal 2
2 0 US !GP
1.3 0.01 0.01 
animal 0 AINV
ide(animal) 2
2 0 US !GP
1.6 0.01 0.03
ide(animal)


!PART 2
emd  ~ mu age year wt sex sex.wt flock tobr aod,
 dob year.dob year.flock sex.dob tobr.dob,
 !r pol(age,2).animal  pol(age,1).ide(animal) ,
  at(year,1).spl(age,20) at(year,2).spl(age,20)

0 0 2
pol(age,2).animal 2
3 0 US 
.3
.1 .3
.1 .1 .3
animal 0 AINV
pol(age,1).ide(animal)
2 0 US 
.3
.1 .1
ide(animal)

!PART 3
!SPLINE spl(age,3) 4 10 16
emd  ~ mu age year wt sex sex.wt flock tobr aod dob,
    year.dob year.flock  sex.dob tobr.dob,
       !r animal animal.age animal.spl(age,3),
     ide(animal) ide(animal).age, ide(animal).spl(age,3),
     at(year,1).spl(age,20) at(year,2).spl(age,20)

0 0 2
animal 2
3 0 US !GU
1.3 0.1 0.01 
.1 .01 .1
animal 0 AINV
ide(animal) 2
2 0 US !GU
1.6 0.1 0.03
ide(animal)

!PART 4
emd  ~ mu age year wt sex sex.wt flock tobr aod dob,
    year.dob year.age -year.sex year.flock year.tobr sex.dob tobr.dob,
       !r pol(age,2).animal  ide(animal) ,
     at(year,1).spl(age,20) at(year,2).spl(age,20)

0 0 1
pol(age,2).animal 2
3 0 US 
1.6
.6 .6
.3 .3 .3
animal 0 AINV
