14.09.2015 Views

Matvec Users’ Guide

Matvec Users' Guide

Matvec Users' Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10.3. BEST LINEAR UNBIASED PREDICTION (BLUP) 61<br />

XPy = X’*y;<br />

ZPy = Z’*y;<br />

rhs = [XPy;<br />

ZPy];<br />

sigma_e = 2.0;<br />

sigma_a = 1.0;<br />

r = sigma_e/sigma_a;<br />

G = A*sigma_a;<br />

MME = [XPX, XPZ;<br />

XPZ’, ZPZ + A.inv()*r];<br />

blup = MME.ginv()*rhs<br />

Now, at the <strong>Matvec</strong> prompt, simply type<br />

> input try1<br />

blup =<br />

Col 1<br />

Row 1 5.51000<br />

Row 2 1.91000<br />

Row 3 3.60000<br />

Row 4 0.260000<br />

Row 5 -0.260000<br />

Row 6 0.260000<br />

Row 7 -0.670000<br />

Row 8 0.670000<br />

The above script written in <strong>Matvec</strong> language is the exactly what Professor Gianola told me to do when I<br />

was taking his linear model course. Step by step, I have clearly shown you what I was doing in the above<br />

script. Now I will do the same job in an encapsulated but efficient way using <strong>Matvec</strong> higher level functions.<br />

10.3.4 Obtain BLUP using <strong>Matvec</strong> higher level functions<br />

M.blup() returns the blup as a vector if M is a Model object. I wrote down the following <strong>Matvec</strong> script and<br />

saved it in an ASCII file called try2:<br />

P = Pedigree();<br />

P.input("try.ped");<br />

D = Data();<br />

D.input("try.dat","animal\$ herd _skip y");<br />

M = Model();<br />

M.equation("y = intercept + herd + animal");<br />

M.variance("residual",2);<br />

M.variance("animal",P,1);<br />

M.fitdata(D);<br />

M.blup()<br />

There are two <strong>Matvec</strong> features I want to mention here:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!