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.
11.1. GENERALIZED LINEAR MODEL 73<br />
11.1.4 Threshold Model<br />
<strong>Matvec</strong> can also be used to fit threshold models based on either an underlying normal, Pr(Z ≤ x) = Φ(x),<br />
or logistic, Pr(Z ≤ x) = e x /(1 + e x ) distribution. Suppose data has been collected on calving difficulty to<br />
examine the effect of gender of the calf on calving difficulty. The data are given in Table 11.3.<br />
Table 11.3: Calving difficulty data.<br />
Calving Difficulty<br />
Sex Easy Moderate Difficult<br />
Male 169 16 15<br />
Female 161 23 16<br />
The threshold link function in <strong>Matvec</strong> requires that ordinal data with c categories be coded as 0, 1, . . . ,<br />
c − 1. The probability that an observation falls in category i is given by<br />
Pr(Y = i) = Pr(τ i−i + η < Z ≤ τ i + η)<br />
where τ −1 = −∞, τ 0 = 0 and τ c = ∞. The data for this study are stored in the file calve.dat:<br />
Male 0 169<br />
Male 1 16<br />
Male 2 15<br />
Female 0 161<br />
Female 1 23<br />
Female 2 16<br />
and are read using:<br />
D=Data();<br />
D.input("calve.dat","Sex $ Score n");<br />
For this example, the linear predictor for observation j will include an intercept and sex main effect. The<br />
threshold between moderate (1) and difficult (2) will only include an intercept. The model is specified by:<br />
M=Model();<br />
M.equation("Score= intercept Sex,Score=intercept");<br />
M.link("thresh",0)<br />
M.param(1);<br />
M.weight("n");<br />
M.fitdata(D);<br />
The M.param(1) indicates that a probit threshold model will be used. Alternatively M.param(0) can be<br />
used to fit a logistic threshold model. The analysis is completed using:<br />
M.glim(20)<br />
M.save("calve.out");<br />
M.contrast("Sex",[1 0 ,-1 0])<br />
Resulting in the following:<br />
Threshold Link Function<br />
Parameters: Probit/Logit (scalar)) 1=probit 0=logit<br />
Terms: Eta1, Thresh1, Thresh2, ...<br />
y 0..numtraits<br />
0<br />
0.48819