Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
10.6. LEAST SQUARES MEANS (LSMEANS) 65<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 />
Kp = [0,1,-1];<br />
M.contrast(Kp)<br />
Now, at the <strong>Matvec</strong> prompt, I type<br />
> input try4<br />
RESULTS FROM CONTRAST(S)<br />
----------------------------------------------------------<br />
Contrast MME_addr K_coef Raw_data_code<br />
---------------------------------------------<br />
1 2 1 herd:1<br />
1 3 -1 herd:2<br />
estimated value (K’b-M) = -1.69 +- 1.3997<br />
Prob(|t| > 1.2074) = 0.227421 (p_value)<br />
----------------------------------------------------------<br />
0.227278<br />
The last two statements in the above <strong>Matvec</strong> script can be replaced by a single statement:<br />
M.contrast("herd",[1,-1])<br />
Any composite hypothesis tests require multi-row matrix Kp. For instance, the test H0: h1 = h2 = 0<br />
can be accomplished in <strong>Matvec</strong> as below:<br />
M.contrast("herd",[1,0; 0,1])<br />
10.6 Least Squares Means (lsmeans)<br />
The least-squares means (lsmeans), also called population marginal means, are the expected values of class<br />
or subclass means that you would expect for a balanced design involving the class variable with all covariates<br />
at their mean level. A least-squares mean for a given level of a given model-term may not be estimable.<br />
M.lsmeans("") outputs the least-squares means for each terms in termname-list. Here<br />
is the example saved in a file try5<br />
D = Data();<br />
D.input("try.dat","animal\$ herd _skip y");<br />
P = Pedigree();<br />
P.input("try.ped");<br />
M = Model();<br />
M.equation("y = intercept herd animal");<br />
M.variance("residual",2.0);<br />
M.variance("animal",P,1.0);<br />
M.fitdata(D);<br />
M.lsmeans("herd");